Skip to content

Commit a8e93ed

Browse files
David BrownellHaavard Skinnemoen
authored andcommitted
[AVR32] Make STK1000 mux settings configurable
This adds some STK1002-specific config options covering the jumper settings, so the kernel can automatically be configured to include the relevant devices. One of them replaces the previous internal SW2_DEFAULT setting; SPI config is affected by two of the jumpers; and a fourth one switches between LCD and the second Ethernet connector. (There's more that to be done.) Signed-off-by: David Brownell <[email protected]> Signed-off-by: Haavard Skinnemoen <[email protected]>
1 parent 9e58e18 commit a8e93ed

File tree

3 files changed

+80
-7
lines changed

3 files changed

+80
-7
lines changed

arch/avr32/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ config BOARD_ATNGW100
113113
bool "ATNGW100 Network Gateway"
114114
endchoice
115115

116+
if BOARD_ATSTK1000
117+
source "arch/avr32/boards/atstk1000/Kconfig"
118+
endif
119+
116120
choice
117121
prompt "Boot loader type"
118122
default LOADER_U_BOOT

arch/avr32/boards/atstk1000/Kconfig

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# STK1000 customization
2+
3+
if BOARD_ATSTK1002
4+
5+
config BOARD_ATSTK1002_CUSTOM
6+
bool "Non-default STK-1002 jumper settings"
7+
help
8+
You will normally leave the jumpers on the CPU card at their
9+
default settings. If you need to use certain peripherals,
10+
you will need to change some of those jumpers.
11+
12+
if BOARD_ATSTK1002_CUSTOM
13+
14+
config BOARD_ATSTK1002_SW1_CUSTOM
15+
bool "SW1: use SSC1 (not SPI0)"
16+
help
17+
This also prevents using the external DAC as an audio interface,
18+
and means you can't initialize the on-board QVGA display.
19+
20+
config BOARD_ATSTK1002_SW2_CUSTOM
21+
bool "SW2: use IRDA or TIMER0 (not UART-A, MMC/SD, and PS2-A)"
22+
help
23+
If you change this you'll want an updated boot loader putting
24+
the console on UART-C not UART-A.
25+
26+
config BOARD_ATSTK1002_SW3_CUSTOM
27+
bool "SW3: use TIMER1 (not SSC0 and GCLK)"
28+
help
29+
This also prevents using the external DAC as an audio interface.
30+
31+
config BOARD_ATSTK1002_SW4_CUSTOM
32+
bool "SW4: use ISI/Camera (not GPIOs, SPI1, and PS2-B)"
33+
help
34+
To use the camera interface you'll need a custom card (on the
35+
PCI-format connector) connect a video sensor.
36+
37+
config BOARD_ATSTK1002_SW5_CUSTOM
38+
bool "SW5: use MACB1 (not LCDC)"
39+
40+
config BOARD_ATSTK1002_SW6_CUSTOM
41+
bool "SW6: more GPIOs (not MACB0)"
42+
43+
endif # custom
44+
45+
config BOARD_ATSTK1002_SPI1
46+
bool "Configure SPI1 controller"
47+
depends on !BOARD_ATSTK1002_SW4_CUSTOM
48+
help
49+
All the signals for the second SPI controller are available on
50+
GPIO lines and accessed through the J1 jumper block. Say "y"
51+
here to configure that SPI controller.
52+
53+
endif # stk 1002

arch/avr32/boards/atstk1000/atstk1002.c

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
#include "atstk1000.h"
2929

30-
#define SW2_DEFAULT /* MMCI and UART_A available */
3130

3231
struct eth_addr {
3332
u8 addr[6];
@@ -36,6 +35,7 @@ struct eth_addr {
3635
static struct eth_addr __initdata hw_addr[2];
3736
static struct eth_platform_data __initdata eth_data[2];
3837

38+
#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
3939
static struct spi_board_info spi0_board_info[] __initdata = {
4040
{
4141
/* QVGA display */
@@ -45,6 +45,13 @@ static struct spi_board_info spi0_board_info[] __initdata = {
4545
.mode = SPI_MODE_3,
4646
},
4747
};
48+
#endif
49+
50+
#ifdef CONFIG_BOARD_ATSTK1002_SPI1
51+
static struct spi_board_info spi1_board_info[] __initdata = { {
52+
/* patch in custom entries here */
53+
} };
54+
#endif
4855

4956
/*
5057
* The next two functions should go away as the boot loader is
@@ -103,10 +110,10 @@ static void __init set_hw_addr(struct platform_device *pdev)
103110

104111
void __init setup_board(void)
105112
{
106-
#ifdef SW2_DEFAULT
107-
at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */
108-
#else
113+
#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
109114
at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */
115+
#else
116+
at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */
110117
#endif
111118
/* USART 2/unused: expansion connector */
112119
at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */
@@ -140,18 +147,27 @@ static int __init atstk1002_init(void)
140147

141148
at32_add_system_devices();
142149

143-
#ifdef SW2_DEFAULT
144-
at32_add_device_usart(0);
145-
#else
150+
#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
146151
at32_add_device_usart(1);
152+
#else
153+
at32_add_device_usart(0);
147154
#endif
148155
at32_add_device_usart(2);
149156

150157
set_hw_addr(at32_add_device_eth(0, &eth_data[0]));
151158

159+
#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
152160
at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info));
161+
#endif
162+
#ifdef CONFIG_BOARD_ATSTK1002_SPI1
163+
at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
164+
#endif
165+
#ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM
166+
set_hw_addr(at32_add_device_eth(1, &eth_data[1]));
167+
#else
153168
at32_add_device_lcdc(0, &atstk1000_lcdc_data,
154169
fbmem_start, fbmem_size);
170+
#endif
155171

156172
return 0;
157173
}

0 commit comments

Comments
 (0)