aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/boards
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2007-10-29 11:02:51 -0400
committerHaavard Skinnemoen <hskinnemoen@atmel.com>2008-01-25 02:31:42 -0500
commitf4c41b2689eec03bd4f8145a08903862673e002b (patch)
tree73926a1ba8dab66a10323ce3359245eee846273c /arch/avr32/boards
parent438ff3f3cc33833206a48492e9d6674e4e82bed8 (diff)
[AVR32] ATSTK1000: Move gpio-leds setup to setup.c
There may be other boards than STK1002 that want to use the leds on STK1000. Move it to stk1000 common code to make it easier to reuse. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/boards')
-rw-r--r--arch/avr32/boards/atstk1000/Kconfig8
-rw-r--r--arch/avr32/boards/atstk1000/atstk1000.h2
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c64
-rw-r--r--arch/avr32/boards/atstk1000/setup.c64
4 files changed, 72 insertions, 66 deletions
diff --git a/arch/avr32/boards/atstk1000/Kconfig b/arch/avr32/boards/atstk1000/Kconfig
index 718578f64069..dcf9e9e2b289 100644
--- a/arch/avr32/boards/atstk1000/Kconfig
+++ b/arch/avr32/boards/atstk1000/Kconfig
@@ -50,9 +50,9 @@ 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
53config BOARD_ATSTK1002_J2_LED 53config BOARD_ATSTK1000_J2_LED
54 bool 54 bool
55 default BOARD_ATSTK1002_J2_LED8 || BOARD_ATSTK1002_J2_RGB 55 default BOARD_ATSTK1000_J2_LED8 || BOARD_ATSTK1000_J2_RGB
56 56
57choice 57choice
58 prompt "LEDs connected to J2:" 58 prompt "LEDs connected to J2:"
@@ -64,12 +64,12 @@ choice
64 IDC cable. A default "heartbeat" trigger is provided, but 64 IDC cable. A default "heartbeat" trigger is provided, but
65 you can of course override this. 65 you can of course override this.
66 66
67config BOARD_ATSTK1002_J2_LED8 67config BOARD_ATSTK1000_J2_LED8
68 bool "LED0..LED7" 68 bool "LED0..LED7"
69 help 69 help
70 Select this if J2 is jumpered to LED0..LED7 amber leds. 70 Select this if J2 is jumpered to LED0..LED7 amber leds.
71 71
72config BOARD_ATSTK1002_J2_RGB 72config BOARD_ATSTK1000_J2_RGB
73 bool "RGB leds" 73 bool "RGB leds"
74 help 74 help
75 Select this if J2 is jumpered to the RGB leds. 75 Select this if J2 is jumpered to the RGB leds.
diff --git a/arch/avr32/boards/atstk1000/atstk1000.h b/arch/avr32/boards/atstk1000/atstk1000.h
index 9a49ed036b72..9392d3252865 100644
--- a/arch/avr32/boards/atstk1000/atstk1000.h
+++ b/arch/avr32/boards/atstk1000/atstk1000.h
@@ -12,4 +12,6 @@
12 12
13extern struct atmel_lcdfb_info atstk1000_lcdc_data; 13extern struct atmel_lcdfb_info atstk1000_lcdc_data;
14 14
15void atstk1000_setup_j2_leds(void);
16
15#endif /* __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H */ 17#endif /* __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H */
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 5be0d13f4b03..2481d2389873 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -11,7 +11,6 @@
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>
15#include <linux/platform_device.h> 14#include <linux/platform_device.h>
16#include <linux/string.h> 15#include <linux/string.h>
17#include <linux/types.h> 16#include <linux/types.h>
@@ -22,7 +21,7 @@
22 21
23#include <asm/io.h> 22#include <asm/io.h>
24#include <asm/setup.h> 23#include <asm/setup.h>
25#include <asm/arch/at32ap7000.h> 24#include <asm/arch/at32ap700x.h>
26#include <asm/arch/board.h> 25#include <asm/arch/board.h>
27#include <asm/arch/init.h> 26#include <asm/arch/init.h>
28#include <asm/arch/portmux.h> 27#include <asm/arch/portmux.h>
@@ -141,65 +140,6 @@ static void __init set_hw_addr(struct platform_device *pdev)
141 clk_put(pclk); 140 clk_put(pclk);
142} 141}
143 142
144#ifdef CONFIG_BOARD_ATSTK1002_J2_LED
145
146static struct gpio_led stk_j2_led[] = {
147#ifdef CONFIG_BOARD_ATSTK1002_J2_LED8
148#define LEDSTRING "J2 jumpered to LED8"
149 { .name = "led0:amber", .gpio = GPIO_PIN_PB( 8), },
150 { .name = "led1:amber", .gpio = GPIO_PIN_PB( 9), },
151 { .name = "led2:amber", .gpio = GPIO_PIN_PB(10), },
152 { .name = "led3:amber", .gpio = GPIO_PIN_PB(13), },
153 { .name = "led4:amber", .gpio = GPIO_PIN_PB(14), },
154 { .name = "led5:amber", .gpio = GPIO_PIN_PB(15), },
155 { .name = "led6:amber", .gpio = GPIO_PIN_PB(16), },
156 { .name = "led7:amber", .gpio = GPIO_PIN_PB(30),
157 .default_trigger = "heartbeat", },
158#else /* RGB */
159#define LEDSTRING "J2 jumpered to RGB LEDs"
160 { .name = "r1:red", .gpio = GPIO_PIN_PB( 8), },
161 { .name = "g1:green", .gpio = GPIO_PIN_PB(10), },
162 { .name = "b1:blue", .gpio = GPIO_PIN_PB(14), },
163
164 { .name = "r2:red", .gpio = GPIO_PIN_PB( 9),
165 .default_trigger = "heartbeat", },
166 { .name = "g2:green", .gpio = GPIO_PIN_PB(13), },
167 { .name = "b2:blue", .gpio = GPIO_PIN_PB(15),
168 .default_trigger = "heartbeat", },
169 /* PB16, PB30 unused */
170#endif
171};
172
173static struct gpio_led_platform_data stk_j2_led_data = {
174 .num_leds = ARRAY_SIZE(stk_j2_led),
175 .leds = stk_j2_led,
176};
177
178static struct platform_device stk_j2_led_dev = {
179 .name = "leds-gpio",
180 .id = 2, /* gpio block J2 */
181 .dev = {
182 .platform_data = &stk_j2_led_data,
183 },
184};
185
186static void setup_j2_leds(void)
187{
188 unsigned i;
189
190 for (i = 0; i < ARRAY_SIZE(stk_j2_led); i++)
191 at32_select_gpio(stk_j2_led[i].gpio, AT32_GPIOF_OUTPUT);
192
193 printk("STK1002: " LEDSTRING "\n");
194 platform_device_register(&stk_j2_led_dev);
195}
196
197#else
198static void setup_j2_leds(void)
199{
200}
201#endif
202
203#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM 143#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
204#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM 144#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
205static void __init at73c213_set_clk(struct at73c213_board_info *info) 145static void __init at73c213_set_clk(struct at73c213_board_info *info)
@@ -298,7 +238,7 @@ static int __init atstk1002_init(void)
298 at32_add_device_ssc(0, ATMEL_SSC_TX); 238 at32_add_device_ssc(0, ATMEL_SSC_TX);
299#endif 239#endif
300 240
301 setup_j2_leds(); 241 atstk1000_setup_j2_leds();
302 242
303#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM 243#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
304#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM 244#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
diff --git a/arch/avr32/boards/atstk1000/setup.c b/arch/avr32/boards/atstk1000/setup.c
index c9af409ada9a..8bedf93876a3 100644
--- a/arch/avr32/boards/atstk1000/setup.c
+++ b/arch/avr32/boards/atstk1000/setup.c
@@ -10,13 +10,17 @@
10#include <linux/bootmem.h> 10#include <linux/bootmem.h>
11#include <linux/fb.h> 11#include <linux/fb.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h>
13#include <linux/types.h> 14#include <linux/types.h>
14#include <linux/linkage.h> 15#include <linux/linkage.h>
15 16
16#include <video/atmel_lcdc.h> 17#include <video/atmel_lcdc.h>
17 18
18#include <asm/setup.h> 19#include <asm/setup.h>
20
21#include <asm/arch/at32ap700x.h>
19#include <asm/arch/board.h> 22#include <asm/arch/board.h>
23#include <asm/arch/portmux.h>
20 24
21#include "atstk1000.h" 25#include "atstk1000.h"
22 26
@@ -61,3 +65,63 @@ struct atmel_lcdfb_info __initdata atstk1000_lcdc_data = {
61 .default_monspecs = &atstk1000_default_monspecs, 65 .default_monspecs = &atstk1000_default_monspecs,
62 .guard_time = 2, 66 .guard_time = 2,
63}; 67};
68
69#ifdef CONFIG_BOARD_ATSTK1000_J2_LED
70#include <linux/leds.h>
71
72static struct gpio_led stk1000_j2_led[] = {
73#ifdef CONFIG_BOARD_ATSTK1000_J2_LED8
74#define LEDSTRING "J2 jumpered to LED8"
75 { .name = "led0:amber", .gpio = GPIO_PIN_PB( 8), },
76 { .name = "led1:amber", .gpio = GPIO_PIN_PB( 9), },
77 { .name = "led2:amber", .gpio = GPIO_PIN_PB(10), },
78 { .name = "led3:amber", .gpio = GPIO_PIN_PB(13), },
79 { .name = "led4:amber", .gpio = GPIO_PIN_PB(14), },
80 { .name = "led5:amber", .gpio = GPIO_PIN_PB(15), },
81 { .name = "led6:amber", .gpio = GPIO_PIN_PB(16), },
82 { .name = "led7:amber", .gpio = GPIO_PIN_PB(30),
83 .default_trigger = "heartbeat", },
84#else /* RGB */
85#define LEDSTRING "J2 jumpered to RGB LEDs"
86 { .name = "r1:red", .gpio = GPIO_PIN_PB( 8), },
87 { .name = "g1:green", .gpio = GPIO_PIN_PB(10), },
88 { .name = "b1:blue", .gpio = GPIO_PIN_PB(14), },
89
90 { .name = "r2:red", .gpio = GPIO_PIN_PB( 9),
91 .default_trigger = "heartbeat", },
92 { .name = "g2:green", .gpio = GPIO_PIN_PB(13), },
93 { .name = "b2:blue", .gpio = GPIO_PIN_PB(15),
94 .default_trigger = "heartbeat", },
95 /* PB16, PB30 unused */
96#endif
97};
98
99static struct gpio_led_platform_data stk1000_j2_led_data = {
100 .num_leds = ARRAY_SIZE(stk1000_j2_led),
101 .leds = stk1000_j2_led,
102};
103
104static struct platform_device stk1000_j2_led_dev = {
105 .name = "leds-gpio",
106 .id = 2, /* gpio block J2 */
107 .dev = {
108 .platform_data = &stk1000_j2_led_data,
109 },
110};
111
112void __init atstk1000_setup_j2_leds(void)
113{
114 unsigned i;
115
116 for (i = 0; i < ARRAY_SIZE(stk1000_j2_led); i++)
117 at32_select_gpio(stk1000_j2_led[i].gpio, AT32_GPIOF_OUTPUT);
118
119 printk("STK1000: " LEDSTRING "\n");
120 platform_device_register(&stk1000_j2_led_dev);
121}
122#else /* CONFIG_BOARD_ATSTK1000_J2_LED */
123void __init atstk1000_setup_j2_leds(void)
124{
125
126}
127#endif /* CONFIG_BOARD_ATSTK1000_J2_LED */