summaryrefslogtreecommitdiffstats
path: root/target/linux/ixp4xx/patches-2.6.32/193-cambria_pld_gpio.patch
blob: 299630f1719366904b126013e6bb3f6aadb0afbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
--- 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)