[PATCH] AVR32: Allow renumbering of serial devices

Allow the board to remap actual USART peripheral devices to serial
devices by calling at32_map_usart(hw_id, serial_line). This ensures
that even though ATSTK1002 uses USART1 as the first serial port, it
will still have a ttyS0 device.

This also adds a board-specific early setup hook and moves the
at32_setup_serial_console() call there from the platform code.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index 49164e9..cced73c 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 
 #include <asm/arch/board.h>
+#include <asm/arch/init.h>
 
 struct eth_platform_data __initdata eth0_data = {
 	.valid		= 1,
@@ -20,13 +21,22 @@
 
 extern struct lcdc_platform_data atstk1000_fb0_data;
 
+void __init setup_board(void)
+{
+	at32_map_usart(1, 0);	/* /dev/ttyS0 */
+	at32_map_usart(2, 1);	/* /dev/ttyS1 */
+	at32_map_usart(3, 2);	/* /dev/ttyS2 */
+
+	at32_setup_serial_console(0);
+}
+
 static int __init atstk1002_init(void)
 {
 	at32_add_system_devices();
 
-	at32_add_device_usart(1);	/* /dev/ttyS0 */
-	at32_add_device_usart(2);	/* /dev/ttyS1 */
-	at32_add_device_usart(3);	/* /dev/ttyS2 */
+	at32_add_device_usart(0);
+	at32_add_device_usart(1);
+	at32_add_device_usart(2);
 
 	at32_add_device_eth(0, &eth0_data);
 	at32_add_device_spi(0);