1 From af66bd3b3324d51f0c43b7672b7a0563db425377 Mon Sep 17 00:00:00 2001
2 From: Rod Whitby <rod@whitby.id.au>
3 Date: Tue, 29 Jan 2008 10:03:19 +1030
4 Subject: ixp4xx: Ethernet support for the nslu2 and nas100d boards
6 Enables the new ixp4xx qmgr and npe drivers in ixp4xx_defconfig.
8 Sets up the corresponding platform data for the nslu2 and nas100d
9 boards, and reads the ethernet MAC address from the internal flash.
11 Tested on both little-endian and big-endian kernels.
13 Signed-off-by: Rod Whitby <rod@whitby.id.au>
14 Signed-off-by: Michael Westerhof <mwester@dls.net>
15 Tested-by: Tom King <tom@websb.net>
18 KernelVersion: v2.6.24-1916-g3832564
20 Index: linux-2.6.24.7/arch/arm/configs/ixp4xx_defconfig
21 ===================================================================
22 --- linux-2.6.24.7.orig/arch/arm/configs/ixp4xx_defconfig
23 +++ linux-2.6.24.7/arch/arm/configs/ixp4xx_defconfig
26 # Automatically generated make config: don't edit
27 -# Linux kernel version: 2.6.24-rc8
28 -# Wed Jan 23 17:26:16 2008
29 +# Linux kernel version: 2.6.24
30 +# Sun Jan 27 07:33:38 2008
33 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
34 @@ -174,6 +174,8 @@ CONFIG_MACH_GTWX5715=y
37 # CONFIG_IXP4XX_INDIRECT_PCI is not set
43 @@ -832,6 +834,7 @@ CONFIG_DUMMY=y
44 # CONFIG_PHYLIB is not set
48 # CONFIG_AX88796 is not set
49 # CONFIG_HAPPYMEAL is not set
50 # CONFIG_SUNGEM is not set
51 @@ -925,6 +928,7 @@ CONFIG_HDLC_X25=m
52 # CONFIG_PC300TOO is not set
53 # CONFIG_FARSYNC is not set
54 # CONFIG_DSCC4 is not set
55 +# CONFIG_IXP4XX_HSS is not set
58 CONFIG_WAN_ROUTER_DRIVERS=m
59 Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c
60 ===================================================================
61 --- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nas100d-setup.c
62 +++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nas100d-setup.c
67 +#include <linux/if_ether.h>
68 #include <linux/kernel.h>
69 #include <linux/serial.h>
70 #include <linux/serial_8250.h>
72 #include <asm/mach-types.h>
73 #include <asm/mach/arch.h>
74 #include <asm/mach/flash.h>
77 static struct flash_platform_data nas100d_flash_data = {
78 .map_name = "cfi_probe",
79 @@ -131,10 +133,28 @@ static struct platform_device nas100d_ua
80 .resource = nas100d_uart_resources,
83 +/* Built-in 10/100 Ethernet MAC interfaces */
84 +static struct eth_plat_info nas100d_plat_eth[] = {
92 +static struct platform_device nas100d_eth[] = {
94 + .name = "ixp4xx_eth",
95 + .id = IXP4XX_ETH_NPEB,
96 + .dev.platform_data = nas100d_plat_eth,
100 static struct platform_device *nas100d_devices[] __initdata = {
107 static void nas100d_power_off(void)
108 @@ -150,6 +170,10 @@ static void nas100d_power_off(void)
110 static void __init nas100d_init(void)
112 + DECLARE_MAC_BUF(mac_buf);
113 + uint8_t __iomem *f;
118 /* gpio 14 and 15 are _not_ clocks */
119 @@ -172,6 +196,25 @@ static void __init nas100d_init(void)
120 (void)platform_device_register(&nas100d_uart);
122 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
125 + * Map in a portion of the flash and read the MAC address.
126 + * Since it is stored in BE in the flash itself, we need to
127 + * byteswap it if we're in LE mode.
129 + f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x1000000);
131 + for (i = 0; i < 6; i++)
133 + nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + i);
135 + nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + (i^3));
139 + printk(KERN_INFO "NAS100D: Using MAC address %s for port 0\n",
140 + print_mac(mac_buf, nas100d_plat_eth[0].hwaddr));
144 MACHINE_START(NAS100D, "Iomega NAS 100d")
145 Index: linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c
146 ===================================================================
147 --- linux-2.6.24.7.orig/arch/arm/mach-ixp4xx/nslu2-setup.c
148 +++ linux-2.6.24.7/arch/arm/mach-ixp4xx/nslu2-setup.c
150 * Changed to conform to new style __init ixdp425 kas11 10/22/04
153 +#include <linux/if_ether.h>
154 #include <linux/kernel.h>
155 #include <linux/serial.h>
156 #include <linux/serial_8250.h>
158 #include <asm/mach/arch.h>
159 #include <asm/mach/flash.h>
160 #include <asm/mach/time.h>
163 static struct flash_platform_data nslu2_flash_data = {
164 .map_name = "cfi_probe",
165 @@ -143,11 +145,29 @@ static struct platform_device nslu2_uart
166 .resource = nslu2_uart_resources,
169 +/* Built-in 10/100 Ethernet MAC interfaces */
170 +static struct eth_plat_info nslu2_plat_eth[] = {
178 +static struct platform_device nslu2_eth[] = {
180 + .name = "ixp4xx_eth",
181 + .id = IXP4XX_ETH_NPEB,
182 + .dev.platform_data = nslu2_plat_eth,
186 static struct platform_device *nslu2_devices[] __initdata = {
194 static void nslu2_power_off(void)
195 @@ -176,6 +196,10 @@ static struct sys_timer nslu2_timer = {
197 static void __init nslu2_init(void)
199 + DECLARE_MAC_BUF(mac_buf);
200 + uint8_t __iomem *f;
205 nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
206 @@ -195,6 +219,26 @@ static void __init nslu2_init(void)
207 (void)platform_device_register(&nslu2_uart);
209 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
213 + * Map in a portion of the flash and read the MAC address.
214 + * Since it is stored in BE in the flash itself, we need to
215 + * byteswap it if we're in LE mode.
217 + f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x40000);
219 + for (i = 0; i < 6; i++)
221 + nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + i);
223 + nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + (i^3));
227 + printk(KERN_INFO "NSLU2: Using MAC address %s for port 0\n",
228 + print_mac(mac_buf, nslu2_plat_eth[0].hwaddr));
232 MACHINE_START(NSLU2, "Linksys NSLU2")