4 * Copyright (C) 2007 Markus Brunner, Mark Jonas
6 * Based on arch/sh/kernel/cpu/sh4/setup-sh7750.c:
8 * Copyright (C) 2006 Paul Mundt
9 * Copyright (C) 2006 Jamie Lenehan
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
15 #include <linux/platform_device.h>
16 #include <linux/init.h>
17 #include <linux/serial.h>
19 #include <linux/serial_sci.h>
22 #define INTC_ICR1 0xA4140010UL
23 #define INTC_ICR_IRLM 0x4000
24 #define INTC_ICR_IRQ (~INTC_ICR_IRLM)
26 static struct resource rtc_resources[] = {
29 .end = 0xa413fec0 + 0x28 - 1,
30 .flags = IORESOURCE_IO,
35 .flags = IORESOURCE_IRQ,
40 .flags = IORESOURCE_IRQ,
45 .flags = IORESOURCE_IRQ,
49 static struct sh_rtc_platform_info rtc_info = {
50 .capabilities = RTC_CAP_4_DIGIT_YEAR,
53 static struct platform_device rtc_device = {
56 .num_resources = ARRAY_SIZE(rtc_resources),
57 .resource = rtc_resources,
59 .platform_data = &rtc_info,
63 static struct plat_sci_port sci_platform_data[] = {
65 .mapbase = 0xa4430000,
66 .flags = UPF_BOOT_AUTOCONF,
68 .irqs = { 80, 80, 80, 80 },
70 .mapbase = 0xa4438000,
71 .flags = UPF_BOOT_AUTOCONF,
73 .irqs = { 81, 81, 81, 81 },
80 static struct platform_device sci_device = {
84 .platform_data = sci_platform_data,
88 static struct resource usb_ohci_resources[] = {
92 .flags = IORESOURCE_MEM,
97 .flags = IORESOURCE_IRQ,
101 static u64 usb_ohci_dma_mask = 0xffffffffUL;
102 static struct platform_device usb_ohci_device = {
106 .dma_mask = &usb_ohci_dma_mask,
107 .coherent_dma_mask = 0xffffffff,
109 .num_resources = ARRAY_SIZE(usb_ohci_resources),
110 .resource = usb_ohci_resources,
113 static struct resource usbf_resources[] = {
118 .flags = IORESOURCE_MEM,
124 .flags = IORESOURCE_IRQ,
128 static struct platform_device usbf_device = {
133 .coherent_dma_mask = 0xffffffff,
135 .num_resources = ARRAY_SIZE(usbf_resources),
136 .resource = usbf_resources,
139 static struct platform_device *sh7720_devices[] __initdata = {
146 static int __init sh7720_devices_setup(void)
148 return platform_add_devices(sh7720_devices,
149 ARRAY_SIZE(sh7720_devices));
151 __initcall(sh7720_devices_setup);
156 /* interrupt sources */
157 TMU0, TMU1, TMU2, RTC_ATI, RTC_PRI, RTC_CUI,
158 WDT, REF_RCMI, SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEND,
159 IRQ0, IRQ1, IRQ2, IRQ3,
160 USBF_SPD, TMU_SUNI, IRQ5, IRQ4,
161 DMAC1_DEI0, DMAC1_DEI1, DMAC1_DEI2, DMAC1_DEI3, LCDC, SSL,
162 ADC, DMAC2_DEI4, DMAC2_DEI5, USBFI0, USBFI1, CMT,
164 PINT07, PINT815, TPU0, TPU1, TPU2, TPU3, IIC,
165 SIOF0, SIOF1, MMCI0, MMCI1, MMCI2, MMCI3, PCC,
168 /* interrupt groups */
169 TMU, RTC, SIM, DMAC1, USBFI, DMAC2, USB, TPU, MMC,
172 static struct intc_vect vectors[] __initdata = {
173 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
174 INTC_VECT(TMU2, 0x440), INTC_VECT(RTC_ATI, 0x480),
175 INTC_VECT(RTC_PRI, 0x4a0), INTC_VECT(RTC_CUI, 0x4c0),
176 INTC_VECT(SIM_ERI, 0x4e0), INTC_VECT(SIM_RXI, 0x500),
177 INTC_VECT(SIM_TXI, 0x520), INTC_VECT(SIM_TEND, 0x540),
178 INTC_VECT(WDT, 0x560), INTC_VECT(REF_RCMI, 0x580),
179 /* H_UDI cannot be masked */ INTC_VECT(TMU_SUNI, 0x6c0),
180 INTC_VECT(USBF_SPD, 0x6e0), INTC_VECT(DMAC1_DEI0, 0x800),
181 INTC_VECT(DMAC1_DEI1, 0x820), INTC_VECT(DMAC1_DEI2, 0x840),
182 INTC_VECT(DMAC1_DEI3, 0x860), INTC_VECT(LCDC, 0x900),
183 #if defined(CONFIG_CPU_SUBTYPE_SH7720)
184 INTC_VECT(SSL, 0x980),
186 INTC_VECT(USBFI0, 0xa20), INTC_VECT(USBFI1, 0xa40),
187 INTC_VECT(USBHI, 0xa60),
188 INTC_VECT(DMAC2_DEI4, 0xb80), INTC_VECT(DMAC2_DEI5, 0xba0),
189 INTC_VECT(ADC, 0xbe0), INTC_VECT(SCIF0, 0xc00),
190 INTC_VECT(SCIF1, 0xc20), INTC_VECT(PINT07, 0xc80),
191 INTC_VECT(PINT815, 0xca0), INTC_VECT(SIOF0, 0xd00),
192 INTC_VECT(SIOF1, 0xd20), INTC_VECT(TPU0, 0xd80),
193 INTC_VECT(TPU1, 0xda0), INTC_VECT(TPU2, 0xdc0),
194 INTC_VECT(TPU3, 0xde0), INTC_VECT(IIC, 0xe00),
195 INTC_VECT(MMCI0, 0xe80), INTC_VECT(MMCI1, 0xea0),
196 INTC_VECT(MMCI2, 0xec0), INTC_VECT(MMCI3, 0xee0),
197 INTC_VECT(CMT, 0xf00), INTC_VECT(PCC, 0xf60),
198 INTC_VECT(AFEIF, 0xfe0),
201 static struct intc_group groups[] __initdata = {
202 INTC_GROUP(TMU, TMU0, TMU1, TMU2),
203 INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
204 INTC_GROUP(SIM, SIM_ERI, SIM_RXI, SIM_TXI, SIM_TEND),
205 INTC_GROUP(DMAC1, DMAC1_DEI0, DMAC1_DEI1, DMAC1_DEI2, DMAC1_DEI3),
206 INTC_GROUP(USBFI, USBFI0, USBFI1),
207 INTC_GROUP(DMAC2, DMAC2_DEI4, DMAC2_DEI5),
208 INTC_GROUP(TPU, TPU0, TPU1, TPU2, TPU3),
209 INTC_GROUP(MMC, MMCI0, MMCI1, MMCI2, MMCI3),
212 static struct intc_prio_reg prio_registers[] __initdata = {
213 { 0xA414FEE2UL, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },
214 { 0xA414FEE4UL, 0, 16, 4, /* IPRB */ { WDT, REF_RCMI, SIM, 0 } },
215 { 0xA4140016UL, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } },
216 { 0xA4140018UL, 0, 16, 4, /* IPRD */ { USBF_SPD, TMU_SUNI, IRQ5, IRQ4 } },
217 #if defined(CONFIG_CPU_SUBTYPE_SH7720)
218 { 0xA414001AUL, 0, 16, 4, /* IPRE */ { DMAC1, 0, LCDC, SSL } },
220 { 0xA414001AUL, 0, 16, 4, /* IPRE */ { DMAC1, 0, LCDC, 0 } },
222 { 0xA4080000UL, 0, 16, 4, /* IPRF */ { ADC, DMAC2, USBFI, CMT } },
223 { 0xA4080002UL, 0, 16, 4, /* IPRG */ { SCIF0, SCIF1, 0, 0 } },
224 { 0xA4080004UL, 0, 16, 4, /* IPRH */ { PINT07, PINT815, TPU, IIC } },
225 { 0xA4080006UL, 0, 16, 4, /* IPRI */ { SIOF0, SIOF1, MMC, PCC } },
226 { 0xA4080008UL, 0, 16, 4, /* IPRJ */ { 0, USBHI, 0, AFEIF } },
229 static DECLARE_INTC_DESC(intc_desc, "sh7720", vectors, groups,
230 NULL, prio_registers, NULL);
232 static struct intc_sense_reg sense_registers[] __initdata = {
233 { INTC_ICR1, 16, 2, { 0, 0, IRQ5, IRQ4, IRQ3, IRQ2, IRQ1, IRQ0 } },
236 static struct intc_vect vectors_irq[] __initdata = {
237 INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
238 INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
239 INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
242 static DECLARE_INTC_DESC(intc_irq_desc, "sh7720-irq", vectors_irq,
243 NULL, NULL, prio_registers, sense_registers);
245 void __init plat_irq_setup_pins(int mode)
249 ctrl_outw(ctrl_inw(INTC_ICR1) & INTC_ICR_IRQ, INTC_ICR1);
250 register_intc_controller(&intc_irq_desc);
257 void __init plat_irq_setup(void)
259 register_intc_controller(&intc_desc);