[U-Boot] [RFC PATCH 2/3] net: fec_mxc: query mac address from environment

Damien Riegel damien.riegel at savoirfairelinux.com
Tue Jun 2 22:22:56 CEST 2015


The TS-4800 doesn't have its MAC address fused, therefore the
fec_mxc driver can not currently fetch it.

This commit adds the capability to fetch the MAC address from
environment if not found in fuses.

Signed-off-by: Damien Riegel <damien.riegel at savoirfairelinux.com>
Cc: Stefano Babic <sbabic at denx.de>
Cc: Joe Hershberger <joe.hershberger at ni.com>
---
 drivers/net/fec_mxc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 9225d37..a789ecc 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1040,6 +1040,10 @@ static int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr,
 		if (!getenv("ethaddr"))
 			eth_setenv_enetaddr("ethaddr", ethaddr);
 	}
+	else if (eth_getenv_enetaddr("ethaddr", ethaddr)) {
+		debug("got MAC%d address from env: %pM\n", dev_id, ethaddr);
+		memcpy(edev->enetaddr, ethaddr, 6);
+	}
 	return ret;
 err4:
 	fec_free_descs(fec);
-- 
1.9.1



More information about the U-Boot mailing list