[PATCH] Make ATNGW100 serial ports configurable

From: Anders Blomdell
Date: Fri Oct 10 2008 - 10:50:41 EST


Make configuration of ATNGW100 serial ports selectable in kernel configuration.

Signed-off-by: Anders Blomdell <anders.blomdell@xxxxxxxxxxxxxx>



diff -urb orig/arch/avr32/boards/atngw100/Kconfig linux-2.6.27-rc6/arch/avr32/boards/atngw100/Kconfig
--- orig/arch/avr32/boards/atngw100/Kconfig 2008-10-09 17:56:14.000000000 +0200
+++ linux-2.6.27-rc6/arch/avr32/boards/atngw100/Kconfig 2008-10-09 16:26:08.000000000 +0200
@@ -0,0 +1,18 @@
+config SERIAL_ATMEL_USART0
+ bool "Enable USART0"
+ depends on SERIAL_ATMEL
+ help
+ Enable USART0 (on expansion header J5, pins 12, 11)
+
+config SERIAL_ATMEL_USART2
+ bool "Enable USART2"
+ depends on SERIAL_ATMEL
+ help
+ Enable USART2 (on expansion header J6, pins 27, 26)
+
+config SERIAL_ATMEL_USART3
+ bool "Enable USART3"
+ depends on SERIAL_ATMEL
+ help
+ Enable USART3 (on expansion header J6, pins 17, 18)
+
diff -urb orig/arch/avr32/boards/atngw100/setup.c linux-2.6.27-rc6/arch/avr32/boards/atngw100/setup.c
--- orig/arch/avr32/boards/atngw100/setup.c 2008-10-09 17:54:55.000000000 +0200
+++ linux-2.6.27-rc6/arch/avr32/boards/atngw100/setup.c 2008-10-09 16:33:50.000000000 +0200
@@ -114,8 +114,20 @@

void __init setup_board(void)
{
- at32_map_usart(1, 0); /* USART 1: /dev/ttyS0, DB9 */
+ int i = 0;
+
+ at32_map_usart(1, i++); /* USART 1: /dev/ttyS0, DB9 */
at32_setup_serial_console(0);
+
+#ifdef CONFIG_SERIAL_ATMEL_USART0
+ at32_map_usart(0, i++); /* USART 0: /dev/ttySX, J5, pins 12, 11 */
+#endif
+#ifdef CONFIG_SERIAL_ATMEL_USART2
+ at32_map_usart(2, i++); /* USART 2: /dev/ttySX, J6, pins 27, 26 */
+#endif
+#ifdef CONFIG_SERIAL_ATMEL_USART3
+ at32_map_usart(3, i++); /* USART 3: /dev/ttySX, J6, pins 17, 18 */
+#endif
}

static const struct gpio_led ngw_leds[] = {
@@ -170,7 +182,17 @@

at32_add_system_devices();

- at32_add_device_usart(0);
+ i = 0;
+ at32_add_device_usart(i++);
+#ifdef CONFIG_SERIAL_ATMEL_USART0
+ at32_add_device_usart(i++);
+#endif
+#ifdef CONFIG_SERIAL_ATMEL_USART2
+ at32_add_device_usart(i++);
+#endif
+#ifdef CONFIG_SERIAL_ATMEL_USART3
+ at32_add_device_usart(i++);
+#endif

set_hw_addr(at32_add_device_eth(0, &eth_data[0]));
set_hw_addr(at32_add_device_eth(1, &eth_data[1]));
diff -urb orig/arch/avr32/Kconfig linux-2.6.27-rc6/arch/avr32/Kconfig
--- orig/arch/avr32/Kconfig 2008-10-09 17:54:55.000000000 +0200
+++ linux-2.6.27-rc6/arch/avr32/Kconfig 2008-10-09 16:21:49.000000000 +0200
@@ -125,6 +125,10 @@
source "arch/avr32/boards/atstk1000/Kconfig"
endif

+if BOARD_ATNGW100
+source "arch/avr32/boards/atngw100/Kconfig"
+endif
+
choice
prompt "Boot loader type"
default LOADER_U_BOOT