1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-27 22:00:50 +02:00
openwrt-xburst/target/linux/ixp4xx/patches-2.6.34/193-cambria_pld_gpio.patch

108 lines
3.0 KiB
Diff
Raw Normal View History

--- a/arch/arm/mach-ixp4xx/cambria-setup.c
+++ b/arch/arm/mach-ixp4xx/cambria-setup.c
@@ -12,11 +12,14 @@
*/
#include <linux/device.h>
+#include <linux/gpio_buttons.h>
#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
#include <linux/i2c/at24.h>
+#include <linux/i2c/gw_i2c_pld.h>
#include <linux/if_ether.h>
#include <linux/init.h>
+#include <linux/input.h>
#include <linux/kernel.h>
#include <linux/leds.h>
#include <linux/memory.h>
@@ -323,6 +326,39 @@ static struct platform_device cambria_us
},
};
+static struct gw_i2c_pld_platform_data gw_i2c_pld_data0 = {
+ .gpio_base = 16,
+ .nr_gpio = 8,
+};
+
+static struct gw_i2c_pld_platform_data gw_i2c_pld_data1 = {
+ .gpio_base = 24,
+ .nr_gpio = 2,
+};
+
+
+static struct gpio_button cambria_gpio_buttons[] = {
+ {
+ .desc = "user",
+ .type = EV_KEY,
+ .code = BTN_0,
+ .threshold = 2,
+ .gpio = 25,
+ }
+};
+
+static struct gpio_buttons_platform_data cambria_gpio_buttons_data = {
+ .poll_interval = 500,
+ .nbuttons = 1,
+ .buttons = cambria_gpio_buttons,
+};
+
+static struct platform_device cambria_gpio_buttons_device = {
+ .name = "gpio-buttons",
+ .id = -1,
+ .dev.platform_data = &cambria_gpio_buttons_data,
+};
+
static struct platform_device *cambria_devices[] __initdata = {
&cambria_i2c_gpio,
&cambria_flash,
@@ -331,6 +367,11 @@ static struct platform_device *cambria_d
static void __init cambria_gw23xx_setup(void)
{
+ cambria_gpio_resources[0].start = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) |\
+ (1 << 5) | (1 << 8) | (1 << 9) | (1 << 12);
+ cambria_gpio_resources[0].end = cambria_gpio_resources[0].start;
+
+ platform_device_register(&cambria_gpio);
platform_device_register(&cambria_npec_device);
platform_device_register(&cambria_npea_device);
}
@@ -377,7 +418,8 @@ static void __init cambria_gw2358_setup(
cambria_optional_uart_data[1].membase = (void __iomem *)ioremap(0x53F80000, 0x0fff);
cambria_optional_uart_data[1].irq = IRQ_IXP4XX_GPIO4;
- cambria_gpio_resources[0].start = (1 << 14);
+ cambria_gpio_resources[0].start = (1 << 14) | (1 << 16) | (1 << 17) | (1 << 18) |\
+ (1 << 19) | (1 << 20) | (1 << 24) | (1 << 25);
cambria_gpio_resources[0].end = cambria_gpio_resources[0].start;
platform_device_register(&cambria_gpio);
@@ -391,7 +433,12 @@ static void __init cambria_gw2358_setup(
platform_device_register(&cambria_pata);
+ cambria_gpio_leds[0].gpio = 24;
+ platform_device_register(&cambria_gpio_leds_device);
+
platform_device_register(&cambria_latch_leds_device);
+
+ platform_device_register(&cambria_gpio_buttons_device);
}
static struct cambria_board_info cambria_boards[] __initdata = {
@@ -460,6 +507,14 @@ static struct i2c_board_info __initdata
I2C_BOARD_INFO("24c08", 0x51),
.platform_data = &cambria_eeprom_info
},
+ {
+ I2C_BOARD_INFO("gw_i2c_pld", 0x56),
+ .platform_data = &gw_i2c_pld_data0,
+ },
+ {
+ I2C_BOARD_INFO("gw_i2c_pld", 0x57),
+ .platform_data = &gw_i2c_pld_data1,
+ },
};
static void __init cambria_init(void)