public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2 v2] net, fec_mxc: only setup the device enetaddr with eeprom value, if ethaddr is not setup
@ 2010-03-30 17:46 Heiko Schocher
  2010-03-30 20:34 ` Wolfgang Denk
  2010-03-31  9:18 ` Mike Frysinger
  0 siblings, 2 replies; 20+ messages in thread
From: Heiko Schocher @ 2010-03-30 17:46 UTC (permalink / raw)
  To: u-boot

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@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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2010-05-03  2:38 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-30 17:46 [U-Boot] [PATCH 1/2 v2] net, fec_mxc: only setup the device enetaddr with eeprom value, if ethaddr is not setup Heiko Schocher
2010-03-30 20:34 ` Wolfgang Denk
2010-03-30 21:57   ` Ben Warren
2010-03-30 21:59   ` Mike Frysinger
2010-03-30 22:16   ` Ben Warren
2010-03-31  5:56     ` Heiko Schocher
2010-03-31  6:07       ` Mike Frysinger
2010-03-31  6:34         ` [U-Boot] [PATCH 1/2 v3] net, fec_mxc: only setup the device enetaddr with eeprom value Heiko Schocher
2010-03-31  6:50           ` Ben Warren
2010-03-31  8:34             ` Wolfgang Denk
2010-03-31  8:41           ` Wolfgang Denk
2010-05-03  2:38       ` [U-Boot] Toggling pins using the BDI3000 Can Aydin
2010-03-31  6:34     ` [U-Boot] [PATCH] net, doc: how to setup mac address correct Heiko Schocher
2010-03-31  8:50       ` Wolfgang Denk
2010-03-31 13:44     ` [U-Boot] [PATCH 1/2 v2] net, fec_mxc: only setup the device enetaddr with eeprom value, if ethaddr is not setup Detlev Zundel
2010-03-31 13:58       ` Ben Warren
2010-03-31 14:46         ` Detlev Zundel
2010-03-31 19:59           ` Mike Frysinger
2010-03-31 20:04             ` Ben Warren
2010-03-31  9:18 ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox