cc891e2482ecd50df2f6bf320a58b8a0355649cb
[openwrt.git] / target / linux / ixp4xx / patches-2.6.33 / 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 @@ -111,6 +114,9 @@ static struct platform_device *wrt300nv2
30 static void __init wrt300nv2_init(void)
31 {
32 ixp4xx_sys_init();
33 + uint8_t __iomem *f;
34 + int offset = 0;
35 + int i;
36
37 wrt300nv2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
38 wrt300nv2_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
39 @@ -119,6 +125,32 @@ static void __init wrt300nv2_init(void)
40 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
41
42 platform_add_devices(wrt300nv2_devices, ARRAY_SIZE(wrt300nv2_devices));
43 +
44 + f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x60000);
45 +
46 + if (f) {
47 + for (i = 0; i < 6; i++) {
48 +#ifdef __ARMEB__
49 + wrt300nv2_plat_eth[0].hwaddr[i] = readb(f + 0x5FFA0 + i);
50 + if (i == 5)
51 + offset = 1;
52 + wrt300nv2_plat_eth[1].hwaddr[i] = (wrt300nv2_plat_eth[0].hwaddr[i] + offset);
53 +#else
54 + wrt300nv2_plat_eth[0].hwaddr[i] = readb(f + 0x5FFA0 + (i^3));
55 + if (i == 5)
56 + offset = 1;
57 + wrt300nv2_plat_eth[1].hwaddr[i] = (wrt300nv2_plat_eth[0].hwaddr[i] + offset);
58 +#endif
59 + }
60 + iounmap(f);
61 + }
62 +
63 + if (!(is_valid_ether_addr(wrt300nv2_plat_eth[0].hwaddr)))
64 + random_ether_addr(wrt300nv2_plat_eth[0].hwaddr);
65 + if (!(is_valid_ether_addr(wrt300nv2_plat_eth[1].hwaddr))) {
66 + memcpy(wrt300nv2_plat_eth[1].hwaddr, wrt300nv2_plat_eth[0].hwaddr, ETH_ALEN);
67 + wrt300nv2_plat_eth[1].hwaddr[5] = (wrt300nv2_plat_eth[0].hwaddr[5] + 1);
68 + }
69 }
70
71 #ifdef CONFIG_MACH_WRT300NV2
This page took 0.044747 seconds and 3 git commands to generate.