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/mach-at32ap/at32ap7000.c | |
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/mach-at32ap/at32ap7000.c')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap7000.c | 22 |
1 files changed, 10 insertions, 12 deletions
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 | /* -------------------------------------------------------------------- |