]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mvgbe: remove setting of ethaddr within the driver
authorMichael Walle <michael@walle.cc>
Thu, 17 Nov 2011 12:52:29 +0000 (12:52 +0000)
committerWolfgang Denk <wd@denx.de>
Tue, 20 Dec 2011 21:55:30 +0000 (22:55 +0100)
A network driver should not touch the environment at all. This patch fixes
this behaviour by removing the code for setting a default/randomized MAC
address.

Signed-off-by: Michael Walle <michael@walle.cc>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Prafulla Wadaskar <prafulla@marvell.com>
Cc: Valentin Longchamp <valentin.longchamp@keymile.com>
Cc: Eric Cooper <ecc@cmu.edu>
Cc: Jason Cooper <u-boot@lakedaemon.net>
Cc: Siddarth Gore <gores@marvell.com>
Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
Cc: Simon Guinot <simon.guinot@sequanux.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>
drivers/net/mvgbe.c

index de7cdd7ba7bdab6d0d3b91095f35a8e41501b29e..1dcb700161289e954d8273dc48b97ad0b2dca905 100644 (file)
@@ -651,7 +651,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++) {
@@ -706,16 +705,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 */
@@ -724,25 +720,6 @@ 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;