aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/mach-at32ap/at32ap7000.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/avr32/mach-at32ap/at32ap7000.c')
-rw-r--r--arch/avr32/mach-at32ap/at32ap7000.c22
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
594static struct platform_device *setup_usart(unsigned int id) 594static struct platform_device *at32_usarts[4];
595
596void __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
628struct platform_device *__init at32_add_device_usart(unsigned int id) 631struct 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
639struct platform_device *atmel_default_console_device; 637struct platform_device *atmel_default_console_device;
640 638
641void __init at32_setup_serial_console(unsigned int usart_id) 639void __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/* --------------------------------------------------------------------