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/nas100d-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/nas100d-setup.c')
-rw-r--r-- | arch/arm/mach-ixp4xx/nas100d-setup.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c index 5801579ae959..a432226b2050 100644 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/if_ether.h> | ||
15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
16 | #include <linux/serial.h> | 17 | #include <linux/serial.h> |
17 | #include <linux/serial_8250.h> | 18 | #include <linux/serial_8250.h> |
@@ -22,6 +23,7 @@ | |||
22 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
23 | #include <asm/mach/arch.h> | 24 | #include <asm/mach/arch.h> |
24 | #include <asm/mach/flash.h> | 25 | #include <asm/mach/flash.h> |
26 | #include <asm/io.h> | ||
25 | 27 | ||
26 | static struct flash_platform_data nas100d_flash_data = { | 28 | static struct flash_platform_data nas100d_flash_data = { |
27 | .map_name = "cfi_probe", | 29 | .map_name = "cfi_probe", |
@@ -131,10 +133,28 @@ static struct platform_device nas100d_uart = { | |||
131 | .resource = nas100d_uart_resources, | 133 | .resource = nas100d_uart_resources, |
132 | }; | 134 | }; |
133 | 135 | ||
136 | /* Built-in 10/100 Ethernet MAC interfaces */ | ||
137 | static struct eth_plat_info nas100d_plat_eth[] = { | ||
138 | { | ||
139 | .phy = 0, | ||
140 | .rxq = 3, | ||
141 | .txreadyq = 20, | ||
142 | } | ||
143 | }; | ||
144 | |||
145 | static struct platform_device nas100d_eth[] = { | ||
146 | { | ||
147 | .name = "ixp4xx_eth", | ||
148 | .id = IXP4XX_ETH_NPEB, | ||
149 | .dev.platform_data = nas100d_plat_eth, | ||
150 | } | ||
151 | }; | ||
152 | |||
134 | static struct platform_device *nas100d_devices[] __initdata = { | 153 | static struct platform_device *nas100d_devices[] __initdata = { |
135 | &nas100d_i2c_gpio, | 154 | &nas100d_i2c_gpio, |
136 | &nas100d_flash, | 155 | &nas100d_flash, |
137 | &nas100d_leds, | 156 | &nas100d_leds, |
157 | &nas100d_eth[0], | ||
138 | }; | 158 | }; |
139 | 159 | ||
140 | static void nas100d_power_off(void) | 160 | static void nas100d_power_off(void) |
@@ -150,6 +170,10 @@ static void nas100d_power_off(void) | |||
150 | 170 | ||
151 | static void __init nas100d_init(void) | 171 | static void __init nas100d_init(void) |
152 | { | 172 | { |
173 | DECLARE_MAC_BUF(mac_buf); | ||
174 | uint8_t __iomem *f; | ||
175 | int i; | ||
176 | |||
153 | ixp4xx_sys_init(); | 177 | ixp4xx_sys_init(); |
154 | 178 | ||
155 | /* gpio 14 and 15 are _not_ clocks */ | 179 | /* gpio 14 and 15 are _not_ clocks */ |
@@ -172,6 +196,25 @@ static void __init nas100d_init(void) | |||
172 | (void)platform_device_register(&nas100d_uart); | 196 | (void)platform_device_register(&nas100d_uart); |
173 | 197 | ||
174 | platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices)); | 198 | platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices)); |
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), 0x1000000); | ||
206 | if (f) { | ||
207 | for (i = 0; i < 6; i++) | ||
208 | #ifdef __ARMEB__ | ||
209 | nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + i); | ||
210 | #else | ||
211 | nas100d_plat_eth[0].hwaddr[i] = readb(f + 0xFC0FD8 + (i^3)); | ||
212 | #endif | ||
213 | iounmap(f); | ||
214 | } | ||
215 | printk(KERN_INFO "NAS100D: Using MAC address %s for port 0\n", | ||
216 | print_mac(mac_buf, nas100d_plat_eth[0].hwaddr)); | ||
217 | |||
175 | } | 218 | } |
176 | 219 | ||
177 | MACHINE_START(NAS100D, "Iomega NAS 100d") | 220 | MACHINE_START(NAS100D, "Iomega NAS 100d") |