UBI/cfi-mtd: Fix mtd name for multiple chips
[oweals/u-boot.git] / drivers / net / 4xx_enet.c
index 19782695998d4bea6036212dd26084d7cf4b92b2..918373bd1f77b899ac162175e9f23c73291e999c 100644 (file)
@@ -1927,24 +1927,22 @@ int ppc_4xx_eth_initialize (bd_t * bis)
                memcpy(ethaddr[eth_num], "\0\0\0\0\0\0", 6);
 
        for (eth_num = 0; eth_num < LAST_EMAC_NUM; eth_num++) {
+               int ethaddr_idx = eth_num + CONFIG_EMAC_NR_START;
                switch (eth_num) {
                default:                /* fall through */
                case 0:
-                       memcpy(ethaddr[eth_num + CONFIG_EMAC_NR_START],
-                              bis->bi_enetaddr, 6);
+                       eth_getenv_enetaddr("ethaddr", ethaddr[ethaddr_idx]);
                        hw_addr[eth_num] = 0x0;
                        break;
 #ifdef CONFIG_HAS_ETH1
                case 1:
-                       memcpy(ethaddr[eth_num + CONFIG_EMAC_NR_START],
-                              bis->bi_enet1addr, 6);
+                       eth_getenv_enetaddr("eth1addr", ethaddr[ethaddr_idx]);
                        hw_addr[eth_num] = 0x100;
                        break;
 #endif
 #ifdef CONFIG_HAS_ETH2
                case 2:
-                       memcpy(ethaddr[eth_num + CONFIG_EMAC_NR_START],
-                              bis->bi_enet2addr, 6);
+                       eth_getenv_enetaddr("eth2addr", ethaddr[ethaddr_idx]);
 #if defined(CONFIG_460GT)
                        hw_addr[eth_num] = 0x300;
 #else
@@ -1954,8 +1952,7 @@ int ppc_4xx_eth_initialize (bd_t * bis)
 #endif
 #ifdef CONFIG_HAS_ETH3
                case 3:
-                       memcpy(ethaddr[eth_num + CONFIG_EMAC_NR_START],
-                              bis->bi_enet3addr, 6);
+                       eth_getenv_enetaddr("eth3addr", ethaddr[ethaddr_idx]);
 #if defined(CONFIG_460GT)
                        hw_addr[eth_num] = 0x400;
 #else