diff options
Diffstat (limited to 'arch/sh/kernel/cpu/sh4a/setup-sh7786.c')
-rw-r--r-- | arch/sh/kernel/cpu/sh4a/setup-sh7786.c | 126 |
1 files changed, 72 insertions, 54 deletions
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c index 8797723231ea..c016c0004714 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c | |||
@@ -629,33 +629,10 @@ static void __init sh7786_usb_setup(void) | |||
629 | } | 629 | } |
630 | } | 630 | } |
631 | 631 | ||
632 | static int __init sh7786_devices_setup(void) | ||
633 | { | ||
634 | int ret; | ||
635 | |||
636 | sh7786_usb_setup(); | ||
637 | |||
638 | ret = platform_add_devices(sh7786_early_devices, | ||
639 | ARRAY_SIZE(sh7786_early_devices)); | ||
640 | if (unlikely(ret != 0)) | ||
641 | return ret; | ||
642 | |||
643 | return platform_add_devices(sh7786_devices, | ||
644 | ARRAY_SIZE(sh7786_devices)); | ||
645 | } | ||
646 | arch_initcall(sh7786_devices_setup); | ||
647 | |||
648 | void __init plat_early_device_setup(void) | ||
649 | { | ||
650 | early_platform_add_devices(sh7786_early_devices, | ||
651 | ARRAY_SIZE(sh7786_early_devices)); | ||
652 | } | ||
653 | |||
654 | enum { | 632 | enum { |
655 | UNUSED = 0, | 633 | UNUSED = 0, |
656 | 634 | ||
657 | /* interrupt sources */ | 635 | /* interrupt sources */ |
658 | |||
659 | IRL0_LLLL, IRL0_LLLH, IRL0_LLHL, IRL0_LLHH, | 636 | IRL0_LLLL, IRL0_LLLH, IRL0_LLHL, IRL0_LLHH, |
660 | IRL0_LHLL, IRL0_LHLH, IRL0_LHHL, IRL0_LHHH, | 637 | IRL0_LHLL, IRL0_LHLH, IRL0_LHHL, IRL0_LHHH, |
661 | IRL0_HLLL, IRL0_HLLH, IRL0_HLHL, IRL0_HLHH, | 638 | IRL0_HLLL, IRL0_HLLH, IRL0_HLHL, IRL0_HLHH, |
@@ -693,9 +670,12 @@ enum { | |||
693 | Thermal, | 670 | Thermal, |
694 | INTICI0, INTICI1, INTICI2, INTICI3, | 671 | INTICI0, INTICI1, INTICI2, INTICI3, |
695 | INTICI4, INTICI5, INTICI6, INTICI7, | 672 | INTICI4, INTICI5, INTICI6, INTICI7, |
673 | |||
674 | /* Muxed sub-events */ | ||
675 | TXI1, BRI1, RXI1, ERI1, | ||
696 | }; | 676 | }; |
697 | 677 | ||
698 | static struct intc_vect vectors[] __initdata = { | 678 | static struct intc_vect sh7786_vectors[] __initdata = { |
699 | INTC_VECT(WDT, 0x3e0), | 679 | INTC_VECT(WDT, 0x3e0), |
700 | INTC_VECT(TMU0_0, 0x400), INTC_VECT(TMU0_1, 0x420), | 680 | INTC_VECT(TMU0_0, 0x400), INTC_VECT(TMU0_1, 0x420), |
701 | INTC_VECT(TMU0_2, 0x440), INTC_VECT(TMU0_3, 0x460), | 681 | INTC_VECT(TMU0_2, 0x440), INTC_VECT(TMU0_3, 0x460), |
@@ -756,14 +736,12 @@ static struct intc_vect vectors[] __initdata = { | |||
756 | 736 | ||
757 | #define INTDISTCR0 0xfe4100b0 | 737 | #define INTDISTCR0 0xfe4100b0 |
758 | #define INTDISTCR1 0xfe4100b4 | 738 | #define INTDISTCR1 0xfe4100b4 |
759 | #define INTACK 0xfe4100b8 | ||
760 | #define INTACKCLR 0xfe4100bc | ||
761 | #define INT2DISTCR0 0xfe410900 | 739 | #define INT2DISTCR0 0xfe410900 |
762 | #define INT2DISTCR1 0xfe410904 | 740 | #define INT2DISTCR1 0xfe410904 |
763 | #define INT2DISTCR2 0xfe410908 | 741 | #define INT2DISTCR2 0xfe410908 |
764 | #define INT2DISTCR3 0xfe41090c | 742 | #define INT2DISTCR3 0xfe41090c |
765 | 743 | ||
766 | static struct intc_mask_reg mask_registers[] __initdata = { | 744 | static struct intc_mask_reg sh7786_mask_registers[] __initdata = { |
767 | { CnINTMSK0, CnINTMSKCLR0, 32, | 745 | { CnINTMSK0, CnINTMSKCLR0, 32, |
768 | { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 }, | 746 | { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 }, |
769 | INTC_SMP_BALANCING(INTDISTCR0) }, | 747 | INTC_SMP_BALANCING(INTDISTCR0) }, |
@@ -807,7 +785,7 @@ static struct intc_mask_reg mask_registers[] __initdata = { | |||
807 | 0, 0, 0, 0, 0, 0, 0, 0 }, INTC_SMP_BALANCING(INT2DISTCR3) }, | 785 | 0, 0, 0, 0, 0, 0, 0, 0 }, INTC_SMP_BALANCING(INT2DISTCR3) }, |
808 | }; | 786 | }; |
809 | 787 | ||
810 | static struct intc_prio_reg prio_registers[] __initdata = { | 788 | static struct intc_prio_reg sh7786_prio_registers[] __initdata = { |
811 | { 0xfe410010, 0, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3, | 789 | { 0xfe410010, 0, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3, |
812 | IRQ4, IRQ5, IRQ6, IRQ7 } }, | 790 | IRQ4, IRQ5, IRQ6, IRQ7 } }, |
813 | { 0xfe410800, 0, 32, 8, /* INT2PRI0 */ { 0, 0, 0, WDT } }, | 791 | { 0xfe410800, 0, 32, 8, /* INT2PRI0 */ { 0, 0, 0, WDT } }, |
@@ -851,11 +829,27 @@ static struct intc_prio_reg prio_registers[] __initdata = { | |||
851 | INTICI3, INTICI2, INTICI1, INTICI0 }, INTC_SMP(4, 2) }, | 829 | INTICI3, INTICI2, INTICI1, INTICI0 }, INTC_SMP(4, 2) }, |
852 | }; | 830 | }; |
853 | 831 | ||
854 | static DECLARE_INTC_DESC(intc_desc, "sh7786", vectors, NULL, | 832 | static struct intc_subgroup sh7786_subgroups[] __initdata = { |
855 | mask_registers, prio_registers, NULL); | 833 | { 0xfe410c20, 32, SCIF1, |
834 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
835 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, TXI1, BRI1, RXI1, ERI1 } }, | ||
836 | }; | ||
856 | 837 | ||
857 | /* Support for external interrupt pins in IRQ mode */ | 838 | static struct intc_desc sh7786_intc_desc __initdata = { |
839 | .name = "sh7786", | ||
840 | .hw = { | ||
841 | .vectors = sh7786_vectors, | ||
842 | .nr_vectors = ARRAY_SIZE(sh7786_vectors), | ||
843 | .mask_regs = sh7786_mask_registers, | ||
844 | .nr_mask_regs = ARRAY_SIZE(sh7786_mask_registers), | ||
845 | .subgroups = sh7786_subgroups, | ||
846 | .nr_subgroups = ARRAY_SIZE(sh7786_subgroups), | ||
847 | .prio_regs = sh7786_prio_registers, | ||
848 | .nr_prio_regs = ARRAY_SIZE(sh7786_prio_registers), | ||
849 | }, | ||
850 | }; | ||
858 | 851 | ||
852 | /* Support for external interrupt pins in IRQ mode */ | ||
859 | static struct intc_vect vectors_irq0123[] __initdata = { | 853 | static struct intc_vect vectors_irq0123[] __initdata = { |
860 | INTC_VECT(IRQ0, 0x200), INTC_VECT(IRQ1, 0x240), | 854 | INTC_VECT(IRQ0, 0x200), INTC_VECT(IRQ1, 0x240), |
861 | INTC_VECT(IRQ2, 0x280), INTC_VECT(IRQ3, 0x2c0), | 855 | INTC_VECT(IRQ2, 0x280), INTC_VECT(IRQ3, 0x2c0), |
@@ -866,23 +860,25 @@ static struct intc_vect vectors_irq4567[] __initdata = { | |||
866 | INTC_VECT(IRQ6, 0x380), INTC_VECT(IRQ7, 0x3c0), | 860 | INTC_VECT(IRQ6, 0x380), INTC_VECT(IRQ7, 0x3c0), |
867 | }; | 861 | }; |
868 | 862 | ||
869 | static struct intc_sense_reg sense_registers[] __initdata = { | 863 | static struct intc_sense_reg sh7786_sense_registers[] __initdata = { |
870 | { 0xfe41001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3, | 864 | { 0xfe41001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3, |
871 | IRQ4, IRQ5, IRQ6, IRQ7 } }, | 865 | IRQ4, IRQ5, IRQ6, IRQ7 } }, |
872 | }; | 866 | }; |
873 | 867 | ||
874 | static struct intc_mask_reg ack_registers[] __initdata = { | 868 | static struct intc_mask_reg sh7786_ack_registers[] __initdata = { |
875 | { 0xfe410024, 0, 32, /* INTREQ */ | 869 | { 0xfe410024, 0, 32, /* INTREQ */ |
876 | { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } }, | 870 | { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } }, |
877 | }; | 871 | }; |
878 | 872 | ||
879 | static DECLARE_INTC_DESC_ACK(intc_desc_irq0123, "sh7786-irq0123", | 873 | static DECLARE_INTC_DESC_ACK(intc_desc_irq0123, "sh7786-irq0123", |
880 | vectors_irq0123, NULL, mask_registers, | 874 | vectors_irq0123, NULL, sh7786_mask_registers, |
881 | prio_registers, sense_registers, ack_registers); | 875 | sh7786_prio_registers, sh7786_sense_registers, |
876 | sh7786_ack_registers); | ||
882 | 877 | ||
883 | static DECLARE_INTC_DESC_ACK(intc_desc_irq4567, "sh7786-irq4567", | 878 | static DECLARE_INTC_DESC_ACK(intc_desc_irq4567, "sh7786-irq4567", |
884 | vectors_irq4567, NULL, mask_registers, | 879 | vectors_irq4567, NULL, sh7786_mask_registers, |
885 | prio_registers, sense_registers, ack_registers); | 880 | sh7786_prio_registers, sh7786_sense_registers, |
881 | sh7786_ack_registers); | ||
886 | 882 | ||
887 | /* External interrupt pins in IRL mode */ | 883 | /* External interrupt pins in IRL mode */ |
888 | 884 | ||
@@ -909,10 +905,10 @@ static struct intc_vect vectors_irl4567[] __initdata = { | |||
909 | }; | 905 | }; |
910 | 906 | ||
911 | static DECLARE_INTC_DESC(intc_desc_irl0123, "sh7786-irl0123", vectors_irl0123, | 907 | static DECLARE_INTC_DESC(intc_desc_irl0123, "sh7786-irl0123", vectors_irl0123, |
912 | NULL, mask_registers, NULL, NULL); | 908 | NULL, sh7786_mask_registers, NULL, NULL); |
913 | 909 | ||
914 | static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7786-irl4567", vectors_irl4567, | 910 | static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7786-irl4567", vectors_irl4567, |
915 | NULL, mask_registers, NULL, NULL); | 911 | NULL, sh7786_mask_registers, NULL, NULL); |
916 | 912 | ||
917 | #define INTC_ICR0 0xfe410000 | 913 | #define INTC_ICR0 0xfe410000 |
918 | #define INTC_INTMSK0 CnINTMSK0 | 914 | #define INTC_INTMSK0 CnINTMSK0 |
@@ -920,19 +916,6 @@ static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7786-irl4567", vectors_irl4567, | |||
920 | #define INTC_INTMSK2 INTMSK2 | 916 | #define INTC_INTMSK2 INTMSK2 |
921 | #define INTC_INTMSKCLR1 CnINTMSKCLR1 | 917 | #define INTC_INTMSKCLR1 CnINTMSKCLR1 |
922 | #define INTC_INTMSKCLR2 INTMSKCLR2 | 918 | #define INTC_INTMSKCLR2 INTMSKCLR2 |
923 | #define INTC_USERIMASK 0xfe411000 | ||
924 | |||
925 | #ifdef CONFIG_INTC_BALANCING | ||
926 | unsigned int irq_lookup(unsigned int irq) | ||
927 | { | ||
928 | return __raw_readl(INTACK) & 1 ? irq : NO_IRQ_IGNORE; | ||
929 | } | ||
930 | |||
931 | void irq_finish(unsigned int irq) | ||
932 | { | ||
933 | __raw_writel(irq2evt(irq), INTACKCLR); | ||
934 | } | ||
935 | #endif | ||
936 | 919 | ||
937 | void __init plat_irq_setup(void) | 920 | void __init plat_irq_setup(void) |
938 | { | 921 | { |
@@ -946,8 +929,7 @@ void __init plat_irq_setup(void) | |||
946 | /* select IRL mode for IRL3-0 + IRL7-4 */ | 929 | /* select IRL mode for IRL3-0 + IRL7-4 */ |
947 | __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0); | 930 | __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0); |
948 | 931 | ||
949 | register_intc_controller(&intc_desc); | 932 | register_intc_controller(&sh7786_intc_desc); |
950 | register_intc_userimask(INTC_USERIMASK); | ||
951 | } | 933 | } |
952 | 934 | ||
953 | void __init plat_irq_setup_pins(int mode) | 935 | void __init plat_irq_setup_pins(int mode) |
@@ -991,3 +973,39 @@ void __init plat_irq_setup_pins(int mode) | |||
991 | void __init plat_mem_setup(void) | 973 | void __init plat_mem_setup(void) |
992 | { | 974 | { |
993 | } | 975 | } |
976 | |||
977 | static int __init sh7786_devices_setup(void) | ||
978 | { | ||
979 | int ret, irq; | ||
980 | |||
981 | sh7786_usb_setup(); | ||
982 | |||
983 | /* | ||
984 | * De-mux SCIF1 IRQs if possible | ||
985 | */ | ||
986 | irq = intc_irq_lookup(sh7786_intc_desc.name, TXI1); | ||
987 | if (irq > 0) { | ||
988 | scif1_platform_data.irqs[SCIx_TXI_IRQ] = irq; | ||
989 | scif1_platform_data.irqs[SCIx_ERI_IRQ] = | ||
990 | intc_irq_lookup(sh7786_intc_desc.name, ERI1); | ||
991 | scif1_platform_data.irqs[SCIx_BRI_IRQ] = | ||
992 | intc_irq_lookup(sh7786_intc_desc.name, BRI1); | ||
993 | scif1_platform_data.irqs[SCIx_RXI_IRQ] = | ||
994 | intc_irq_lookup(sh7786_intc_desc.name, RXI1); | ||
995 | } | ||
996 | |||
997 | ret = platform_add_devices(sh7786_early_devices, | ||
998 | ARRAY_SIZE(sh7786_early_devices)); | ||
999 | if (unlikely(ret != 0)) | ||
1000 | return ret; | ||
1001 | |||
1002 | return platform_add_devices(sh7786_devices, | ||
1003 | ARRAY_SIZE(sh7786_devices)); | ||
1004 | } | ||
1005 | arch_initcall(sh7786_devices_setup); | ||
1006 | |||
1007 | void __init plat_early_device_setup(void) | ||
1008 | { | ||
1009 | early_platform_add_devices(sh7786_early_devices, | ||
1010 | ARRAY_SIZE(sh7786_early_devices)); | ||
1011 | } | ||