aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ixp4xx
diff options
context:
space:
mode:
authorRod Whitby <rod@whitby.id.au>2008-02-01 18:04:05 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-02-04 08:15:26 -0500
commitb7edc84a9619eb2c8bfb5265d4079da9c70ad270 (patch)
treecacd9ffa7a99d6d75ce42f0b6edcd84c90fdf9e2 /arch/arm/mach-ixp4xx
parent1208ebf25b654a48f075c191de1d6410af7062b0 (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')
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c43
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c44
2 files changed, 87 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
26static struct flash_platform_data nas100d_flash_data = { 28static 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 */
137static struct eth_plat_info nas100d_plat_eth[] = {
138 {
139 .phy = 0,
140 .rxq = 3,
141 .txreadyq = 20,
142 }
143};
144
145static 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
134static struct platform_device *nas100d_devices[] __initdata = { 153static 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
140static void nas100d_power_off(void) 160static void nas100d_power_off(void)
@@ -150,6 +170,10 @@ static void nas100d_power_off(void)
150 170
151static void __init nas100d_init(void) 171static 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
177MACHINE_START(NAS100D, "Iomega NAS 100d") 220MACHINE_START(NAS100D, "Iomega NAS 100d")
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
29static struct flash_platform_data nslu2_flash_data = { 31static 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 */
149static struct eth_plat_info nslu2_plat_eth[] = {
150 {
151 .phy = 1,
152 .rxq = 3,
153 .txreadyq = 20,
154 }
155};
156
157static 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
146static struct platform_device *nslu2_devices[] __initdata = { 165static 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
153static void nslu2_power_off(void) 173static void nslu2_power_off(void)
@@ -176,6 +196,10 @@ static struct sys_timer nslu2_timer = {
176 196
177static void __init nslu2_init(void) 197static 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
200MACHINE_START(NSLU2, "Linksys NSLU2") 244MACHINE_START(NSLU2, "Linksys NSLU2")