Updated to 2.6.26 for stable and 2.6.27 for development
[nslu2-linux/kernel.git] / patches / 2.6.19 / 52-nas100d-mtd-load-mac.patch
blob4a81d8063718549d51ca0da9dac00f45c9a1e40d
1 Index: linux-2.6.19/arch/arm/mach-ixp4xx/nas100d-setup.c
2 ===================================================================
3 --- linux-2.6.19.orig/arch/arm/mach-ixp4xx/nas100d-setup.c 2007-01-23 03:11:34.000000000 -0800
4 +++ linux-2.6.19/arch/arm/mach-ixp4xx/nas100d-setup.c 2007-01-23 03:11:43.000000000 -0800
5 @@ -16,6 +16,7 @@
6 #include <linux/serial.h>
7 #include <linux/serial_8250.h>
8 #include <linux/leds.h>
9 +#include <linux/mtd/mtd.h>
11 #include <asm/mach-types.h>
12 #include <asm/mach/arch.h>
13 @@ -166,6 +167,30 @@
14 &nas100d_npe_ucode,
17 +static void nas100d_flash_add(struct mtd_info *mtd)
19 + if (strcmp(mtd->name, "RedBoot config") == 0) {
20 + size_t retlen;
21 + u_char mac[6];
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(plat_mac0.hwaddr, mac, 6);
27 + } else {
28 + printk(KERN_ERR "nas100d mac: read failed\n");
29 + }
30 + }
33 +static void nas100d_flash_remove(struct mtd_info *mtd) {
36 +static struct mtd_notifier nas100d_flash_notifier = {
37 + .add = nas100d_flash_add,
38 + .remove = nas100d_flash_remove,
39 +};
41 static void nas100d_power_off(void)
43 /* This causes the box to drop the power and go dead. */
44 @@ -197,6 +222,8 @@
45 (void)platform_device_register(&nas100d_uart);
47 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
49 + register_mtd_user(&nas100d_flash_notifier);
52 MACHINE_START(NAS100D, "Iomega NAS 100d")