1 From 31f59b98f850870515f73d05517b2fa00d9e46fd Mon Sep 17 00:00:00 2001
2 From: Rod Whitby <rod@whitby.id.au>
3 Date: Sun, 27 Jan 2008 09:06:51 +1030
4 Subject: [PATCH] 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 bit-endian platforms.
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>
17 arch/arm/configs/ixp4xx_defconfig | 8 ++++-
18 arch/arm/mach-ixp4xx/nas100d-setup.c | 49 +++++++++++++++++++++++++++++++++
19 arch/arm/mach-ixp4xx/nslu2-setup.c | 50 ++++++++++++++++++++++++++++++++++
20 3 files changed, 105 insertions(+), 2 deletions(-)
22 diff --git a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig
23 index 2d5ae33..45192ef 100644
24 --- a/arch/arm/configs/ixp4xx_defconfig
25 +++ b/arch/arm/configs/ixp4xx_defconfig
28 # Automatically generated make config: don't edit
29 -# Linux kernel version: 2.6.24-rc8
30 -# Wed Jan 23 17:26:16 2008
31 +# Linux kernel version: 2.6.24
32 +# Sun Jan 27 07:33:38 2008
35 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
36 @@ -174,6 +174,8 @@ CONFIG_MACH_GTWX5715=y
39 # CONFIG_IXP4XX_INDIRECT_PCI is not set
45 @@ -832,6 +834,7 @@ CONFIG_DUMMY=y
46 # CONFIG_PHYLIB is not set
50 # CONFIG_AX88796 is not set
51 # CONFIG_HAPPYMEAL is not set
52 # CONFIG_SUNGEM is not set
53 @@ -925,6 +928,7 @@ CONFIG_HDLC_X25=m
54 # CONFIG_PC300TOO is not set
55 # CONFIG_FARSYNC is not set
56 # CONFIG_DSCC4 is not set
57 +# CONFIG_IXP4XX_HSS is not set
60 CONFIG_WAN_ROUTER_DRIVERS=m
61 diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
62 index ea334f3..36421b3 100644
63 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c
64 +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
66 #include <asm/mach-types.h>
67 #include <asm/mach/arch.h>
68 #include <asm/mach/flash.h>
71 static struct flash_platform_data nas100d_flash_data = {
72 .map_name = "cfi_probe",
73 @@ -123,12 +124,30 @@ static struct platform_device nas100d_uart = {
74 .resource = nas100d_uart_resources,
77 +/* Built-in 10/100 Ethernet MAC interfaces */
78 +static struct eth_plat_info nas100d_plat_eth[] = {
86 +static struct platform_device nas100d_eth[] = {
88 + .name = "ixp4xx_eth",
89 + .id = IXP4XX_ETH_NPEB,
90 + .dev.platform_data = nas100d_plat_eth,
94 static struct platform_device *nas100d_devices[] __initdata = {
95 &nas100d_i2c_controller,
97 #ifdef CONFIG_LEDS_IXP4XX
103 static void nas100d_power_off(void)
104 @@ -144,6 +163,9 @@ static void nas100d_power_off(void)
106 static void __init nas100d_init(void)
108 + uint8_t __iomem *f;
113 /* gpio 14 and 15 are _not_ clocks */
114 @@ -163,6 +185,33 @@ static void __init nas100d_init(void)
115 (void)platform_device_register(&nas100d_uart);
117 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
120 + * Map in a portion of the flash and read the MAC address.
121 + * Since it is stored in BE in the flash itself, we need to
122 + * byteswap it if we're in LE mode.
124 + f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x1000000);
127 + for (i = 0; i < 6; i++)
128 + nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + i);
130 + nas100d_plat_eth[0].hwaddr[0] = readb(f + 0xFC0FD8 + 3);
131 + nas100d_plat_eth[0].hwaddr[1] = readb(f + 0xFC0FD8 + 2);
132 + nas100d_plat_eth[0].hwaddr[2] = readb(f + 0xFC0FD8 + 1);
133 + nas100d_plat_eth[0].hwaddr[3] = readb(f + 0xFC0FD8 + 0);
134 + nas100d_plat_eth[0].hwaddr[4] = readb(f + 0xFC0FD8 + 7);
135 + nas100d_plat_eth[0].hwaddr[5] = readb(f + 0xFC0FD8 + 6);
139 + printk(KERN_INFO "NAS100D: Using MAC address "
140 + "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x for port 0\n",
141 + nas100d_plat_eth[0].hwaddr[0], nas100d_plat_eth[0].hwaddr[1],
142 + nas100d_plat_eth[0].hwaddr[2], nas100d_plat_eth[0].hwaddr[3],
143 + nas100d_plat_eth[0].hwaddr[4], nas100d_plat_eth[0].hwaddr[5]);
147 MACHINE_START(NAS100D, "Iomega NAS 100d")
148 diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
149 index 9bf8ccb..b10e094 100644
150 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c
151 +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
153 #include <asm/mach/arch.h>
154 #include <asm/mach/flash.h>
155 #include <asm/mach/time.h>
158 static struct flash_platform_data nslu2_flash_data = {
159 .map_name = "cfi_probe",
160 @@ -138,6 +139,23 @@ static struct platform_device nslu2_uart = {
161 .resource = nslu2_uart_resources,
164 +/* Built-in 10/100 Ethernet MAC interfaces */
165 +static struct eth_plat_info nslu2_plat_eth[] = {
173 +static struct platform_device nslu2_eth[] = {
175 + .name = "ixp4xx_eth",
176 + .id = IXP4XX_ETH_NPEB,
177 + .dev.platform_data = nslu2_plat_eth,
181 static struct platform_device *nslu2_devices[] __initdata = {
182 &nslu2_i2c_controller,
184 @@ -145,6 +163,7 @@ static struct platform_device *nslu2_devices[] __initdata = {
185 #ifdef CONFIG_LEDS_IXP4XX
191 static void nslu2_power_off(void)
192 @@ -173,6 +192,9 @@ static struct sys_timer nslu2_timer = {
194 static void __init nslu2_init(void)
196 + uint8_t __iomem *f;
201 nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
202 @@ -189,6 +211,34 @@ static void __init nslu2_init(void)
203 (void)platform_device_register(&nslu2_uart);
205 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
209 + * Map in a portion of the flash and read the MAC address.
210 + * Since it is stored in BE in the flash itself, we need to
211 + * byteswap it if we're in LE mode.
213 + f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x40000);
216 + for (i = 0; i < 6; i++)
217 + nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + i);
219 + nslu2_plat_eth[0].hwaddr[0] = readb(f + 0x3FFB0 + 3);
220 + nslu2_plat_eth[0].hwaddr[1] = readb(f + 0x3FFB0 + 2);
221 + nslu2_plat_eth[0].hwaddr[2] = readb(f + 0x3FFB0 + 1);
222 + nslu2_plat_eth[0].hwaddr[3] = readb(f + 0x3FFB0 + 0);
223 + nslu2_plat_eth[0].hwaddr[4] = readb(f + 0x3FFB0 + 7);
224 + nslu2_plat_eth[0].hwaddr[5] = readb(f + 0x3FFB0 + 6);
228 + printk(KERN_INFO "NSLU2: Using MAC address "
229 + "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x for port 0\n",
230 + nslu2_plat_eth[0].hwaddr[0], nslu2_plat_eth[0].hwaddr[1],
231 + nslu2_plat_eth[0].hwaddr[2], nslu2_plat_eth[0].hwaddr[3],
232 + nslu2_plat_eth[0].hwaddr[4], nslu2_plat_eth[0].hwaddr[5]);
236 MACHINE_START(NSLU2, "Linksys NSLU2")