4 * Copyright (C) 2007 Markus Brunner, Mark Jonas
5 * Copyright (C) 2009 Paul Mundt
7 * Based on arch/sh/kernel/cpu/sh4/setup-sh7750.c:
9 * Copyright (C) 2006 Paul Mundt
10 * Copyright (C) 2006 Jamie Lenehan
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file "COPYING" in the main directory of this archive
16 #include <linux/platform_device.h>
17 #include <linux/init.h>
18 #include <linux/serial.h>
20 #include <linux/serial_sci.h>
21 #include <linux/sh_timer.h>
24 static struct resource rtc_resources
[] = {
27 .end
= 0xa413fec0 + 0x28 - 1,
28 .flags
= IORESOURCE_IO
,
31 /* Shared Period/Carry/Alarm IRQ */
33 .flags
= IORESOURCE_IRQ
,
37 static struct sh_rtc_platform_info rtc_info
= {
38 .capabilities
= RTC_CAP_4_DIGIT_YEAR
,
41 static struct platform_device rtc_device
= {
44 .num_resources
= ARRAY_SIZE(rtc_resources
),
45 .resource
= rtc_resources
,
47 .platform_data
= &rtc_info
,
51 static struct plat_sci_port scif0_platform_data
= {
52 .mapbase
= 0xa4430000,
53 .flags
= UPF_BOOT_AUTOCONF
,
55 .irqs
= { 80, 80, 80, 80 },
58 static struct platform_device scif0_device
= {
62 .platform_data
= &scif0_platform_data
,
66 static struct plat_sci_port scif1_platform_data
= {
67 .mapbase
= 0xa4438000,
68 .flags
= UPF_BOOT_AUTOCONF
,
70 .irqs
= { 81, 81, 81, 81 },
73 static struct platform_device scif1_device
= {
77 .platform_data
= &scif1_platform_data
,
81 static struct resource usb_ohci_resources
[] = {
85 .flags
= IORESOURCE_MEM
,
90 .flags
= IORESOURCE_IRQ
,
94 static u64 usb_ohci_dma_mask
= 0xffffffffUL
;
95 static struct platform_device usb_ohci_device
= {
99 .dma_mask
= &usb_ohci_dma_mask
,
100 .coherent_dma_mask
= 0xffffffff,
102 .num_resources
= ARRAY_SIZE(usb_ohci_resources
),
103 .resource
= usb_ohci_resources
,
106 static struct resource usbf_resources
[] = {
111 .flags
= IORESOURCE_MEM
,
117 .flags
= IORESOURCE_IRQ
,
121 static struct platform_device usbf_device
= {
126 .coherent_dma_mask
= 0xffffffff,
128 .num_resources
= ARRAY_SIZE(usbf_resources
),
129 .resource
= usbf_resources
,
132 static struct sh_timer_config cmt0_platform_data
= {
133 .channel_offset
= 0x10,
135 .clockevent_rating
= 125,
136 .clocksource_rating
= 125,
139 static struct resource cmt0_resources
[] = {
143 .flags
= IORESOURCE_MEM
,
147 .flags
= IORESOURCE_IRQ
,
151 static struct platform_device cmt0_device
= {
155 .platform_data
= &cmt0_platform_data
,
157 .resource
= cmt0_resources
,
158 .num_resources
= ARRAY_SIZE(cmt0_resources
),
161 static struct sh_timer_config cmt1_platform_data
= {
162 .channel_offset
= 0x20,
166 static struct resource cmt1_resources
[] = {
170 .flags
= IORESOURCE_MEM
,
174 .flags
= IORESOURCE_IRQ
,
178 static struct platform_device cmt1_device
= {
182 .platform_data
= &cmt1_platform_data
,
184 .resource
= cmt1_resources
,
185 .num_resources
= ARRAY_SIZE(cmt1_resources
),
188 static struct sh_timer_config cmt2_platform_data
= {
189 .channel_offset
= 0x30,
193 static struct resource cmt2_resources
[] = {
197 .flags
= IORESOURCE_MEM
,
201 .flags
= IORESOURCE_IRQ
,
205 static struct platform_device cmt2_device
= {
209 .platform_data
= &cmt2_platform_data
,
211 .resource
= cmt2_resources
,
212 .num_resources
= ARRAY_SIZE(cmt2_resources
),
215 static struct sh_timer_config cmt3_platform_data
= {
216 .channel_offset
= 0x40,
220 static struct resource cmt3_resources
[] = {
224 .flags
= IORESOURCE_MEM
,
228 .flags
= IORESOURCE_IRQ
,
232 static struct platform_device cmt3_device
= {
236 .platform_data
= &cmt3_platform_data
,
238 .resource
= cmt3_resources
,
239 .num_resources
= ARRAY_SIZE(cmt3_resources
),
242 static struct sh_timer_config cmt4_platform_data
= {
243 .channel_offset
= 0x50,
247 static struct resource cmt4_resources
[] = {
251 .flags
= IORESOURCE_MEM
,
255 .flags
= IORESOURCE_IRQ
,
259 static struct platform_device cmt4_device
= {
263 .platform_data
= &cmt4_platform_data
,
265 .resource
= cmt4_resources
,
266 .num_resources
= ARRAY_SIZE(cmt4_resources
),
269 static struct sh_timer_config tmu0_platform_data
= {
270 .channel_offset
= 0x02,
272 .clockevent_rating
= 200,
275 static struct resource tmu0_resources
[] = {
279 .flags
= IORESOURCE_MEM
,
283 .flags
= IORESOURCE_IRQ
,
287 static struct platform_device tmu0_device
= {
291 .platform_data
= &tmu0_platform_data
,
293 .resource
= tmu0_resources
,
294 .num_resources
= ARRAY_SIZE(tmu0_resources
),
297 static struct sh_timer_config tmu1_platform_data
= {
298 .channel_offset
= 0xe,
300 .clocksource_rating
= 200,
303 static struct resource tmu1_resources
[] = {
307 .flags
= IORESOURCE_MEM
,
311 .flags
= IORESOURCE_IRQ
,
315 static struct platform_device tmu1_device
= {
319 .platform_data
= &tmu1_platform_data
,
321 .resource
= tmu1_resources
,
322 .num_resources
= ARRAY_SIZE(tmu1_resources
),
325 static struct sh_timer_config tmu2_platform_data
= {
326 .channel_offset
= 0x1a,
330 static struct resource tmu2_resources
[] = {
334 .flags
= IORESOURCE_MEM
,
338 .flags
= IORESOURCE_IRQ
,
342 static struct platform_device tmu2_device
= {
346 .platform_data
= &tmu2_platform_data
,
348 .resource
= tmu2_resources
,
349 .num_resources
= ARRAY_SIZE(tmu2_resources
),
352 static struct platform_device
*sh7720_devices
[] __initdata
= {
368 static int __init
sh7720_devices_setup(void)
370 return platform_add_devices(sh7720_devices
,
371 ARRAY_SIZE(sh7720_devices
));
373 arch_initcall(sh7720_devices_setup
);
375 static struct platform_device
*sh7720_early_devices
[] __initdata
= {
388 void __init
plat_early_device_setup(void)
390 early_platform_add_devices(sh7720_early_devices
,
391 ARRAY_SIZE(sh7720_early_devices
));
397 /* interrupt sources */
398 TMU0
, TMU1
, TMU2
, RTC
,
400 IRQ0
, IRQ1
, IRQ2
, IRQ3
,
401 USBF_SPD
, TMU_SUNI
, IRQ5
, IRQ4
,
403 ADC
, DMAC2
, USBFI
, CMT
,
405 PINT07
, PINT815
, TPU
, IIC
,
406 SIOF0
, SIOF1
, MMC
, PCC
,
411 static struct intc_vect vectors
[] __initdata
= {
412 /* IRQ0->5 are handled in setup-sh3.c */
413 INTC_VECT(TMU0
, 0x400), INTC_VECT(TMU1
, 0x420),
414 INTC_VECT(TMU2
, 0x440), INTC_VECT(RTC
, 0x480),
415 INTC_VECT(RTC
, 0x4a0), INTC_VECT(RTC
, 0x4c0),
416 INTC_VECT(SIM
, 0x4e0), INTC_VECT(SIM
, 0x500),
417 INTC_VECT(SIM
, 0x520), INTC_VECT(SIM
, 0x540),
418 INTC_VECT(WDT
, 0x560), INTC_VECT(REF_RCMI
, 0x580),
419 /* H_UDI cannot be masked */ INTC_VECT(TMU_SUNI
, 0x6c0),
420 INTC_VECT(USBF_SPD
, 0x6e0), INTC_VECT(DMAC1
, 0x800),
421 INTC_VECT(DMAC1
, 0x820), INTC_VECT(DMAC1
, 0x840),
422 INTC_VECT(DMAC1
, 0x860), INTC_VECT(LCDC
, 0x900),
423 #if defined(CONFIG_CPU_SUBTYPE_SH7720)
424 INTC_VECT(SSL
, 0x980),
426 INTC_VECT(USBFI
, 0xa20), INTC_VECT(USBFI
, 0xa40),
427 INTC_VECT(USBHI
, 0xa60),
428 INTC_VECT(DMAC2
, 0xb80), INTC_VECT(DMAC2
, 0xba0),
429 INTC_VECT(ADC
, 0xbe0), INTC_VECT(SCIF0
, 0xc00),
430 INTC_VECT(SCIF1
, 0xc20), INTC_VECT(PINT07
, 0xc80),
431 INTC_VECT(PINT815
, 0xca0), INTC_VECT(SIOF0
, 0xd00),
432 INTC_VECT(SIOF1
, 0xd20), INTC_VECT(TPU
, 0xd80),
433 INTC_VECT(TPU
, 0xda0), INTC_VECT(TPU
, 0xdc0),
434 INTC_VECT(TPU
, 0xde0), INTC_VECT(IIC
, 0xe00),
435 INTC_VECT(MMC
, 0xe80), INTC_VECT(MMC
, 0xea0),
436 INTC_VECT(MMC
, 0xec0), INTC_VECT(MMC
, 0xee0),
437 INTC_VECT(CMT
, 0xf00), INTC_VECT(PCC
, 0xf60),
438 INTC_VECT(AFEIF
, 0xfe0),
441 static struct intc_prio_reg prio_registers
[] __initdata
= {
442 { 0xA414FEE2UL
, 0, 16, 4, /* IPRA */ { TMU0
, TMU1
, TMU2
, RTC
} },
443 { 0xA414FEE4UL
, 0, 16, 4, /* IPRB */ { WDT
, REF_RCMI
, SIM
, 0 } },
444 { 0xA4140016UL
, 0, 16, 4, /* IPRC */ { IRQ3
, IRQ2
, IRQ1
, IRQ0
} },
445 { 0xA4140018UL
, 0, 16, 4, /* IPRD */ { USBF_SPD
, TMU_SUNI
, IRQ5
, IRQ4
} },
446 { 0xA414001AUL
, 0, 16, 4, /* IPRE */ { DMAC1
, 0, LCDC
, SSL
} },
447 { 0xA4080000UL
, 0, 16, 4, /* IPRF */ { ADC
, DMAC2
, USBFI
, CMT
} },
448 { 0xA4080002UL
, 0, 16, 4, /* IPRG */ { SCIF0
, SCIF1
, 0, 0 } },
449 { 0xA4080004UL
, 0, 16, 4, /* IPRH */ { PINT07
, PINT815
, TPU
, IIC
} },
450 { 0xA4080006UL
, 0, 16, 4, /* IPRI */ { SIOF0
, SIOF1
, MMC
, PCC
} },
451 { 0xA4080008UL
, 0, 16, 4, /* IPRJ */ { 0, USBHI
, 0, AFEIF
} },
454 static DECLARE_INTC_DESC(intc_desc
, "sh7720", vectors
, NULL
,
455 NULL
, prio_registers
, NULL
);
457 void __init
plat_irq_setup(void)
459 register_intc_controller(&intc_desc
);
460 plat_irq_setup_sh3();