ramips: combine led setup for all boards in one file
[openwrt.git] / target / linux / ixp4xx / patches-2.6.38 / 132-wrt300nv2_mac_fix.patch
1 --- a/arch/arm/mach-ixp4xx/wrt300nv2-setup.c
2 +++ b/arch/arm/mach-ixp4xx/wrt300nv2-setup.c
3 @@ -3,6 +3,7 @@
4 *
5 * Board setup for the Linksys WRT300N v2
6 *
7 + * Copyright (C) 2010 Alexandros C. Couloumbis <alex@ozo.com>
8 * Copyright (C) 2007 Imre Kaloz <Kaloz@openwrt.org>
9 *
10 * based on coyote-setup.c:
11 @@ -18,6 +19,7 @@
12 #include <linux/tty.h>
13 #include <linux/serial_8250.h>
14 #include <linux/slab.h>
15 +#include <linux/etherdevice.h>
16
17 #include <asm/types.h>
18 #include <asm/setup.h>
19 @@ -79,7 +81,8 @@ static struct platform_device wrt300nv2_
20 /* Built-in 10/100 Ethernet MAC interfaces */
21 static struct eth_plat_info wrt300nv2_plat_eth[] = {
22 {
23 - .phy = -1,
24 + .phy = IXP4XX_ETH_PHY_MAX_ADDR,
25 + .phy_mask = 0x0F0000,
26 .rxq = 3,
27 .txreadyq = 20,
28 }, {
29 @@ -110,6 +113,10 @@ static struct platform_device *wrt300nv2
30
31 static void __init wrt300nv2_init(void)
32 {
33 + uint8_t __iomem *f;
34 + int offset = 0;
35 + int i;
36 +
37 ixp4xx_sys_init();
38
39 wrt300nv2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
40 @@ -119,6 +126,32 @@ static void __init wrt300nv2_init(void)
41 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
42
43 platform_add_devices(wrt300nv2_devices, ARRAY_SIZE(wrt300nv2_devices));
44 +
45 + f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x60000);
46 +
47 + if (f) {
48 + for (i = 0; i < 6; i++) {
49 +#ifdef __ARMEB__
50 + wrt300nv2_plat_eth[0].hwaddr[i] = readb(f + 0x5FFA0 + i);
51 + if (i == 5)
52 + offset = 1;
53 + wrt300nv2_plat_eth[1].hwaddr[i] = (wrt300nv2_plat_eth[0].hwaddr[i] + offset);
54 +#else
55 + wrt300nv2_plat_eth[0].hwaddr[i] = readb(f + 0x5FFA0 + (i^3));
56 + if (i == 5)
57 + offset = 1;
58 + wrt300nv2_plat_eth[1].hwaddr[i] = (wrt300nv2_plat_eth[0].hwaddr[i] + offset);
59 +#endif
60 + }
61 + iounmap(f);
62 + }
63 +
64 + if (!(is_valid_ether_addr(wrt300nv2_plat_eth[0].hwaddr)))
65 + random_ether_addr(wrt300nv2_plat_eth[0].hwaddr);
66 + if (!(is_valid_ether_addr(wrt300nv2_plat_eth[1].hwaddr))) {
67 + memcpy(wrt300nv2_plat_eth[1].hwaddr, wrt300nv2_plat_eth[0].hwaddr, ETH_ALEN);
68 + wrt300nv2_plat_eth[1].hwaddr[5] = (wrt300nv2_plat_eth[0].hwaddr[5] + 1);
69 + }
70 }
71
72 #ifdef CONFIG_MACH_WRT300NV2
This page took 0.046672 seconds and 5 git commands to generate.