1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-08-21 13:02:24 +03:00

[ixp4xx] update Avila patches

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10968 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2008-04-28 18:46:05 +00:00
parent cf0c1284db
commit ea77fa9c7d
6 changed files with 343 additions and 162 deletions

View File

@ -2,54 +2,44 @@ 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.orig/arch/arm/mach-ixp4xx/avila-setup.c
+++ linux-2.6.24.2/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 @@ -132,6 +132,31 @@ static struct platform_device avila_pata
.resource = avila_pata_resources, .resource = avila_pata_resources,
}; };
+/* Built-in 10/100 Ethernet MAC interfaces */ +/* Built-in 10/100 Ethernet MAC interfaces */
+static struct eth_plat_info avila_plat_eth[] = { +static struct eth_plat_info avila_npeb_data = {
+ { + .phy = 0,
+ .phy = 0, + .rxq = 3,
+ .rxq = 3, + .txreadyq = 20,
+ .txreadyq = 20,
+ }, {
+ .phy = 1,
+ .rxq = 4,
+ .txreadyq = 21,
+ }
+}; +};
+ +
+static struct platform_device avila_eth[] = { +static struct eth_plat_info avila_npec_data = {
+ { + .phy = 1,
+ .name = "ixp4xx_eth", + .rxq = 4,
+ .id = IXP4XX_ETH_NPEB, + .txreadyq = 21,
+ .dev.platform_data = avila_plat_eth, +};
+ }, { +
+ .name = "ixp4xx_eth", +static struct platform_device avila_npeb_device = {
+ .id = IXP4XX_ETH_NPEC, + .name = "ixp4xx_eth",
+ .dev.platform_data = avila_plat_eth + 1, + .id = IXP4XX_ETH_NPEB,
+ } + .dev.platform_data = &avila_npeb_data,
+};
+
+static struct platform_device avila_npec_device = {
+ .name = "ixp4xx_eth",
+ .id = IXP4XX_ETH_NPEC,
+ .dev.platform_data = &avila_npec_data,
+}; +};
+ +
static struct platform_device *avila_devices[] __initdata = { static struct platform_device *avila_devices[] __initdata = {
&avila_i2c_gpio, &avila_i2c_gpio,
&avila_flash, &avila_flash,
&avila_uart @@ -159,6 +184,8 @@ static void __init avila_init(void)
};
+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_device_register(&avila_pata);
+ platform_add_devices(avila_eth_devices, ARRAY_SIZE(avila_eth_devices)); + platform_device_register(avila_npeb_device);
+ platform_device_register(avila_npec_device);
} }
MACHINE_START(AVILA, "Gateworks Avila Network Platform") MACHINE_START(AVILA, "Gateworks Avila Network Platform")

View File

