Renumbered the avila-related patches, since nslu2-linux no longer carries them.
[librecmc/librecmc.git] / target / linux / ixp4xx / patches-2.6.23 / 066-nslu2_fetch_mac.patch
1 Index: linux-2.6.23.11-armeb/arch/arm/mach-ixp4xx/nslu2-setup.c
2 ===================================================================
3 --- linux-2.6.23.11-armeb.orig/arch/arm/mach-ixp4xx/nslu2-setup.c       2007-12-29 01:46:05.000000000 -0600
4 +++ linux-2.6.23.11-armeb/arch/arm/mach-ixp4xx/nslu2-setup.c    2007-12-29 12:21:29.000000000 -0600
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 @@ -193,6 +194,9 @@
14  
15  static void __init nslu2_init(void)
16  {
17 +       uint8_t __iomem *f;
18 +       int i;
19 +
20         ixp4xx_sys_init();
21  
22         nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
23 @@ -209,6 +213,33 @@
24         (void)platform_device_register(&nslu2_uart);
25  
26         platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
27 +
28 +
29 +       /*
30 +        * Map in a portion of the flash and read the MAC address.
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), 0x40000))) {
35 +#ifdef __ARMEB__
36 +               for (i = 0; i < 6; i++) {
37 +                       nslu2_plat_eth[0].hwaddr[i] = readb(f + 0x3FFB0 + i);
38 +               }
39 +#else
40 +               nslu2_plat_eth[0].hwaddr[0] = readb(f + 0x3FFB0 + 3);
41 +               nslu2_plat_eth[0].hwaddr[1] = readb(f + 0x3FFB0 + 2);
42 +               nslu2_plat_eth[0].hwaddr[2] = readb(f + 0x3FFB0 + 1);
43 +               nslu2_plat_eth[0].hwaddr[3] = readb(f + 0x3FFB0 + 0);
44 +               nslu2_plat_eth[0].hwaddr[4] = readb(f + 0x3FFB0 + 7);
45 +               nslu2_plat_eth[0].hwaddr[5] = readb(f + 0x3FFB0 + 6);
46 +#endif
47 +               iounmap(f);
48 +       }
49 +       printk(KERN_INFO "NSLU2: Using MAC address %.2x:%.2x:%.2x:%.2x:%.2x:%.2x for port 0\n",
50 +              nslu2_plat_eth[0].hwaddr[0], nslu2_plat_eth[0].hwaddr[1],
51 +              nslu2_plat_eth[0].hwaddr[2], nslu2_plat_eth[0].hwaddr[3],
52 +              nslu2_plat_eth[0].hwaddr[4], nslu2_plat_eth[0].hwaddr[5]);
53 +
54  }
55  
56  MACHINE_START(NSLU2, "Linksys NSLU2")