2 * Setup code for SH7720, SH7721.
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>
23 #include <cpu/serial.h>
25 static struct resource rtc_resources
[] = {
28 .end
= 0xa413fec0 + 0x28 - 1,
29 .flags
= IORESOURCE_IO
,
32 /* Shared Period/Carry/Alarm IRQ */
34 .flags
= IORESOURCE_IRQ
,
38 static struct sh_rtc_platform_info rtc_info
= {
39 .capabilities
= RTC_CAP_4_DIGIT_YEAR
,
42 static struct platform_device rtc_device
= {
45 .num_resources
= ARRAY_SIZE(rtc_resources
),
46 .resource
= rtc_resources
,
48 .platform_data
= &rtc_info
,
52 static struct plat_sci_port scif0_platform_data
= {
53 .mapbase
= 0xa4430000,
54 .flags
= UPF_BOOT_AUTOCONF
,
55 .scscr
= SCSCR_RE
| SCSCR_TE
,
56 .scbrr_algo_id
= SCBRR_ALGO_4
,
58 .irqs
= { 80, 80, 80, 80 },
59 .ops
= &sh7720_sci_port_ops
,
60 .regtype
= SCIx_SH7705_SCIF_REGTYPE
,
63 static struct platform_device scif0_device
= {
67 .platform_data
= &scif0_platform_data
,
71 static struct plat_sci_port scif1_platform_data
= {
72 .mapbase
= 0xa4438000,
73 .flags
= UPF_BOOT_AUTOCONF
,
74 .scscr
= SCSCR_RE
| SCSCR_TE
,
75 .scbrr_algo_id
= SCBRR_ALGO_4
,
77 .irqs
= { 81, 81, 81, 81 },
78 .ops
= &sh7720_sci_port_ops
,
79 .regtype
= SCIx_SH7705_SCIF_REGTYPE
,
82 static struct platform_device scif1_device
= {
86 .platform_data
= &scif1_platform_data
,
90 static struct resource usb_ohci_resources
[] = {
94 .flags
= IORESOURCE_MEM
,
99 .flags
= IORESOURCE_IRQ
,
103 static u64 usb_ohci_dma_mask
= 0xffffffffUL
;
104 static struct platform_device usb_ohci_device
= {
108 .dma_mask
= &usb_ohci_dma_mask
,
109 .coherent_dma_mask
= 0xffffffff,
111 .num_resources
= ARRAY_SIZE(usb_ohci_resources
),
112 .resource
= usb_ohci_resources
,
115 static struct resource usbf_resources
[] = {
120 .flags
= IORESOURCE_MEM
,
126 .flags
= IORESOURCE_IRQ
,
130 static struct platform_device usbf_device
= {
135 .coherent_dma_mask
= 0xffffffff,
137 .num_resources
= ARRAY_SIZE(usbf_resources
),
138 .resource
= usbf_resources
,
141 static struct sh_timer_config cmt0_platform_data
= {
142 .channel_offset
= 0x10,
144 .clockevent_rating
= 125,
145 .clocksource_rating
= 125,
148 static struct resource cmt0_resources
[] = {
152 .flags
= IORESOURCE_MEM
,
156 .flags
= IORESOURCE_IRQ
,
160 static struct platform_device cmt0_device
= {
164 .platform_data
= &cmt0_platform_data
,
166 .resource
= cmt0_resources
,
167 .num_resources
= ARRAY_SIZE(cmt0_resources
),
170 static struct sh_timer_config cmt1_platform_data
= {
171 .channel_offset
= 0x20,
175 static struct resource cmt1_resources
[] = {
179 .flags
= IORESOURCE_MEM
,
183 .flags
= IORESOURCE_IRQ
,
187 static struct platform_device cmt1_device
= {
191 .platform_data
= &cmt1_platform_data
,
193 .resource
= cmt1_resources
,
194 .num_resources
= ARRAY_SIZE(cmt1_resources
),
197 static struct sh_timer_config cmt2_platform_data
= {
198 .channel_offset
= 0x30,
202 static struct resource cmt2_resources
[] = {
206 .flags
= IORESOURCE_MEM
,
210 .flags
= IORESOURCE_IRQ
,
214 static struct platform_device cmt2_device
= {
218 .platform_data
= &cmt2_platform_data
,
220 .resource
= cmt2_resources
,
221 .num_resources
= ARRAY_SIZE(cmt2_resources
),
224 static struct sh_timer_config cmt3_platform_data
= {
225 .channel_offset
= 0x40,
229 static struct resource cmt3_resources
[] = {
233 .flags
= IORESOURCE_MEM
,
237 .flags
= IORESOURCE_IRQ
,
241 static struct platform_device cmt3_device
= {
245 .platform_data
= &cmt3_platform_data
,
247 .resource
= cmt3_resources
,
248 .num_resources
= ARRAY_SIZE(cmt3_resources
),
251 static struct sh_timer_config cmt4_platform_data
= {
252 .channel_offset
= 0x50,
256 static struct resource cmt4_resources
[] = {
260 .flags
= IORESOURCE_MEM
,
264 .flags
= IORESOURCE_IRQ
,
268 static struct platform_device cmt4_device
= {
272 .platform_data
= &cmt4_platform_data
,
274 .resource
= cmt4_resources
,
275 .num_resources
= ARRAY_SIZE(cmt4_resources
),
278 static struct sh_timer_config tmu0_platform_data
= {
279 .channel_offset
= 0x02,
281 .clockevent_rating
= 200,
284 static struct resource tmu0_resources
[] = {
288 .flags
= IORESOURCE_MEM
,
292 .flags
= IORESOURCE_IRQ
,
296 static struct platform_device tmu0_device
= {
300 .platform_data
= &tmu0_platform_data
,
302 .resource
= tmu0_resources
,
303 .num_resources
= ARRAY_SIZE(tmu0_resources
),
306 static struct sh_timer_config tmu1_platform_data
= {
307 .channel_offset
= 0xe,
309 .clocksource_rating
= 200,
312 static struct resource tmu1_resources
[] = {
316 .flags
= IORESOURCE_MEM
,
320 .flags
= IORESOURCE_IRQ
,
324 static struct platform_device tmu1_device
= {
328 .platform_data
= &tmu1_platform_data
,
330 .resource
= tmu1_resources
,
331 .num_resources
= ARRAY_SIZE(tmu1_resources
),
334 static struct sh_timer_config tmu2_platform_data
= {
335 .channel_offset
= 0x1a,
339 static struct resource tmu2_resources
[] = {
343 .flags
= IORESOURCE_MEM
,
347 .flags
= IORESOURCE_IRQ
,
351 static struct platform_device tmu2_device
= {
355 .platform_data
= &tmu2_platform_data
,
357 .resource
= tmu2_resources
,
358 .num_resources
= ARRAY_SIZE(tmu2_resources
),
361 static struct platform_device
*sh7720_devices
[] __initdata
= {
377 static int __init
sh7720_devices_setup(void)
379 return platform_add_devices(sh7720_devices
,
380 ARRAY_SIZE(sh7720_devices
));
382 arch_initcall(sh7720_devices_setup
);
384 static struct platform_device
*sh7720_early_devices
[] __initdata
= {
397 void __init
plat_early_device_setup(void)
399 early_platform_add_devices(sh7720_early_devices
,
400 ARRAY_SIZE(sh7720_early_devices
));
406 /* interrupt sources */
407 TMU0
, TMU1
, TMU2
, RTC
,
409 IRQ0
, IRQ1
, IRQ2
, IRQ3
,
410 USBF_SPD
, TMU_SUNI
, IRQ5
, IRQ4
,
412 ADC
, DMAC2
, USBFI
, CMT
,
414 PINT07
, PINT815
, TPU
, IIC
,
415 SIOF0
, SIOF1
, MMC
, PCC
,
420 static struct intc_vect vectors
[] __initdata
= {
421 /* IRQ0->5 are handled in setup-sh3.c */
422 INTC_VECT(TMU0
, 0x400), INTC_VECT(TMU1
, 0x420),
423 INTC_VECT(TMU2
, 0x440), INTC_VECT(RTC
, 0x480),
424 INTC_VECT(RTC
, 0x4a0), INTC_VECT(RTC
, 0x4c0),
425 INTC_VECT(SIM
, 0x4e0), INTC_VECT(SIM
, 0x500),
426 INTC_VECT(SIM
, 0x520), INTC_VECT(SIM
, 0x540),
427 INTC_VECT(WDT
, 0x560), INTC_VECT(REF_RCMI
, 0x580),
428 /* H_UDI cannot be masked */ INTC_VECT(TMU_SUNI
, 0x6c0),
429 INTC_VECT(USBF_SPD
, 0x6e0), INTC_VECT(DMAC1
, 0x800),
430 INTC_VECT(DMAC1
, 0x820), INTC_VECT(DMAC1
, 0x840),
431 INTC_VECT(DMAC1
, 0x860), INTC_VECT(LCDC
, 0x900),
432 #if defined(CONFIG_CPU_SUBTYPE_SH7720)
433 INTC_VECT(SSL
, 0x980),
435 INTC_VECT(USBFI
, 0xa20), INTC_VECT(USBFI
, 0xa40),
436 INTC_VECT(USBHI
, 0xa60),
437 INTC_VECT(DMAC2
, 0xb80), INTC_VECT(DMAC2
, 0xba0),
438 INTC_VECT(ADC
, 0xbe0), INTC_VECT(SCIF0
, 0xc00),
439 INTC_VECT(SCIF1
, 0xc20), INTC_VECT(PINT07
, 0xc80),
440 INTC_VECT(PINT815
, 0xca0), INTC_VECT(SIOF0
, 0xd00),
441 INTC_VECT(SIOF1
, 0xd20), INTC_VECT(TPU
, 0xd80),
442 INTC_VECT(TPU
, 0xda0), INTC_VECT(TPU
, 0xdc0),
443 INTC_VECT(TPU
, 0xde0), INTC_VECT(IIC
, 0xe00),
444 INTC_VECT(MMC
, 0xe80), INTC_VECT(MMC
, 0xea0),
445 INTC_VECT(MMC
, 0xec0), INTC_VECT(MMC
, 0xee0),
446 INTC_VECT(CMT
, 0xf00), INTC_VECT(PCC
, 0xf60),
447 INTC_VECT(AFEIF
, 0xfe0),
450 static struct intc_prio_reg prio_registers
[] __initdata
= {
451 { 0xA414FEE2UL
, 0, 16, 4, /* IPRA */ { TMU0
, TMU1
, TMU2
, RTC
} },
452 { 0xA414FEE4UL
, 0, 16, 4, /* IPRB */ { WDT
, REF_RCMI
, SIM
, 0 } },
453 { 0xA4140016UL
, 0, 16, 4, /* IPRC */ { IRQ3
, IRQ2
, IRQ1
, IRQ0
} },
454 { 0xA4140018UL
, 0, 16, 4, /* IPRD */ { USBF_SPD
, TMU_SUNI
, IRQ5
, IRQ4
} },
455 { 0xA414001AUL
, 0, 16, 4, /* IPRE */ { DMAC1
, 0, LCDC
, SSL
} },
456 { 0xA4080000UL
, 0, 16, 4, /* IPRF */ { ADC
, DMAC2
, USBFI
, CMT
} },
457 { 0xA4080002UL
, 0, 16, 4, /* IPRG */ { SCIF0
, SCIF1
, 0, 0 } },
458 { 0xA4080004UL
, 0, 16, 4, /* IPRH */ { PINT07
, PINT815
, TPU
, IIC
} },
459 { 0xA4080006UL
, 0, 16, 4, /* IPRI */ { SIOF0
, SIOF1
, MMC
, PCC
} },
460 { 0xA4080008UL
, 0, 16, 4, /* IPRJ */ { 0, USBHI
, 0, AFEIF
} },
463 static DECLARE_INTC_DESC(intc_desc
, "sh7720", vectors
, NULL
,
464 NULL
, prio_registers
, NULL
);
466 void __init
plat_irq_setup(void)
468 register_intc_controller(&intc_desc
);
469 plat_irq_setup_sh3();