aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/boards/atngw100
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2007-07-08 06:49:53 -0400
committerRichard Purdie <rpurdie@rpsys.net>2007-07-15 20:15:51 -0400
commitf9f451d9cac24b9bd49947d1c6971f3d689381fa (patch)
treea6bcb371f5d9df816860083eecb06050d5e9dff8 /arch/avr32/boards/atngw100
parente3986f6380558b84fef1e7ce7a29fed5bb090721 (diff)
leds: leds-gpio for ngw100
Add GPIO leds to the NGW100 platform and its defconfig. Access through /sys/class/leds/{a,b,sys}/* files; one defaults to a heartbeat. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'arch/avr32/boards/atngw100')
-rw-r--r--arch/avr32/boards/atngw100/setup.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
index 6c4dc0a00e9f..2edcecdea8bd 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -13,6 +13,7 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/leds.h>
16#include <linux/spi/spi.h> 17#include <linux/spi/spi.h>
17 18
18#include <asm/io.h> 19#include <asm/io.h>
@@ -21,6 +22,7 @@
21#include <asm/arch/at32ap7000.h> 22#include <asm/arch/at32ap7000.h>
22#include <asm/arch/board.h> 23#include <asm/arch/board.h>
23#include <asm/arch/init.h> 24#include <asm/arch/init.h>
25#include <asm/arch/portmux.h>
24 26
25/* Initialized by bootloader-specific startup code. */ 27/* Initialized by bootloader-specific startup code. */
26struct tag *bootloader_tags __initdata; 28struct tag *bootloader_tags __initdata;
@@ -100,8 +102,31 @@ void __init setup_board(void)
100 at32_setup_serial_console(0); 102 at32_setup_serial_console(0);
101} 103}
102 104
105static const struct gpio_led ngw_leds[] = {
106 { .name = "sys", .gpio = GPIO_PIN_PA(16), .active_low = 1,
107 .default_trigger = "heartbeat",
108 },
109 { .name = "a", .gpio = GPIO_PIN_PA(19), .active_low = 1, },
110 { .name = "b", .gpio = GPIO_PIN_PE(19), .active_low = 1, },
111};
112
113static const struct gpio_led_platform_data ngw_led_data = {
114 .num_leds = ARRAY_SIZE(ngw_leds),
115 .leds = (void *) ngw_leds,
116};
117
118static struct platform_device ngw_gpio_leds = {
119 .name = "leds-gpio",
120 .id = -1,
121 .dev = {
122 .platform_data = (void *) &ngw_led_data,
123 }
124};
125
103static int __init atngw100_init(void) 126static int __init atngw100_init(void)
104{ 127{
128 unsigned i;
129
105 /* 130 /*
106 * ATNGW100 uses 16-bit SDRAM interface, so we don't need to 131 * ATNGW100 uses 16-bit SDRAM interface, so we don't need to
107 * reserve any pins for it. 132 * reserve any pins for it.
@@ -116,6 +141,12 @@ static int __init atngw100_init(void)
116 141
117 at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); 142 at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info));
118 143
144 for (i = 0; i < ARRAY_SIZE(ngw_leds); i++) {
145 at32_select_gpio(ngw_leds[i].gpio,
146 AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
147 }
148 platform_device_register(&ngw_gpio_leds);
149
119 return 0; 150 return 0;
120} 151}
121postcore_initcall(atngw100_init); 152postcore_initcall(atngw100_init);