On Thursday, March 17, 2011 15:46:56 Michael Spang wrote:
>               while (!eth_getenv_enetaddr(s, dev->enetaddr)) {

this logic in the mvgbe is plain broken.  it should not be touching the env at 
all.  if there is no eeprom to read, then the mvgbe driver should leave dev-
>enetaddr alone.  let the boards take care of setting things up.

i.e. this patch:
diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
index c701f43..4c0d5bf 100644
--- a/drivers/net/mvgbe.c
+++ b/drivers/net/mvgbe.c
@@ -645,7 +645,6 @@ int mvgbe_initialize(bd_t *bis)
        struct mvgbe_device *dmvgbe;
        struct eth_device *dev;
        int devnum;
-       char *s;
        u8 used_ports[MAX_MVGBE_DEVS] = CONFIG_MVGBE_PORTS;
 
        for (devnum = 0; devnum < MAX_MVGBE_DEVS; devnum++) {
@@ -700,16 +699,13 @@ error1:
                /* must be less than NAMESIZE (16) */
                sprintf(dev->name, "egiga%d", devnum);
 
-               /* Extract the MAC address from the environment */
                switch (devnum) {
                case 0:
                        dmvgbe->regs = (void *)MVGBE0_BASE;
-                       s = "ethaddr";
                        break;
 #if defined(MVGBE1_BASE)
                case 1:
                        dmvgbe->regs = (void *)MVGBE1_BASE;
-                       s = "eth1addr";
                        break;
 #endif
                default:        /* this should never happen */
@@ -718,30 +714,11 @@ error1:
                        return -1;
                }
 
-               while (!eth_getenv_enetaddr(s, dev->enetaddr)) {
-                       /* Generate Private MAC addr if not set */
-                       dev->enetaddr[0] = 0x02;
-                       dev->enetaddr[1] = 0x50;
-                       dev->enetaddr[2] = 0x43;
-#if defined (CONFIG_SKIP_LOCAL_MAC_RANDOMIZATION)
-                       /* Generate fixed lower MAC half using devnum */
-                       dev->enetaddr[3] = 0;
-                       dev->enetaddr[4] = 0;
-                       dev->enetaddr[5] = devnum;
-#else
-                       /* Generate random lower MAC half */
-                       dev->enetaddr[3] = get_random_hex();
-                       dev->enetaddr[4] = get_random_hex();
-                       dev->enetaddr[5] = get_random_hex();
-#endif
-                       eth_setenv_enetaddr(s, dev->enetaddr);
-               }
-
-               dev->init = (void *)mvgbe_init;
-               dev->halt = (void *)mvgbe_halt;
-               dev->send = (void *)mvgbe_send;
-               dev->recv = (void *)mvgbe_recv;
-               dev->write_hwaddr = (void *)mvgbe_write_hwaddr;
+               dev->init = mvgbe_init;
+               dev->halt = mvgbe_halt;
+               dev->send = mvgbe_send;
+               dev->recv = mvgbe_recv;
+               dev->write_hwaddr = mvgbe_write_hwaddr;
 
                eth_register(dev);
 
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

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

Reply via email to