2 * sh73a0 processor support
4 * Copyright (C) 2010 Takashi Yoshii
5 * Copyright (C) 2010 Magnus Damm
6 * Copyright (C) 2008 Yoshihiro Shimoda
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <linux/kernel.h>
22 #include <linux/init.h>
23 #include <linux/interrupt.h>
24 #include <linux/irq.h>
25 #include <linux/platform_device.h>
26 #include <linux/delay.h>
27 #include <linux/input.h>
29 #include <linux/serial_sci.h>
30 #include <linux/sh_intc.h>
31 #include <linux/sh_timer.h>
32 #include <mach/hardware.h>
33 #include <asm/mach-types.h>
34 #include <asm/mach/arch.h>
36 static struct plat_sci_port scif0_platform_data
= {
37 .mapbase
= 0xe6c40000,
38 .flags
= UPF_BOOT_AUTOCONF
,
40 .irqs
= { gic_spi(72), gic_spi(72),
41 gic_spi(72), gic_spi(72) },
44 static struct platform_device scif0_device
= {
48 .platform_data
= &scif0_platform_data
,
52 static struct plat_sci_port scif1_platform_data
= {
53 .mapbase
= 0xe6c50000,
54 .flags
= UPF_BOOT_AUTOCONF
,
56 .irqs
= { gic_spi(73), gic_spi(73),
57 gic_spi(73), gic_spi(73) },
60 static struct platform_device scif1_device
= {
64 .platform_data
= &scif1_platform_data
,
68 static struct plat_sci_port scif2_platform_data
= {
69 .mapbase
= 0xe6c60000,
70 .flags
= UPF_BOOT_AUTOCONF
,
72 .irqs
= { gic_spi(74), gic_spi(74),
73 gic_spi(74), gic_spi(74) },
76 static struct platform_device scif2_device
= {
80 .platform_data
= &scif2_platform_data
,
84 static struct plat_sci_port scif3_platform_data
= {
85 .mapbase
= 0xe6c70000,
86 .flags
= UPF_BOOT_AUTOCONF
,
88 .irqs
= { gic_spi(75), gic_spi(75),
89 gic_spi(75), gic_spi(75) },
92 static struct platform_device scif3_device
= {
96 .platform_data
= &scif3_platform_data
,
100 static struct plat_sci_port scif4_platform_data
= {
101 .mapbase
= 0xe6c80000,
102 .flags
= UPF_BOOT_AUTOCONF
,
104 .irqs
= { gic_spi(78), gic_spi(78),
105 gic_spi(78), gic_spi(78) },
108 static struct platform_device scif4_device
= {
112 .platform_data
= &scif4_platform_data
,
116 static struct plat_sci_port scif5_platform_data
= {
117 .mapbase
= 0xe6cb0000,
118 .flags
= UPF_BOOT_AUTOCONF
,
120 .irqs
= { gic_spi(79), gic_spi(79),
121 gic_spi(79), gic_spi(79) },
124 static struct platform_device scif5_device
= {
128 .platform_data
= &scif5_platform_data
,
132 static struct plat_sci_port scif6_platform_data
= {
133 .mapbase
= 0xe6cc0000,
134 .flags
= UPF_BOOT_AUTOCONF
,
136 .irqs
= { gic_spi(156), gic_spi(156),
137 gic_spi(156), gic_spi(156) },
140 static struct platform_device scif6_device
= {
144 .platform_data
= &scif6_platform_data
,
148 static struct plat_sci_port scif7_platform_data
= {
149 .mapbase
= 0xe6cd0000,
150 .flags
= UPF_BOOT_AUTOCONF
,
152 .irqs
= { gic_spi(143), gic_spi(143),
153 gic_spi(143), gic_spi(143) },
156 static struct platform_device scif7_device
= {
160 .platform_data
= &scif7_platform_data
,
164 static struct plat_sci_port scif8_platform_data
= {
165 .mapbase
= 0xe6c30000,
166 .flags
= UPF_BOOT_AUTOCONF
,
168 .irqs
= { gic_spi(80), gic_spi(80),
169 gic_spi(80), gic_spi(80) },
172 static struct platform_device scif8_device
= {
176 .platform_data
= &scif8_platform_data
,
180 static struct sh_timer_config cmt10_platform_data
= {
182 .channel_offset
= 0x10,
184 .clockevent_rating
= 125,
185 .clocksource_rating
= 125,
188 static struct resource cmt10_resources
[] = {
193 .flags
= IORESOURCE_MEM
,
196 .start
= gic_spi(65),
197 .flags
= IORESOURCE_IRQ
,
201 static struct platform_device cmt10_device
= {
205 .platform_data
= &cmt10_platform_data
,
207 .resource
= cmt10_resources
,
208 .num_resources
= ARRAY_SIZE(cmt10_resources
),
212 static struct sh_timer_config tmu00_platform_data
= {
214 .channel_offset
= 0x4,
216 .clockevent_rating
= 200,
219 static struct resource tmu00_resources
[] = {
224 .flags
= IORESOURCE_MEM
,
227 .start
= intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */
228 .flags
= IORESOURCE_IRQ
,
232 static struct platform_device tmu00_device
= {
236 .platform_data
= &tmu00_platform_data
,
238 .resource
= tmu00_resources
,
239 .num_resources
= ARRAY_SIZE(tmu00_resources
),
242 static struct sh_timer_config tmu01_platform_data
= {
244 .channel_offset
= 0x10,
246 .clocksource_rating
= 200,
249 static struct resource tmu01_resources
[] = {
254 .flags
= IORESOURCE_MEM
,
257 .start
= intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */
258 .flags
= IORESOURCE_IRQ
,
262 static struct platform_device tmu01_device
= {
266 .platform_data
= &tmu01_platform_data
,
268 .resource
= tmu01_resources
,
269 .num_resources
= ARRAY_SIZE(tmu01_resources
),
272 static struct resource i2c0_resources
[] = {
276 .end
= 0xe6820425 - 1,
277 .flags
= IORESOURCE_MEM
,
280 .start
= gic_spi(167),
282 .flags
= IORESOURCE_IRQ
,
286 static struct resource i2c1_resources
[] = {
290 .end
= 0xe6822425 - 1,
291 .flags
= IORESOURCE_MEM
,
294 .start
= gic_spi(51),
296 .flags
= IORESOURCE_IRQ
,
300 static struct resource i2c2_resources
[] = {
304 .end
= 0xe6824425 - 1,
305 .flags
= IORESOURCE_MEM
,
308 .start
= gic_spi(171),
310 .flags
= IORESOURCE_IRQ
,
314 static struct resource i2c3_resources
[] = {
318 .end
= 0xe6826425 - 1,
319 .flags
= IORESOURCE_MEM
,
322 .start
= gic_spi(183),
324 .flags
= IORESOURCE_IRQ
,
328 static struct resource i2c4_resources
[] = {
332 .end
= 0xe6828425 - 1,
333 .flags
= IORESOURCE_MEM
,
336 .start
= gic_spi(187),
338 .flags
= IORESOURCE_IRQ
,
342 static struct platform_device i2c0_device
= {
343 .name
= "i2c-sh_mobile",
345 .resource
= i2c0_resources
,
346 .num_resources
= ARRAY_SIZE(i2c0_resources
),
349 static struct platform_device i2c1_device
= {
350 .name
= "i2c-sh_mobile",
352 .resource
= i2c1_resources
,
353 .num_resources
= ARRAY_SIZE(i2c1_resources
),
356 static struct platform_device i2c2_device
= {
357 .name
= "i2c-sh_mobile",
359 .resource
= i2c2_resources
,
360 .num_resources
= ARRAY_SIZE(i2c2_resources
),
363 static struct platform_device i2c3_device
= {
364 .name
= "i2c-sh_mobile",
366 .resource
= i2c3_resources
,
367 .num_resources
= ARRAY_SIZE(i2c3_resources
),
370 static struct platform_device i2c4_device
= {
371 .name
= "i2c-sh_mobile",
373 .resource
= i2c4_resources
,
374 .num_resources
= ARRAY_SIZE(i2c4_resources
),
377 static struct platform_device
*sh73a0_early_devices
[] __initdata
= {
392 static struct platform_device
*sh73a0_late_devices
[] __initdata
= {
400 void __init
sh73a0_add_standard_devices(void)
402 platform_add_devices(sh73a0_early_devices
,
403 ARRAY_SIZE(sh73a0_early_devices
));
404 platform_add_devices(sh73a0_late_devices
,
405 ARRAY_SIZE(sh73a0_late_devices
));
408 void __init
sh73a0_add_early_devices(void)
410 early_platform_add_devices(sh73a0_early_devices
,
411 ARRAY_SIZE(sh73a0_early_devices
));