[U-Boot] [PATCH] NET: Fix MAC addr handling for smc911x

"Seunghyeon Rhee (이승현)" seunghyeon at lpmtec.com
Mon Nov 2 06:24:38 CET 2009


This patch turns off MAC address mismatch warning when 
optional eeprom programmed with MAC address is not available.
In that case, smc911x's MAC address register has its default 
value ff:ff:ff:ff:ff:ff and it's not a valid address. This 
makes eth_initialize() show the warning which has no 
meaningful information while environment variable ethaddr 
overrides the address read from the register. If there's no
eeprom and the value of MAC address register is not valid
after initialization, dev->enetaddr had better not be updated
and maintain its initial value 00:00:00:00:00:00, which I 
think is what eth_initialize() expects. This is not a bug fix. 
Even without this patch, the driver works fine. It's just for 
enhancing the way of displaying messages.

Signed-off-by: Seunghyeon Rhee <seunghyeon at lpmtec.com>
---
 drivers/net/smc911x.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index c50758e..3244850 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -257,12 +257,15 @@ int smc911x_initialize(u8 dev_num, int base_addr)
 
 	addrh = smc911x_get_mac_csr(dev, ADDRH);
 	addrl = smc911x_get_mac_csr(dev, ADDRL);
-	dev->enetaddr[0] = addrl;
-	dev->enetaddr[1] = addrl >>  8;
-	dev->enetaddr[2] = addrl >> 16;
-	dev->enetaddr[3] = addrl >> 24;
-	dev->enetaddr[4] = addrh;
-	dev->enetaddr[5] = addrh >> 8;
+	if (!(addrl == 0xffffffff && addrh == 0x0000ffff)) {
+		/* address is obtained from optional eeprom */
+		dev->enetaddr[0] = addrl;
+		dev->enetaddr[1] = addrl >>  8;
+		dev->enetaddr[2] = addrl >> 16;
+		dev->enetaddr[3] = addrl >> 24;
+		dev->enetaddr[4] = addrh;
+		dev->enetaddr[5] = addrh >> 8;
+	}
 
 	dev->init = smc911x_init;
 	dev->halt = smc911x_halt;
-- 
1.6.2.5



-- 
Seunghyeon Rhee, Ph.D. / Director
LPM Technology Inc.
T +82-70-8255-6007  F +82-2-6442-6462
M +82-10-2790-0657


More information about the U-Boot mailing list