[ARM] 4806/1: ixp4xx: Ethernet support for the nslu2 and nas100d boards

Enables the new ixp4xx qmgr and npe drivers in ixp4xx_defconfig.

Sets up the corresponding platform data for the nslu2 and nas100d
boards, and reads the ethernet MAC address from the internal flash.

Tested on both little-endian and big-endian kernels.

Tested-by: Tom King <tom@websb.net>

Signed-off-by: Rod Whitby <rod@whitby.id.au>
Signed-off-by: Michael Westerhof <mwester@dls.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by Rod Whitby and committed by Russell King b7edc84a 1208ebf2

+93 -2
+6 -2
arch/arm/configs/ixp4xx_defconfig
··· 1 1 # 2 2 # Automatically generated make config: don't edit 3 - # Linux kernel version: 2.6.24-rc8 4 - # Wed Jan 23 17:26:16 2008 3 + # Linux kernel version: 2.6.24 4 + # Sun Jan 27 07:33:38 2008 5 5 # 6 6 CONFIG_ARM=y 7 7 CONFIG_SYS_SUPPORTS_APM_EMULATION=y ··· 174 174 # 175 175 CONFIG_DMABOUNCE=y 176 176 # CONFIG_IXP4XX_INDIRECT_PCI is not set 177 + CONFIG_IXP4XX_QMGR=y 178 + CONFIG_IXP4XX_NPE=y 177 179 178 180 # 179 181 # Boot options ··· 834 832 # CONFIG_PHYLIB is not set 835 833 CONFIG_NET_ETHERNET=y 836 834 CONFIG_MII=y 835 + CONFIG_IXP4XX_ETH=y 837 836 # CONFIG_AX88796 is not set 838 837 # CONFIG_HAPPYMEAL is not set 839 838 # CONFIG_SUNGEM is not set ··· 928 925 # CONFIG_PC300TOO is not set 929 926 # CONFIG_FARSYNC is not set 930 927 # CONFIG_DSCC4 is not set 928 + # CONFIG_IXP4XX_HSS is not set 931 929 CONFIG_DLCI=m 932 930 CONFIG_DLCI_MAX=8 933 931 CONFIG_WAN_ROUTER_DRIVERS=m
+43
arch/arm/mach-ixp4xx/nas100d-setup.c
··· 12 12 * 13 13 */ 14 14 15 + #include <linux/if_ether.h> 15 16 #include <linux/kernel.h> 16 17 #include <linux/serial.h> 17 18 #include <linux/serial_8250.h> ··· 23 22 #include <asm/mach-types.h> 24 23 #include <asm/mach/arch.h> 25 24 #include <asm/mach/flash.h> 25 + #include <asm/io.h> 26 26 27 27 static struct flash_platform_data nas100d_flash_data = { 28 28 .map_name = "cfi_probe", ··· 133 131 .resource = nas100d_uart_resources, 134 132 }; 135 133 134 + /* Built-in 10/100 Ethernet MAC interfaces */ 135 + static struct eth_plat_info nas100d_plat_eth[] = { 136 + { 137 + .phy = 0, 138 + .rxq = 3, 139 + .txreadyq = 20, 140 + } 141 + }; 142 + 143 + static struct platform_device nas100d_eth[] = { 144 + { 145 + .name = "ixp4xx_eth", 146 + .id = IXP4XX_ETH_NPEB, 147 + .dev.platform_data = nas100d_plat_eth, 148 + } 149 + }; 150 + 136 151 static struct platform_device *nas100d_devices[] __initdata = { 137 152 &nas100d_i2c_gpio, 138 153 &nas100d_flash, 139 154 &nas100d_leds, 155 + &nas100d_eth[0], 140 156 }; 141 157 142 158 static void nas100d_power_off(void) ··· 170 150 171 151 static void __init nas100d_init(void) 172 152 { 153 + DECLARE_MAC_BUF(mac_buf); 154 + uint8_t __iomem *f; 155 + int i; 156 + 173 157 ixp4xx_sys_init(); 174 158 175 159 /* gpio 14 and 15 are _not_ clocks */ ··· 196 172 (void)platform_device_register(&nas100d_uart); 197 173 198 174 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices)); 175 + 176 + /* 177 + * Map in a portion of the flash and read the MAC address. 178 + * Since it is stored in BE in the flash itself, we need to 179 + * byteswap it if we're in LE mode. 180 + */ 181 + f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x1000000); 182 + if (f) { 183 + for (i = 0; i < 6; i++) 184 + #ifdef __ARMEB__ 185 + nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + i); 186 + #else 187 + nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + (i^3)); 188 + #endif 189 + iounmap(f); 190 + } 191 + printk(KERN_INFO "NAS100D: Using MAC address %s for port 0\n", 192 + print_mac(mac_buf, nas100d_plat_eth[0].hwaddr)); 193 + 199 194 } 200 195 201 196 MACHINE_START(NAS100D, "Iomega NAS 100d")
+44
arch/arm/mach-ixp4xx/nslu2-setup.c
··· 14 14 * Changed to conform to new style __init ixdp425 kas11 10/22/04 15 15 */ 16 16 17 + #include <linux/if_ether.h> 17 18 #include <linux/kernel.h> 18 19 #include <linux/serial.h> 19 20 #include <linux/serial_8250.h> ··· 26 25 #include <asm/mach/arch.h> 27 26 #include <asm/mach/flash.h> 28 27 #include <asm/mach/time.h> 28 + #include <asm/io.h> 29 29 30 30 static struct flash_platform_data nslu2_flash_data = { 31 31 .map_name = "cfi_probe", ··· 145 143 .resource = nslu2_uart_resources, 146 144 }; 147 145 146 + /* Built-in 10/100 Ethernet MAC interfaces */ 147 + static struct eth_plat_info nslu2_plat_eth[] = { 148 + { 149 + .phy = 1, 150 + .rxq = 3, 151 + .txreadyq = 20, 152 + } 153 + }; 154 + 155 + static struct platform_device nslu2_eth[] = { 156 + { 157 + .name = "ixp4xx_eth", 158 + .id = IXP4XX_ETH_NPEB, 159 + .dev.platform_data = nslu2_plat_eth, 160 + } 161 + }; 162 + 148 163 static struct platform_device *nslu2_devices[] __initdata = { 149 164 &nslu2_i2c_gpio, 150 165 &nslu2_flash, 151 166 &nslu2_beeper, 152 167 &nslu2_leds, 168 + &nslu2_eth[0], 153 169 }; 154 170 155 171 static void nslu2_power_off(void) ··· 196 176 197 177 static void __init nslu2_init(void) 198 178 { 179 + DECLARE_MAC_BUF(mac_buf); 180 + uint8_t __iomem *f; 181 + int i; 182 + 199 183 ixp4xx_sys_init(); 200 184 201 185 nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); ··· 219 195 (void)platform_device_register(&nslu2_uart); 220 196 221 197 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices)); 198 + 199 + 200 + /* 201 + * Map in a portion of the flash and read the MAC address. 202 + * Since it is stored in BE in the flash itself, we need to 203 + * byteswap it if we're in LE mode. 204 + */ 205 + f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x40000); 206 + if (f) { 207 + for (i = 0; i < 6; i++) 208 + #ifdef __ARMEB__ 209 + nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + i); 210 + #else 211 + nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + (i^3)); 212 + #endif 213 + iounmap(f); 214 + } 215 + printk(KERN_INFO "NSLU2: Using MAC address %s for port 0\n", 216 + print_mac(mac_buf, nslu2_plat_eth[0].hwaddr)); 217 + 222 218 } 223 219 224 220 MACHINE_START(NSLU2, "Linksys NSLU2")