diff options
Diffstat (limited to 'arch/arm/mach-at91/board-sam9rlek.c')
-rw-r--r-- | arch/arm/mach-at91/board-sam9rlek.c | 81 |
1 files changed, 80 insertions, 1 deletions
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c index f6b5672cabd..94ffb5c103b 100644 --- a/arch/arm/mach-at91/board-sam9rlek.c +++ b/arch/arm/mach-at91/board-sam9rlek.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/spi/spi.h> | 15 | #include <linux/spi/spi.h> |
16 | #include <linux/fb.h> | 16 | #include <linux/fb.h> |
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <linux/input.h> | ||
19 | #include <linux/gpio_keys.h> | ||
18 | 20 | ||
19 | #include <video/atmel_lcdc.h> | 21 | #include <video/atmel_lcdc.h> |
20 | 22 | ||
@@ -41,7 +43,7 @@ static void __init ek_map_io(void) | |||
41 | /* Initialize processor: 12.000 MHz crystal */ | 43 | /* Initialize processor: 12.000 MHz crystal */ |
42 | at91sam9rl_initialize(12000000); | 44 | at91sam9rl_initialize(12000000); |
43 | 45 | ||
44 | /* DGBU on ttyS0. (Rx & Tx only) */ | 46 | /* DBGU on ttyS0. (Rx & Tx only) */ |
45 | at91_register_uart(0, 0, 0); | 47 | at91_register_uart(0, 0, 0); |
46 | 48 | ||
47 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */ | 49 | /* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */ |
@@ -208,6 +210,79 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data; | |||
208 | #endif | 210 | #endif |
209 | 211 | ||
210 | 212 | ||
213 | /* | ||
214 | * LEDs | ||
215 | */ | ||
216 | static struct gpio_led ek_leds[] = { | ||
217 | { /* "bottom" led, green, userled1 to be defined */ | ||
218 | .name = "ds1", | ||
219 | .gpio = AT91_PIN_PD15, | ||
220 | .active_low = 1, | ||
221 | .default_trigger = "none", | ||
222 | }, | ||
223 | { /* "bottom" led, green, userled2 to be defined */ | ||
224 | .name = "ds2", | ||
225 | .gpio = AT91_PIN_PD16, | ||
226 | .active_low = 1, | ||
227 | .default_trigger = "none", | ||
228 | }, | ||
229 | { /* "power" led, yellow */ | ||
230 | .name = "ds3", | ||
231 | .gpio = AT91_PIN_PD14, | ||
232 | .default_trigger = "heartbeat", | ||
233 | } | ||
234 | }; | ||
235 | |||
236 | |||
237 | /* | ||
238 | * GPIO Buttons | ||
239 | */ | ||
240 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
241 | static struct gpio_keys_button ek_buttons[] = { | ||
242 | { | ||
243 | .gpio = AT91_PIN_PB0, | ||
244 | .code = BTN_2, | ||
245 | .desc = "Right Click", | ||
246 | .active_low = 1, | ||
247 | .wakeup = 1, | ||
248 | }, | ||
249 | { | ||
250 | .gpio = AT91_PIN_PB1, | ||
251 | .code = BTN_1, | ||
252 | .desc = "Left Click", | ||
253 | .active_low = 1, | ||
254 | .wakeup = 1, | ||
255 | } | ||
256 | }; | ||
257 | |||
258 | static struct gpio_keys_platform_data ek_button_data = { | ||
259 | .buttons = ek_buttons, | ||
260 | .nbuttons = ARRAY_SIZE(ek_buttons), | ||
261 | }; | ||
262 | |||
263 | static struct platform_device ek_button_device = { | ||
264 | .name = "gpio-keys", | ||
265 | .id = -1, | ||
266 | .num_resources = 0, | ||
267 | .dev = { | ||
268 | .platform_data = &ek_button_data, | ||
269 | } | ||
270 | }; | ||
271 | |||
272 | static void __init ek_add_device_buttons(void) | ||
273 | { | ||
274 | at91_set_gpio_input(AT91_PIN_PB1, 1); /* btn1 */ | ||
275 | at91_set_deglitch(AT91_PIN_PB1, 1); | ||
276 | at91_set_gpio_input(AT91_PIN_PB0, 1); /* btn2 */ | ||
277 | at91_set_deglitch(AT91_PIN_PB0, 1); | ||
278 | |||
279 | platform_device_register(&ek_button_device); | ||
280 | } | ||
281 | #else | ||
282 | static void __init ek_add_device_buttons(void) {} | ||
283 | #endif | ||
284 | |||
285 | |||
211 | static void __init ek_board_init(void) | 286 | static void __init ek_board_init(void) |
212 | { | 287 | { |
213 | /* Serial */ | 288 | /* Serial */ |
@@ -226,6 +301,10 @@ static void __init ek_board_init(void) | |||
226 | at91_add_device_lcdc(&ek_lcdc_data); | 301 | at91_add_device_lcdc(&ek_lcdc_data); |
227 | /* Touch Screen Controller */ | 302 | /* Touch Screen Controller */ |
228 | at91_add_device_tsadcc(); | 303 | at91_add_device_tsadcc(); |
304 | /* LEDs */ | ||
305 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); | ||
306 | /* Push Buttons */ | ||
307 | ek_add_device_buttons(); | ||
229 | } | 308 | } |
230 | 309 | ||
231 | MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK") | 310 | MACHINE_START(AT91SAM9RLEK, "Atmel AT91SAM9RL-EK") |