aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/boards
diff options
context:
space:
mode:
Diffstat (limited to 'arch/avr32/boards')
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 6b9e466104ad..5be0d13f4b03 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -16,6 +16,7 @@
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/spi/spi.h> 18#include <linux/spi/spi.h>
19#include <linux/spi/at73c213.h>
19 20
20#include <video/atmel_lcdc.h> 21#include <video/atmel_lcdc.h>
21 22
@@ -49,7 +50,26 @@ static struct eth_platform_data __initdata eth_data[2] = {
49}; 50};
50 51
51#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM 52#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
53#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
54static struct at73c213_board_info at73c213_data = {
55 .ssc_id = 0,
56 .shortname = "AVR32 STK1000 external DAC",
57};
58#endif
59#endif
60
61#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
52static struct spi_board_info spi0_board_info[] __initdata = { 62static struct spi_board_info spi0_board_info[] __initdata = {
63#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
64 {
65 /* AT73C213 */
66 .modalias = "at73c213",
67 .max_speed_hz = 200000,
68 .chip_select = 0,
69 .mode = SPI_MODE_1,
70 .platform_data = &at73c213_data,
71 },
72#endif
53 { 73 {
54 /* QVGA display */ 74 /* QVGA display */
55 .modalias = "ltv350qv", 75 .modalias = "ltv350qv",
@@ -180,6 +200,38 @@ static void setup_j2_leds(void)
180} 200}
181#endif 201#endif
182 202
203#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
204#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
205static void __init at73c213_set_clk(struct at73c213_board_info *info)
206{
207 struct clk *gclk;
208 struct clk *pll;
209
210 gclk = clk_get(NULL, "gclk0");
211 if (IS_ERR(gclk))
212 goto err_gclk;
213 pll = clk_get(NULL, "pll0");
214 if (IS_ERR(pll))
215 goto err_pll;
216
217 if (clk_set_parent(gclk, pll)) {
218 pr_debug("STK1000: failed to set pll0 as parent for DAC clock\n");
219 goto err_set_clk;
220 }
221
222 at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0);
223 info->dac_clk = gclk;
224
225err_set_clk:
226 clk_put(pll);
227err_pll:
228 clk_put(gclk);
229err_gclk:
230 return;
231}
232#endif
233#endif
234
183void __init setup_board(void) 235void __init setup_board(void)
184{ 236{
185#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM 237#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
@@ -248,6 +300,12 @@ static int __init atstk1002_init(void)
248 300
249 setup_j2_leds(); 301 setup_j2_leds();
250 302
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
251 return 0; 309 return 0;
252} 310}
253postcore_initcall(atstk1002_init); 311postcore_initcall(atstk1002_init);