diff options
author | Alexandros C. Couloumbis <alex@ozo.com> | 2010-06-18 11:14:20 +0000 |
---|---|---|
committer | Alexandros C. Couloumbis <alex@ozo.com> | 2010-06-18 11:14:20 +0000 |
commit | 44e51c530f821f9c780e9e2fffca9b4aae316c62 (patch) | |
tree | 0a6bb8fbc704d0d90e84d6ff5621efc22dfbf450 /target/linux | |
parent | b54213c5800e337d2b1f1597e31bb1a1dc0edb63 (diff) | |
download | mtk-20170518-44e51c530f821f9c780e9e2fffca9b4aae316c62.zip mtk-20170518-44e51c530f821f9c780e9e2fffca9b4aae316c62.tar.gz mtk-20170518-44e51c530f821f9c780e9e2fffca9b4aae316c62.tar.bz2 |
ixp4xx: fix MAC parsing and switch (unmanaged) functionality for wrt300nv2 (thank you Ernesto Elbe)
SVN-Revision: 21836
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/ixp4xx/patches-2.6.33/132-wrt300nv2_mac_fix.patch | 71 | ||||
-rw-r--r-- | target/linux/ixp4xx/patches-2.6.35/132-wrt300nv2_mac_fix.patch | 71 |
2 files changed, 142 insertions, 0 deletions
diff --git a/target/linux/ixp4xx/patches-2.6.33/132-wrt300nv2_mac_fix.patch b/target/linux/ixp4xx/patches-2.6.33/132-wrt300nv2_mac_fix.patch new file mode 100644 index 0000000..cc891e2 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.33/132-wrt300nv2_mac_fix.patch @@ -0,0 +1,71 @@ +--- a/arch/arm/mach-ixp4xx/wrt300nv2-setup.c ++++ b/arch/arm/mach-ixp4xx/wrt300nv2-setup.c +@@ -3,6 +3,7 @@ + * + * Board setup for the Linksys WRT300N v2 + * ++ * Copyright (C) 2010 Alexandros C. Couloumbis <alex@ozo.com> + * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> + * + * based on coyote-setup.c: +@@ -18,6 +19,7 @@ + #include <linux/tty.h> + #include <linux/serial_8250.h> + #include <linux/slab.h> ++#include <linux/etherdevice.h> + + #include <asm/types.h> + #include <asm/setup.h> +@@ -79,7 +81,8 @@ static struct platform_device wrt300nv2_ + /* Built-in 10/100 Ethernet MAC interfaces */ + static struct eth_plat_info wrt300nv2_plat_eth[] = { + { +- .phy = -1, ++ .phy = IXP4XX_ETH_PHY_MAX_ADDR, ++ .phy_mask = 0x0F0000, + .rxq = 3, + .txreadyq = 20, + }, { +@@ -111,6 +114,9 @@ static struct platform_device *wrt300nv2 + static void __init wrt300nv2_init(void) + { + ixp4xx_sys_init(); ++ uint8_t __iomem *f; ++ int offset = 0; ++ int i; + + wrt300nv2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); + wrt300nv2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; +@@ -119,6 +125,32 @@ static void __init wrt300nv2_init(void) + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; + + platform_add_devices(wrt300nv2_devices, ARRAY_SIZE(wrt300nv2_devices)); ++ ++ f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x60000); ++ ++ if (f) { ++ for (i = 0; i < 6; i++) { ++#ifdef __ARMEB__ ++ wrt300nv2_plat_eth[0].hwaddr[i] = readb(f + 0x5FFA0 + i); ++ if (i == 5) ++ offset = 1; ++ wrt300nv2_plat_eth[1].hwaddr[i] = (wrt300nv2_plat_eth[0].hwaddr[i] + offset); ++#else ++ wrt300nv2_plat_eth[0].hwaddr[i] = readb(f + 0x5FFA0 + (i^3)); ++ if (i == 5) ++ offset = 1; ++ wrt300nv2_plat_eth[1].hwaddr[i] = (wrt300nv2_plat_eth[0].hwaddr[i] + offset); ++#endif ++ } ++ iounmap(f); ++ } ++ ++ if (!(is_valid_ether_addr(wrt300nv2_plat_eth[0].hwaddr))) ++ random_ether_addr(wrt300nv2_plat_eth[0].hwaddr); ++ if (!(is_valid_ether_addr(wrt300nv2_plat_eth[1].hwaddr))) { ++ memcpy(wrt300nv2_plat_eth[1].hwaddr, wrt300nv2_plat_eth[0].hwaddr, ETH_ALEN); ++ wrt300nv2_plat_eth[1].hwaddr[5] = (wrt300nv2_plat_eth[0].hwaddr[5] + 1); ++ } + } + + #ifdef CONFIG_MACH_WRT300NV2 diff --git a/target/linux/ixp4xx/patches-2.6.35/132-wrt300nv2_mac_fix.patch b/target/linux/ixp4xx/patches-2.6.35/132-wrt300nv2_mac_fix.patch new file mode 100644 index 0000000..cc891e2 --- /dev/null +++ b/target/linux/ixp4xx/patches-2.6.35/132-wrt300nv2_mac_fix.patch @@ -0,0 +1,71 @@ +--- a/arch/arm/mach-ixp4xx/wrt300nv2-setup.c ++++ b/arch/arm/mach-ixp4xx/wrt300nv2-setup.c +@@ -3,6 +3,7 @@ + * + * Board setup for the Linksys WRT300N v2 + * ++ * Copyright (C) 2010 Alexandros C. Couloumbis <alex@ozo.com> + * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org> + * + * based on coyote-setup.c: +@@ -18,6 +19,7 @@ + #include <linux/tty.h> + #include <linux/serial_8250.h> + #include <linux/slab.h> ++#include <linux/etherdevice.h> + + #include <asm/types.h> + #include <asm/setup.h> +@@ -79,7 +81,8 @@ static struct platform_device wrt300nv2_ + /* Built-in 10/100 Ethernet MAC interfaces */ + static struct eth_plat_info wrt300nv2_plat_eth[] = { + { +- .phy = -1, ++ .phy = IXP4XX_ETH_PHY_MAX_ADDR, ++ .phy_mask = 0x0F0000, + .rxq = 3, + .txreadyq = 20, + }, { +@@ -111,6 +114,9 @@ static struct platform_device *wrt300nv2 + static void __init wrt300nv2_init(void) + { + ixp4xx_sys_init(); ++ uint8_t __iomem *f; ++ int offset = 0; ++ int i; + + wrt300nv2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); + wrt300nv2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1; +@@ -119,6 +125,32 @@ static void __init wrt300nv2_init(void) + *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; + + platform_add_devices(wrt300nv2_devices, ARRAY_SIZE(wrt300nv2_devices)); ++ ++ f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x60000); ++ ++ if (f) { ++ for (i = 0; i < 6; i++) { ++#ifdef __ARMEB__ ++ wrt300nv2_plat_eth[0].hwaddr[i] = readb(f + 0x5FFA0 + i); ++ if (i == 5) ++ offset = 1; ++ wrt300nv2_plat_eth[1].hwaddr[i] = (wrt300nv2_plat_eth[0].hwaddr[i] + offset); ++#else ++ wrt300nv2_plat_eth[0].hwaddr[i] = readb(f + 0x5FFA0 + (i^3)); ++ if (i == 5) ++ offset = 1; ++ wrt300nv2_plat_eth[1].hwaddr[i] = (wrt300nv2_plat_eth[0].hwaddr[i] + offset); ++#endif ++ } ++ iounmap(f); ++ } ++ ++ if (!(is_valid_ether_addr(wrt300nv2_plat_eth[0].hwaddr))) ++ random_ether_addr(wrt300nv2_plat_eth[0].hwaddr); ++ if (!(is_valid_ether_addr(wrt300nv2_plat_eth[1].hwaddr))) { ++ memcpy(wrt300nv2_plat_eth[1].hwaddr, wrt300nv2_plat_eth[0].hwaddr, ETH_ALEN); ++ wrt300nv2_plat_eth[1].hwaddr[5] = (wrt300nv2_plat_eth[0].hwaddr[5] + 1); ++ } + } + + #ifdef CONFIG_MACH_WRT300NV2 |