If there is no SROM attached to the SMSC chip it's MAC address is
initialized to ff:ff:ff:ff:ff:ff and it causes the following
warning:

    Warning: smc911x-0 MAC addresses don't match:
    Address in SROM is         ff:ff:ff:ff:ff:ff
    Address in environment is  00:01:ba:dc:0d:03

Set dev->enetaddr only if MAC address is valid, and thus avoid the
above case.

Signed-off-by: Mike Rapoport <m...@compulab.co.il>
---
 drivers/net/smc911x.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 9ff1288..f5d984d 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -237,6 +237,7 @@ static int smc911x_rx(struct eth_device *dev)
 int smc911x_initialize(u8 dev_num, int base_addr)
 {
        unsigned long addrl, addrh;
+       unsigned char enetaddr[6];
        struct eth_device *dev;
 
        dev = malloc(sizeof(*dev));
@@ -257,12 +258,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;
+       enetaddr[0] = addrl;
+       enetaddr[1] = addrl >>  8;
+       enetaddr[2] = addrl >> 16;
+       enetaddr[3] = addrl >> 24;
+       enetaddr[4] = addrh;
+       enetaddr[5] = addrh >> 8;
+
+       if (is_valid_ether_addr(enetaddr))
+               memcpy(dev->enetaddr, enetaddr, 6);
 
        dev->init = smc911x_init;
        dev->halt = smc911x_halt;
-- 
1.6.0.6

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to