[adm5120] fix mac address setup on RouterBOARDs
authorGabor Juhos <juhosg@openwrt.org>
Wed, 12 Dec 2007 08:43:41 +0000 (08:43 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Wed, 12 Dec 2007 08:43:41 +0000 (08:43 +0000)
SVN-Revision: 9713

target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c
target/linux/adm5120/files/arch/mips/adm5120/prom/routerboot.c
target/linux/adm5120/files/include/asm-mips/mach-adm5120/prom/routerboot.h

index 3d2facfd1533c99d6fab1b3a07438760989ecdcd..744c82f15a49c2fb4442ae292dc73b0734d43fc4 100644 (file)
@@ -64,8 +64,6 @@
 #define RB153_GPIO_CF_RDY      ADM5120_GPIO_P1L1
 #define RB153_GPIO_CF_WT       ADM5120_GPIO_P0L0
 
-extern struct rb_hard_settings rb_hs;
-
 /*--------------------------------------------------------------------------*/
 
 static struct adm5120_pci_irq rb1xx_pci_irqs[] __initdata = {
@@ -219,9 +217,13 @@ static void __init rb1xx_mac_setup(void)
 {
        int i, j;
 
-       for (i = 0; i < rb_hs.mac_count; i++) {
-               for (j = 0; j < RB_MAC_SIZE; j++)
-                       adm5120_eth_macs[i][j] = rb_hs.macs[i][j];
+       if (!rb_hs.mac_base)
+               return;
+
+       for (i = 0; i < 6; i++) {
+               for (j = 0; j < 5; j++)
+                       adm5120_eth_macs[i][j] = rb_hs.mac_base[j];
+               adm5120_eth_macs[i][5] = rb_hs.mac_base[5]+i;
        }
 }
 
index a93382dc8a029f5911f522b58eed1b9e676b7d96..0effe24d0e2e725b52432ca91d67e11800b58bd9 100644 (file)
@@ -37,7 +37,6 @@
 #include "prom_read.h"
 
 struct rb_hard_settings rb_hs;
-EXPORT_SYMBOL(rb_hs);
 static int rb_found;
 
 static int __init routerboot_load_hs(u8 *buf, u16 buflen)
@@ -86,15 +85,8 @@ static int __init routerboot_load_hs(u8 *buf, u16 buflen)
                        rb_hs.mac_count = prom_read_le32(buf);
                        break;
                case RB_ID_MAC_ADDRESS_PACK:
-                       rb_hs.mac_count = len/RB_MAC_SIZE;
-                       if (rb_hs.mac_count > RB_MAX_MAC_COUNT)
-                               rb_hs.mac_count = RB_MAX_MAC_COUNT;
-                       mac = buf;
-                       for (i = 0; i < rb_hs.mac_count; i++) {
-                               for (j = 0; j < RB_MAC_SIZE; j++)
-                                       rb_hs.macs[i][j] = mac[j];
-                               mac += RB_MAC_SIZE;
-                       }
+                       if ((len / RB_MAC_SIZE) > 0)
+                               rb_hs.mac_base = buf;
                        break;
                }
 
index 3c0898b3dee7961fe44dc5c9b2e22a9f1e3f2240..41121c9d736a2cb16dba7821231689a43d8eba9d 100644 (file)
@@ -26,7 +26,6 @@
 #define _ROUTERBOOT_H
 
 #define RB_MAC_SIZE            6
-#define RB_MAX_MAC_COUNT       6
 
 struct rb_bios_settings {
        u32     hs_offs; /* hard settings offset */
@@ -41,7 +40,7 @@ struct rb_hard_settings {
        char    *bios_ver;      /* BIOS version */
        u32     mem_size;       /* memory size in bytes */
        u32     mac_count;      /* number of mac addresses */
-       u8      macs[RB_MAC_SIZE][RB_MAX_MAC_COUNT]; /* mac addresses */
+       u8      *mac_base;      /* mac address base */
 };
 
 /*
@@ -134,4 +133,6 @@ struct rb_hard_settings {
 extern int routerboot_present(void) __init;
 extern char *routerboot_get_boardname(void);
 
+extern struct rb_hard_settings rb_hs;
+
 #endif /* _ROUTERBOOT_H */