diff options
author | Haavard Skinnemoen <hskinnemoen@atmel.com> | 2006-10-04 10:02:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-04 13:25:06 -0400 |
commit | c194588dba968510b5aa7a1818bd2c8b36a416f7 (patch) | |
tree | 4c9379f6482572340ab701c369e8b01eb2b43493 /arch/avr32 | |
parent | acca9b83acfe89fbb7421d5412176dee2ad2959a (diff) |
[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>
Diffstat (limited to 'arch/avr32')
-rw-r--r-- | arch/avr32/boards/atstk1000/atstk1002.c | 16 | ||||
-rw-r--r-- | arch/avr32/kernel/setup.c | 1 | ||||
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap.c | 3 | ||||
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap7000.c | 22 |
4 files changed, 24 insertions, 18 deletions
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c index 49164e9aadd6..cced73c58115 100644 --- a/arch/avr32/boards/atstk1000/atstk1002.c +++ b/arch/avr32/boards/atstk1000/atstk1002.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | 11 | ||
12 | #include <asm/arch/board.h> | 12 | #include <asm/arch/board.h> |
13 | #include <asm/arch/init.h> | ||
13 | 14 | ||
14 | struct eth_platform_data __initdata eth0_data = { | 15 | struct eth_platform_data __initdata eth0_data = { |
15 | .valid = 1, | 16 | .valid = 1, |
@@ -20,13 +21,22 @@ struct eth_platform_data __initdata eth0_data = { | |||
20 | 21 | ||
21 | extern struct lcdc_platform_data atstk1000_fb0_data; | 22 | extern struct lcdc_platform_data atstk1000_fb0_data; |
22 | 23 | ||
24 | void __init setup_board(void) | ||
25 | { | ||
26 | at32_map_usart(1, 0); /* /dev/ttyS0 */ | ||
27 | at32_map_usart(2, 1); /* /dev/ttyS1 */ | ||
28 | at32_map_usart(3, 2); /* /dev/ttyS2 */ | ||
29 | |||
30 | at32_setup_serial_console(0); | ||
31 | } | ||
32 | |||
23 | static int __init atstk1002_init(void) | 33 | static int __init atstk1002_init(void) |
24 | { | 34 | { |
25 | at32_add_system_devices(); | 35 | at32_add_system_devices(); |
26 | 36 | ||
27 | at32_add_device_usart(1); /* /dev/ttyS0 */ | 37 | at32_add_device_usart(0); |
28 | at32_add_device_usart(2); /* /dev/ttyS1 */ | 38 | at32_add_device_usart(1); |
29 | at32_add_device_usart(3); /* /dev/ttyS2 */ | 39 | at32_add_device_usart(2); |
30 | 40 | ||
31 | at32_add_device_eth(0, ð0_data); | 41 | at32_add_device_eth(0, ð0_data); |
32 | at32_add_device_spi(0); | 42 | at32_add_device_spi(0); |
diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c index 5d68f3c6990b..ea2d1ffee478 100644 --- a/arch/avr32/kernel/setup.c +++ b/arch/avr32/kernel/setup.c | |||
@@ -292,6 +292,7 @@ void __init setup_arch (char **cmdline_p) | |||
292 | 292 | ||
293 | setup_processor(); | 293 | setup_processor(); |
294 | setup_platform(); | 294 | setup_platform(); |
295 | setup_board(); | ||
295 | 296 | ||
296 | cpu_clk = clk_get(NULL, "cpu"); | 297 | cpu_clk = clk_get(NULL, "cpu"); |
297 | if (IS_ERR(cpu_clk)) { | 298 | if (IS_ERR(cpu_clk)) { |
diff --git a/arch/avr32/mach-at32ap/at32ap.c b/arch/avr32/mach-at32ap/at32ap.c index f7cedf5aabea..90f207e8e96d 100644 --- a/arch/avr32/mach-at32ap/at32ap.c +++ b/arch/avr32/mach-at32ap/at32ap.c | |||
@@ -48,9 +48,6 @@ void __init setup_platform(void) | |||
48 | at32_sm_init(); | 48 | at32_sm_init(); |
49 | at32_clock_init(); | 49 | at32_clock_init(); |
50 | at32_portmux_init(); | 50 | at32_portmux_init(); |
51 | |||
52 | /* FIXME: This doesn't belong here */ | ||
53 | at32_setup_serial_console(1); | ||
54 | } | 51 | } |
55 | 52 | ||
56 | static int __init pdc_probe(struct platform_device *pdev) | 53 | static int __init pdc_probe(struct platform_device *pdev) |
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c index 3dd305875087..7ff6ad8bab5f 100644 --- a/arch/avr32/mach-at32ap/at32ap7000.c +++ b/arch/avr32/mach-at32ap/at32ap7000.c | |||
@@ -591,11 +591,13 @@ static inline void configure_usart3_pins(void) | |||
591 | portmux_set_func(PIOB, 17, FUNC_B); /* TXD */ | 591 | portmux_set_func(PIOB, 17, FUNC_B); /* TXD */ |
592 | } | 592 | } |
593 | 593 | ||
594 | static struct platform_device *setup_usart(unsigned int id) | 594 | static struct platform_device *at32_usarts[4]; |
595 | |||
596 | void __init at32_map_usart(unsigned int hw_id, unsigned int line) | ||
595 | { | 597 | { |
596 | struct platform_device *pdev; | 598 | struct platform_device *pdev; |
597 | 599 | ||
598 | switch (id) { | 600 | switch (hw_id) { |
599 | case 0: | 601 | case 0: |
600 | pdev = &atmel_usart0_device; | 602 | pdev = &atmel_usart0_device; |
601 | configure_usart0_pins(); | 603 | configure_usart0_pins(); |
@@ -613,7 +615,7 @@ static struct platform_device *setup_usart(unsigned int id) | |||
613 | configure_usart3_pins(); | 615 | configure_usart3_pins(); |
614 | break; | 616 | break; |
615 | default: | 617 | default: |
616 | return NULL; | 618 | return; |
617 | } | 619 | } |
618 | 620 | ||
619 | if (PXSEG(pdev->resource[0].start) == P4SEG) { | 621 | if (PXSEG(pdev->resource[0].start) == P4SEG) { |
@@ -622,25 +624,21 @@ static struct platform_device *setup_usart(unsigned int id) | |||
622 | data->regs = (void __iomem *)pdev->resource[0].start; | 624 | data->regs = (void __iomem *)pdev->resource[0].start; |
623 | } | 625 | } |
624 | 626 | ||
625 | return pdev; | 627 | pdev->id = line; |
628 | at32_usarts[line] = pdev; | ||
626 | } | 629 | } |
627 | 630 | ||
628 | struct platform_device *__init at32_add_device_usart(unsigned int id) | 631 | struct platform_device *__init at32_add_device_usart(unsigned int id) |
629 | { | 632 | { |
630 | struct platform_device *pdev; | 633 | platform_device_register(at32_usarts[id]); |
631 | 634 | return at32_usarts[id]; | |
632 | pdev = setup_usart(id); | ||
633 | if (pdev) | ||
634 | platform_device_register(pdev); | ||
635 | |||
636 | return pdev; | ||
637 | } | 635 | } |
638 | 636 | ||
639 | struct platform_device *atmel_default_console_device; | 637 | struct platform_device *atmel_default_console_device; |
640 | 638 | ||
641 | void __init at32_setup_serial_console(unsigned int usart_id) | 639 | void __init at32_setup_serial_console(unsigned int usart_id) |
642 | { | 640 | { |
643 | atmel_default_console_device = setup_usart(usart_id); | 641 | atmel_default_console_device = at32_usarts[usart_id]; |
644 | } | 642 | } |
645 | 643 | ||
646 | /* -------------------------------------------------------------------- | 644 | /* -------------------------------------------------------------------- |