mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
[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>
This commit is contained in:
parent
f4c41b2689
commit
64d8105267
2 changed files with 17 additions and 16 deletions
|
@ -76,4 +76,9 @@ config BOARD_ATSTK1000_J2_RGB
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
config BOARD_ATSTK1000_EXTDAC
|
||||||
|
bool
|
||||||
|
depends on !BOARD_ATSTK1002_SW1_CUSTOM && !BOARD_ATSTK1002_SW3_CUSTOM
|
||||||
|
default y
|
||||||
|
|
||||||
endif # stk 1002
|
endif # stk 1002
|
||||||
|
|
|
@ -48,18 +48,16 @@ static struct eth_platform_data __initdata eth_data[2] = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
|
#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
|
||||||
#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
|
|
||||||
static struct at73c213_board_info at73c213_data = {
|
static struct at73c213_board_info at73c213_data = {
|
||||||
.ssc_id = 0,
|
.ssc_id = 0,
|
||||||
.shortname = "AVR32 STK1000 external DAC",
|
.shortname = "AVR32 STK1000 external DAC",
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
|
#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
|
||||||
static struct spi_board_info spi0_board_info[] __initdata = {
|
static struct spi_board_info spi0_board_info[] __initdata = {
|
||||||
#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
|
#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
|
||||||
{
|
{
|
||||||
/* AT73C213 */
|
/* AT73C213 */
|
||||||
.modalias = "at73c213",
|
.modalias = "at73c213",
|
||||||
|
@ -140,9 +138,8 @@ static void __init set_hw_addr(struct platform_device *pdev)
|
||||||
clk_put(pclk);
|
clk_put(pclk);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
|
#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
|
||||||
#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
|
static void __init atstk1002_setup_extdac(void)
|
||||||
static void __init at73c213_set_clk(struct at73c213_board_info *info)
|
|
||||||
{
|
{
|
||||||
struct clk *gclk;
|
struct clk *gclk;
|
||||||
struct clk *pll;
|
struct clk *pll;
|
||||||
|
@ -160,7 +157,7 @@ static void __init at73c213_set_clk(struct at73c213_board_info *info)
|
||||||
}
|
}
|
||||||
|
|
||||||
at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0);
|
at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0);
|
||||||
info->dac_clk = gclk;
|
at73c213_data.dac_clk = gclk;
|
||||||
|
|
||||||
err_set_clk:
|
err_set_clk:
|
||||||
clk_put(pll);
|
clk_put(pll);
|
||||||
|
@ -169,8 +166,12 @@ static void __init at73c213_set_clk(struct at73c213_board_info *info)
|
||||||
err_gclk:
|
err_gclk:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#else
|
||||||
#endif
|
static void __init atstk1002_setup_extdac(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_BOARD_ATSTK1000_EXTDAC */
|
||||||
|
|
||||||
void __init setup_board(void)
|
void __init setup_board(void)
|
||||||
{
|
{
|
||||||
|
@ -239,12 +240,7 @@ static int __init atstk1002_init(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
atstk1000_setup_j2_leds();
|
atstk1000_setup_j2_leds();
|
||||||
|
atstk1002_setup_extdac();
|
||||||
#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
|
|
||||||
#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
|
|
||||||
at73c213_set_clk(&at73c213_data);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue