- gpio_keys support - leds - uarts 2 and 4 (for oled) Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@xxxxxxxxxxxx> --- arch/arm/boards/usb-a926x/init.c | 108 ++++++++++++++++++++++++++++++++++++++ arch/arm/mach-at91/Kconfig | 9 +++ 2 files changed, 117 insertions(+), 0 deletions(-) diff --git a/arch/arm/boards/usb-a926x/init.c b/arch/arm/boards/usb-a926x/init.c index 364c1ba..af025b4 100644 --- a/arch/arm/boards/usb-a926x/init.c +++ b/arch/arm/boards/usb-a926x/init.c @@ -41,6 +41,8 @@ #include <mach/io.h> #include <mach/at91_pmc.h> #include <mach/at91_rstc.h> +#include <gpio_keys.h> +#include <readkey.h> static void usb_a9260_set_board_type(void) { @@ -219,6 +221,101 @@ static void __init ek_add_device_button(void) export_env_ull("dfu_button", AT91_PIN_PB10); } +#ifdef CONFIG_CALAO_DAB_MMX +struct gpio_led dab_mmx_leds[] = { + { + .gpio = AT91_PIN_PB20, + .led = { + .name = "user_led1", + }, + }, { + .gpio = AT91_PIN_PB21, + .led = { + .name = "user_led2", + }, + }, { + .gpio = AT91_PIN_PB22, + .led = { + .name = "user_led3", + }, + }, { + .gpio = AT91_PIN_PB23, + .led = { + .name = "user_led4", + }, + }, { + .gpio = AT91_PIN_PB24, + .led = { + .name = "red", + }, + }, { + .gpio = AT91_PIN_PB30, + .led = { + .name = "orange", + }, + }, { + .gpio = AT91_PIN_PB31, + .led = { + .name = "green", + }, + }, +}; + +#ifdef CONFIG_KEYBOARD_GPIO +struct gpio_keys_button keys[] = { + { + .code = KEY_UP, + .gpio = AT91_PIN_PB25, + }, { + .code = KEY_HOME, + .gpio = AT91_PIN_PB13, + }, { + .code = KEY_DOWN, + .gpio = AT91_PIN_PA26, + }, { + .code = KEY_ENTER, + .gpio = AT91_PIN_PC9, + }, +}; + +struct gpio_keys_platform_data gk_pdata = { + .buttons = keys, + .nbuttons = ARRAY_SIZE(keys), +}; + +static void usb_a9260_keyboard_device_dab_mmx(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 usb_a9260_keyboard_device_dab_mmx(void) {} +#endif + +static void usb_a9260_device_dab_mmx(void) +{ + int i; + + usb_a9260_keyboard_device_dab_mmx(); + + for (i = 0; i < ARRAY_SIZE(dab_mmx_leds); i++) { + dab_mmx_leds[i].active_low = 1; + at91_set_gpio_output(dab_mmx_leds[i].gpio, dab_mmx_leds[i].active_low); + led_gpio_register(&dab_mmx_leds[i]); + } +} +#else +static void usb_a9260_device_dab_mmx(void) {} +#endif + static int usb_a9260_devices_init(void) { usb_a9260_add_device_nand(); @@ -229,6 +326,7 @@ static int usb_a9260_devices_init(void) ek_add_device_udc(); ek_add_led(); ek_add_device_button(); + usb_a9260_device_dab_mmx(); armlinux_set_bootparams((void *)(AT91_CHIPSELECT_1 + 0x100)); usb_a9260_set_board_type(); @@ -248,7 +346,17 @@ device_initcall(usb_a9260_devices_init); static int usb_a9260_console_init(void) { + struct device_d *dev; + at91_register_uart(0, 0); + + if (IS_ENABLED(CONFIG_CALAO_DAB_MMX)) { + at91_register_uart(2, 0); + + dev = at91_register_uart(4, 0); + dev_set_param(dev, "active", ""); + } + return 0; } console_initcall(usb_a9260_console_init); diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 41e9b99..d2bb7bc 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -93,6 +93,9 @@ config ARCH_BAREBOX_MAX_BARE_INIT_SIZE default 0xF000 if ARCH_AT91SAM9G45 default 0xffffffff +config SUPPORT_CALAO_DAB_MMX + bool + # ---------------------------------------------------------- if ARCH_AT91RM9200 @@ -133,6 +136,7 @@ config MACH_TNY_A9260 config MACH_USB_A9260 bool "CALAO USB-A9260" + select SUPPORT_CALAO_DAB_MMX help Select this if you are using a Calao Systems USB-A9260. <http://www.calao-systems.com> @@ -209,6 +213,7 @@ config MACH_TNY_A9G20 config MACH_USB_A9G20 bool "CALAO USB-A9G20" + select SUPPORT_CALAO_DAB_MMX help Select this if you are using a Calao Systems USB-A9G20. <http://www.calao-systems.com> @@ -328,4 +333,8 @@ config LCD_LG_LB043WQ1 endchoice +config CALAO_DAB_MMX + bool "DAB MMX Daughter Board support" + depends on SUPPORT_CALAO_DAB_MMX + endif -- 1.7.7 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox