update Avila patches

SVN-Revision: 10968
owl
Gabor Juhos 2008-04-28 18:46:05 +00:00
parent a57272d80b
commit dbbf5a2b84
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/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,
};
+/* 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,
+ .rxq = 3,
+ .txreadyq = 20,
+ }, {
+};
+
+static struct eth_plat_info avila_npec_data = {
+ .phy = 1,
+ .rxq = 4,
+ .txreadyq = 21,
+ }
+};
+
+static struct platform_device avila_eth[] = {
+ {
+static struct platform_device avila_npeb_device = {
+ .name = "ixp4xx_eth",
+ .id = IXP4XX_ETH_NPEB,
+ .dev.platform_data = avila_plat_eth,
+ }, {
+ .dev.platform_data = &avila_npeb_data,
+};
+
+static struct platform_device avila_npec_device = {
+ .name = "ixp4xx_eth",
+ .id = IXP4XX_ETH_NPEC,
+ .dev.platform_data = avila_plat_eth + 1,
+ }
+ .dev.platform_data = &avila_npec_data,
+};
+
static struct platform_device *avila_devices[] __initdata = {
&avila_i2c_gpio,
&avila_flash,
&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)
@@ -159,6 +184,8 @@ static void __init avila_init(void)
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")

View File

@ -1,7 +1,8 @@
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
--- 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
@@ -138,6 +138,35 @@ static struct platform_device *avila_dev
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
@@ -163,6 +163,35 @@ static struct platform_device *avila_dev
&avila_uart
};
@ -37,7 +38,7 @@ diff -uprN linux-2.6.23.orig/arch/arm/mach-ixp4xx/avila-setup.c linux-2.6.23/arc
static void __init avila_init(void)
{
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> */
.phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
.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,
.init_irq = ixp4xx_init_irq,
.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> */
.phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
.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 <asm/types.h>
@@ -177,6 +185,118 @@ static struct platform_device *avila_eth
&avila_eth[1]
};
@@ -29,6 +37,13 @@
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
+#ifdef CONFIG_SENSORS_EEPROM
+struct avila_board_info {
+ unsigned char *model;
+ int npes_used;
+ int npeb_phy;
+ int npec_phy;
+ void (* setup)(void);
+};
+
+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",
+ .npes_used = 2,
+ .npeb_phy = 0,
+ .npec_phy = 1,
+ .setup = avila_gw2342_setup,
+ }, {
+ .model = "GW2345",
+ .setup = avila_gw2345_setup,
+ }, {
+ .model = "GW2347",
+ .npes_used = 1,
+ .npeb_phy = 1,
+ .setup = avila_gw2347_setup,
+ }, {
+ .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 = "GW2348",
+ .setup = avila_gw2348_setup,
+ }, {
+ .model = "GW2353",
+ .npes_used = 1,
+ .npeb_phy = 1,
+ .setup = avila_gw2353_setup,
+ }, {
+ .model = "GW2355",
+ .npes_used = 2,
+ .npeb_phy = -1,
+ .npec_phy = 1,
+ .setup = avila_gw2355_setup,
+ }, {
+ .model = "GW2357",
+ .npes_used = 1,
+ .npeb_phy = 1,
+ .setup = avila_gw2357_setup,
+ }
+};
+
+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;
+
@ -91,13 +140,15 @@ Index: linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c
+ 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)
+{
+ struct eeprom_data *ee = t;
+ struct avila_board_info *info = NULL;
+ struct avila_eeprom_header hdr;
+
+ if (avila_info)
+ return NOTIFY_DONE;
+
+ /* The eeprom is at address 0x51 */
+ if (event != EEPROM_REGISTER || ee->client.addr != 0x51)
+ return NOTIFY_DONE;
@ -108,47 +159,71 @@ Index: linux-2.6.24.2/arch/arm/mach-ixp4xx/avila-setup.c
+ 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);
+ memcpy(&avila_npeb_data.hwaddr, hdr.mac0, ETH_ALEN);
+ memcpy(&avila_npec_data.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);
+ avila_info = avila_find_board_info(hdr.model);
+
+ return NOTIFY_OK;
+}
+
+static struct notifier_block avila_eeprom_notifier = {
+static struct notifier_block avila_eeprom_notifier __initdata = {
+ .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)
{
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);
+#ifdef CONFIG_SENSORS_EEPROM
+ register_eeprom_notifier(&avila_eeprom_notifier);
+#else
platform_add_devices(avila_eth_devices, ARRAY_SIZE(avila_eth_devices));
+#endif
- platform_device_register(avila_npeb_device);
- platform_device_register(avila_npec_device);
+ avila_register_eeprom_notifier();
+}
+
+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")
/* 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/include/asm-arm/arch-ixp4xx/avila.h
@@ -36,4 +36,5 @@
@@ -36,4 +36,6 @@
#define AVILA_PCI_INTC_PIN 9
#define AVILA_PCI_INTD_PIN 8
-
+/* User LED */
+#define AVILA_LED_USER_GPIO 3
+/* User LEDs */
+#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
===================================================================
--- 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[
}
@@ -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 resource avila_led_resources[] = {
+static struct gpio_led avila_leds[] = {
+ {
+ .name = "user",
+ .start = AVILA_LED_USER_GPIO,
+ .end = AVILA_LED_USER_GPIO,
+ .flags = IXP4XX_GPIO_LOW,
+ },
+ .name = "user", /* green led */
+ .gpio = AVILA_GW23XX_LED_USER_GPIO,
+ .active_low = 1,
+ }
+};
+
+static struct platform_device avila_leds = {
+ .name = "IXP4XX-GPIO-LED",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(avila_led_resources),
+ .resource = avila_led_resources,
+static struct gpio_led_platform_data avila_leds_data = {
+ .num_leds = 1,
+ .leds = avila_leds,
+};
+
+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 = {
&avila_i2c_gpio,
&avila_flash,
- &avila_uart
+ &avila_uart,
+#ifdef CONFIG_LEDS_IXP4XX
+ &avila_leds,
+#endif
};
@@ -211,6 +231,8 @@ static void __init avila_gw23xx_setup(vo
{
platform_device_register(&avila_npeb_device);
platform_device_register(&avila_npec_device);
+
+ 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/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[] = {
+ {
+ .name = "gpio",
+ /* FIXME: gpio mask should be model specific */
+ .start = AVILA_GPIO_MASK,
+ .end = AVILA_GPIO_MASK,
+ .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),
+ .resource = avila_gpio_resources,
+};
+#endif
+
static struct platform_device *avila_devices[] __initdata = {
&avila_i2c_gpio,
&avila_flash,
@@ -199,6 +217,9 @@ static struct platform_device *avila_dev
#ifdef CONFIG_LEDS_IXP4XX
&avila_leds,
#endif
+#ifdef CONFIG_GPIO_DEVICE
- &avila_uart
+ &avila_uart,
+ &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
===================================================================
--- 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 */
#define AVILA_LED_USER_GPIO 3
@@ -39,3 +39,6 @@
/* User LEDs */
#define AVILA_GW23XX_LED_USER_GPIO 3
#define AVILA_GW23X7_LED_USER_GPIO 4
+
+/* gpio mask used by platform device */
+#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 */