2 * SH3 Setup code for SH7706, SH7707, SH7708, SH7709
4 * Copyright (C) 2007 Magnus Damm
5 * Copyright (C) 2009 Paul Mundt
7 * Based on setup-sh7709.c
9 * Copyright (C) 2006 Paul Mundt
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/init.h>
17 #include <linux/irq.h>
18 #include <linux/platform_device.h>
19 #include <linux/serial.h>
20 #include <linux/serial_sci.h>
21 #include <linux/sh_timer.h>
22 #include <cpu/serial.h>
27 /* interrupt sources */
28 IRQ0
, IRQ1
, IRQ2
, IRQ3
, IRQ4
, IRQ5
,
30 DMAC
, SCIF0
, SCIF2
, SCI
, ADC_ADI
,
36 static struct intc_vect vectors
[] __initdata
= {
37 INTC_VECT(TMU0
, 0x400), INTC_VECT(TMU1
, 0x420),
38 INTC_VECT(TMU2
, 0x440), INTC_VECT(TMU2
, 0x460),
39 INTC_VECT(RTC
, 0x480), INTC_VECT(RTC
, 0x4a0),
40 INTC_VECT(RTC
, 0x4c0),
41 INTC_VECT(SCI
, 0x4e0), INTC_VECT(SCI
, 0x500),
42 INTC_VECT(SCI
, 0x520), INTC_VECT(SCI
, 0x540),
43 INTC_VECT(WDT
, 0x560),
44 INTC_VECT(REF
, 0x580),
45 INTC_VECT(REF
, 0x5a0),
46 #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
47 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
48 defined(CONFIG_CPU_SUBTYPE_SH7709)
49 /* IRQ0->5 are handled in setup-sh3.c */
50 INTC_VECT(DMAC
, 0x800), INTC_VECT(DMAC
, 0x820),
51 INTC_VECT(DMAC
, 0x840), INTC_VECT(DMAC
, 0x860),
52 INTC_VECT(ADC_ADI
, 0x980),
53 INTC_VECT(SCIF2
, 0x900), INTC_VECT(SCIF2
, 0x920),
54 INTC_VECT(SCIF2
, 0x940), INTC_VECT(SCIF2
, 0x960),
56 #if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
57 defined(CONFIG_CPU_SUBTYPE_SH7709)
58 INTC_VECT(PINT07
, 0x700), INTC_VECT(PINT815
, 0x720),
59 INTC_VECT(SCIF0
, 0x880), INTC_VECT(SCIF0
, 0x8a0),
60 INTC_VECT(SCIF0
, 0x8c0), INTC_VECT(SCIF0
, 0x8e0),
62 #if defined(CONFIG_CPU_SUBTYPE_SH7707)
63 INTC_VECT(LCDC
, 0x9a0),
64 INTC_VECT(PCC0
, 0x9c0), INTC_VECT(PCC1
, 0x9e0),
68 static struct intc_prio_reg prio_registers
[] __initdata
= {
69 { 0xfffffee2, 0, 16, 4, /* IPRA */ { TMU0
, TMU1
, TMU2
, RTC
} },
70 { 0xfffffee4, 0, 16, 4, /* IPRB */ { WDT
, REF
, SCI
, 0 } },
71 #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
72 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
73 defined(CONFIG_CPU_SUBTYPE_SH7709)
74 { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3
, IRQ2
, IRQ1
, IRQ0
} },
75 { 0xa4000018, 0, 16, 4, /* IPRD */ { 0, 0, IRQ5
, IRQ4
} },
76 { 0xa400001a, 0, 16, 4, /* IPRE */ { DMAC
, 0, SCIF2
, ADC_ADI
} },
78 #if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
79 defined(CONFIG_CPU_SUBTYPE_SH7709)
80 { 0xa4000018, 0, 16, 4, /* IPRD */ { PINT07
, PINT815
, } },
81 { 0xa400001a, 0, 16, 4, /* IPRE */ { 0, SCIF0
} },
83 #if defined(CONFIG_CPU_SUBTYPE_SH7707)
84 { 0xa400001c, 0, 16, 4, /* IPRF */ { 0, LCDC
, PCC0
, PCC1
, } },
88 static DECLARE_INTC_DESC(intc_desc
, "sh770x", vectors
, NULL
,
89 NULL
, prio_registers
, NULL
);
91 static struct resource rtc_resources
[] = {
94 .end
= 0xfffffec0 + 0x1e,
95 .flags
= IORESOURCE_IO
,
99 .flags
= IORESOURCE_IRQ
,
103 static struct platform_device rtc_device
= {
106 .num_resources
= ARRAY_SIZE(rtc_resources
),
107 .resource
= rtc_resources
,
110 static struct plat_sci_port scif0_platform_data
= {
111 .mapbase
= 0xfffffe80,
112 .port_reg
= 0xa4000136,
113 .flags
= UPF_BOOT_AUTOCONF
,
114 .scscr
= SCSCR_TE
| SCSCR_RE
,
115 .scbrr_algo_id
= SCBRR_ALGO_2
,
117 .irqs
= { 23, 23, 23, 0 },
118 .ops
= &sh770x_sci_port_ops
,
122 static struct platform_device scif0_device
= {
126 .platform_data
= &scif0_platform_data
,
129 #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
130 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
131 defined(CONFIG_CPU_SUBTYPE_SH7709)
132 static struct plat_sci_port scif1_platform_data
= {
133 .mapbase
= 0xa4000150,
134 .flags
= UPF_BOOT_AUTOCONF
,
135 .scscr
= SCSCR_TE
| SCSCR_RE
,
136 .scbrr_algo_id
= SCBRR_ALGO_2
,
138 .irqs
= { 56, 56, 56, 56 },
139 .ops
= &sh770x_sci_port_ops
,
140 .regtype
= SCIx_SH3_SCIF_REGTYPE
,
143 static struct platform_device scif1_device
= {
147 .platform_data
= &scif1_platform_data
,
151 #if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
152 defined(CONFIG_CPU_SUBTYPE_SH7709)
153 static struct plat_sci_port scif2_platform_data
= {
154 .mapbase
= 0xa4000140,
155 .port_reg
= SCIx_NOT_SUPPORTED
,
156 .flags
= UPF_BOOT_AUTOCONF
,
157 .scscr
= SCSCR_TE
| SCSCR_RE
,
158 .scbrr_algo_id
= SCBRR_ALGO_2
,
160 .irqs
= { 52, 52, 52, 52 },
161 .ops
= &sh770x_sci_port_ops
,
165 static struct platform_device scif2_device
= {
169 .platform_data
= &scif2_platform_data
,
174 static struct sh_timer_config tmu0_platform_data
= {
175 .channel_offset
= 0x02,
177 .clockevent_rating
= 200,
180 static struct resource tmu0_resources
[] = {
184 .flags
= IORESOURCE_MEM
,
188 .flags
= IORESOURCE_IRQ
,
192 static struct platform_device tmu0_device
= {
196 .platform_data
= &tmu0_platform_data
,
198 .resource
= tmu0_resources
,
199 .num_resources
= ARRAY_SIZE(tmu0_resources
),
202 static struct sh_timer_config tmu1_platform_data
= {
203 .channel_offset
= 0xe,
205 .clocksource_rating
= 200,
208 static struct resource tmu1_resources
[] = {
212 .flags
= IORESOURCE_MEM
,
216 .flags
= IORESOURCE_IRQ
,
220 static struct platform_device tmu1_device
= {
224 .platform_data
= &tmu1_platform_data
,
226 .resource
= tmu1_resources
,
227 .num_resources
= ARRAY_SIZE(tmu1_resources
),
230 static struct sh_timer_config tmu2_platform_data
= {
231 .channel_offset
= 0x1a,
235 static struct resource tmu2_resources
[] = {
239 .flags
= IORESOURCE_MEM
,
243 .flags
= IORESOURCE_IRQ
,
247 static struct platform_device tmu2_device
= {
251 .platform_data
= &tmu2_platform_data
,
253 .resource
= tmu2_resources
,
254 .num_resources
= ARRAY_SIZE(tmu2_resources
),
257 static struct platform_device
*sh770x_devices
[] __initdata
= {
259 #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
260 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
261 defined(CONFIG_CPU_SUBTYPE_SH7709)
264 #if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
265 defined(CONFIG_CPU_SUBTYPE_SH7709)
274 static int __init
sh770x_devices_setup(void)
276 return platform_add_devices(sh770x_devices
,
277 ARRAY_SIZE(sh770x_devices
));
279 arch_initcall(sh770x_devices_setup
);
281 static struct platform_device
*sh770x_early_devices
[] __initdata
= {
283 #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
284 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
285 defined(CONFIG_CPU_SUBTYPE_SH7709)
288 #if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
289 defined(CONFIG_CPU_SUBTYPE_SH7709)
297 void __init
plat_early_device_setup(void)
299 early_platform_add_devices(sh770x_early_devices
,
300 ARRAY_SIZE(sh770x_early_devices
));
303 void __init
plat_irq_setup(void)
305 register_intc_controller(&intc_desc
);
306 #if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
307 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
308 defined(CONFIG_CPU_SUBTYPE_SH7709)
309 plat_irq_setup_sh3();