2 * SH3 Setup code for SH7706, SH7707, SH7708, SH7709
4 * Copyright (C) 2007 Magnus Damm
6 * Based on setup-sh7709.c
8 * Copyright (C) 2006 Paul Mundt
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
14 #include <linux/init.h>
16 #include <linux/irq.h>
17 #include <linux/platform_device.h>
18 #include <linux/serial.h>
19 #include <linux/serial_sci.h>
24 /* interrupt sources */
25 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5,
27 DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3,
28 SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI,
29 SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI,
30 SCI_ERI, SCI_RXI, SCI_TXI, SCI_TEI,
33 TMU0, TMU1, TMU2_TUNI, TMU2_TICPI,
34 RTC_ATI, RTC_PRI, RTC_CUI,
38 /* interrupt groups */
39 RTC, REF, TMU2, DMAC, SCI, SCIF2, SCIF0,
42 static struct intc_vect vectors[] __initdata = {
43 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
44 INTC_VECT(TMU2_TUNI, 0x440), INTC_VECT(TMU2_TICPI, 0x460),
45 INTC_VECT(RTC_ATI, 0x480), INTC_VECT(RTC_PRI, 0x4a0),
46 INTC_VECT(RTC_CUI, 0x4c0),
47 INTC_VECT(SCI_ERI, 0x4e0), INTC_VECT(SCI_RXI, 0x500),
48 INTC_VECT(SCI_TXI, 0x520), INTC_VECT(SCI_TEI, 0x540),
49 INTC_VECT(WDT, 0x560),
50 INTC_VECT(REF_RCMI, 0x580),
51 INTC_VECT(REF_ROVI, 0x5a0),
52 #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
53 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
54 defined(CONFIG_CPU_SUBTYPE_SH7709)
55 /* IRQ0->5 are handled in setup-sh3.c */
56 INTC_VECT(DMAC_DEI0, 0x800), INTC_VECT(DMAC_DEI1, 0x820),
57 INTC_VECT(DMAC_DEI2, 0x840), INTC_VECT(DMAC_DEI3, 0x860),
58 INTC_VECT(ADC_ADI, 0x980),
59 INTC_VECT(SCIF2_ERI, 0x900), INTC_VECT(SCIF2_RXI, 0x920),
60 INTC_VECT(SCIF2_BRI, 0x940), INTC_VECT(SCIF2_TXI, 0x960),
62 #if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
63 defined(CONFIG_CPU_SUBTYPE_SH7709)
64 INTC_VECT(PINT07, 0x700), INTC_VECT(PINT815, 0x720),
65 INTC_VECT(SCIF0_ERI, 0x880), INTC_VECT(SCIF0_RXI, 0x8a0),
66 INTC_VECT(SCIF0_BRI, 0x8c0), INTC_VECT(SCIF0_TXI, 0x8e0),
68 #if defined(CONFIG_CPU_SUBTYPE_SH7707)
69 INTC_VECT(LCDC, 0x9a0),
70 INTC_VECT(PCC0, 0x9c0), INTC_VECT(PCC1, 0x9e0),
74 static struct intc_group groups[] __initdata = {
75 INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
76 INTC_GROUP(TMU2, TMU2_TUNI, TMU2_TICPI),
77 INTC_GROUP(REF, REF_RCMI, REF_ROVI),
78 INTC_GROUP(DMAC, DMAC_DEI0, DMAC_DEI1, DMAC_DEI2, DMAC_DEI3),
79 INTC_GROUP(SCI, SCI_ERI, SCI_RXI, SCI_TXI, SCI_TEI),
80 INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI),
81 INTC_GROUP(SCIF2, SCIF2_ERI, SCIF2_RXI, SCIF2_BRI, SCIF2_TXI),
84 static struct intc_prio_reg prio_registers[] __initdata = {
85 { 0xfffffee2, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },
86 { 0xfffffee4, 0, 16, 4, /* IPRB */ { WDT, REF, SCI, 0 } },
87 #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
88 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
89 defined(CONFIG_CPU_SUBTYPE_SH7709)
90 { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } },
91 { 0xa4000018, 0, 16, 4, /* IPRD */ { 0, 0, IRQ5, IRQ4 } },
92 { 0xa400001a, 0, 16, 4, /* IPRE */ { DMAC, 0, SCIF2, ADC_ADI } },
94 #if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
95 defined(CONFIG_CPU_SUBTYPE_SH7709)
96 { 0xa4000018, 0, 16, 4, /* IPRD */ { PINT07, PINT815, } },
97 { 0xa400001a, 0, 16, 4, /* IPRE */ { 0, SCIF0 } },
99 #if defined(CONFIG_CPU_SUBTYPE_SH7707)
100 { 0xa400001c, 0, 16, 4, /* IPRF */ { 0, LCDC, PCC0, PCC1, } },
104 static DECLARE_INTC_DESC(intc_desc, "sh770x", vectors, groups,
105 NULL, prio_registers, NULL);
107 static struct resource rtc_resources[] = {
110 .end = 0xfffffec0 + 0x1e,
111 .flags = IORESOURCE_IO,
115 .flags = IORESOURCE_IRQ,
119 .flags = IORESOURCE_IRQ,
123 .flags = IORESOURCE_IRQ,
127 static struct platform_device rtc_device = {
130 .num_resources = ARRAY_SIZE(rtc_resources),
131 .resource = rtc_resources,
134 static struct plat_sci_port sci_platform_data[] = {
136 .mapbase = 0xfffffe80,
137 .flags = UPF_BOOT_AUTOCONF,
139 .irqs = { 23, 24, 25, 0 },
141 #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
142 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
143 defined(CONFIG_CPU_SUBTYPE_SH7709)
145 .mapbase = 0xa4000150,
146 .flags = UPF_BOOT_AUTOCONF,
148 .irqs = { 56, 57, 59, 58 },
151 #if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
152 defined(CONFIG_CPU_SUBTYPE_SH7709)
154 .mapbase = 0xa4000140,
155 .flags = UPF_BOOT_AUTOCONF,
157 .irqs = { 52, 53, 55, 54 },
165 static struct platform_device sci_device = {
169 .platform_data = sci_platform_data,
173 static struct platform_device *sh770x_devices[] __initdata = {
178 static int __init sh770x_devices_setup(void)
180 return platform_add_devices(sh770x_devices,
181 ARRAY_SIZE(sh770x_devices));
183 __initcall(sh770x_devices_setup);
185 void __init plat_irq_setup(void)
187 register_intc_controller(&intc_desc);
188 #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
189 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
190 defined(CONFIG_CPU_SUBTYPE_SH7709)
191 plat_irq_setup_sh3();