diff --git a/target/linux/ixp4xx/patches-2.6.24/296-avila_mac_plat_info.patch b/target/linux/ixp4xx/patches-2.6.24/296-avila_mac_plat_info.patch index e4813fe2c9e..8c142df130a 100644 --- a/target/linux/ixp4xx/patches-2.6.24/296-avila_mac_plat_info.patch +++ b/target/linux/ixp4xx/patches-2.6.24/296-avila_mac_plat_info.patch @@ -1,43 +1,55 @@ -diff --git a/arch/arm/mach-ixp4xx/avila-setup.c b/arch/arm/mach-ixp4xx/avila-setup.c -index e38f45f..10ed5d6 100644 ---- a/arch/arm/mach-ixp4xx/avila-setup.c -+++ b/arch/arm/mach-ixp4xx/avila-setup.c -@@ -132,10 +132,37 @@ static struct platform_device avila_pata = { +Index: linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c +=================================================================== +--- linux-2.6.24.2.orig/arch/arm/mach-ixp4xx/avila-setup.c ++++ linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c +@@ -132,12 +132,42 @@ static struct platform_device avila_pata .resource = avila_pata_resources, }; +/* Built-in 10/100 Ethernet MAC interfaces */ +static struct eth_plat_info avila_plat_eth[] = { -+ { -+ .phy = 0, -+ .rxq = 3, ++ { ++ .phy = 0, ++ .rxq = 3, + .txreadyq = 20, -+ }, { -+ .phy = 1, -+ .rxq = 4, ++ }, { ++ .phy = 1, ++ .rxq = 4, + .txreadyq = 21, + } +}; + +static struct platform_device avila_eth[] = { -+ { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEB, -+ .dev.platform_data = avila_plat_eth, -+ }, { -+ .name = "ixp4xx_eth", -+ .id = IXP4XX_ETH_NPEC, -+ .dev.platform_data = avila_plat_eth + 1, ++ { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEB, ++ .dev.platform_data = avila_plat_eth, ++ }, { ++ .name = "ixp4xx_eth", ++ .id = IXP4XX_ETH_NPEC, ++ .dev.platform_data = avila_plat_eth + 1, + } +}; + static struct platform_device *avila_devices[] __initdata = { &avila_i2c_gpio, &avila_flash, -- &avila_uart -+ &avila_uart, -+ &avila_eth[0], -+ &avila_eth[1], + &avila_uart }; ++static struct platform_device *avila_eth_devices[] = { ++ &avila_eth[0], ++ &avila_eth[1] ++}; ++ static void __init avila_init(void) + { + ixp4xx_sys_init(); +@@ -159,6 +189,7 @@ static void __init avila_init(void) + + platform_device_register(&avila_pata); + ++ platform_add_devices(avila_eth_devices, ARRAY_SIZE(avila_eth_devices)); + } + + MACHINE_START(AVILA, "Gateworks Avila Network Platform") diff --git a/target/linux/ixp4xx/patches-2.6.24/300-avila_fetch_mac.patch b/target/linux/ixp4xx/patches-2.6.24/300-avila_fetch_mac.patch index 2a987588b72..ce0d73042d6 100644 --- a/target/linux/ixp4xx/patches-2.6.24/300-avila_fetch_mac.patch +++ b/target/linux/ixp4xx/patches-2.6.24/300-avila_fetch_mac.patch @@ -1,6 +1,7 @@ -diff -r -u linux-2.6.23.12/arch/arm/mach-ixp4xx/avila-setup.c ../../../../trunk/build_dir/linux-ixp4xx_generic/linux-2.6.23.12/arch/arm/mach-ixp4xx/avila-setup.c ---- linux-2.6.23.12/arch/arm/mach-ixp4xx/avila-setup.c 2008-01-04 01:28:24.134925761 +0100 -+++ ../../../../trunk/build_dir/linux-ixp4xx_generic/linux-2.6.23.12/arch/arm/mach-ixp4xx/avila-setup.c 2008-01-04 01:23:27.874042817 +0100 +Index: linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c +=================================================================== +--- linux-2.6.24.2.orig/arch/arm/mach-ixp4xx/avila-setup.c ++++ linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c @@ -14,10 +14,18 @@ #include #include @@ -20,53 +21,134 @@ diff -r -u linux-2.6.23.12/arch/arm/mach-ixp4xx/avila-setup.c ../../../../trunk/ #include #include -@@ -194,9 +202,48 @@ - t->hdr.size = 0; - } +@@ -177,6 +185,118 @@ static struct platform_device *avila_eth + &avila_eth[1] + }; +#ifdef CONFIG_SENSORS_EEPROM -+static int loft_eeprom_do(struct notifier_block *self, unsigned long event, void *t) ++struct avila_board_info { ++ unsigned char *model; ++ int npes_used; ++ int npeb_phy; ++ int npec_phy; ++}; ++ ++static struct avila_board_info avila_boards[] = { ++ { ++ .model = "GW2342", ++ .npes_used = 2, ++ .npeb_phy = 0, ++ .npec_phy = 1, ++ }, { ++ .model = "GW2345", ++ .npes_used = 2, ++ .npeb_phy = 0, ++ .npec_phy = 1, ++ }, { ++ .model = "GW2347", ++ .npes_used = 1, ++ .npeb_phy = 1, ++ }, { ++ .model = "GW2348-2", ++ .npes_used = 2, ++ .npeb_phy = 0, ++ .npec_phy = 1, ++ }, { ++ .model = "GW2348-4", ++ .npes_used = 2, ++ .npeb_phy = 0, ++ .npec_phy = 1, ++ }, { ++ .model = "GW2353", ++ .npes_used = 1, ++ .npeb_phy = 1, ++ }, { ++ .model = "GW2357", ++ .npes_used = 1, ++ .npeb_phy = 1, ++ } ++}; ++ ++static struct avila_board_info *avila_find_board_info(char *model) +{ -+ struct eeprom_data *data = t; -+ struct sockaddr address; -+ struct net_device * netdev ; ++ int i; + -+ char macs[12]; ++ for (i = 0; i < ARRAY_SIZE(avila_boards); i++) { ++ struct avila_board_info *info = &avila_boards[i]; ++ if (strncmp(info->model, model, strlen(info->model)) == 0) ++ return info; ++ } + -+ /* The MACs are the first 12 bytes in the eeprom at address 0x51 */ -+ if (event == EEPROM_REGISTER && data->client.addr == 0x51) { -+ data->attr->read(&data->client.dev.kobj, data->attr, macs, 0, 12); -+ /*eth0*/ -+ /* using dev_get_by_name here is really ugly and can cause -+ * confusion if other ethernet devices are present. FIXME */ -+ -+ memcpy(address.sa_data, macs, ETH_ALEN); -+ memcpy(&avila_plat_eth[0].hwaddr, macs, ETH_ALEN); -+ if ( (netdev = dev_get_by_name(&init_net, "eth0")) ) -+ netdev->set_mac_address(netdev, &address); -+ -+ /*same for eth1*/ -+ memcpy(address.sa_data, macs + ETH_ALEN, ETH_ALEN); -+ memcpy(&avila_plat_eth[1].hwaddr, macs + ETH_ALEN, ETH_ALEN); -+ if ( (netdev = dev_get_by_name(&init_net, "eth1")) ) -+ netdev->set_mac_address(netdev, &address); -+ } -+ -+ return NOTIFY_DONE; ++ return NULL; +} + -+static struct notifier_block loft_eeprom_notifier = { -+ .notifier_call = loft_eeprom_do ++struct avila_eeprom_header { ++ unsigned char mac0[ETH_ALEN]; ++ unsigned char mac1[ETH_ALEN]; ++ unsigned char res0[4]; ++ unsigned char magic[2]; ++ unsigned char config[14]; ++ unsigned char model[16]; ++}; ++ ++static int avila_eeprom_notify(struct notifier_block *self, ++ unsigned long event, void *t) ++{ ++ struct eeprom_data *ee = t; ++ struct avila_board_info *info = NULL; ++ struct avila_eeprom_header hdr; ++ ++ /* The eeprom is at address 0x51 */ ++ if (event != EEPROM_REGISTER || ee->client.addr != 0x51) ++ return NOTIFY_DONE; ++ ++ ee->attr->read(&ee->client.dev.kobj, ee->attr, (char *)&hdr, ++ 0, sizeof(hdr)); ++ ++ if (hdr.magic[0] != 'G' || hdr.magic[1] != 'W') ++ return NOTIFY_DONE; ++ ++ memcpy(&avila_plat_eth[0].hwaddr, hdr.mac0, ETH_ALEN); ++ memcpy(&avila_plat_eth[1].hwaddr, hdr.mac1, ETH_ALEN); ++ ++ info = avila_find_board_info(hdr.model); ++ ++ if (info) { ++ printk(KERN_DEBUG "Running on Gateworks Avila %s\n", ++ info->model); ++ avila_plat_eth[0].phy = info->npeb_phy; ++ avila_plat_eth[1].phy = info->npec_phy; ++ platform_add_devices(avila_eth_devices, ++ info->npes_used); ++ } else { ++ printk(KERN_INFO "Unknown/missing Avila model number" ++ " -- defaults will be used\n"); ++ platform_add_devices(avila_eth_devices, ++ ARRAY_SIZE(avila_eth_devices)); ++ } ++ ++ unregister_eeprom_notifier(self); ++ ++ return NOTIFY_OK; ++} ++ ++static struct notifier_block avila_eeprom_notifier = { ++ .notifier_call = avila_eeprom_notify +}; +#endif + static void __init avila_init(void) { ixp4xx_sys_init(); -+#ifdef CONFIG_SENSORS_EEPROM -+ register_eeprom_notifier(&loft_eeprom_notifier); -+#endif +@@ -201,7 +321,11 @@ static void __init avila_init(void) - avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); - avila_flash_resource.end = - + platform_device_register(&avila_pata); + ++#ifdef CONFIG_SENSORS_EEPROM ++ register_eeprom_notifier(&avila_eeprom_notifier); ++#else + platform_add_devices(avila_eth_devices, ARRAY_SIZE(avila_eth_devices)); ++#endif + } + + MACHINE_START(AVILA, "Gateworks Avila Network Platform") diff --git a/target/linux/ixp4xx/patches-2.6.24/301-avila_led.patch b/target/linux/ixp4xx/patches-2.6.24/301-avila_led.patch index b82ed7df572..181d6baad88 100644 --- a/target/linux/ixp4xx/patches-2.6.24/301-avila_led.patch +++ b/target/linux/ixp4xx/patches-2.6.24/301-avila_led.patch @@ -1,8 +1,19 @@ -Index: linux-2.6.23.14/arch/arm/mach-ixp4xx/avila-setup.c +Index: linux-2.6.24.2/include/asm-arm/arch-ixp4xx/avila.h =================================================================== ---- linux-2.6.23.14.orig/arch/arm/mach-ixp4xx/avila-setup.c 2008-01-25 18:26:06.000000000 +0100 -+++ linux-2.6.23.14/arch/arm/mach-ixp4xx/avila-setup.c 2008-01-25 18:44:02.000000000 +0100 -@@ -165,12 +165,34 @@ +--- linux-2.6.24.2.orig/include/asm-arm/arch-ixp4xx/avila.h ++++ linux-2.6.24.2/include/asm-arm/arch-ixp4xx/avila.h +@@ -36,4 +36,5 @@ + #define AVILA_PCI_INTC_PIN 9 + #define AVILA_PCI_INTD_PIN 8 + +- ++/* User LED */ ++#define AVILA_LED_USER_GPIO 3 +Index: linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c +=================================================================== +--- linux-2.6.24.2.orig/arch/arm/mach-ixp4xx/avila-setup.c ++++ linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c +@@ -174,10 +174,31 @@ static struct platform_device avila_eth[ } }; @@ -17,34 +28,21 @@ Index: linux-2.6.23.14/arch/arm/mach-ixp4xx/avila-setup.c +}; + +static struct platform_device avila_leds = { -+ .name = "IXP4XX-GPIO-LED", -+ .id = -1, ++ .name = "IXP4XX-GPIO-LED", ++ .id = -1, + .num_resources = ARRAY_SIZE(avila_led_resources), -+ .resource = avila_led_resources, ++ .resource = avila_led_resources, +}; +#endif -+ + static struct platform_device *avila_devices[] __initdata = { &avila_i2c_gpio, &avila_flash, - &avila_uart, - &avila_eth[0], - &avila_eth[1], +- &avila_uart ++ &avila_uart, +#ifdef CONFIG_LEDS_IXP4XX + &avila_leds, +#endif }; - static char avila_rtc_probe[] __initdata = "rtc-ds1672.probe=0,0x68 "; -Index: linux-2.6.23.14/include/asm-arm/arch-ixp4xx/avila.h -=================================================================== ---- linux-2.6.23.14.orig/include/asm-arm/arch-ixp4xx/avila.h 2008-01-25 18:26:02.000000000 +0100 -+++ linux-2.6.23.14/include/asm-arm/arch-ixp4xx/avila.h 2008-01-25 18:26:06.000000000 +0100 -@@ -36,4 +36,5 @@ - #define AVILA_PCI_INTC_PIN 9 - #define AVILA_PCI_INTD_PIN 8 - -- -+/* User LED */ -+#define AVILA_LED_USER_GPIO 3 + static struct platform_device *avila_eth_devices[] = { diff --git a/target/linux/ixp4xx/patches-2.6.24/302-gpio_device.patch b/target/linux/ixp4xx/patches-2.6.24/302-gpio_device.patch index 0a1831b4fcf..faa08beeabc 100644 --- a/target/linux/ixp4xx/patches-2.6.24/302-gpio_device.patch +++ b/target/linux/ixp4xx/patches-2.6.24/302-gpio_device.patch @@ -1,8 +1,8 @@ -Index: linux-2.6.23.14/arch/arm/mach-ixp4xx/avila-setup.c +Index: linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c =================================================================== ---- linux-2.6.23.14.orig/arch/arm/mach-ixp4xx/avila-setup.c 2008-01-26 02:59:30.000000000 +0100 -+++ linux-2.6.23.14/arch/arm/mach-ixp4xx/avila-setup.c 2008-01-26 03:03:07.000000000 +0100 -@@ -183,6 +183,23 @@ +--- linux-2.6.24.2.orig/arch/arm/mach-ixp4xx/avila-setup.c ++++ linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c +@@ -192,6 +192,24 @@ static struct platform_device avila_leds }; #endif @@ -17,16 +17,17 @@ Index: linux-2.6.23.14/arch/arm/mach-ixp4xx/avila-setup.c +}; + +static struct platform_device avila_gpio = { -+ .name = "GPIODEV", -+ .id = -1, ++ .name = "GPIODEV", ++ .id = -1, + .num_resources = ARRAY_SIZE(avila_gpio_resources), -+ .resource = avila_gpio_resources, ++ .resource = avila_gpio_resources, +}; +#endif - ++ static struct platform_device *avila_devices[] __initdata = { &avila_i2c_gpio, -@@ -193,6 +210,9 @@ + &avila_flash, +@@ -199,6 +217,9 @@ static struct platform_device *avila_dev #ifdef CONFIG_LEDS_IXP4XX &avila_leds, #endif @@ -35,11 +36,11 @@ Index: linux-2.6.23.14/arch/arm/mach-ixp4xx/avila-setup.c +#endif }; - static char avila_rtc_probe[] __initdata = "rtc-ds1672.probe=0,0x68 "; -Index: linux-2.6.23.14/include/asm-arm/arch-ixp4xx/avila.h + static struct platform_device *avila_eth_devices[] = { +Index: linux-2.6.24.2/include/asm-arm/arch-ixp4xx/avila.h =================================================================== ---- linux-2.6.23.14.orig/include/asm-arm/arch-ixp4xx/avila.h 2008-01-26 03:03:27.000000000 +0100 -+++ linux-2.6.23.14/include/asm-arm/arch-ixp4xx/avila.h 2008-01-26 03:07:02.000000000 +0100 +--- linux-2.6.24.2.orig/include/asm-arm/arch-ixp4xx/avila.h ++++ linux-2.6.24.2/include/asm-arm/arch-ixp4xx/avila.h @@ -38,3 +38,6 @@ /* User LED */