acx: fix X86 builds
[openwrt.git] / target / linux / ixp4xx / patches / 152-nas100d_mtd_load_mac.patch
1 ---
2 arch/arm/mach-ixp4xx/nas100d-setup.c | 27 +++++++++++++++++++++++++++
3 1 file changed, 27 insertions(+)
4
5 Index: linux-2.6.19/arch/arm/mach-ixp4xx/nas100d-setup.c
6 ===================================================================
7 --- linux-2.6.19.orig/arch/arm/mach-ixp4xx/nas100d-setup.c
8 +++ linux-2.6.19/arch/arm/mach-ixp4xx/nas100d-setup.c
9 @@ -16,6 +16,7 @@
10 #include <linux/serial.h>
11 #include <linux/serial_8250.h>
12 #include <linux/leds.h>
13 +#include <linux/mtd/mtd.h>
14
15 #include <asm/mach-types.h>
16 #include <asm/mach/arch.h>
17 @@ -165,6 +166,30 @@ static struct platform_device *nas100d_d
18 &nas100d_npe_ucode,
19 };
20
21 +static void nas100d_flash_add(struct mtd_info *mtd)
22 +{
23 + if (strcmp(mtd->name, "RedBoot config") == 0) {
24 + size_t retlen;
25 + u_char mac[6];
26 +
27 + if (mtd->read(mtd, 0x0FD8, 6, &retlen, mac) == 0 && retlen == 6) {
28 + printk(KERN_INFO "nas100d mac: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
29 + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
30 + memcpy(plat_mac0.hwaddr, mac, 6);
31 + } else {
32 + printk(KERN_ERR "nas100d mac: read failed\n");
33 + }
34 + }
35 +}
36 +
37 +static void nas100d_flash_remove(struct mtd_info *mtd) {
38 +}
39 +
40 +static struct mtd_notifier nas100d_flash_notifier = {
41 + .add = nas100d_flash_add,
42 + .remove = nas100d_flash_remove,
43 +};
44 +
45 static void nas100d_power_off(void)
46 {
47 /* This causes the box to drop the power and go dead. */
48 @@ -196,6 +221,8 @@ static void __init nas100d_init(void)
49 (void)platform_device_register(&nas100d_uart);
50
51 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
52 +
53 + register_mtd_user(&nas100d_flash_notifier);
54 }
55
56 MACHINE_START(NAS100D, "Iomega NAS 100d")
This page took 0.042874 seconds and 5 git commands to generate.