diff options
author | Rod Whitby <rod@whitby.id.au> | 2008-02-01 18:04:05 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-02-04 08:15:26 -0500 |
commit | b7edc84a9619eb2c8bfb5265d4079da9c70ad270 (patch) | |
tree | cacd9ffa7a99d6d75ce42f0b6edcd84c90fdf9e2 /arch/arm/mach-ixp4xx/nslu2-setup.c | |
parent | 1208ebf25b654a48f075c191de1d6410af7062b0 (diff) |
[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>
Diffstat (limited to 'arch/arm/mach-ixp4xx/nslu2-setup.c')
-rw-r--r-- | arch/arm/mach-ixp4xx/nslu2-setup.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c index 41d55c84164a..fd9ec17c8b86 100644 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * Changed to conform to new style __init ixdp425 kas11 10/22/04 | 14 | * Changed to conform to new style __init ixdp425 kas11 10/22/04 |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/if_ether.h> | ||
17 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
18 | #include <linux/serial.h> | 19 | #include <linux/serial.h> |
19 | #include <linux/serial_8250.h> | 20 | #include <linux/serial_8250.h> |
@@ -25,6 +26,7 @@ | |||
25 | #include <asm/mach/arch.h> | 26 | #include <asm/mach/arch.h> |
26 | #include <asm/mach/flash.h> | 27 | #include <asm/mach/flash.h> |
27 | #include <asm/mach/time.h> | 28 | #include <asm/mach/time.h> |
29 | #include <asm/io.h> | ||
28 | 30 | ||
29 | static struct flash_platform_data nslu2_flash_data = { | 31 | static struct flash_platform_data nslu2_flash_data = { |
30 | .map_name = "cfi_probe", | 32 | .map_name = "cfi_probe", |
@@ -143,11 +145,29 @@ static struct platform_device nslu2_uart = { | |||
143 | .resource = nslu2_uart_resources, | 145 | .resource = nslu2_uart_resources, |
144 | }; | 146 | }; |
145 | 147 | ||
148 | /* Built-in 10/100 Ethernet MAC interfaces */ | ||
149 | static struct eth_plat_info nslu2_plat_eth[] = { | ||
150 | { | ||
151 | .phy = 1, | ||
152 | .rxq = 3, | ||
153 | .txreadyq = 20, | ||
154 | } | ||
155 | }; | ||
156 | |||
157 | static struct platform_device nslu2_eth[] = { | ||
158 | { | ||
159 | .name = "ixp4xx_eth", | ||
160 | .id = IXP4XX_ETH_NPEB, | ||
161 | .dev.platform_data = nslu2_plat_eth, | ||
162 | } | ||
163 | }; | ||
164 | |||
146 | static struct platform_device *nslu2_devices[] __initdata = { | 165 | static struct platform_device *nslu2_devices[] __initdata = { |
147 | &nslu2_i2c_gpio, | 166 | &nslu2_i2c_gpio, |
148 | &nslu2_flash, | 167 | &nslu2_flash, |
149 | &nslu2_beeper, | 168 | &nslu2_beeper, |
150 | &nslu2_leds, | 169 | &nslu2_leds, |
170 | &nslu2_eth[0], | ||
151 | }; | 171 | }; |
152 | 172 | ||
153 | static void nslu2_power_off(void) | 173 | static void nslu2_power_off(void) |
@@ -176,6 +196,10 @@ static struct sys_timer nslu2_timer = { | |||
176 | 196 | ||
177 | static void __init nslu2_init(void) | 197 | static void __init nslu2_init(void) |
178 | { | 198 | { |
199 | DECLARE_MAC_BUF(mac_buf); | ||
200 | uint8_t __iomem *f; | ||
201 | int i; | ||
202 | |||
179 | ixp4xx_sys_init(); | 203 | ixp4xx_sys_init(); |
180 | 204 | ||
181 | nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); | 205 | nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); |
@@ -195,6 +219,26 @@ static void __init nslu2_init(void) | |||
195 | (void)platform_device_register(&nslu2_uart); | 219 | (void)platform_device_register(&nslu2_uart); |
196 | 220 | ||
197 | platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices)); | 221 | platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices)); |
222 | |||
223 | |||
224 | /* | ||
225 | * Map in a portion of the flash and read the MAC address. | ||
226 | * Since it is stored in BE in the flash itself, we need to | ||
227 | * byteswap it if we're in LE mode. | ||
228 | */ | ||
229 | f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x40000); | ||
230 | if (f) { | ||
231 | for (i = 0; i < 6; i++) | ||
232 | #ifdef __ARMEB__ | ||
233 | nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + i); | ||
234 | #else | ||
235 | nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + (i^3)); | ||
236 | #endif | ||
237 | iounmap(f); | ||
238 | } | ||
239 | printk(KERN_INFO "NSLU2: Using MAC address %s for port 0\n", | ||
240 | print_mac(mac_buf, nslu2_plat_eth[0].hwaddr)); | ||
241 | |||
198 | } | 242 | } |
199 | 243 | ||
200 | MACHINE_START(NSLU2, "Linksys NSLU2") | 244 | MACHINE_START(NSLU2, "Linksys NSLU2") |