diff options
Diffstat (limited to 'arch/arm/mach-at91/board-csb337.c')
-rw-r--r-- | arch/arm/mach-at91/board-csb337.c | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c index d0aa20c9383e..0e2a11fc5bbd 100644 --- a/arch/arm/mach-at91/board-csb337.c +++ b/arch/arm/mach-at91/board-csb337.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/spi/spi.h> | 26 | #include <linux/spi/spi.h> |
27 | #include <linux/mtd/physmap.h> | 27 | #include <linux/mtd/physmap.h> |
28 | #include <linux/input.h> | ||
29 | #include <linux/gpio_keys.h> | ||
28 | 30 | ||
29 | #include <asm/hardware.h> | 31 | #include <asm/hardware.h> |
30 | #include <asm/setup.h> | 32 | #include <asm/setup.h> |
@@ -156,6 +158,85 @@ static struct platform_device csb_flash = { | |||
156 | .num_resources = ARRAY_SIZE(csb_flash_resources), | 158 | .num_resources = ARRAY_SIZE(csb_flash_resources), |
157 | }; | 159 | }; |
158 | 160 | ||
161 | /* | ||
162 | * GPIO Buttons (on CSB300) | ||
163 | */ | ||
164 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
165 | static struct gpio_keys_button csb300_buttons[] = { | ||
166 | { | ||
167 | .gpio = AT91_PIN_PB29, | ||
168 | .code = BTN_0, | ||
169 | .desc = "sw0", | ||
170 | .active_low = 1, | ||
171 | .wakeup = 1, | ||
172 | }, | ||
173 | { | ||
174 | .gpio = AT91_PIN_PB28, | ||
175 | .code = BTN_1, | ||
176 | .desc = "sw1", | ||
177 | .active_low = 1, | ||
178 | .wakeup = 1, | ||
179 | }, | ||
180 | { | ||
181 | .gpio = AT91_PIN_PA21, | ||
182 | .code = BTN_2, | ||
183 | .desc = "sw2", | ||
184 | .active_low = 1, | ||
185 | .wakeup = 1, | ||
186 | } | ||
187 | }; | ||
188 | |||
189 | static struct gpio_keys_platform_data csb300_button_data = { | ||
190 | .buttons = csb300_buttons, | ||
191 | .nbuttons = ARRAY_SIZE(csb300_buttons), | ||
192 | }; | ||
193 | |||
194 | static struct platform_device csb300_button_device = { | ||
195 | .name = "gpio-keys", | ||
196 | .id = -1, | ||
197 | .num_resources = 0, | ||
198 | .dev = { | ||
199 | .platform_data = &csb300_button_data, | ||
200 | } | ||
201 | }; | ||
202 | |||
203 | static void __init csb300_add_device_buttons(void) | ||
204 | { | ||
205 | at91_set_gpio_input(AT91_PIN_PB29, 0); /* sw0 */ | ||
206 | at91_set_deglitch(AT91_PIN_PB29, 1); | ||
207 | at91_set_gpio_input(AT91_PIN_PB28, 0); /* sw1 */ | ||
208 | at91_set_deglitch(AT91_PIN_PB28, 1); | ||
209 | at91_set_gpio_input(AT91_PIN_PA21, 0); /* sw2 */ | ||
210 | at91_set_deglitch(AT91_PIN_PA21, 1); | ||
211 | |||
212 | platform_device_register(&csb300_button_device); | ||
213 | } | ||
214 | #else | ||
215 | static void __init csb300_add_device_buttons(void) {} | ||
216 | #endif | ||
217 | |||
218 | static struct gpio_led csb_leds[] = { | ||
219 | { /* "led0", yellow */ | ||
220 | .name = "led0", | ||
221 | .gpio = AT91_PIN_PB2, | ||
222 | .active_low = 1, | ||
223 | .default_trigger = "heartbeat", | ||
224 | }, | ||
225 | { /* "led1", green */ | ||
226 | .name = "led1", | ||
227 | .gpio = AT91_PIN_PB1, | ||
228 | .active_low = 1, | ||
229 | .default_trigger = "mmc0", | ||
230 | }, | ||
231 | { /* "led2", yellow */ | ||
232 | .name = "led2", | ||
233 | .gpio = AT91_PIN_PB0, | ||
234 | .active_low = 1, | ||
235 | .default_trigger = "ide-disk", | ||
236 | }, | ||
237 | }; | ||
238 | |||
239 | |||
159 | static void __init csb337_board_init(void) | 240 | static void __init csb337_board_init(void) |
160 | { | 241 | { |
161 | /* Serial */ | 242 | /* Serial */ |
@@ -177,6 +258,10 @@ static void __init csb337_board_init(void) | |||
177 | at91_add_device_mmc(0, &csb337_mmc_data); | 258 | at91_add_device_mmc(0, &csb337_mmc_data); |
178 | /* NOR flash */ | 259 | /* NOR flash */ |
179 | platform_device_register(&csb_flash); | 260 | platform_device_register(&csb_flash); |
261 | /* LEDs */ | ||
262 | at91_gpio_leds(csb_leds, ARRAY_SIZE(csb_leds)); | ||
263 | /* Switches on CSB300 */ | ||
264 | csb300_add_device_buttons(); | ||
180 | } | 265 | } |
181 | 266 | ||
182 | MACHINE_START(CSB337, "Cogent CSB337") | 267 | MACHINE_START(CSB337, "Cogent CSB337") |