[U-Boot] [PATCH 1/2 v2] net, fec_mxc: only setup the device enetaddr with eeprom value, if ethaddr is not setup

Heiko Schocher hs at denx.de
Tue Mar 30 19:46:17 CEST 2010


if ethaddr is not setup in the environment, fill the device
enetaddr with the contents of the eeprom, and only
the device enetaddr, not the mac address registers!

Tested on the magnesium board.

Signed-off-by: Heiko Schocher <hs at denx.de>
---
- changes since v1 posted here:
  http://lists.denx.de/pipermail/u-boot/2010-March/069192.html

  - splitted in two patches as Wolfgang suggested

 drivers/net/fec_mxc.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 5af9cdb..98ff64b 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -749,10 +749,11 @@ static int fec_probe(bd_t *bd)

 	eth_register(edev);

-	if (fec_get_hwaddr(edev, ethaddr) == 0) {
-		printf("got MAC address from EEPROM: %pM\n", ethaddr);
-		memcpy(edev->enetaddr, ethaddr, 6);
-		fec_set_hwaddr(edev);
+	if (!eth_getenv_enetaddr("ethaddr", ethaddr)) {	
+		if (fec_get_hwaddr(edev, ethaddr) == 0) {
+			printf("got MAC address from EEPROM: %pM\n", ethaddr);
+			memcpy(edev->enetaddr, ethaddr, 6);
+		}
 	}

 	return 0;
-- 
1.6.2.5

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


More information about the U-Boot mailing list