diff options
Diffstat (limited to 'packages/linux/ixp4xx-kernel/2.6.15/93-loft-maclist.patch')
-rw-r--r-- | packages/linux/ixp4xx-kernel/2.6.15/93-loft-maclist.patch | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/packages/linux/ixp4xx-kernel/2.6.15/93-loft-maclist.patch b/packages/linux/ixp4xx-kernel/2.6.15/93-loft-maclist.patch new file mode 100644 index 0000000000..ffda1136ef --- /dev/null +++ b/packages/linux/ixp4xx-kernel/2.6.15/93-loft-maclist.patch @@ -0,0 +1,96 @@ +add loft support for setting the maclist from EEPROM + +Signed-off-by: John Bowler <jbowler@acm.org> + +--- linux-2.6.15/arch/arm/mach-ixp4xx/ixdp425-setup.c 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.15/arch/arm/mach-ixp4xx/ixdp425-setup.c 1970-01-01 00:00:00.000000000 +0000 +@@ -14,6 +14,7 @@ + #include <linux/serial.h> + #include <linux/tty.h> + #include <linux/serial_8250.h> ++#include <linux/eeprom.h> + + #include <asm/types.h> + #include <asm/setup.h> +@@ -24,6 +25,8 @@ + #include <asm/mach/arch.h> + #include <asm/mach/flash.h> + ++#include <net/maclist.h> ++ + static struct flash_platform_data ixdp425_flash_data = { + .map_name = "cfi_probe", + .width = 2, +@@ -188,9 +191,62 @@ MACHINE_END + /* + * Loft is functionally equivalent to Avila except that it has a + * different number for the maximum PCI devices. The MACHINE +- * structure below is identical to Avila except for the comment. ++ * structure below is identical to Avila except for the and ++ * the use of a loft specific init. ++ * ++ * The loft init registers a notifier on the on-board EEPROM to ++ * detect the MAC addresses. ++ * NOTE: this probably works for all Gateworks Avila boards and ++ * maybe the ixdp425 too. + */ + #ifdef CONFIG_MACH_LOFT ++/* ++ * When the EEPROM is added the MAC address are read from it. ++ */ ++static void loft_eeprom_add(int address, int kind, struct kobject *kobj, ++ struct bin_attribute *eeprom_attr) { ++ /* The MACs are the first 12 bytes in the eeprom at address 0x51 */ ++ if (address == 0x51) { ++ ssize_t retlen; ++ char data[12]; ++ ++ /* Two Macs, one at 0, the other at 6, maclist_add will ++ * complain if the ID is not a valid MAC. ++ */ ++ retlen = eeprom_attr->read(kobj, data, 0, sizeof data); ++ if (retlen >= 6) { ++ u8 mac[6]; ++ memcpy(mac, data+0, sizeof mac); ++ printk(KERN_INFO "LOFT MAC[0]: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", ++ mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); ++ maclist_add(mac); ++ } ++ if (retlen >= 12) { ++ u8 mac[6]; ++ memcpy(mac, data+6, sizeof mac); ++ printk(KERN_INFO "LOFT MAC[1]: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", ++ mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); ++ maclist_add(mac); ++ } ++ } ++} ++ ++static struct eeprom_notifier loft_eeprom_notifier = { ++ .add = loft_eeprom_add ++}; ++ ++static void __init loft_init(void) ++{ ++ /* The EEPROM has two ethernet MACs embedded in it which we need, ++ * that is all this notifier does. ++ */ ++ register_eeprom_user(&loft_eeprom_notifier); ++ ++ ixp4xx_sys_init(); ++ ++ platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices)); ++} ++ + MACHINE_START(LOFT, "Giant Shoulder Inc Loft board") + /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */ + .phys_ram = PHYS_OFFSET, +@@ -200,7 +256,7 @@ MACHINE_START(LOFT, "Giant Shoulder Inc + .init_irq = ixp4xx_init_irq, + .timer = &ixp4xx_timer, + .boot_params = 0x0100, +- .init_machine = ixdp425_init, ++ .init_machine = loft_init, + MACHINE_END + #endif + |