aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-10-05 10:26:42 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-10-05 10:26:42 -0400
commitd91ddc2553426a2d9b6b978b5e346f303fccee67 (patch)
treec7ee669043a35e5707b66e3fd89f30e250adc8f8 /arch
parent2be6bb0c79c7fbda3425b65ee51c558bbaf4cf91 (diff)
sh: Wire up INTC subgroup splitting for SH7786 SCIF1.
SH7786 is the big user for subgroup splitting, mostly for the PCIe block, but those will follow later. For now we simply split up SCIF1, as used by the serial console on SDK7786 and others. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7786.c110
1 files changed, 72 insertions, 38 deletions
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
index bbc0a974da04..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
632static 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}
646arch_initcall(sh7786_devices_setup);
647
648void __init plat_early_device_setup(void)
649{
650 early_platform_add_devices(sh7786_early_devices,
651 ARRAY_SIZE(sh7786_early_devices));
652}
653
654enum { 632enum {
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
698static struct intc_vect vectors[] __initdata = { 678static 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),
@@ -761,7 +741,7 @@ static struct intc_vect vectors[] __initdata = {
761#define INT2DISTCR2 0xfe410908 741#define INT2DISTCR2 0xfe410908
762#define INT2DISTCR3 0xfe41090c 742#define INT2DISTCR3 0xfe41090c
763 743
764static struct intc_mask_reg mask_registers[] __initdata = { 744static struct intc_mask_reg sh7786_mask_registers[] __initdata = {
765 { CnINTMSK0, CnINTMSKCLR0, 32, 745 { CnINTMSK0, CnINTMSKCLR0, 32,
766 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 }, 746 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 },
767 INTC_SMP_BALANCING(INTDISTCR0) }, 747 INTC_SMP_BALANCING(INTDISTCR0) },
@@ -805,7 +785,7 @@ static struct intc_mask_reg mask_registers[] __initdata = {
805 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) },
806}; 786};
807 787
808static struct intc_prio_reg prio_registers[] __initdata = { 788static struct intc_prio_reg sh7786_prio_registers[] __initdata = {
809 { 0xfe410010, 0, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3, 789 { 0xfe410010, 0, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3,
810 IRQ4, IRQ5, IRQ6, IRQ7 } }, 790 IRQ4, IRQ5, IRQ6, IRQ7 } },
811 { 0xfe410800, 0, 32, 8, /* INT2PRI0 */ { 0, 0, 0, WDT } }, 791 { 0xfe410800, 0, 32, 8, /* INT2PRI0 */ { 0, 0, 0, WDT } },
@@ -849,11 +829,27 @@ static struct intc_prio_reg prio_registers[] __initdata = {
849 INTICI3, INTICI2, INTICI1, INTICI0 }, INTC_SMP(4, 2) }, 829 INTICI3, INTICI2, INTICI1, INTICI0 }, INTC_SMP(4, 2) },
850}; 830};
851 831
852static DECLARE_INTC_DESC(intc_desc, "sh7786", vectors, NULL, 832static struct intc_subgroup sh7786_subgroups[] __initdata = {
853 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};
854 837
855/* Support for external interrupt pins in IRQ mode */ 838static 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};
856 851
852/* Support for external interrupt pins in IRQ mode */
857static struct intc_vect vectors_irq0123[] __initdata = { 853static struct intc_vect vectors_irq0123[] __initdata = {
858 INTC_VECT(IRQ0, 0x200), INTC_VECT(IRQ1, 0x240), 854 INTC_VECT(IRQ0, 0x200), INTC_VECT(IRQ1, 0x240),
859 INTC_VECT(IRQ2, 0x280), INTC_VECT(IRQ3, 0x2c0), 855 INTC_VECT(IRQ2, 0x280), INTC_VECT(IRQ3, 0x2c0),
@@ -864,23 +860,25 @@ static struct intc_vect vectors_irq4567[] __initdata = {
864 INTC_VECT(IRQ6, 0x380), INTC_VECT(IRQ7, 0x3c0), 860 INTC_VECT(IRQ6, 0x380), INTC_VECT(IRQ7, 0x3c0),
865}; 861};
866 862
867static struct intc_sense_reg sense_registers[] __initdata = { 863static struct intc_sense_reg sh7786_sense_registers[] __initdata = {
868 { 0xfe41001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3, 864 { 0xfe41001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3,
869 IRQ4, IRQ5, IRQ6, IRQ7 } }, 865 IRQ4, IRQ5, IRQ6, IRQ7 } },
870}; 866};
871 867
872static struct intc_mask_reg ack_registers[] __initdata = { 868static struct intc_mask_reg sh7786_ack_registers[] __initdata = {
873 { 0xfe410024, 0, 32, /* INTREQ */ 869 { 0xfe410024, 0, 32, /* INTREQ */
874 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } }, 870 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
875}; 871};
876 872
877static DECLARE_INTC_DESC_ACK(intc_desc_irq0123, "sh7786-irq0123", 873static DECLARE_INTC_DESC_ACK(intc_desc_irq0123, "sh7786-irq0123",
878 vectors_irq0123, NULL, mask_registers, 874 vectors_irq0123, NULL, sh7786_mask_registers,
879 prio_registers, sense_registers, ack_registers); 875 sh7786_prio_registers, sh7786_sense_registers,
876 sh7786_ack_registers);
880 877
881static DECLARE_INTC_DESC_ACK(intc_desc_irq4567, "sh7786-irq4567", 878static DECLARE_INTC_DESC_ACK(intc_desc_irq4567, "sh7786-irq4567",
882 vectors_irq4567, NULL, mask_registers, 879 vectors_irq4567, NULL, sh7786_mask_registers,
883 prio_registers, sense_registers, ack_registers); 880 sh7786_prio_registers, sh7786_sense_registers,
881 sh7786_ack_registers);
884 882
885/* External interrupt pins in IRL mode */ 883/* External interrupt pins in IRL mode */
886 884
@@ -907,10 +905,10 @@ static struct intc_vect vectors_irl4567[] __initdata = {
907}; 905};
908 906
909static DECLARE_INTC_DESC(intc_desc_irl0123, "sh7786-irl0123", vectors_irl0123, 907static DECLARE_INTC_DESC(intc_desc_irl0123, "sh7786-irl0123", vectors_irl0123,
910 NULL, mask_registers, NULL, NULL); 908 NULL, sh7786_mask_registers, NULL, NULL);
911 909
912static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7786-irl4567", vectors_irl4567, 910static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7786-irl4567", vectors_irl4567,
913 NULL, mask_registers, NULL, NULL); 911 NULL, sh7786_mask_registers, NULL, NULL);
914 912
915#define INTC_ICR0 0xfe410000 913#define INTC_ICR0 0xfe410000
916#define INTC_INTMSK0 CnINTMSK0 914#define INTC_INTMSK0 CnINTMSK0
@@ -931,7 +929,7 @@ void __init plat_irq_setup(void)
931 /* select IRL mode for IRL3-0 + IRL7-4 */ 929 /* select IRL mode for IRL3-0 + IRL7-4 */
932 __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0); 930 __raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
933 931
934 register_intc_controller(&intc_desc); 932 register_intc_controller(&sh7786_intc_desc);
935} 933}
936 934
937void __init plat_irq_setup_pins(int mode) 935void __init plat_irq_setup_pins(int mode)
@@ -975,3 +973,39 @@ void __init plat_irq_setup_pins(int mode)
975void __init plat_mem_setup(void) 973void __init plat_mem_setup(void)
976{ 974{
977} 975}
976
977static 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}
1005arch_initcall(sh7786_devices_setup);
1006
1007void __init plat_early_device_setup(void)
1008{
1009 early_platform_add_devices(sh7786_early_devices,
1010 ARRAY_SIZE(sh7786_early_devices));
1011}