strip the kernel version suffix from target directories, except for brcm-2.4 (the...
[15.05/openwrt.git] / target / linux / ixp4xx / patches / 212-gateway_7001_mtd_microcode.patch
1 --- linux-2.6.21.5/arch/arm/mach-ixp4xx/gateway7001-setup.c.orig        2007-06-19 18:03:37.202848276 +0100
2 +++ linux-2.6.21.5/arch/arm/mach-ixp4xx/gateway7001-setup.c     2007-06-19 18:09:04.152969985 +0100
3 @@ -16,6 +16,7 @@
4  #include <linux/device.h>
5  #include <linux/serial.h>
6  #include <linux/tty.h>
7 +#include <linux/mtd/mtd.h>
8  #include <linux/serial_8250.h>
9  #include <linux/slab.h>
10  
11 @@ -122,11 +123,48 @@
12         .resource       = &res_mac1,
13  };
14  
15 +struct npe_ucode_platform_data gateway7001_npe_ucode_data = {
16 +       .mtd_partition  = "microcode",
17 +};
18 +
19 +static struct platform_device gateway7001_npe_ucode = {
20 +       .name                   = "ixp4xx_npe_ucode",
21 +       .id                     = 0,
22 +       .dev.platform_data      = &gateway7001_npe_ucode_data,
23 +};
24 +
25  static struct platform_device *gateway7001_devices[] __initdata = {
26         &gateway7001_flash,
27         &gateway7001_uart,
28         &mac0,
29         &mac1,
30 +       &gateway7001_npe_ucode,
31 +};
32 +
33 +static void gateway7001_flash_add(struct mtd_info *mtd) 
34 +{
35 +       if (strcmp(mtd->name, "RedBoot config") == 0) {
36 +               size_t retlen;
37 +               u_char mac0[6], mac1[6];
38 +                       if (mtd->read(mtd, 0x0422, 6, &retlen, mac0) == 0 && retlen == 6) {
39 +                               printk(KERN_INFO "gateway 7001 mac0: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
40 +                                       mac0[0], mac0[1], mac0[2], mac0[3], mac0[4], mac0[5]);
41 +                               memcpy(plat_mac0.hwaddr, mac0, 6);
42 +                       }
43 +                       if (mtd->read(mtd, 0x043B, 6, &retlen, mac1) == 0 && retlen == 6) {
44 +                               printk(KERN_INFO "gateway 7001 mac1: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
45 +                                       mac1[0], mac1[1], mac1[2], mac1[3], mac1[4], mac1[5]);
46 +                               memcpy(plat_mac1.hwaddr, mac1, 6);
47 +               }
48 +       }
49 +}
50 +
51 +static void gateway7001_flash_remove(struct mtd_info *mtd) {
52 +}
53 +
54 +static struct mtd_notifier gateway7001_flash_notifier = {
55 +       .add = gateway7001_flash_add,
56 +       .remove = gateway7001_flash_remove,
57  };
58  
59  static void __init gateway7001_init(void)
60 @@ -140,6 +178,7 @@
61         *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
62  
63         platform_add_devices(gateway7001_devices, ARRAY_SIZE(gateway7001_devices));
64 +       register_mtd_user(&gateway7001_flash_notifier);
65  }
66  
67  #ifdef CONFIG_MACH_GATEWAY7001