diff options
Diffstat (limited to 'arch/avr32/boards')
-rw-r--r-- | arch/avr32/boards/atstk1000/Kconfig | 26 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/atstk1002.c | 62 |
2 files changed, 88 insertions, 0 deletions
diff --git a/arch/avr32/boards/atstk1000/Kconfig b/arch/avr32/boards/atstk1000/Kconfig index 71bc7d364fb7..718578f64069 100644 --- a/arch/avr32/boards/atstk1000/Kconfig +++ b/arch/avr32/boards/atstk1000/Kconfig | |||
@@ -50,4 +50,30 @@ config BOARD_ATSTK1002_SPI1 | |||
50 | GPIO lines and accessed through the J1 jumper block. Say "y" | 50 | GPIO lines and accessed through the J1 jumper block. Say "y" |
51 | here to configure that SPI controller. | 51 | here to configure that SPI controller. |
52 | 52 | ||
53 | config BOARD_ATSTK1002_J2_LED | ||
54 | bool | ||
55 | default BOARD_ATSTK1002_J2_LED8 || BOARD_ATSTK1002_J2_RGB | ||
56 | |||
57 | choice | ||
58 | prompt "LEDs connected to J2:" | ||
59 | depends on LEDS_GPIO && !BOARD_ATSTK1002_SW4_CUSTOM | ||
60 | optional | ||
61 | help | ||
62 | Select this if you have jumpered the J2 jumper block to the | ||
63 | LED0..LED7 amber leds, or to the RGB leds, using a ten-pin | ||
64 | IDC cable. A default "heartbeat" trigger is provided, but | ||
65 | you can of course override this. | ||
66 | |||
67 | config BOARD_ATSTK1002_J2_LED8 | ||
68 | bool "LED0..LED7" | ||
69 | help | ||
70 | Select this if J2 is jumpered to LED0..LED7 amber leds. | ||
71 | |||
72 | config BOARD_ATSTK1002_J2_RGB | ||
73 | bool "RGB leds" | ||
74 | help | ||
75 | Select this if J2 is jumpered to the RGB leds. | ||
76 | |||
77 | endchoice | ||
78 | |||
53 | endif # stk 1002 | 79 | endif # stk 1002 |
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c index cb93eabb9c6c..c9981b731efa 100644 --- a/arch/avr32/boards/atstk1000/atstk1002.c +++ b/arch/avr32/boards/atstk1000/atstk1002.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/etherdevice.h> | 11 | #include <linux/etherdevice.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/leds.h> | ||
14 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
15 | #include <linux/string.h> | 16 | #include <linux/string.h> |
16 | #include <linux/types.h> | 17 | #include <linux/types.h> |
@@ -120,6 +121,65 @@ static void __init set_hw_addr(struct platform_device *pdev) | |||
120 | clk_put(pclk); | 121 | clk_put(pclk); |
121 | } | 122 | } |
122 | 123 | ||
124 | #ifdef CONFIG_BOARD_ATSTK1002_J2_LED | ||
125 | |||
126 | static struct gpio_led stk_j2_led[] = { | ||
127 | #ifdef CONFIG_BOARD_ATSTK1002_J2_LED8 | ||
128 | #define LEDSTRING "J2 jumpered to LED8" | ||
129 | { .name = "led0:amber", .gpio = GPIO_PIN_PB( 8), }, | ||
130 | { .name = "led1:amber", .gpio = GPIO_PIN_PB( 9), }, | ||
131 | { .name = "led2:amber", .gpio = GPIO_PIN_PB(10), }, | ||
132 | { .name = "led3:amber", .gpio = GPIO_PIN_PB(13), }, | ||
133 | { .name = "led4:amber", .gpio = GPIO_PIN_PB(14), }, | ||
134 | { .name = "led5:amber", .gpio = GPIO_PIN_PB(15), }, | ||
135 | { .name = "led6:amber", .gpio = GPIO_PIN_PB(16), }, | ||
136 | { .name = "led7:amber", .gpio = GPIO_PIN_PB(30), | ||
137 | .default_trigger = "heartbeat", }, | ||
138 | #else /* RGB */ | ||
139 | #define LEDSTRING "J2 jumpered to RGB LEDs" | ||
140 | { .name = "r1:red", .gpio = GPIO_PIN_PB( 8), }, | ||
141 | { .name = "g1:green", .gpio = GPIO_PIN_PB(10), }, | ||
142 | { .name = "b1:blue", .gpio = GPIO_PIN_PB(14), }, | ||
143 | |||
144 | { .name = "r2:red", .gpio = GPIO_PIN_PB( 9), | ||
145 | .default_trigger = "heartbeat", }, | ||
146 | { .name = "g2:green", .gpio = GPIO_PIN_PB(13), }, | ||
147 | { .name = "b2:blue", .gpio = GPIO_PIN_PB(15), | ||
148 | .default_trigger = "heartbeat", }, | ||
149 | /* PB16, PB30 unused */ | ||
150 | #endif | ||
151 | }; | ||
152 | |||
153 | static struct gpio_led_platform_data stk_j2_led_data = { | ||
154 | .num_leds = ARRAY_SIZE(stk_j2_led), | ||
155 | .leds = stk_j2_led, | ||
156 | }; | ||
157 | |||
158 | static struct platform_device stk_j2_led_dev = { | ||
159 | .name = "leds-gpio", | ||
160 | .id = 2, /* gpio block J2 */ | ||
161 | .dev = { | ||
162 | .platform_data = &stk_j2_led_data, | ||
163 | }, | ||
164 | }; | ||
165 | |||
166 | static void setup_j2_leds(void) | ||
167 | { | ||
168 | unsigned i; | ||
169 | |||
170 | for (i = 0; i < ARRAY_SIZE(stk_j2_led); i++) | ||
171 | at32_select_gpio(stk_j2_led[i].gpio, AT32_GPIOF_OUTPUT); | ||
172 | |||
173 | printk("STK1002: " LEDSTRING "\n"); | ||
174 | platform_device_register(&stk_j2_led_dev); | ||
175 | } | ||
176 | |||
177 | #else | ||
178 | static void setup_j2_leds(void) | ||
179 | { | ||
180 | } | ||
181 | #endif | ||
182 | |||
123 | void __init setup_board(void) | 183 | void __init setup_board(void) |
124 | { | 184 | { |
125 | #ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM | 185 | #ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM |
@@ -185,6 +245,8 @@ static int __init atstk1002_init(void) | |||
185 | at32_add_device_ssc(0, ATMEL_SSC_TX); | 245 | at32_add_device_ssc(0, ATMEL_SSC_TX); |
186 | #endif | 246 | #endif |
187 | 247 | ||
248 | setup_j2_leds(); | ||
249 | |||
188 | return 0; | 250 | return 0; |
189 | } | 251 | } |
190 | postcore_initcall(atstk1002_init); | 252 | postcore_initcall(atstk1002_init); |