From 96e7d211b46ce838ceca5d9734d6e166cfafdef4 Mon Sep 17 00:00:00 2001 From: Siddarth Gore Date: Tue, 5 May 2009 14:52:09 +0530 Subject: [ARM] Kirkwood: enable gpio leds/buttons for the mv88f6281gtw_ge board Signed-off-by: Siddarth Gore Signed-off-by: Lennert Buytenhek --- arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c | 74 ++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c b/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c index 4fb03f4d3f4..0358f45766c 100644 --- a/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c +++ b/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c @@ -17,6 +17,10 @@ #include #include #include +#include +#include +#include +#include #include #include #include @@ -26,6 +30,7 @@ #include #include #include "common.h" +#include "mpp.h" static struct mv643xx_eth_platform_data mv88f6281gtw_ge_ge00_data = { .phy_addr = MV643XX_ETH_PHY_NONE, @@ -62,12 +67,79 @@ static struct spi_board_info __initdata mv88f6281gtw_ge_spi_slave_info[] = { }, }; +static struct gpio_keys_button mv88f6281gtw_ge_button_pins[] = { + { + .code = KEY_RESTART, + .gpio = 47, + .desc = "SWR Button", + .active_low = 1, + }, { + .code = KEY_F1, + .gpio = 46, + .desc = "WPS Button(F1)", + .active_low = 1, + }, +}; + +static struct gpio_keys_platform_data mv88f6281gtw_ge_button_data = { + .buttons = mv88f6281gtw_ge_button_pins, + .nbuttons = ARRAY_SIZE(mv88f6281gtw_ge_button_pins), +}; + +static struct platform_device mv88f6281gtw_ge_buttons = { + .name = "gpio-keys", + .id = -1, + .num_resources = 0, + .dev = { + .platform_data = &mv88f6281gtw_ge_button_data, + }, +}; + +static struct gpio_led mv88f6281gtw_ge_led_pins[] = { + { + .name = "gtw:green:Status", + .gpio = 20, + .active_low = 0, + }, { + .name = "gtw:red:Status", + .gpio = 21, + .active_low = 0, + }, { + .name = "gtw:green:USB", + .gpio = 12, + .active_low = 0, + }, +}; + +static struct gpio_led_platform_data mv88f6281gtw_ge_led_data = { + .leds = mv88f6281gtw_ge_led_pins, + .num_leds = ARRAY_SIZE(mv88f6281gtw_ge_led_pins), +}; + +static struct platform_device mv88f6281gtw_ge_leds = { + .name = "leds-gpio", + .id = -1, + .dev = { + .platform_data = &mv88f6281gtw_ge_led_data, + }, +}; + +static unsigned int mv88f6281gtw_ge_mpp_config[] __initdata = { + MPP12_GPO, /* Status#_USB pin */ + MPP20_GPIO, /* Status#_GLED pin */ + MPP21_GPIO, /* Status#_RLED pin */ + MPP46_GPIO, /* WPS_Switch pin */ + MPP47_GPIO, /* SW_Init pin */ + 0 +}; + static void __init mv88f6281gtw_ge_init(void) { /* * Basic setup. Needs to be called early. */ kirkwood_init(); + kirkwood_mpp_conf(mv88f6281gtw_ge_mpp_config); kirkwood_ehci_init(); kirkwood_ge00_init(&mv88f6281gtw_ge_ge00_data); @@ -76,6 +148,8 @@ static void __init mv88f6281gtw_ge_init(void) ARRAY_SIZE(mv88f6281gtw_ge_spi_slave_info)); kirkwood_spi_init(); kirkwood_uart0_init(); + platform_device_register(&mv88f6281gtw_ge_leds); + platform_device_register(&mv88f6281gtw_ge_buttons); } static int __init mv88f6281gtw_ge_pci_init(void) -- cgit v1.2.3