@ -1,43 +1,44 @@
diff -uprN linux-2.6.23.orig/arch/arm/mach-ixp4xx/avila-setup.c linux-2.6.23/arch/arm/mach-ixp4xx/avila-setup.c Index: linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c
--- linux-2.6.23.orig/arch/arm/mach-ixp4xx/avila-setup.c 2007-10-09 15:31:38.000000000 -0500 ===================================================================
+++ linux-2.6.23/arch/arm/mach-ixp4xx/avila-setup.c 2007-10-11 01:08:21.000000000 -0500 --- linux-2.6.24.2.orig/arch/arm/mach-ixp4xx/avila-setup.c
@@ -138,6 +138,35 @@ static struct platform_device *avila_dev +++ linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c
@@ -163,6 +163,35 @@ static struct platform_device *avila_dev
&avila_uart &avila_uart
}; };
+static char avila_rtc_probe[] __initdata = "rtc-ds1672.probe=0,0x68 "; +static char avila_rtc_probe[] __initdata = "rtc-ds1672.probe=0,0x68 ";
+ +
+static void __init avila_fixup(struct machine_desc *desc, +static void __init avila_fixup(struct machine_desc *desc,
+ struct tag *tags, char **cmdline, struct meminfo *mi) + struct tag *tags, char **cmdline, struct meminfo *mi)
+{ +{
+ struct tag *t = tags; + struct tag *t = tags;
+ char *p = *cmdline; + char *p = *cmdline;
+ +
+ /* Find the end of the tags table, taking note of any cmdline tag. */ + /* Find the end of the tags table, taking note of any cmdline tag. */
+ for (; t->hdr.size; t = tag_next(t)) { + for (; t->hdr.size; t = tag_next(t)) {
+ if (t->hdr.tag == ATAG_CMDLINE) { + if (t->hdr.tag == ATAG_CMDLINE) {
+ p = t->u.cmdline.cmdline; + p = t->u.cmdline.cmdline;
+ } + }
+ } + }
+ +
+ /* Overwrite the end of the table with a new cmdline tag. */ + /* Overwrite the end of the table with a new cmdline tag. */
+ t->hdr.tag = ATAG_CMDLINE; + t->hdr.tag = ATAG_CMDLINE;
+ t->hdr.size = (sizeof (struct tag_header) + + t->hdr.size = (sizeof (struct tag_header) +
+ strlen(avila_rtc_probe) + strlen(p) + 1 + 4) >> 2; + strlen(avila_rtc_probe) + strlen(p) + 1 + 4) >> 2;
+ strlcpy(t->u.cmdline.cmdline, avila_rtc_probe, COMMAND_LINE_SIZE); + strlcpy(t->u.cmdline.cmdline, avila_rtc_probe, COMMAND_LINE_SIZE);
+ strlcpy(t->u.cmdline.cmdline + strlen(avila_rtc_probe), p, + strlcpy(t->u.cmdline.cmdline + strlen(avila_rtc_probe), p,
+ COMMAND_LINE_SIZE - strlen(avila_rtc_probe)); + COMMAND_LINE_SIZE - strlen(avila_rtc_probe));
+ +
+ /* Terminate the table. */ + /* Terminate the table. */
+ t = tag_next(t); + t = tag_next(t);
+ t->hdr.tag = ATAG_NONE; + t->hdr.tag = ATAG_NONE;
+ t->hdr.size = 0; + t->hdr.size = 0;
+} +}
+ +
static void __init avila_init(void) static void __init avila_init(void)
{ {
ixp4xx_sys_init(); ixp4xx_sys_init();
@@ -165,6 +194,7 @@ MACHINE_START(AVILA, "Gateworks Avila Ne @@ -192,6 +221,7 @@ MACHINE_START(AVILA, "Gateworks Avila Ne
/* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
.phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
.io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
@ -45,7 +46,7 @@ diff -uprN linux-2.6.23.orig/arch/arm/mach-ixp4xx/avila-setup.c linux-2.6.23/arc
.map_io = ixp4xx_map_io, .map_io = ixp4xx_map_io,
.init_irq = ixp4xx_init_irq, .init_irq = ixp4xx_init_irq,
.timer = &ixp4xx_timer, .timer = &ixp4xx_timer,
@@ -182,6 +212,7 @@ MACHINE_START(LOFT, "Giant Shoulder Inc @@ -209,6 +239,7 @@ MACHINE_START(LOFT, "Giant Shoulder Inc
/* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */ /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */
.phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
.io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,

View File

@ -21,55 +21,104 @@ Index: linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
#include <asm/types.h> #include <asm/types.h>
@@ -177,6 +185,118 @@ static struct platform_device *avila_eth @@ -29,6 +37,13 @@
&avila_eth[1] #include <asm/mach/arch.h>
}; #include <asm/mach/flash.h>
+#ifdef CONFIG_SENSORS_EEPROM
+struct avila_board_info { +struct avila_board_info {
+ unsigned char *model; + unsigned char *model;
+ int npes_used; + void (* setup)(void);
+ int npeb_phy;
+ int npec_phy;
+}; +};
+ +
+static struct avila_board_info avila_boards[] = { +static struct avila_board_info *avila_info __initdata;
+
static struct flash_platform_data avila_flash_data = {
.map_name = "cfi_probe",
.width = 2,
@@ -192,10 +207,160 @@ static void __init avila_fixup(struct ma
t->hdr.size = 0;
}
+static void __init avila_gw23xx_setup(void)
+{
+ platform_device_register(&avila_npeb_device);
+ platform_device_register(&avila_npec_device);
+}
+
+#ifdef CONFIG_SENSORS_EEPROM
+static void __init avila_gw2342_setup(void)
+{
+ platform_device_register(&avila_npeb_device);
+ platform_device_register(&avila_npec_device);
+}
+
+static void __init avila_gw2345_setup(void)
+{
+ avila_npeb_data.phy = IXP4XX_ETH_PHY_MAX_ADDR;
+ avila_npeb_data.phy_mask = 0x1e; /* ports 1-4 of the KS8995 switch */
+ platform_device_register(&avila_npeb_device);
+
+ avila_npec_data.phy = 5; /* port 5 of the KS8995 switch */
+ platform_device_register(&avila_npec_device);
+}
+
+static void __init avila_gw2347_setup(void)
+{
+ platform_device_register(&avila_npeb_device);
+}
+
+static void __init avila_gw2348_setup(void)
+{
+ platform_device_register(&avila_npeb_device);
+ platform_device_register(&avila_npec_device);
+}
+
+static void __init avila_gw2353_setup(void)
+{
+ platform_device_register(&avila_npeb_device);
+}
+
+static void __init avila_gw2355_setup(void)
+{
+ avila_npeb_data.phy = IXP4XX_ETH_PHY_MAX_ADDR;
+ avila_npeb_data.phy_mask = 0x1e; /* ports 1-4 of the KS8995 switch */
+ platform_device_register(&avila_npeb_device);
+
+ avila_npec_data.phy = 5;
+ platform_device_register(&avila_npec_device);
+}
+
+static void __init avila_gw2357_setup(void)
+{
+ platform_device_register(&avila_npeb_device);
+}
+
+static struct avila_board_info avila_boards[] __initdata = {
+ { + {
+ .model = "GW2342", + .model = "GW2342",
+ .npes_used = 2, + .setup = avila_gw2342_setup,
+ .npeb_phy = 0, + }, {
+ .npec_phy = 1, + .model = "GW2345",
+ .setup = avila_gw2345_setup,
+ }, { + }, {
+ .model = "GW2347", + .model = "GW2347",
+ .npes_used = 1, + .setup = avila_gw2347_setup,
+ .npeb_phy = 1,
+ }, { + }, {
+ .model = "GW2348-2", + .model = "GW2348",
+ .npes_used = 2, + .setup = avila_gw2348_setup,
+ .npeb_phy = 0,
+ .npec_phy = 1,
+ }, {
+ .model = "GW2348-4",
+ .npes_used = 2,
+ .npeb_phy = 0,
+ .npec_phy = 1,
+ }, { + }, {
+ .model = "GW2353", + .model = "GW2353",
+ .npes_used = 1, + .setup = avila_gw2353_setup,
+ .npeb_phy = 1,
+ }, { + }, {
+ .model = "GW2355", + .model = "GW2355",
+ .npes_used = 2, + .setup = avila_gw2355_setup,
+ .npeb_phy = -1,
+ .npec_phy = 1,
+ }, { + }, {
+ .model = "GW2357", + .model = "GW2357",
+ .npes_used = 1, + .setup = avila_gw2357_setup,
+ .npeb_phy = 1,
+ } + }
+}; +};
+ +
+static struct avila_board_info *avila_find_board_info(char *model) +static struct avila_board_info * __init avila_find_board_info(char *model)
+{ +{
+ int i; + int i;
+ +
@ -91,64 +140,90 @@ Index: linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c
+ unsigned char model[16]; + unsigned char model[16];
+}; +};
+ +
+static int avila_eeprom_notify(struct notifier_block *self, +static int __init avila_eeprom_notify(struct notifier_block *self,
+ unsigned long event, void *t) + unsigned long event, void *t)
+{ +{
+ struct eeprom_data *ee = t; + struct eeprom_data *ee = t;
+ struct avila_board_info *info = NULL;
+ struct avila_eeprom_header hdr; + struct avila_eeprom_header hdr;
+ +
+ if (avila_info)
+ return NOTIFY_DONE;
+
+ /* The eeprom is at address 0x51 */ + /* The eeprom is at address 0x51 */
+ if (event != EEPROM_REGISTER || ee->client.addr != 0x51) + if (event != EEPROM_REGISTER || ee->client.addr != 0x51)
+ return NOTIFY_DONE; + return NOTIFY_DONE;
+ +
+ ee->attr->read(&ee->client.dev.kobj, ee->attr, (char *)&hdr, + ee->attr->read(&ee->client.dev.kobj, ee->attr, (char *)&hdr,
+ 0, sizeof(hdr)); + 0, sizeof(hdr));
+ +
+ if (hdr.magic[0] != 'G' || hdr.magic[1] != 'W') + if (hdr.magic[0] != 'G' || hdr.magic[1] != 'W')
+ return NOTIFY_DONE; + return NOTIFY_DONE;
+ +
+ memcpy(&avila_plat_eth[0].hwaddr, hdr.mac0, ETH_ALEN); + memcpy(&avila_npeb_data.hwaddr, hdr.mac0, ETH_ALEN);
+ memcpy(&avila_plat_eth[1].hwaddr, hdr.mac1, ETH_ALEN); + memcpy(&avila_npec_data.hwaddr, hdr.mac1, ETH_ALEN);
+ +
+ info = avila_find_board_info(hdr.model); + avila_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; + return NOTIFY_OK;
+} +}
+ +
+static struct notifier_block avila_eeprom_notifier = { +static struct notifier_block avila_eeprom_notifier __initdata = {
+ .notifier_call = avila_eeprom_notify + .notifier_call = avila_eeprom_notify
+}; +};
+#endif +
+static void __init avila_register_eeprom_notifier(void)
+{
+ register_eeprom_notifier(&avila_eeprom_notifier);
+}
+
+static void __init avila_unregister_eeprom_notifier(void)
+{
+ unregister_eeprom_notifier(&avila_eeprom_notifier);
+}
+#else /* CONFIG_SENSORS_EEPROM */
+static inline void avila_register_eeprom_notifier(void) {};
+static inline void avila_unregister_eeprom_notifier(void) {};
+#endif /* CONFIG_SENSORS_EEPROM */
+ +
static void __init avila_init(void) static void __init avila_init(void)
{ {
ixp4xx_sys_init(); ixp4xx_sys_init();
@@ -201,7 +321,11 @@ static void __init avila_init(void)
+ /*
+ * These devices are present on all Avila models and don't need any
+ * model specific setup.
+ */
avila_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
avila_flash_resource.end =
IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
@@ -213,9 +378,28 @@ static void __init avila_init(void)
platform_device_register(&avila_pata); platform_device_register(&avila_pata);
+#ifdef CONFIG_SENSORS_EEPROM - platform_device_register(avila_npeb_device);
+ register_eeprom_notifier(&avila_eeprom_notifier); - platform_device_register(avila_npec_device);
+#else + avila_register_eeprom_notifier();
platform_add_devices(avila_eth_devices, ARRAY_SIZE(avila_eth_devices)); +}
+#endif +
+static int __init avila_model_setup(void)
+{
+ if (!machine_is_avila())
+ return 0;
+
+ if (avila_info) {
+ printk(KERN_DEBUG "Running on Gateworks Avila %s\n",
+ avila_info->model);
+ avila_info->setup();
+ } else {
+ printk(KERN_INFO "Unknown/missing Avila model number"
+ " -- defaults will be used\n");
+ avila_gw23xx_setup();
+ }
+
+ avila_unregister_eeprom_notifier();
+ return 0;
} }
+late_initcall(avila_model_setup);
MACHINE_START(AVILA, "Gateworks Avila Network Platform") MACHINE_START(AVILA, "Gateworks Avila Network Platform")
/* Maintainer: Deepak Saxena <dsaxena@plexity.net> */

View File

@ -2,47 +2,115 @@ Index: linux-2.6.24.2/include/asm-arm/arch-ixp4xx/avila.h
=================================================================== ===================================================================
--- linux-2.6.24.2.orig/include/asm-arm/arch-ixp4xx/avila.h --- 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 +++ linux-2.6.24.2/include/asm-arm/arch-ixp4xx/avila.h
@@ -36,4 +36,5 @@ @@ -36,4 +36,6 @@
#define AVILA_PCI_INTC_PIN 9 #define AVILA_PCI_INTC_PIN 9
#define AVILA_PCI_INTD_PIN 8 #define AVILA_PCI_INTD_PIN 8
- -
+/* User LED */ +/* User LEDs */
+#define AVILA_LED_USER_GPIO 3 +#define AVILA_GW23XX_LED_USER_GPIO 3
+#define AVILA_GW23X7_LED_USER_GPIO 4
Index: linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c 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.orig/arch/arm/mach-ixp4xx/avila-setup.c
+++ linux-2.6.24.2/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[ @@ -26,6 +26,7 @@
} # include <linux/eeprom.h>
#endif
+#include <linux/leds.h>
#include <linux/i2c-gpio.h>
#include <asm/types.h>
@@ -172,6 +173,25 @@ static struct platform_device avila_npec
.dev.platform_data = &avila_npec_data,
}; };
+#ifdef CONFIG_LEDS_IXP4XX +static struct gpio_led avila_leds[] = {
+static struct resource avila_led_resources[] = {
+ { + {
+ .name = "user", + .name = "user", /* green led */
+ .start = AVILA_LED_USER_GPIO, + .gpio = AVILA_GW23XX_LED_USER_GPIO,
+ .end = AVILA_LED_USER_GPIO, + .active_low = 1,
+ .flags = IXP4XX_GPIO_LOW, + }
+ },
+}; +};
+ +
+static struct platform_device avila_leds = { +static struct gpio_led_platform_data avila_leds_data = {
+ .name = "IXP4XX-GPIO-LED", + .num_leds = 1,
+ .id = -1, + .leds = avila_leds,
+ .num_resources = ARRAY_SIZE(avila_led_resources), +};
+ .resource = avila_led_resources, +
+static struct platform_device avila_leds_device = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev.platform_data = &avila_leds_data,
+}; +};
+#endif
+ +
static struct platform_device *avila_devices[] __initdata = { static struct platform_device *avila_devices[] __initdata = {
&avila_i2c_gpio, &avila_i2c_gpio,
&avila_flash, &avila_flash,
- &avila_uart @@ -211,6 +231,8 @@ static void __init avila_gw23xx_setup(vo
+ &avila_uart, {
+#ifdef CONFIG_LEDS_IXP4XX platform_device_register(&avila_npeb_device);
+ &avila_leds, platform_device_register(&avila_npec_device);
+#endif +
}; + platform_device_register(&avila_leds_device);
}
static struct platform_device *avila_eth_devices[] = { #ifdef CONFIG_SENSORS_EEPROM
@@ -218,6 +240,8 @@ static void __init avila_gw2342_setup(vo
{
platform_device_register(&avila_npeb_device);
platform_device_register(&avila_npec_device);
+
+ platform_device_register(&avila_leds_device);
}
static void __init avila_gw2345_setup(void)
@@ -228,22 +252,30 @@ static void __init avila_gw2345_setup(vo
avila_npec_data.phy = 5; /* port 5 of the KS8995 switch */
platform_device_register(&avila_npec_device);
+
+ platform_device_register(&avila_leds_device);
}
static void __init avila_gw2347_setup(void)
{
platform_device_register(&avila_npeb_device);
+
+ avila_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
+ platform_device_register(&avila_leds_device);
}
static void __init avila_gw2348_setup(void)
{
platform_device_register(&avila_npeb_device);
platform_device_register(&avila_npec_device);
+
+ platform_device_register(&avila_leds_device);
}
static void __init avila_gw2353_setup(void)
{
platform_device_register(&avila_npeb_device);
+ platform_device_register(&avila_leds_device);
}
static void __init avila_gw2355_setup(void)
@@ -254,11 +286,16 @@ static void __init avila_gw2355_setup(vo
avila_npec_data.phy = 5;
platform_device_register(&avila_npec_device);
+
+ platform_device_register(&avila_leds_device);
}
static void __init avila_gw2357_setup(void)
{
platform_device_register(&avila_npeb_device);
+
+ avila_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
+ platform_device_register(&avila_leds_device);
}
static struct avila_board_info avila_boards[] __initdata = {

View File

@ -2,14 +2,14 @@ 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.orig/arch/arm/mach-ixp4xx/avila-setup.c
+++ linux-2.6.24.2/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 @@ -192,10 +192,28 @@ static struct platform_device avila_leds
.dev.platform_data = &avila_leds_data,
}; };
#endif
+#ifdef CONFIG_GPIO_DEVICE
+static struct resource avila_gpio_resources[] = { +static struct resource avila_gpio_resources[] = {
+ { + {
+ .name = "gpio", + .name = "gpio",
+ /* FIXME: gpio mask should be model specific */
+ .start = AVILA_GPIO_MASK, + .start = AVILA_GPIO_MASK,
+ .end = AVILA_GPIO_MASK, + .end = AVILA_GPIO_MASK,
+ .flags = 0, + .flags = 0,
@ -22,29 +22,24 @@ Index: linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c
+ .num_resources = ARRAY_SIZE(avila_gpio_resources), + .num_resources = ARRAY_SIZE(avila_gpio_resources),
+ .resource = avila_gpio_resources, + .resource = avila_gpio_resources,
+}; +};
+#endif
+ +
static struct platform_device *avila_devices[] __initdata = { static struct platform_device *avila_devices[] __initdata = {
&avila_i2c_gpio, &avila_i2c_gpio,
&avila_flash, &avila_flash,
@@ -199,6 +217,9 @@ static struct platform_device *avila_dev - &avila_uart
#ifdef CONFIG_LEDS_IXP4XX + &avila_uart,
&avila_leds,
#endif
+#ifdef CONFIG_GPIO_DEVICE
+ &avila_gpio, + &avila_gpio,
+#endif
}; };
static struct platform_device *avila_eth_devices[] = { static char avila_rtc_probe[] __initdata = "rtc-ds1672.probe=0,0x68 ";
Index: linux-2.6.24.2/include/asm-arm/arch-ixp4xx/avila.h Index: linux-2.6.24.2/include/asm-arm/arch-ixp4xx/avila.h
=================================================================== ===================================================================
--- linux-2.6.24.2.orig/include/asm-arm/arch-ixp4xx/avila.h --- 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 +++ linux-2.6.24.2/include/asm-arm/arch-ixp4xx/avila.h
@@ -38,3 +38,6 @@ @@ -39,3 +39,6 @@
/* User LEDs */
/* User LED */ #define AVILA_GW23XX_LED_USER_GPIO 3
#define AVILA_LED_USER_GPIO 3 #define AVILA_GW23X7_LED_USER_GPIO 4
+ +
+/* gpio mask used by platform device */ +/* gpio mask used by platform device */
+#define AVILA_GPIO_MASK (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9) +#define AVILA_GPIO_MASK (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9)

View File

@ -0,0 +1,52 @@
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
@@ -276,6 +276,7 @@ static void __init avila_gw2345_setup(vo
static void __init avila_gw2347_setup(void)
{
+ avila_npeb_data.quirks |= IXP4XX_ETH_QUIRK_GW23X7;
platform_device_register(&avila_npeb_device);
avila_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
@@ -310,6 +311,7 @@ static void __init avila_gw2355_setup(vo
static void __init avila_gw2357_setup(void)
{
+ avila_npeb_data.quirks |= IXP4XX_ETH_QUIRK_GW23X7;
platform_device_register(&avila_npeb_device);
avila_leds[0].gpio = AVILA_GW23X7_LED_USER_GPIO;
Index: linux-2.6.24.2/drivers/net/arm/ixp4xx_eth.c
===================================================================
--- linux-2.6.24.2.orig/drivers/net/arm/ixp4xx_eth.c
+++ linux-2.6.24.2/drivers/net/arm/ixp4xx_eth.c
@@ -347,6 +347,14 @@ static void phy_reset(struct net_device
return;
}
+ if (port->plat->quirks & IXP4XX_ETH_QUIRK_GW23X7) {
+ mdio_write(dev, 1, 0x19,
+ (mdio_read(dev, 1, 0x19) & 0xfffe) | 0x8000);
+
+ printk(KERN_DEBUG "%s: phy_id of the DP83848 changed to 0\n",
+ dev->name);
+ }
+
/* restart auto negotiation */
bmcr = mdio_read(dev, phy_id, MII_BMCR);
bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART);
Index: linux-2.6.24.2/include/asm-arm/arch-ixp4xx/platform.h
===================================================================
--- linux-2.6.24.2.orig/include/asm-arm/arch-ixp4xx/platform.h
+++ linux-2.6.24.2/include/asm-arm/arch-ixp4xx/platform.h
@@ -115,6 +115,8 @@ struct eth_plat_info {
u8 txreadyq;
u8 hwaddr[6];
u32 phy_mask;
+ u32 quirks;
+#define IXP4XX_ETH_QUIRK_GW23X7 0x00000001
};
/* Information about built-in HSS (synchronous serial) interfaces */