]> git.sur5r.net Git - u-boot/commitdiff
omap3evm: Set environment variable 'ethaddr'
authorSanjeev Premi <premi@ti.com>
Fri, 2 Sep 2011 05:57:16 +0000 (05:57 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Thu, 3 Nov 2011 21:56:23 +0000 (22:56 +0100)
It is now responsibility of the board specific init
code to set the environment variable corresponding
to the MAC address.

Signed-off-by: Sanjeev Premi <premi@ti.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
board/ti/evm/evm.c

index b17c0fbadfc21c4deb4f13cd3675e0ba026aad10..8c434633ddc277ece3bdcd4a4f625c850069dfc2 100644 (file)
@@ -217,7 +217,22 @@ int board_eth_init(bd_t *bis)
 {
        int rc = 0;
 #ifdef CONFIG_SMC911X
+#define STR_ENV_ETHADDR        "ethaddr"
+
+       struct eth_device *dev;
+       uchar eth_addr[6];
+
        rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
+
+       if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) {
+               dev = eth_get_dev_by_index(0);
+               if (dev) {
+                       eth_setenv_enetaddr(STR_ENV_ETHADDR, dev->enetaddr);
+               } else {
+                       printf("omap3evm: Couldn't get eth device\n");
+                       rc = -1;
+               }
+       }
 #endif
        return rc;
 }