Forgot to commit the config change
[openwrt/svn-archive/archive.git] / target / linux / ixp4xx / patches-2.6.23 / 068-fsg3_fetch_mac.patch
1 Index: linux-2.6.23.12/arch/arm/mach-ixp4xx/fsg-setup.c
2 ===================================================================
3 --- linux-2.6.23.12.orig/arch/arm/mach-ixp4xx/fsg-setup.c 2008-01-05 13:56:28.000000000 +1030
4 +++ linux-2.6.23.12/arch/arm/mach-ixp4xx/fsg-setup.c 2008-01-05 13:56:43.000000000 +1030
5 @@ -21,6 +21,7 @@
6 #include <asm/mach-types.h>
7 #include <asm/mach/arch.h>
8 #include <asm/mach/flash.h>
9 +#include <asm/io.h>
10
11 static struct flash_platform_data fsg_flash_data = {
12 .map_name = "cfi_probe",
13 @@ -140,6 +141,9 @@
14
15 static void __init fsg_init(void)
16 {
17 + uint8_t __iomem *f;
18 + int i;
19 +
20 ixp4xx_sys_init();
21
22 fsg_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
23 @@ -161,6 +165,45 @@
24 (void)platform_device_register(&fsg_uart);
25
26 platform_add_devices(fsg_devices, ARRAY_SIZE(fsg_devices));
27 +
28 +
29 + /*
30 + * Map in a portion of the flash and read the MAC addresses.
31 + * Since it is stored in BE in the flash itself, we need to
32 + * byteswap it if we're in LE mode.
33 + */
34 + if ((f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x400000))) {
35 +#ifdef __ARMEB__
36 + for (i = 0; i < 6; i++) {
37 + fsg_plat_eth[0].hwaddr[i] = readb(f + 0x3C0422 + i);
38 + fsg_plat_eth[1].hwaddr[i] = readb(f + 0x3C043B + i);
39 + }
40 +#else
41 + fsg_plat_eth[0].hwaddr[0] = readb(f + 0x3C0422 + 3);
42 + fsg_plat_eth[0].hwaddr[1] = readb(f + 0x3C0422 + 2);
43 + fsg_plat_eth[0].hwaddr[2] = readb(f + 0x3C0422 + 1);
44 + fsg_plat_eth[0].hwaddr[3] = readb(f + 0x3C0422 + 0);
45 + fsg_plat_eth[0].hwaddr[4] = readb(f + 0x3C0422 + 7);
46 + fsg_plat_eth[0].hwaddr[5] = readb(f + 0x3C0422 + 6);
47 +
48 + fsg_plat_eth[1].hwaddr[0] = readb(f + 0x3C0422 + 3);
49 + fsg_plat_eth[1].hwaddr[1] = readb(f + 0x3C0422 + 2);
50 + fsg_plat_eth[1].hwaddr[2] = readb(f + 0x3C0422 + 1);
51 + fsg_plat_eth[1].hwaddr[3] = readb(f + 0x3C0422 + 0);
52 + fsg_plat_eth[1].hwaddr[4] = readb(f + 0x3C0422 + 7);
53 + fsg_plat_eth[1].hwaddr[5] = readb(f + 0x3C0422 + 6);
54 +#endif
55 + iounmap(f);
56 + }
57 + printk(KERN_INFO "FSG: Using MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x for port 0\n",
58 + fsg_plat_eth[0].hwaddr[0], fsg_plat_eth[0].hwaddr[1],
59 + fsg_plat_eth[0].hwaddr[2], fsg_plat_eth[0].hwaddr[3],
60 + fsg_plat_eth[0].hwaddr[4], fsg_plat_eth[0].hwaddr[5]);
61 + printk(KERN_INFO "FSG: Using MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x for port 1\n",
62 + fsg_plat_eth[1].hwaddr[0], fsg_plat_eth[1].hwaddr[1],
63 + fsg_plat_eth[1].hwaddr[2], fsg_plat_eth[1].hwaddr[3],
64 + fsg_plat_eth[1].hwaddr[4], fsg_plat_eth[1].hwaddr[5]);
65 +
66 }
67
68 MACHINE_START(FSG, "Freecom FSG-3")