fix led driver (closes: #2972)
[openwrt/staging/mkresin.git] / target / linux / ixp4xx / patches-2.6.23 / 062-nas100d_setup_mac.patch
1 diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
2 index d4d8540..b8c99fa 100644
3 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c
4 +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
5 @@ -17,6 +17,7 @@
6 #include <linux/serial_8250.h>
7 #include <linux/leds.h>
8 #include <linux/i2c-gpio.h>
9 +#include <linux/mtd/mtd.h>
10
11 #include <asm/mach-types.h>
12 #include <asm/mach/arch.h>
13 @@ -151,6 +152,30 @@ static struct platform_device *nas100d_devices[] __initdata = {
14 &nas100d_eth[0],
15 };
16
17 +static void nas100d_flash_add(struct mtd_info *mtd)
18 +{
19 + if (strcmp(mtd->name, "RedBoot config") == 0) {
20 + size_t retlen;
21 + u_char mac[6];
22 +
23 + if (mtd->read(mtd, 0x0FD8, 6, &retlen, mac) == 0 && retlen == 6) {
24 + printk(KERN_INFO "nas100d mac: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
25 + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
26 + memcpy(nas100d_plat_eth[0].hwaddr, mac, 6);
27 + } else {
28 + printk(KERN_ERR "nas100d mac: read failed\n");
29 + }
30 + }
31 +}
32 +
33 +static void nas100d_flash_remove(struct mtd_info *mtd) {
34 +}
35 +
36 +static struct mtd_notifier nas100d_flash_notifier = {
37 + .add = nas100d_flash_add,
38 + .remove = nas100d_flash_remove,
39 +};
40 +
41 static void nas100d_power_off(void)
42 {
43 /* This causes the box to drop the power and go dead. */
44 @@ -183,6 +208,8 @@ static void __init nas100d_init(void)
45 (void)platform_device_register(&nas100d_uart);
46
47 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
48 +
49 + register_mtd_user(&nas100d_flash_notifier);
50 }
51
52 MACHINE_START(NAS100D, "Iomega NAS 100d")