diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-03-01 15:58:56 +0800 |
---|---|---|
committer | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-03-12 18:32:53 +0800 |
commit | 65480192e65b4477f5fedb910af7b09e191cb878 (patch) | |
tree | b170b0bbd81cb2023312b0b83ad099ed5e72e827 /arch/arm/boards/at91sam9261ek | |
parent | 85f5d9645da5b759a1e1023571baf62a2783373c (diff) | |
download | barebox-65480192e65b4477f5fedb910af7b09e191cb878.tar.gz barebox-65480192e65b4477f5fedb910af7b09e191cb878.tar.xz |
at91sam9261ek/9g10ek: add gpio Keyboard support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'arch/arm/boards/at91sam9261ek')
-rw-r--r-- | arch/arm/boards/at91sam9261ek/init.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/arch/arm/boards/at91sam9261ek/init.c b/arch/arm/boards/at91sam9261ek/init.c index 2952a76bfe..acc71f4f58 100644 --- a/arch/arm/boards/at91sam9261ek/init.c +++ b/arch/arm/boards/at91sam9261ek/init.c @@ -39,6 +39,8 @@ #include <mach/at91sam9_smc.h> #include <mach/sam9_smc.h> #include <dm9000.h> +#include <gpio_keys.h> +#include <readkey.h> #include <led.h> static struct atmel_nand_data nand_pdata = { @@ -152,11 +154,48 @@ static void ek_add_device_udc(void) static void ek_add_device_udc(void) {} #endif +#ifdef CONFIG_KEYBOARD_GPIO +struct gpio_keys_button keys[] = { + { + .code = KEY_UP, + .gpio = AT91_PIN_PA26, + }, { + .code = KEY_DOWN, + .gpio = AT91_PIN_PA25, + }, { + .code = KEY_ENTER, + .gpio = AT91_PIN_PA24, + }, +}; + +struct gpio_keys_platform_data gk_pdata = { + .buttons = keys, + .nbuttons = ARRAY_SIZE(keys), +}; + +static void ek_add_device_keyboard_buttons(void) +{ + int i; + + for (i = 0; i < gk_pdata.nbuttons; i++) { + /* user push button, pull up enabled */ + keys[i].active_low = 1; + at91_set_GPIO_periph(keys[i].gpio, keys[i].active_low); + at91_set_deglitch(keys[i].gpio, 1); + } + + add_gpio_keys_device(-1, &gk_pdata); +} +#else +static void ek_add_device_keyboard_buttons(void) {} +#endif + static void __init ek_add_device_buttons(void) { at91_set_gpio_input(AT91_PIN_PA27, 1); at91_set_deglitch(AT91_PIN_PA27, 1); export_env_ull("dfu_button", AT91_PIN_PA27); + ek_add_device_keyboard_buttons(); } #ifdef CONFIG_LED_GPIO |