ar71xx: rewrite prom code (based on a patch by Jeff Hansen)
[openwrt.git] / target / linux / ixp4xx / patches-2.6.28 / 193-cambria_pld_gpio.patch
1 --- a/arch/arm/mach-ixp4xx/cambria-setup.c
2 +++ b/arch/arm/mach-ixp4xx/cambria-setup.c
3 @@ -12,11 +12,14 @@
4 */
5
6 #include <linux/device.h>
7 +#include <linux/gpio_buttons.h>
8 #include <linux/i2c.h>
9 #include <linux/i2c-gpio.h>
10 #include <linux/i2c/at24.h>
11 +#include <linux/i2c/gw_i2c_pld.h>
12 #include <linux/if_ether.h>
13 #include <linux/init.h>
14 +#include <linux/input.h>
15 #include <linux/kernel.h>
16 #include <linux/leds.h>
17 #include <linux/memory.h>
18 @@ -323,6 +326,39 @@ static struct platform_device cambria_us
19 },
20 };
21
22 +static struct gw_i2c_pld_platform_data gw_i2c_pld_data0 = {
23 + .gpio_base = 16,
24 + .nr_gpio = 8,
25 +};
26 +
27 +static struct gw_i2c_pld_platform_data gw_i2c_pld_data1 = {
28 + .gpio_base = 24,
29 + .nr_gpio = 2,
30 +};
31 +
32 +
33 +static struct gpio_button cambria_gpio_buttons[] = {
34 + {
35 + .desc = "user",
36 + .type = EV_KEY,
37 + .code = BTN_0,
38 + .threshold = 2,
39 + .gpio = 25,
40 + }
41 +};
42 +
43 +static struct gpio_buttons_platform_data cambria_gpio_buttons_data = {
44 + .poll_interval = 500,
45 + .nbuttons = 1,
46 + .buttons = cambria_gpio_buttons,
47 +};
48 +
49 +static struct platform_device cambria_gpio_buttons_device = {
50 + .name = "gpio-buttons",
51 + .id = -1,
52 + .dev.platform_data = &cambria_gpio_buttons_data,
53 +};
54 +
55 static struct platform_device *cambria_devices[] __initdata = {
56 &cambria_i2c_gpio,
57 &cambria_flash,
58 @@ -331,6 +367,11 @@ static struct platform_device *cambria_d
59
60 static void __init cambria_gw23xx_setup(void)
61 {
62 + cambria_gpio_resources[0].start = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) |\
63 + (1 << 5) | (1 << 8) | (1 << 9) | (1 << 12);
64 + cambria_gpio_resources[0].end = cambria_gpio_resources[0].start;
65 +
66 + platform_device_register(&cambria_gpio);
67 platform_device_register(&cambria_npec_device);
68 platform_device_register(&cambria_npea_device);
69 }
70 @@ -377,7 +418,8 @@ static void __init cambria_gw2358_setup(
71 cambria_optional_uart_data[1].membase = (void __iomem *)ioremap(0x53F80000, 0x0fff);
72 cambria_optional_uart_data[1].irq = IRQ_IXP4XX_GPIO4;
73
74 - cambria_gpio_resources[0].start = (1 << 14);
75 + cambria_gpio_resources[0].start = (1 << 14) | (1 << 16) | (1 << 17) | (1 << 18) |\
76 + (1 << 19) | (1 << 20) | (1 << 24) | (1 << 25);
77 cambria_gpio_resources[0].end = cambria_gpio_resources[0].start;
78
79 platform_device_register(&cambria_gpio);
80 @@ -391,7 +433,12 @@ static void __init cambria_gw2358_setup(
81
82 platform_device_register(&cambria_pata);
83
84 + cambria_gpio_leds[0].gpio = 24;
85 + platform_device_register(&cambria_gpio_leds_device);
86 +
87 platform_device_register(&cambria_latch_leds_device);
88 +
89 + platform_device_register(&cambria_gpio_buttons_device);
90 }
91
92 static struct cambria_board_info cambria_boards[] __initdata = {
93 @@ -460,6 +507,14 @@ static struct i2c_board_info __initdata
94 I2C_BOARD_INFO("24c08", 0x51),
95 .platform_data = &cambria_eeprom_info
96 },
97 + {
98 + I2C_BOARD_INFO("gw_i2c_pld", 0x56),
99 + .platform_data = &gw_i2c_pld_data0,
100 + },
101 + {
102 + I2C_BOARD_INFO("gw_i2c_pld", 0x57),
103 + .platform_data = &gw_i2c_pld_data1,
104 + },
105 };
106
107 static void __init cambria_init(void)
This page took 0.044053 seconds and 5 git commands to generate.