aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/boards/atstk1000/atstk1002.c
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2007-10-29 11:24:09 -0400
committerHaavard Skinnemoen <hskinnemoen@atmel.com>2008-01-25 02:31:42 -0500
commit64d81052671bc2e66efd46251883f5e8e3043db9 (patch)
tree7a72e66dddc5174aa4b30a7112aa5e33f0f4d02d /arch/avr32/boards/atstk1000/atstk1002.c
parentf4c41b2689eec03bd4f8145a08903862673e002b (diff)
[AVR32] Clean up external DAC setup code
Reduce the ridiculous amount of #ifdef clutter in atstk1002.c a bit by moving all the extdac stuff into its own function and providing an empty stub for the case when it isn't wanted. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/boards/atstk1000/atstk1002.c')
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 2481d2389873..57f610ea30df 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -48,18 +48,16 @@ static struct eth_platform_data __initdata eth_data[2] = {
48 }, 48 },
49}; 49};
50 50
51#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM 51#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
52#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
53static struct at73c213_board_info at73c213_data = { 52static struct at73c213_board_info at73c213_data = {
54 .ssc_id = 0, 53 .ssc_id = 0,
55 .shortname = "AVR32 STK1000 external DAC", 54 .shortname = "AVR32 STK1000 external DAC",
56}; 55};
57#endif 56#endif
58#endif
59 57
60#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM 58#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
61static struct spi_board_info spi0_board_info[] __initdata = { 59static struct spi_board_info spi0_board_info[] __initdata = {
62#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM 60#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
63 { 61 {
64 /* AT73C213 */ 62 /* AT73C213 */
65 .modalias = "at73c213", 63 .modalias = "at73c213",
@@ -140,9 +138,8 @@ static void __init set_hw_addr(struct platform_device *pdev)
140 clk_put(pclk); 138 clk_put(pclk);
141} 139}
142 140
143#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM 141#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
144#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM 142static void __init atstk1002_setup_extdac(void)
145static void __init at73c213_set_clk(struct at73c213_board_info *info)
146{ 143{
147 struct clk *gclk; 144 struct clk *gclk;
148 struct clk *pll; 145 struct clk *pll;
@@ -160,7 +157,7 @@ static void __init at73c213_set_clk(struct at73c213_board_info *info)
160 } 157 }
161 158
162 at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0); 159 at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0);
163 info->dac_clk = gclk; 160 at73c213_data.dac_clk = gclk;
164 161
165err_set_clk: 162err_set_clk:
166 clk_put(pll); 163 clk_put(pll);
@@ -169,8 +166,12 @@ err_pll:
169err_gclk: 166err_gclk:
170 return; 167 return;
171} 168}
172#endif 169#else
173#endif 170static void __init atstk1002_setup_extdac(void)
171{
172
173}
174#endif /* CONFIG_BOARD_ATSTK1000_EXTDAC */
174 175
175void __init setup_board(void) 176void __init setup_board(void)
176{ 177{
@@ -239,12 +240,7 @@ static int __init atstk1002_init(void)
239#endif 240#endif
240 241
241 atstk1000_setup_j2_leds(); 242 atstk1000_setup_j2_leds();
242 243 atstk1002_setup_extdac();
243#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
244#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
245 at73c213_set_clk(&at73c213_data);
246#endif
247#endif
248 244
249 return 0; 245 return 0;
250} 246}