Commit a3d912c8 authored by David Brownell's avatar David Brownell Committed by Haavard Skinnemoen

[AVR32] fix serial port setup on ATSTK1000

Fixes to USART setup on the stk-1000 ... don't configure USART 2, since
its TXD/RXD are used for INT-A and INT-B buttons; and configure USART 0
(for IRDA, and with corrected IRQ) iff SW2 has a non-default setting.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarHaavard Skinnemoen <hskinnemoen@atmel.com>
parent 914ab062
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
#include <asm/arch/board.h> #include <asm/arch/board.h>
#include <asm/arch/init.h> #include <asm/arch/init.h>
#define SW2_DEFAULT /* MMCI and UART_A available */
struct eth_addr { struct eth_addr {
u8 addr[6]; u8 addr[6];
}; };
...@@ -86,9 +89,13 @@ static void __init set_hw_addr(struct platform_device *pdev) ...@@ -86,9 +89,13 @@ static void __init set_hw_addr(struct platform_device *pdev)
void __init setup_board(void) void __init setup_board(void)
{ {
at32_map_usart(1, 0); /* /dev/ttyS0 */ #ifdef SW2_DEFAULT
at32_map_usart(2, 1); /* /dev/ttyS1 */ at32_map_usart(1, 0); /* USART 1/A: /dev/ttyS0, DB9 */
at32_map_usart(3, 2); /* /dev/ttyS2 */ #else
at32_map_usart(0, 1); /* USART 0/B: /dev/ttyS1, IRDA */
#endif
/* USART 2/unused: expansion connector */
at32_map_usart(3, 2); /* USART 3/C: /dev/ttyS2, DB9 */
at32_setup_serial_console(0); at32_setup_serial_console(0);
} }
...@@ -97,8 +104,11 @@ static int __init atstk1002_init(void) ...@@ -97,8 +104,11 @@ static int __init atstk1002_init(void)
{ {
at32_add_system_devices(); at32_add_system_devices();
#ifdef SW2_DEFAULT
at32_add_device_usart(0); at32_add_device_usart(0);
#else
at32_add_device_usart(1); at32_add_device_usart(1);
#endif
at32_add_device_usart(2); at32_add_device_usart(2);
set_hw_addr(at32_add_device_eth(0, &eth_data[0])); set_hw_addr(at32_add_device_eth(0, &eth_data[0]));
......
...@@ -521,7 +521,7 @@ static struct atmel_uart_data atmel_usart0_data = { ...@@ -521,7 +521,7 @@ static struct atmel_uart_data atmel_usart0_data = {
}; };
static struct resource atmel_usart0_resource[] = { static struct resource atmel_usart0_resource[] = {
PBMEM(0xffe00c00), PBMEM(0xffe00c00),
IRQ(7), IRQ(6),
}; };
DEFINE_DEV_DATA(atmel_usart, 0); DEFINE_DEV_DATA(atmel_usart, 0);
DEV_CLK(usart, atmel_usart0, pba, 4); DEV_CLK(usart, atmel_usart0, pba, 4);
...@@ -583,7 +583,7 @@ static inline void configure_usart3_pins(void) ...@@ -583,7 +583,7 @@ static inline void configure_usart3_pins(void)
select_peripheral(PB(17), PERIPH_B, 0); /* TXD */ select_peripheral(PB(17), PERIPH_B, 0); /* TXD */
} }
static struct platform_device *at32_usarts[4]; static struct platform_device *__initdata at32_usarts[4];
void __init at32_map_usart(unsigned int hw_id, unsigned int line) void __init at32_map_usart(unsigned int hw_id, unsigned int line)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment