diff options
Diffstat (limited to 'arch/avr32/boards/atstk1000')
-rw-r--r-- | arch/avr32/boards/atstk1000/Kconfig | 28 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/Makefile | 2 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/atstk1002.c | 14 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/atstk1003.c | 162 | ||||
-rw-r--r-- | arch/avr32/boards/atstk1000/atstk1004.c | 147 |
5 files changed, 333 insertions, 20 deletions
diff --git a/arch/avr32/boards/atstk1000/Kconfig b/arch/avr32/boards/atstk1000/Kconfig index 23e8c84f0237..28c47802a560 100644 --- a/arch/avr32/boards/atstk1000/Kconfig +++ b/arch/avr32/boards/atstk1000/Kconfig | |||
@@ -1,34 +1,34 @@ | |||
1 | # STK1000 customization | 1 | # STK1000 customization |
2 | 2 | ||
3 | if BOARD_ATSTK1002 | 3 | if BOARD_ATSTK1000 |
4 | 4 | ||
5 | config BOARD_ATSTK1002_CUSTOM | 5 | config BOARD_ATSTK100X_CUSTOM |
6 | bool "Non-default STK-1002 jumper settings" | 6 | bool "Non-default STK1002/STK1003/STK1004 jumper settings" |
7 | help | 7 | help |
8 | You will normally leave the jumpers on the CPU card at their | 8 | You will normally leave the jumpers on the CPU card at their |
9 | default settings. If you need to use certain peripherals, | 9 | default settings. If you need to use certain peripherals, |
10 | you will need to change some of those jumpers. | 10 | you will need to change some of those jumpers. |
11 | 11 | ||
12 | if BOARD_ATSTK1002_CUSTOM | 12 | if BOARD_ATSTK100X_CUSTOM |
13 | 13 | ||
14 | config BOARD_ATSTK1002_SW1_CUSTOM | 14 | config BOARD_ATSTK100X_SW1_CUSTOM |
15 | bool "SW1: use SSC1 (not SPI0)" | 15 | bool "SW1: use SSC1 (not SPI0)" |
16 | help | 16 | help |
17 | This also prevents using the external DAC as an audio interface, | 17 | This also prevents using the external DAC as an audio interface, |
18 | and means you can't initialize the on-board QVGA display. | 18 | and means you can't initialize the on-board QVGA display. |
19 | 19 | ||
20 | config BOARD_ATSTK1002_SW2_CUSTOM | 20 | config BOARD_ATSTK100X_SW2_CUSTOM |
21 | bool "SW2: use IRDA or TIMER0 (not UART-A, MMC/SD, and PS2-A)" | 21 | bool "SW2: use IRDA or TIMER0 (not UART-A, MMC/SD, and PS2-A)" |
22 | help | 22 | help |
23 | If you change this you'll want an updated boot loader putting | 23 | If you change this you'll want an updated boot loader putting |
24 | the console on UART-C not UART-A. | 24 | the console on UART-C not UART-A. |
25 | 25 | ||
26 | config BOARD_ATSTK1002_SW3_CUSTOM | 26 | config BOARD_ATSTK100X_SW3_CUSTOM |
27 | bool "SW3: use TIMER1 (not SSC0 and GCLK)" | 27 | bool "SW3: use TIMER1 (not SSC0 and GCLK)" |
28 | help | 28 | help |
29 | This also prevents using the external DAC as an audio interface. | 29 | This also prevents using the external DAC as an audio interface. |
30 | 30 | ||
31 | config BOARD_ATSTK1002_SW4_CUSTOM | 31 | config BOARD_ATSTK100X_SW4_CUSTOM |
32 | bool "SW4: use ISI/Camera (not GPIOs, SPI1, and PS2-B)" | 32 | bool "SW4: use ISI/Camera (not GPIOs, SPI1, and PS2-B)" |
33 | help | 33 | help |
34 | To use the camera interface you'll need a custom card (on the | 34 | To use the camera interface you'll need a custom card (on the |
@@ -36,15 +36,17 @@ config BOARD_ATSTK1002_SW4_CUSTOM | |||
36 | 36 | ||
37 | config BOARD_ATSTK1002_SW5_CUSTOM | 37 | config BOARD_ATSTK1002_SW5_CUSTOM |
38 | bool "SW5: use MACB1 (not LCDC)" | 38 | bool "SW5: use MACB1 (not LCDC)" |
39 | depends on BOARD_ATSTK1002 | ||
39 | 40 | ||
40 | config BOARD_ATSTK1002_SW6_CUSTOM | 41 | config BOARD_ATSTK1002_SW6_CUSTOM |
41 | bool "SW6: more GPIOs (not MACB0)" | 42 | bool "SW6: more GPIOs (not MACB0)" |
43 | depends on BOARD_ATSTK1002 | ||
42 | 44 | ||
43 | endif # custom | 45 | endif # custom |
44 | 46 | ||
45 | config BOARD_ATSTK1002_SPI1 | 47 | config BOARD_ATSTK100X_SPI1 |
46 | bool "Configure SPI1 controller" | 48 | bool "Configure SPI1 controller" |
47 | depends on !BOARD_ATSTK1002_SW4_CUSTOM | 49 | depends on !BOARD_ATSTK100X_SW4_CUSTOM |
48 | help | 50 | help |
49 | All the signals for the second SPI controller are available on | 51 | All the signals for the second SPI controller are available on |
50 | GPIO lines and accessed through the J1 jumper block. Say "y" | 52 | GPIO lines and accessed through the J1 jumper block. Say "y" |
@@ -56,7 +58,7 @@ config BOARD_ATSTK1000_J2_LED | |||
56 | 58 | ||
57 | choice | 59 | choice |
58 | prompt "LEDs connected to J2:" | 60 | prompt "LEDs connected to J2:" |
59 | depends on LEDS_GPIO && !BOARD_ATSTK1002_SW4_CUSTOM | 61 | depends on LEDS_GPIO && !BOARD_ATSTK100X_SW4_CUSTOM |
60 | optional | 62 | optional |
61 | help | 63 | help |
62 | Select this if you have jumpered the J2 jumper block to the | 64 | Select this if you have jumpered the J2 jumper block to the |
@@ -78,7 +80,7 @@ endchoice | |||
78 | 80 | ||
79 | config BOARD_ATSTK1000_EXTDAC | 81 | config BOARD_ATSTK1000_EXTDAC |
80 | bool | 82 | bool |
81 | depends on !BOARD_ATSTK1002_SW1_CUSTOM && !BOARD_ATSTK1002_SW3_CUSTOM | 83 | depends on !BOARD_ATSTK100X_SW1_CUSTOM && !BOARD_ATSTK100X_SW3_CUSTOM |
82 | default y | 84 | default y |
83 | 85 | ||
84 | endif # stk 1002 | 86 | 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/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c index 57f610ea30df..000eb4220a12 100644 --- a/arch/avr32/boards/atstk1000/atstk1002.c +++ b/arch/avr32/boards/atstk1000/atstk1002.c | |||
@@ -55,7 +55,7 @@ static struct at73c213_board_info at73c213_data = { | |||
55 | }; | 55 | }; |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM | 58 | #ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM |
59 | static struct spi_board_info spi0_board_info[] __initdata = { | 59 | static struct spi_board_info spi0_board_info[] __initdata = { |
60 | #ifdef CONFIG_BOARD_ATSTK1000_EXTDAC | 60 | #ifdef CONFIG_BOARD_ATSTK1000_EXTDAC |
61 | { | 61 | { |
@@ -77,7 +77,7 @@ static struct spi_board_info spi0_board_info[] __initdata = { | |||
77 | }; | 77 | }; |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | #ifdef CONFIG_BOARD_ATSTK1002_SPI1 | 80 | #ifdef CONFIG_BOARD_ATSTK100X_SPI1 |
81 | static struct spi_board_info spi1_board_info[] __initdata = { { | 81 | static struct spi_board_info spi1_board_info[] __initdata = { { |
82 | /* patch in custom entries here */ | 82 | /* patch in custom entries here */ |
83 | } }; | 83 | } }; |
@@ -175,7 +175,7 @@ static void __init atstk1002_setup_extdac(void) | |||
175 | 175 | ||
176 | void __init setup_board(void) | 176 | void __init setup_board(void) |
177 | { | 177 | { |
178 | #ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM | 178 | #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM |
179 | at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ | 179 | at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */ |
180 | #else | 180 | #else |
181 | at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ | 181 | at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */ |
@@ -212,7 +212,7 @@ static int __init atstk1002_init(void) | |||
212 | 212 | ||
213 | at32_add_system_devices(); | 213 | at32_add_system_devices(); |
214 | 214 | ||
215 | #ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM | 215 | #ifdef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM |
216 | at32_add_device_usart(1); | 216 | at32_add_device_usart(1); |
217 | #else | 217 | #else |
218 | at32_add_device_usart(0); | 218 | at32_add_device_usart(0); |
@@ -222,10 +222,10 @@ static int __init atstk1002_init(void) | |||
222 | #ifndef CONFIG_BOARD_ATSTK1002_SW6_CUSTOM | 222 | #ifndef CONFIG_BOARD_ATSTK1002_SW6_CUSTOM |
223 | set_hw_addr(at32_add_device_eth(0, ð_data[0])); | 223 | set_hw_addr(at32_add_device_eth(0, ð_data[0])); |
224 | #endif | 224 | #endif |
225 | #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM | 225 | #ifndef CONFIG_BOARD_ATSTK100X_SW1_CUSTOM |
226 | 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)); |
227 | #endif | 227 | #endif |
228 | #ifdef CONFIG_BOARD_ATSTK1002_SPI1 | 228 | #ifdef CONFIG_BOARD_ATSTK100X_SPI1 |
229 | 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)); |
230 | #endif | 230 | #endif |
231 | #ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM | 231 | #ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM |
@@ -235,7 +235,7 @@ static int __init atstk1002_init(void) | |||
235 | fbmem_start, fbmem_size); | 235 | fbmem_start, fbmem_size); |
236 | #endif | 236 | #endif |
237 | at32_add_device_usba(0, NULL); | 237 | at32_add_device_usba(0, NULL); |
238 | #ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM | 238 | #ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM |
239 | at32_add_device_ssc(0, ATMEL_SSC_TX); | 239 | at32_add_device_ssc(0, ATMEL_SSC_TX); |
240 | #endif | 240 | #endif |
241 | 241 | ||
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); | ||