Combined the nslu2 net driver patches, based on new nslu2-linux patch
[openwrt/staging/yousong.git] / target / linux / ixp4xx / patches-2.6.23 / 031-ixp4xx-net-drivers-nslu2.patch
1 Index: linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nslu2-setup.c
2 ===================================================================
3 --- linux-2.6.23.12-armeb.orig/arch/arm/mach-ixp4xx/nslu2-setup.c 2008-01-08 15:28:13.000000000 +1030
4 +++ linux-2.6.23.12-armeb/arch/arm/mach-ixp4xx/nslu2-setup.c 2008-01-08 15:28:32.000000000 +1030
5 @@ -24,6 +24,7 @@
6 #include <asm/mach/arch.h>
7 #include <asm/mach/flash.h>
8 #include <asm/mach/time.h>
9 +#include <asm/io.h>
10
11 static struct flash_platform_data nslu2_flash_data = {
12 .map_name = "cfi_probe",
13 @@ -140,6 +141,23 @@
14 .resource = nslu2_uart_resources,
15 };
16
17 +/* Built-in 10/100 Ethernet MAC interfaces */
18 +static struct eth_plat_info nslu2_plat_eth[] = {
19 + {
20 + .phy = 1,
21 + .rxq = 3,
22 + .txreadyq = 20,
23 + }
24 +};
25 +
26 +static struct platform_device nslu2_eth[] = {
27 + {
28 + .name = "ixp4xx_eth",
29 + .id = IXP4XX_ETH_NPEB,
30 + .dev.platform_data = nslu2_plat_eth,
31 + }
32 +};
33 +
34 static struct platform_device *nslu2_devices[] __initdata = {
35 &nslu2_i2c_gpio,
36 &nslu2_flash,
37 @@ -147,6 +165,7 @@
38 #ifdef CONFIG_LEDS_IXP4XX
39 &nslu2_leds,
40 #endif
41 + &nslu2_eth[0],
42 };
43
44 static void nslu2_power_off(void)
45 @@ -175,6 +194,9 @@
46
47 static void __init nslu2_init(void)
48 {
49 + uint8_t __iomem *f;
50 + int i;
51 +
52 ixp4xx_sys_init();
53
54 nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
55 @@ -191,6 +213,33 @@
56 (void)platform_device_register(&nslu2_uart);
57
58 platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
59 +
60 +
61 + /*
62 + * Map in a portion of the flash and read the MAC address.
63 + * Since it is stored in BE in the flash itself, we need to
64 + * byteswap it if we're in LE mode.
65 + */
66 + if ((f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x40000))) {
67 +#ifdef __ARMEB__
68 + for (i = 0; i < 6; i++) {
69 + nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + i);
70 + }
71 +#else
72 + nslu2_plat_eth[0].hwaddr[0] = readb(f + 0x3FFB0 + 3);
73 + nslu2_plat_eth[0].hwaddr[1] = readb(f + 0x3FFB0 + 2);
74 + nslu2_plat_eth[0].hwaddr[2] = readb(f + 0x3FFB0 + 1);
75 + nslu2_plat_eth[0].hwaddr[3] = readb(f + 0x3FFB0 + 0);
76 + nslu2_plat_eth[0].hwaddr[4] = readb(f + 0x3FFB0 + 7);
77 + nslu2_plat_eth[0].hwaddr[5] = readb(f + 0x3FFB0 + 6);
78 +#endif
79 + iounmap(f);
80 + }
81 + printk(KERN_INFO "NSLU2: Using MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x for port 0\n",
82 + nslu2_plat_eth[0].hwaddr[0], nslu2_plat_eth[0].hwaddr[1],
83 + nslu2_plat_eth[0].hwaddr[2], nslu2_plat_eth[0].hwaddr[3],
84 + nslu2_plat_eth[0].hwaddr[4], nslu2_plat_eth[0].hwaddr[5]);
85 +
86 }
87
88 MACHINE_START(NSLU2, "Linksys NSLU2")