[U-Boot] [PATCH 11/11] drivers: net: fsl-mc: Write MAC address in eth_device

Bogdan Purcareata bogdan.purcareata at nxp.com
Thu Apr 27 10:26:44 UTC 2017


MC might boot before MAC addresses are assigned to eth_devices from the
u-boot environment. Write them when booting the MC so that they are
available for the DPC fixup.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata at nxp.com>
---
 drivers/net/fsl-mc/mc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 9f69d75..18cb63c 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -164,6 +164,14 @@ static int mc_fixup_dpc_mac_addr(void *blob, int noff, int dpmac_id,
 
 	sprintf(mac_name, "mac@%d", dpmac_id);
 
+	/* MC might boot before eth MAC addresses have been initialized */
+	err = eth_write_hwaddr(eth_dev, "eth", eth_dev->index);
+	if (err) {
+		printf("eth_write_hwaddr: err=%s\n",
+		       fdt_strerror(err));
+		return err;
+	}
+
 	/* node not found - create it */
 	nodeoffset = fdt_subnode_offset(blob, noff, (const char *) mac_name);
 	if (nodeoffset < 0) {
-- 
1.9.1



More information about the U-Boot mailing list