diff options
author | Andrew Lunn <andrew@lunn.ch> | 2011-05-15 07:32:41 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2011-05-16 14:46:17 -0400 |
commit | 28a2b45054f2e3f3671e36a6e9efc82756afa31a (patch) | |
tree | b33726c3de55636902cc033124eb3dd6ba6fe1d1 /arch/arm/mach-mv78xx0 | |
parent | 5c60255149eece2a36ec9f5c99817b85f96fe8ec (diff) |
ARM: orion: Consolidate the creation of the uart platform data.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'arch/arm/mach-mv78xx0')
-rw-r--r-- | arch/arm/mach-mv78xx0/common.c | 160 |
1 files changed, 10 insertions, 150 deletions
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c index c38250d1f07f..5b474e4574de 100644 --- a/arch/arm/mach-mv78xx0/common.c +++ b/arch/arm/mach-mv78xx0/common.c | |||
@@ -25,8 +25,10 @@ | |||
25 | #include <plat/ehci-orion.h> | 25 | #include <plat/ehci-orion.h> |
26 | #include <plat/orion_nand.h> | 26 | #include <plat/orion_nand.h> |
27 | #include <plat/time.h> | 27 | #include <plat/time.h> |
28 | #include <plat/common.h> | ||
28 | #include "common.h" | 29 | #include "common.h" |
29 | 30 | ||
31 | static int get_tclk(void); | ||
30 | 32 | ||
31 | /***************************************************************************** | 33 | /***************************************************************************** |
32 | * Common bits | 34 | * Common bits |
@@ -642,179 +644,41 @@ void __init mv78xx0_sata_init(struct mv_sata_platform_data *sata_data) | |||
642 | /***************************************************************************** | 644 | /***************************************************************************** |
643 | * UART0 | 645 | * UART0 |
644 | ****************************************************************************/ | 646 | ****************************************************************************/ |
645 | static struct plat_serial8250_port mv78xx0_uart0_data[] = { | ||
646 | { | ||
647 | .mapbase = UART0_PHYS_BASE, | ||
648 | .membase = (char *)UART0_VIRT_BASE, | ||
649 | .irq = IRQ_MV78XX0_UART_0, | ||
650 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, | ||
651 | .iotype = UPIO_MEM, | ||
652 | .regshift = 2, | ||
653 | .uartclk = 0, | ||
654 | }, { | ||
655 | }, | ||
656 | }; | ||
657 | |||
658 | static struct resource mv78xx0_uart0_resources[] = { | ||
659 | { | ||
660 | .start = UART0_PHYS_BASE, | ||
661 | .end = UART0_PHYS_BASE + 0xff, | ||
662 | .flags = IORESOURCE_MEM, | ||
663 | }, { | ||
664 | .start = IRQ_MV78XX0_UART_0, | ||
665 | .end = IRQ_MV78XX0_UART_0, | ||
666 | .flags = IORESOURCE_IRQ, | ||
667 | }, | ||
668 | }; | ||
669 | |||
670 | static struct platform_device mv78xx0_uart0 = { | ||
671 | .name = "serial8250", | ||
672 | .id = PLAT8250_DEV_PLATFORM, | ||
673 | .dev = { | ||
674 | .platform_data = mv78xx0_uart0_data, | ||
675 | }, | ||
676 | .resource = mv78xx0_uart0_resources, | ||
677 | .num_resources = ARRAY_SIZE(mv78xx0_uart0_resources), | ||
678 | }; | ||
679 | |||
680 | void __init mv78xx0_uart0_init(void) | 647 | void __init mv78xx0_uart0_init(void) |
681 | { | 648 | { |
682 | platform_device_register(&mv78xx0_uart0); | 649 | orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE, |
650 | IRQ_MV78XX0_UART_0, get_tclk()); | ||
683 | } | 651 | } |
684 | 652 | ||
685 | 653 | ||
686 | /***************************************************************************** | 654 | /***************************************************************************** |
687 | * UART1 | 655 | * UART1 |
688 | ****************************************************************************/ | 656 | ****************************************************************************/ |
689 | static struct plat_serial8250_port mv78xx0_uart1_data[] = { | ||
690 | { | ||
691 | .mapbase = UART1_PHYS_BASE, | ||
692 | .membase = (char *)UART1_VIRT_BASE, | ||
693 | .irq = IRQ_MV78XX0_UART_1, | ||
694 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, | ||
695 | .iotype = UPIO_MEM, | ||
696 | .regshift = 2, | ||
697 | .uartclk = 0, | ||
698 | }, { | ||
699 | }, | ||
700 | }; | ||
701 | |||
702 | static struct resource mv78xx0_uart1_resources[] = { | ||
703 | { | ||
704 | .start = UART1_PHYS_BASE, | ||
705 | .end = UART1_PHYS_BASE + 0xff, | ||
706 | .flags = IORESOURCE_MEM, | ||
707 | }, { | ||
708 | .start = IRQ_MV78XX0_UART_1, | ||
709 | .end = IRQ_MV78XX0_UART_1, | ||
710 | .flags = IORESOURCE_IRQ, | ||
711 | }, | ||
712 | }; | ||
713 | |||
714 | static struct platform_device mv78xx0_uart1 = { | ||
715 | .name = "serial8250", | ||
716 | .id = PLAT8250_DEV_PLATFORM1, | ||
717 | .dev = { | ||
718 | .platform_data = mv78xx0_uart1_data, | ||
719 | }, | ||
720 | .resource = mv78xx0_uart1_resources, | ||
721 | .num_resources = ARRAY_SIZE(mv78xx0_uart1_resources), | ||
722 | }; | ||
723 | |||
724 | void __init mv78xx0_uart1_init(void) | 657 | void __init mv78xx0_uart1_init(void) |
725 | { | 658 | { |
726 | platform_device_register(&mv78xx0_uart1); | 659 | orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE, |
660 | IRQ_MV78XX0_UART_1, get_tclk()); | ||
727 | } | 661 | } |
728 | 662 | ||
729 | 663 | ||
730 | /***************************************************************************** | 664 | /***************************************************************************** |
731 | * UART2 | 665 | * UART2 |
732 | ****************************************************************************/ | 666 | ****************************************************************************/ |
733 | static struct plat_serial8250_port mv78xx0_uart2_data[] = { | ||
734 | { | ||
735 | .mapbase = UART2_PHYS_BASE, | ||
736 | .membase = (char *)UART2_VIRT_BASE, | ||
737 | .irq = IRQ_MV78XX0_UART_2, | ||
738 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, | ||
739 | .iotype = UPIO_MEM, | ||
740 | .regshift = 2, | ||
741 | .uartclk = 0, | ||
742 | }, { | ||
743 | }, | ||
744 | }; | ||
745 | |||
746 | static struct resource mv78xx0_uart2_resources[] = { | ||
747 | { | ||
748 | .start = UART2_PHYS_BASE, | ||
749 | .end = UART2_PHYS_BASE + 0xff, | ||
750 | .flags = IORESOURCE_MEM, | ||
751 | }, { | ||
752 | .start = IRQ_MV78XX0_UART_2, | ||
753 | .end = IRQ_MV78XX0_UART_2, | ||
754 | .flags = IORESOURCE_IRQ, | ||
755 | }, | ||
756 | }; | ||
757 | |||
758 | static struct platform_device mv78xx0_uart2 = { | ||
759 | .name = "serial8250", | ||
760 | .id = PLAT8250_DEV_PLATFORM2, | ||
761 | .dev = { | ||
762 | .platform_data = mv78xx0_uart2_data, | ||
763 | }, | ||
764 | .resource = mv78xx0_uart2_resources, | ||
765 | .num_resources = ARRAY_SIZE(mv78xx0_uart2_resources), | ||
766 | }; | ||
767 | |||
768 | void __init mv78xx0_uart2_init(void) | 667 | void __init mv78xx0_uart2_init(void) |
769 | { | 668 | { |
770 | platform_device_register(&mv78xx0_uart2); | 669 | orion_uart2_init(UART2_VIRT_BASE, UART2_PHYS_BASE, |
670 | IRQ_MV78XX0_UART_2, get_tclk()); | ||
771 | } | 671 | } |
772 | 672 | ||
773 | |||
774 | /***************************************************************************** | 673 | /***************************************************************************** |
775 | * UART3 | 674 | * UART3 |
776 | ****************************************************************************/ | 675 | ****************************************************************************/ |
777 | static struct plat_serial8250_port mv78xx0_uart3_data[] = { | ||
778 | { | ||
779 | .mapbase = UART3_PHYS_BASE, | ||
780 | .membase = (char *)UART3_VIRT_BASE, | ||
781 | .irq = IRQ_MV78XX0_UART_3, | ||
782 | .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF, | ||
783 | .iotype = UPIO_MEM, | ||
784 | .regshift = 2, | ||
785 | .uartclk = 0, | ||
786 | }, { | ||
787 | }, | ||
788 | }; | ||
789 | |||
790 | static struct resource mv78xx0_uart3_resources[] = { | ||
791 | { | ||
792 | .start = UART3_PHYS_BASE, | ||
793 | .end = UART3_PHYS_BASE + 0xff, | ||
794 | .flags = IORESOURCE_MEM, | ||
795 | }, { | ||
796 | .start = IRQ_MV78XX0_UART_3, | ||
797 | .end = IRQ_MV78XX0_UART_3, | ||
798 | .flags = IORESOURCE_IRQ, | ||
799 | }, | ||
800 | }; | ||
801 | |||
802 | static struct platform_device mv78xx0_uart3 = { | ||
803 | .name = "serial8250", | ||
804 | .id = 3, | ||
805 | .dev = { | ||
806 | .platform_data = mv78xx0_uart3_data, | ||
807 | }, | ||
808 | .resource = mv78xx0_uart3_resources, | ||
809 | .num_resources = ARRAY_SIZE(mv78xx0_uart3_resources), | ||
810 | }; | ||
811 | |||
812 | void __init mv78xx0_uart3_init(void) | 676 | void __init mv78xx0_uart3_init(void) |
813 | { | 677 | { |
814 | platform_device_register(&mv78xx0_uart3); | 678 | orion_uart3_init(UART3_VIRT_BASE, UART3_PHYS_BASE, |
679 | IRQ_MV78XX0_UART_3, get_tclk()); | ||
815 | } | 680 | } |
816 | 681 | ||
817 | |||
818 | /***************************************************************************** | 682 | /***************************************************************************** |
819 | * Time handling | 683 | * Time handling |
820 | ****************************************************************************/ | 684 | ****************************************************************************/ |
@@ -900,8 +764,4 @@ void __init mv78xx0_init(void) | |||
900 | mv78xx0_ge01_shared_data.t_clk = tclk; | 764 | mv78xx0_ge01_shared_data.t_clk = tclk; |
901 | mv78xx0_ge10_shared_data.t_clk = tclk; | 765 | mv78xx0_ge10_shared_data.t_clk = tclk; |
902 | mv78xx0_ge11_shared_data.t_clk = tclk; | 766 | mv78xx0_ge11_shared_data.t_clk = tclk; |
903 | mv78xx0_uart0_data[0].uartclk = tclk; | ||
904 | mv78xx0_uart1_data[0].uartclk = tclk; | ||
905 | mv78xx0_uart2_data[0].uartclk = tclk; | ||
906 | mv78xx0_uart3_data[0].uartclk = tclk; | ||
907 | } | 767 | } |