diff options
Diffstat (limited to 'arch/avr32/boards')
-rw-r--r-- | arch/avr32/boards/atngw100/setup.c | 2 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/Kconfig | 58 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/Makefile | 2 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/atstk1000.h | 2 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/atstk1002.c | 106 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/atstk1003.c | 162 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/atstk1004.c | 147 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/setup.c | 64 |
8 files changed, 441 insertions, 102 deletions
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c index 52987c81d668..a398be284966 100644 --- a/arch/avr32/boards/atngw100/setup.c +++ b/arch/avr32/boards/atngw100/setup.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <asm/io.h> | 20 | #include <asm/io.h> |
21 | #include <asm/setup.h> | 21 | #include <asm/setup.h> |
22 | 22 | ||
23 | #include <asm/arch/at32ap7000.h> | 23 | #include <asm/arch/at32ap700x.h> |
24 | #include <asm/arch/board.h> | 24 | #include <asm/arch/board.h> |
25 | #include <asm/arch/init.h> | 25 | #include <asm/arch/init.h> |
26 | #include <asm/arch/portmux.h> | 26 | #include <asm/arch/portmux.h> |
diff --git a/arch/avr32/boards/atstk1000/Kconfig b/arch/avr32/boards/atstk1000/Kconfig index 718578f64069..af90b00100fd 100644 --- a/arch/avr32/boards/atstk1000/Kconfig +++ b/arch/avr32/boards/atstk1000/Kconfig | |||
@@ -1,34 +1,53 @@ | |||
1 | # STK1000 customization | 1 | # STK1000 customization |
2 | 2 | ||
3 | if BOARD_ATSTK1002 | 3 | if BOARD_ATSTK1000 |
4 | 4 | ||
5 | config BOARD_ATSTK1002_CUSTOM | 5 | choice |
6 | bool "Non-default STK-1002 jumper settings" | 6 | prompt "ATSTK1000 CPU daughterboard type" |
7 | default BOARD_ATSTK1002 | ||
8 | |||
9 | config BOARD_ATSTK1002 | ||
10 | bool "ATSTK1002" | ||
11 | select CPU_AT32AP7000 | ||
12 | |||
13 | config BOARD_ATSTK1003 | ||
14 | bool "ATSTK1003" | ||
15 | select CPU_AT32AP7001 | ||
16 | |||
17 | config BOARD_ATSTK1004 | ||
18 | bool "ATSTK1004" | ||
19 | select CPU_AT32AP7002 | ||
20 | |||
21 | endchoice | ||
22 | |||
23 | |||
24 | config BOARD_ATSTK100X_CUSTOM | ||
25 | bool "Non-default STK1002/STK1003/STK1004 jumper settings" | ||
7 | help | 26 | help |
8 | You will normally leave the jumpers on the CPU card at their | 27 | You will normally leave the jumpers on the CPU card at their |
9 | default settings. If you need to use certain peripherals, | 28 | default settings. If you need to use certain peripherals, |
10 | you will need to change some of those jumpers. | 29 | you will need to change some of those jumpers. |
11 | 30 | ||
12 | if BOARD_ATSTK1002_CUSTOM | 31 | if BOARD_ATSTK100X_CUSTOM |
13 | 32 | ||
14 | config BOARD_ATSTK1002_SW1_CUSTOM | 33 | config BOARD_ATSTK100X_SW1_CUSTOM |
15 | bool "SW1: use SSC1 (not SPI0)" | 34 | bool "SW1: use SSC1 (not SPI0)" |
16 | help | 35 | help |
17 | This also prevents using the external DAC as an audio interface, | 36 | This also prevents using the external DAC as an audio interface, |
18 | and means you can't initialize the on-board QVGA display. | 37 | and means you can't initialize the on-board QVGA display. |
19 | 38 | ||
20 | config BOARD_ATSTK1002_SW2_CUSTOM | 39 | config BOARD_ATSTK100X_SW2_CUSTOM |
21 | bool "SW2: use IRDA or TIMER0 (not UART-A, MMC/SD, and PS2-A)" | 40 | bool "SW2: use IRDA or TIMER0 (not UART-A, MMC/SD, and PS2-A)" |
22 | help | 41 | help |
23 | If you change this you'll want an updated boot loader putting | 42 | If you change this you'll want an updated boot loader putting |
24 | the console on UART-C not UART-A. | 43 | the console on UART-C not UART-A. |
25 | 44 | ||
26 | config BOARD_ATSTK1002_SW3_CUSTOM | 45 | config BOARD_ATSTK100X_SW3_CUSTOM |
27 | bool "SW3: use TIMER1 (not SSC0 and GCLK)" | 46 | bool "SW3: use TIMER1 (not SSC0 and GCLK)" |
28 | help | 47 | help |
29 | This also prevents using the external DAC as an audio interface. | 48 | This also prevents using the external DAC as an audio interface. |
30 | 49 | ||
31 | config BOARD_ATSTK1002_SW4_CUSTOM | 50 | config BOARD_ATSTK100X_SW4_CUSTOM |
32 | bool "SW4: use ISI/Camera (not GPIOs, SPI1, and PS2-B)" | 51 | bool "SW4: use ISI/Camera (not GPIOs, SPI1, and PS2-B)" |
33 | help | 52 | help |
34 | To use the camera interface you'll need a custom card (on the | 53 | To use the camera interface you'll need a custom card (on the |
@@ -36,27 +55,29 @@ config BOARD_ATSTK1002_SW4_CUSTOM | |||
36 | 55 | ||
37 | config BOARD_ATSTK1002_SW5_CUSTOM | 56 | config BOARD_ATSTK1002_SW5_CUSTOM |
38 | bool "SW5: use MACB1 (not LCDC)" | 57 | bool "SW5: use MACB1 (not LCDC)" |
58 | depends on BOARD_ATSTK1002 | ||
39 | 59 | ||
40 | config BOARD_ATSTK1002_SW6_CUSTOM | 60 | config BOARD_ATSTK1002_SW6_CUSTOM |
41 | bool "SW6: more GPIOs (not MACB0)" | 61 | bool "SW6: more GPIOs (not MACB0)" |
62 | depends on BOARD_ATSTK1002 | ||
42 | 63 | ||
43 | endif # custom | 64 | endif # custom |
44 | 65 | ||
45 | config BOARD_ATSTK1002_SPI1 | 66 | config BOARD_ATSTK100X_SPI1 |
46 | bool "Configure SPI1 controller" | 67 | bool "Configure SPI1 controller" |
47 | depends on !BOARD_ATSTK1002_SW4_CUSTOM | 68 | depends on !BOARD_ATSTK100X_SW4_CUSTOM |
48 | help | 69 | help |
49 | All the signals for the second SPI controller are available on | 70 | All the signals for the second SPI controller are available on |
50 | GPIO lines and accessed through the J1 jumper block. Say "y" | 71 | GPIO lines and accessed through the J1 jumper block. Say "y" |
51 | here to configure that SPI controller. | 72 | here to configure that SPI controller. |
52 | 73 | ||
53 | config BOARD_ATSTK1002_J2_LED | 74 | config BOARD_ATSTK1000_J2_LED |
54 | bool | 75 | bool |
55 | default BOARD_ATSTK1002_J2_LED8 || BOARD_ATSTK1002_J2_RGB | 76 | default BOARD_ATSTK1000_J2_LED8 || BOARD_ATSTK1000_J2_RGB |
56 | 77 | ||
57 | choice | 78 | choice |
58 | prompt "LEDs connected to J2:" | 79 | prompt "LEDs connected to J2:" |
59 | depends on LEDS_GPIO && !BOARD_ATSTK1002_SW4_CUSTOM | 80 | depends on LEDS_GPIO && !BOARD_ATSTK100X_SW4_CUSTOM |
60 | optional | 81 | optional |
61 | help | 82 | help |
62 | Select this if you have jumpered the J2 jumper block to the | 83 | Select this if you have jumpered the J2 jumper block to the |
@@ -64,16 +85,21 @@ choice | |||
64 | IDC cable. A default "heartbeat" trigger is provided, but | 85 | IDC cable. A default "heartbeat" trigger is provided, but |
65 | you can of course override this. | 86 | you can of course override this. |
66 | 87 | ||
67 | config BOARD_ATSTK1002_J2_LED8 | 88 | config BOARD_ATSTK1000_J2_LED8 |
68 | bool "LED0..LED7" | 89 | bool "LED0..LED7" |
69 | help | 90 | help |
70 | Select this if J2 is jumpered to LED0..LED7 amber leds. | 91 | Select this if J2 is jumpered to LED0..LED7 amber leds. |
71 | 92 | ||
72 | config BOARD_ATSTK1002_J2_RGB | 93 | config BOARD_ATSTK1000_J2_RGB |
73 | bool "RGB leds" | 94 | bool "RGB leds" |
74 | help | 95 | help |
75 | Select this if J2 is jumpered to the RGB leds. | 96 | Select this if J2 is jumpered to the RGB leds. |
76 | 97 | ||
77 | endchoice | 98 | endchoice |
78 | 99 | ||
79 | endif # stk 1002 | 100 | config BOARD_ATSTK1000_EXTDAC |
101 | bool | ||
102 | depends on !BOARD_ATSTK100X_SW1_CUSTOM && !BOARD_ATSTK100X_SW3_CUSTOM | ||
103 | default y | ||
104 | |||
105 | endif # stk 1000 | ||
diff --git a/arch/avr32/boards/atstk1000/Makefile b/arch/avr32/boards/atstk1000/Makefile index 8e0992201bb9..beead86462e8 100644 --- a/arch/avr32/boards/atstk1000/Makefile +++ b/arch/avr32/boards/atstk1000/Makefile | |||
@@ -1,2 +1,4 @@ | |||
1 | obj-y += setup.o flash.o | 1 | obj-y += setup.o flash.o |
2 | obj-$(CONFIG_BOARD_ATSTK1002) += atstk1002.o | 2 | obj-$(CONFIG_BOARD_ATSTK1002) += atstk1002.o |
3 | obj-$(CONFIG_BOARD_ATSTK1003) += atstk1003.o | ||
4 | obj-$(CONFIG_BOARD_ATSTK1004) += atstk1004.o | ||
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 | ||
13 | extern struct atmel_lcdfb_info atstk1000_lcdc_data; | 13 | extern struct atmel_lcdfb_info atstk1000_lcdc_data; |
14 | 14 | ||
15 | void 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..000eb4220a12 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> |
@@ -49,18 +48,16 @@ static struct eth_platform_data __initdata eth_data[2] = { | |||
49 | }, | 48 | }, |
50 | }; | 49 | }; |
51 | 50 | ||
52 | #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM | 51 | #ifdef CONFIG_BOARD_ATSTK1000_EXTDAC |
53 | #ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM | ||
54 | static struct at73c213_board_info at73c213_data = { | 52 | static struct at73c213_board_info at73c213_data = { |
55 | .ssc_id = 0, | 53 | .ssc_id = 0, |
56 | .shortname = "AVR32 STK1000 external DAC", | 54 | .shortname = "AVR32 STK1000 external DAC", |
57 | }; | 55 | }; |
58 | #endif | 56 | #endif |
59 | #endif | ||
60 | 57 | ||
61 | #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM | 58 | #ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM |
62 | static struct spi_board_info spi0_board_info[] __initdata = { | 59 | static struct spi_board_info spi0_board_info[] __initdata = { |
63 | #ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM | 60 | #ifdef CONFIG_BOARD_ATSTK1000_EXTDAC |
64 | { | 61 | { |
65 | /* AT73C213 */ | 62 | /* AT73C213 */ |
66 | .modalias = "at73c213", | 63 | .modalias = "at73c213", |
@@ -80,7 +77,7 @@ static struct spi_board_info spi0_board_info[] __initdata = { | |||
80 | }; | 77 | }; |
81 | #endif | 78 | #endif |
82 | 79 | ||
83 | #ifdef CONFIG_BOARD_ATSTK1002_SPI1 | 80 | #ifdef CONFIG_BOARD_ATSTK100X_SPI1 |
84 | static struct spi_board_info spi1_board_info[] __initdata = { { | 81 | static struct spi_board_info spi1_board_info[] __initdata = { { |
85 | /* patch in custom entries here */ | 82 | /* patch in custom entries here */ |
86 | } }; | 83 | } }; |
@@ -141,68 +138,8 @@ static void __init set_hw_addr(struct platform_device *pdev) | |||
141 | clk_put(pclk); | 138 | clk_put(pclk); |
142 | } | 139 | } |
143 | 140 | ||
144 | #ifdef CONFIG_BOARD_ATSTK1002_J2_LED | 141 | #ifdef CONFIG_BOARD_ATSTK1000_EXTDAC |
145 | 142 | static void __init atstk1002_setup_extdac(void) | |
146 | static 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 | |||
173 | static struct gpio_led_platform_data stk_j2_led_data = { | ||
174 | .num_leds = ARRAY_SIZE(stk_j2_led), | ||
175 | .leds = stk_j2_led, | ||
176 | }; | ||
177 | |||
178 | static 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 | |||
186 | static 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 | ||
198 | static void setup_j2_leds(void) | ||
199 | { | ||
200 | } | ||
201 | #endif | ||
202 | |||
203 | #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM | ||
204 | #ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM | ||
205 | static void __init at73c213_set_clk(struct at73c213_board_info *info) | ||
206 | { | 143 | { |
207 | struct clk *gclk; | 144 | struct clk *gclk; |
208 | struct clk *pll; | 145 | struct clk *pll; |
@@ -220,7 +157,7 @@ static void __init at73c213_set_clk(struct at73c213_board_info *info) | |||
220 | } | 157 | } |
221 | 158 | ||
222 | at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0); | 159 | at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0); |
223 | info->dac_clk = gclk; | 160 | at73c213_data.dac_clk = gclk; |
224 | 161 | ||
225 | err_set_clk: | 162 | err_set_clk: |
226 | clk_put(pll); | 163 | clk_put(pll); |
@@ -229,12 +166,16 @@ err_pll: | |||
229 | err_gclk: | 166 | err_gclk: |
230 | return; | 167 | return; |
231 | } | 168 | } |
232 | #endif | 169 | #else |
233 | #endif | 170 | static void __init atstk1002_setup_extdac(void) |
171 | { | ||
172 | |||
173 | } | ||
174 | #endif /* CONFIG_BOARD_ATSTK1000_EXTDAC */ | ||
234 | 175 | ||
235 | void __init setup_board(void) | 176 | void __init setup_board(void) |
236 | { | 177 | { |
237 | #ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM | 178 | #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM |
238 | at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ | 179 | at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ |
239 | #else | 180 | #else |
240 | at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ | 181 | at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ |
@@ -271,7 +212,7 @@ static int __init atstk1002_init(void) | |||
271 | 212 | ||
272 | at32_add_system_devices(); | 213 | at32_add_system_devices(); |
273 | 214 | ||
274 | #ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM | 215 | #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM |
275 | at32_add_device_usart(1); | 216 | at32_add_device_usart(1); |
276 | #else | 217 | #else |
277 | at32_add_device_usart(0); | 218 | at32_add_device_usart(0); |
@@ -281,10 +222,10 @@ static int __init atstk1002_init(void) | |||
281 | #ifndef CONFIG_BOARD_ATSTK1002_SW6_CUSTOM | 222 | #ifndef CONFIG_BOARD_ATSTK1002_SW6_CUSTOM |
282 | set_hw_addr(at32_add_device_eth(0, ð_data[0])); | 223 | set_hw_addr(at32_add_device_eth(0, ð_data[0])); |
283 | #endif | 224 | #endif |
284 | #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM | 225 | #ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM |
285 | at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); | 226 | at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); |
286 | #endif | 227 | #endif |
287 | #ifdef CONFIG_BOARD_ATSTK1002_SPI1 | 228 | #ifdef CONFIG_BOARD_ATSTK100X_SPI1 |
288 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); | 229 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); |
289 | #endif | 230 | #endif |
290 | #ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM | 231 | #ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM |
@@ -294,17 +235,12 @@ static int __init atstk1002_init(void) | |||
294 | fbmem_start, fbmem_size); | 235 | fbmem_start, fbmem_size); |
295 | #endif | 236 | #endif |
296 | at32_add_device_usba(0, NULL); | 237 | at32_add_device_usba(0, NULL); |
297 | #ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM | 238 | #ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM |
298 | at32_add_device_ssc(0, ATMEL_SSC_TX); | 239 | at32_add_device_ssc(0, ATMEL_SSC_TX); |
299 | #endif | 240 | #endif |
300 | 241 | ||
301 | setup_j2_leds(); | 242 | atstk1000_setup_j2_leds(); |
302 | 243 | atstk1002_setup_extdac(); | |
303 | #ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM | ||
304 | #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM | ||
305 | at73c213_set_clk(&at73c213_data); | ||
306 | #endif | ||
307 | #endif | ||
308 | 244 | ||
309 | return 0; | 245 | return 0; |
310 | } | 246 | } |
diff --git a/arch/avr32/boards/atstk1000/atstk1003.c b/arch/avr32/boards/atstk1000/atstk1003.c new file mode 100644 index 000000000000..a0b223df35a2 --- /dev/null +++ b/arch/avr32/boards/atstk1000/atstk1003.c | |||
@@ -0,0 +1,162 @@ | |||
1 | /* | ||
2 | * ATSTK1003 daughterboard-specific init code | ||
3 | * | ||
4 | * Copyright (C) 2007 Atmel Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #include <linux/clk.h> | ||
11 | #include <linux/err.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/string.h> | ||
16 | #include <linux/types.h> | ||
17 | |||
18 | #include <linux/spi/at73c213.h> | ||
19 | #include <linux/spi/spi.h> | ||
20 | |||
21 | #include <asm/setup.h> | ||
22 | |||
23 | #include <asm/arch/at32ap700x.h> | ||
24 | #include <asm/arch/board.h> | ||
25 | #include <asm/arch/init.h> | ||
26 | #include <asm/arch/portmux.h> | ||
27 | |||
28 | #include "atstk1000.h" | ||
29 | |||
30 | #ifdef CONFIG_BOARD_ATSTK1000_EXTDAC | ||
31 | static struct at73c213_board_info at73c213_data = { | ||
32 | .ssc_id = 0, | ||
33 | .shortname = "AVR32 STK1000 external DAC", | ||
34 | }; | ||
35 | #endif | ||
36 | |||
37 | #ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM | ||
38 | static struct spi_board_info spi0_board_info[] __initdata = { | ||
39 | #ifdef CONFIG_BOARD_ATSTK1000_EXTDAC | ||
40 | { | ||
41 | /* AT73C213 */ | ||
42 | .modalias = "at73c213", | ||
43 | .max_speed_hz = 200000, | ||
44 | .chip_select = 0, | ||
45 | .mode = SPI_MODE_1, | ||
46 | .platform_data = &at73c213_data, | ||
47 | }, | ||
48 | #endif | ||
49 | /* | ||
50 | * We can control the LTV350QV LCD panel, but it isn't much | ||
51 | * point since we don't have an LCD controller... | ||
52 | */ | ||
53 | }; | ||
54 | #endif | ||
55 | |||
56 | #ifdef CONFIG_BOARD_ATSTK100X_SPI1 | ||
57 | static struct spi_board_info spi1_board_info[] __initdata = { { | ||
58 | /* patch in custom entries here */ | ||
59 | } }; | ||
60 | #endif | ||
61 | |||
62 | #ifdef CONFIG_BOARD_ATSTK1000_EXTDAC | ||
63 | static void __init atstk1003_setup_extdac(void) | ||
64 | { | ||
65 | struct clk *gclk; | ||
66 | struct clk *pll; | ||
67 | |||
68 | gclk = clk_get(NULL, "gclk0"); | ||
69 | if (IS_ERR(gclk)) | ||
70 | goto err_gclk; | ||
71 | pll = clk_get(NULL, "pll0"); | ||
72 | if (IS_ERR(pll)) | ||
73 | goto err_pll; | ||
74 | |||
75 | if (clk_set_parent(gclk, pll)) { | ||
76 | pr_debug("STK1000: failed to set pll0 as parent for DAC clock\n"); | ||
77 | goto err_set_clk; | ||
78 | } | ||
79 | |||
80 | at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0); | ||
81 | at73c213_data.dac_clk = gclk; | ||
82 | |||
83 | err_set_clk: | ||
84 | clk_put(pll); | ||
85 | err_pll: | ||
86 | clk_put(gclk); | ||
87 | err_gclk: | ||
88 | return; | ||
89 | } | ||
90 | #else | ||
91 | static void __init atstk1003_setup_extdac(void) | ||
92 | { | ||
93 | |||
94 | } | ||
95 | #endif /* CONFIG_BOARD_ATSTK1000_EXTDAC */ | ||
96 | |||
97 | void __init setup_board(void) | ||
98 | { | ||
99 | #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM | ||
100 | at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ | ||
101 | #else | ||
102 | at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ | ||
103 | #endif | ||
104 | /* USART 2/unused: expansion connector */ | ||
105 | at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */ | ||
106 | |||
107 | at32_setup_serial_console(0); | ||
108 | } | ||
109 | |||
110 | static int __init atstk1003_init(void) | ||
111 | { | ||
112 | /* | ||
113 | * ATSTK1000 uses 32-bit SDRAM interface. Reserve the | ||
114 | * SDRAM-specific pins so that nobody messes with them. | ||
115 | */ | ||
116 | at32_reserve_pin(GPIO_PIN_PE(0)); /* DATA[16] */ | ||
117 | at32_reserve_pin(GPIO_PIN_PE(1)); /* DATA[17] */ | ||
118 | at32_reserve_pin(GPIO_PIN_PE(2)); /* DATA[18] */ | ||
119 | at32_reserve_pin(GPIO_PIN_PE(3)); /* DATA[19] */ | ||
120 | at32_reserve_pin(GPIO_PIN_PE(4)); /* DATA[20] */ | ||
121 | at32_reserve_pin(GPIO_PIN_PE(5)); /* DATA[21] */ | ||
122 | at32_reserve_pin(GPIO_PIN_PE(6)); /* DATA[22] */ | ||
123 | at32_reserve_pin(GPIO_PIN_PE(7)); /* DATA[23] */ | ||
124 | at32_reserve_pin(GPIO_PIN_PE(8)); /* DATA[24] */ | ||
125 | at32_reserve_pin(GPIO_PIN_PE(9)); /* DATA[25] */ | ||
126 | at32_reserve_pin(GPIO_PIN_PE(10)); /* DATA[26] */ | ||
127 | at32_reserve_pin(GPIO_PIN_PE(11)); /* DATA[27] */ | ||
128 | at32_reserve_pin(GPIO_PIN_PE(12)); /* DATA[28] */ | ||
129 | at32_reserve_pin(GPIO_PIN_PE(13)); /* DATA[29] */ | ||
130 | at32_reserve_pin(GPIO_PIN_PE(14)); /* DATA[30] */ | ||
131 | at32_reserve_pin(GPIO_PIN_PE(15)); /* DATA[31] */ | ||
132 | at32_reserve_pin(GPIO_PIN_PE(26)); /* SDCS */ | ||
133 | |||
134 | at32_add_system_devices(); | ||
135 | |||
136 | #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM | ||
137 | at32_add_device_usart(1); | ||
138 | #else | ||
139 | at32_add_device_usart(0); | ||
140 | #endif | ||
141 | at32_add_device_usart(2); | ||
142 | |||
143 | #ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM | ||
144 | at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); | ||
145 | #endif | ||
146 | #ifdef CONFIG_BOARD_ATSTK100X_SPI1 | ||
147 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); | ||
148 | #endif | ||
149 | #ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM | ||
150 | at32_add_device_mci(0); | ||
151 | #endif | ||
152 | at32_add_device_usba(0, NULL); | ||
153 | #ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM | ||
154 | at32_add_device_ssc(0, ATMEL_SSC_TX); | ||
155 | #endif | ||
156 | |||
157 | atstk1000_setup_j2_leds(); | ||
158 | atstk1003_setup_extdac(); | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | postcore_initcall(atstk1003_init); | ||
diff --git a/arch/avr32/boards/atstk1000/atstk1004.c b/arch/avr32/boards/atstk1000/atstk1004.c new file mode 100644 index 000000000000..5a77030e07a0 --- /dev/null +++ b/arch/avr32/boards/atstk1000/atstk1004.c | |||
@@ -0,0 +1,147 @@ | |||
1 | /* | ||
2 | * ATSTK1003 daughterboard-specific init code | ||
3 | * | ||
4 | * Copyright (C) 2007 Atmel Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #include <linux/clk.h> | ||
11 | #include <linux/err.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/string.h> | ||
16 | #include <linux/types.h> | ||
17 | |||
18 | #include <linux/spi/at73c213.h> | ||
19 | #include <linux/spi/spi.h> | ||
20 | |||
21 | #include <video/atmel_lcdc.h> | ||
22 | |||
23 | #include <asm/setup.h> | ||
24 | |||
25 | #include <asm/arch/at32ap700x.h> | ||
26 | #include <asm/arch/board.h> | ||
27 | #include <asm/arch/init.h> | ||
28 | #include <asm/arch/portmux.h> | ||
29 | |||
30 | #include "atstk1000.h" | ||
31 | |||
32 | #ifdef CONFIG_BOARD_ATSTK1000_EXTDAC | ||
33 | static struct at73c213_board_info at73c213_data = { | ||
34 | .ssc_id = 0, | ||
35 | .shortname = "AVR32 STK1000 external DAC", | ||
36 | }; | ||
37 | #endif | ||
38 | |||
39 | #ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM | ||
40 | static struct spi_board_info spi0_board_info[] __initdata = { | ||
41 | #ifdef CONFIG_BOARD_ATSTK1000_EXTDAC | ||
42 | { | ||
43 | /* AT73C213 */ | ||
44 | .modalias = "at73c213", | ||
45 | .max_speed_hz = 200000, | ||
46 | .chip_select = 0, | ||
47 | .mode = SPI_MODE_1, | ||
48 | .platform_data = &at73c213_data, | ||
49 | }, | ||
50 | #endif | ||
51 | { | ||
52 | /* QVGA display */ | ||
53 | .modalias = "ltv350qv", | ||
54 | .max_speed_hz = 16000000, | ||
55 | .chip_select = 1, | ||
56 | .mode = SPI_MODE_3, | ||
57 | }, | ||
58 | }; | ||
59 | #endif | ||
60 | |||
61 | #ifdef CONFIG_BOARD_ATSTK100X_SPI1 | ||
62 | static struct spi_board_info spi1_board_info[] __initdata = { { | ||
63 | /* patch in custom entries here */ | ||
64 | } }; | ||
65 | #endif | ||
66 | |||
67 | #ifdef CONFIG_BOARD_ATSTK1000_EXTDAC | ||
68 | static void __init atstk1004_setup_extdac(void) | ||
69 | { | ||
70 | struct clk *gclk; | ||
71 | struct clk *pll; | ||
72 | |||
73 | gclk = clk_get(NULL, "gclk0"); | ||
74 | if (IS_ERR(gclk)) | ||
75 | goto err_gclk; | ||
76 | pll = clk_get(NULL, "pll0"); | ||
77 | if (IS_ERR(pll)) | ||
78 | goto err_pll; | ||
79 | |||
80 | if (clk_set_parent(gclk, pll)) { | ||
81 | pr_debug("STK1000: failed to set pll0 as parent for DAC clock\n"); | ||
82 | goto err_set_clk; | ||
83 | } | ||
84 | |||
85 | at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0); | ||
86 | at73c213_data.dac_clk = gclk; | ||
87 | |||
88 | err_set_clk: | ||
89 | clk_put(pll); | ||
90 | err_pll: | ||
91 | clk_put(gclk); | ||
92 | err_gclk: | ||
93 | return; | ||
94 | } | ||
95 | #else | ||
96 | static void __init atstk1004_setup_extdac(void) | ||
97 | { | ||
98 | |||
99 | } | ||
100 | #endif /* CONFIG_BOARD_ATSTK1000_EXTDAC */ | ||
101 | |||
102 | void __init setup_board(void) | ||
103 | { | ||
104 | #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM | ||
105 | at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ | ||
106 | #else | ||
107 | at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ | ||
108 | #endif | ||
109 | /* USART 2/unused: expansion connector */ | ||
110 | at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */ | ||
111 | |||
112 | at32_setup_serial_console(0); | ||
113 | } | ||
114 | |||
115 | static int __init atstk1004_init(void) | ||
116 | { | ||
117 | at32_add_system_devices(); | ||
118 | |||
119 | #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM | ||
120 | at32_add_device_usart(1); | ||
121 | #else | ||
122 | at32_add_device_usart(0); | ||
123 | #endif | ||
124 | at32_add_device_usart(2); | ||
125 | |||
126 | #ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM | ||
127 | at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info)); | ||
128 | #endif | ||
129 | #ifdef CONFIG_BOARD_ATSTK100X_SPI1 | ||
130 | at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); | ||
131 | #endif | ||
132 | #ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM | ||
133 | at32_add_device_mci(0); | ||
134 | #endif | ||
135 | at32_add_device_lcdc(0, &atstk1000_lcdc_data, | ||
136 | fbmem_start, fbmem_size); | ||
137 | at32_add_device_usba(0, NULL); | ||
138 | #ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM | ||
139 | at32_add_device_ssc(0, ATMEL_SSC_TX); | ||
140 | #endif | ||
141 | |||
142 | atstk1000_setup_j2_leds(); | ||
143 | atstk1004_setup_extdac(); | ||
144 | |||
145 | return 0; | ||
146 | } | ||
147 | postcore_initcall(atstk1004_init); | ||
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 | |||
72 | static 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 | |||
99 | static struct gpio_led_platform_data stk1000_j2_led_data = { | ||
100 | .num_leds = ARRAY_SIZE(stk1000_j2_led), | ||
101 | .leds = stk1000_j2_led, | ||
102 | }; | ||
103 | |||
104 | static 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 | |||
112 | void __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 */ | ||
123 | void __init atstk1000_setup_j2_leds(void) | ||
124 | { | ||
125 | |||
126 | } | ||
127 | #endif /* CONFIG_BOARD_ATSTK1000_J2_LED */ | ||