X-Git-Url: http://git.ozo.com/?a=blobdiff_plain;f=target%2Flinux%2Fatheros-2.6%2Ffiles%2Farch%2Fmips%2Fatheros%2Far5312.c;h=57d56eb0e5e69e265efec2136a908f50600d842f;hb=51dad7245443d4a057687669bc34bcf934c2f483;hp=d337098d5cd68ab2b3594bc1d628900a8ef912fb;hpb=6869d66ad6e8d662dc124fc9103566cb1bd7454a;p=openwrt-10.03%2F.git diff --git a/target/linux/atheros-2.6/files/arch/mips/atheros/ar5312.c b/target/linux/atheros-2.6/files/arch/mips/atheros/ar5312.c index d337098d5..57d56eb0e 100644 --- a/target/linux/atheros-2.6/files/arch/mips/atheros/ar5312.c +++ b/target/linux/atheros-2.6/files/arch/mips/atheros/ar5312.c @@ -215,6 +215,7 @@ int __init ar5312_init_devices(void) struct ar531x_boarddata *bcfg; char *radio, *c; int dev = 0; + uint32_t fctl = 0; if (!is_5312) return 0; @@ -253,10 +254,24 @@ int __init ar5312_init_devices(void) ar5312_eth0_data.board_config = board_config; ar5312_eth1_data.board_config = board_config; + + /* fixup flash width */ + fctl = sysRegRead(AR531X_FLASHCTL) & FLASHCTL_MW; + switch (fctl) { + case FLASHCTL_MWx16: + ar5312_flash_data.width = 2; + break; + case FLASHCTL_MWx8: + default: + ar5312_flash_data.width = 1; + break; + } + ar5312_devs[dev++] = &ar5312_physmap_flash; - ar5312_eth0_data.macaddr = bcfg->enet0Mac; - ar5312_eth1_data.macaddr = bcfg->enet1Mac; + if (!memcmp(bcfg->enet0Mac, "\xff\xff\xff\xff\xff\xff", 6)) + memcpy(bcfg->enet0Mac, bcfg->enet1Mac, 6); + if (memcmp(bcfg->enet0Mac, bcfg->enet1Mac, 6) == 0) { /* ENET0 and ENET1 have the same mac. * Increment the one from ENET1 */ @@ -267,20 +282,25 @@ int __init ar5312_init_devices(void) switch(mips_machtype) { case MACH_ATHEROS_AR5312: + ar5312_eth0_data.macaddr = bcfg->enet0Mac; + ar5312_eth1_data.macaddr = bcfg->enet1Mac; ar5312_devs[dev++] = &ar5312_eth[0]; ar5312_devs[dev++] = &ar5312_eth[1]; break; case MACH_ATHEROS_AR2312: case MACH_ATHEROS_AR2313: + ar231x_eth0_data.macaddr = bcfg->enet0Mac; ar5312_devs[dev++] = &ar231x_eth0; ar5312_flash_data.width = 1; break; } if (radio) { - if (*((u32 *) radio) & AR531X_RADIO0_MASK) { - ar5312_wmac[0].dev.platform_data = init_wmac(0); - ar5312_devs[dev++] = &ar5312_wmac[0]; + if (mips_machtype == MACH_ATHEROS_AR5312) { + if (*((u32 *) radio) & AR531X_RADIO0_MASK) { + ar5312_wmac[0].dev.platform_data = init_wmac(0); + ar5312_devs[dev++] = &ar5312_wmac[0]; + } } if (*((u32 *) radio) & AR531X_RADIO1_MASK) { ar5312_wmac[1].dev.platform_data = init_wmac(1);