diff mbox series

[V2,8/8] eQos: Implement the read_rom_hwaddr callback

Message ID 20200503144120.30038-8-peng.fan@nxp.com
State New
Headers show
Series [V2,1/8] net: eth-uclass: add return value check | expand

Commit Message

Peng Fan May 3, 2020, 2:41 p.m. UTC
From: Ye Li <ye.li at nxp.com>

Implement the read_rom_hwaddr callback to load MAC address from fuse
for imx8m platforms.

Reviewed-by: Fugang Duan <fugang.duan at nxp.com>
Signed-off-by: Ye Li <ye.li at nxp.com>
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 drivers/net/dwc_eth_qos.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Stefano Babic May 11, 2020, 10:15 a.m. UTC | #1
> From: Ye Li <ye.li at nxp.com>
> Implement the read_rom_hwaddr callback to load MAC address from fuse
> for imx8m platforms.
> Reviewed-by: Fugang Duan <fugang.duan at nxp.com>
> Signed-off-by: Ye Li <ye.li at nxp.com>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c
index 15dae20e57..55a35db739 100644
--- a/drivers/net/dwc_eth_qos.c
+++ b/drivers/net/dwc_eth_qos.c
@@ -1145,6 +1145,16 @@  static int eqos_write_hwaddr(struct udevice *dev)
 	return 0;
 }
 
+static int eqos_read_rom_hwaddr(struct udevice *dev)
+{
+	struct eth_pdata *pdata = dev_get_platdata(dev);
+
+#ifdef CONFIG_ARCH_IMX8M
+	imx_get_mac_from_fuse(dev->req_seq, pdata->enetaddr);
+#endif
+	return !is_valid_ethaddr(pdata->enetaddr);
+}
+
 static int eqos_start(struct udevice *dev)
 {
 	struct eqos_priv *eqos = dev_get_priv(dev);
@@ -2058,6 +2068,7 @@  static const struct eth_ops eqos_ops = {
 	.recv = eqos_recv,
 	.free_pkt = eqos_free_pkt,
 	.write_hwaddr = eqos_write_hwaddr,
+	.read_rom_hwaddr	= eqos_read_rom_hwaddr,
 };
 
 static struct eqos_ops eqos_tegra186_ops = {