generate package for the new IXP4xx crpyto driver
[10.03/openwrt.git] / target / linux / ixp4xx / patches / 740-avila_loft_mac_platform.patch
1 Index: linux-2.6.21.7/arch/arm/mach-ixp4xx/avila-setup.c
2 ===================================================================
3 --- linux-2.6.21.7.orig/arch/arm/mach-ixp4xx/avila-setup.c
4 +++ linux-2.6.21.7/arch/arm/mach-ixp4xx/avila-setup.c
5 @@ -18,6 +18,10 @@
6  #include <linux/tty.h>
7  #include <linux/serial_8250.h>
8  #include <linux/slab.h>
9 +#ifdef CONFIG_SENSORS_EEPROM
10 +#include <linux/i2c.h>
11 +#include <linux/eeprom.h>
12 +#endif
13  
14  #include <asm/types.h>
15  #include <asm/setup.h>
16 @@ -188,9 +192,34 @@ static struct platform_device *avila_dev
17  
18  };
19  
20 +#ifdef CONFIG_SENSORS_EEPROM
21 +static int loft_eeprom_do(struct notifier_block *self, unsigned long event, void *t)
22 +{
23 +       struct eeprom_data *data = t;
24 +
25 +       char macs[12];
26 +
27 +       /* The MACs are the first 12 bytes in the eeprom at address 0x51 */
28 +       if (event == EEPROM_REGISTER && data->client.addr == 0x51) {
29 +               data->attr->read(&data->client.dev.kobj, macs, 0, 12);
30 +               memcpy(&plat_mac0.hwaddr, macs, 6);
31 +               memcpy(&plat_mac1.hwaddr, macs + 6, 6);
32 +       }
33 +
34 +       return NOTIFY_DONE;
35 +}
36 +
37 +static struct notifier_block loft_eeprom_notifier = {
38 +       .notifier_call = loft_eeprom_do
39 +};
40 +#endif
41 +
42  static void __init avila_init(void)
43  {
44         ixp4xx_sys_init();
45 +#ifdef CONFIG_SENSORS_EEPROM
46 +       register_eeprom_notifier(&loft_eeprom_notifier);
47 +#endif
48  
49         avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
50         avila_flash_resource.end =