2 * sh7377 processor support
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include <linux/kernel.h>
21 #include <linux/init.h>
22 #include <linux/interrupt.h>
23 #include <linux/irq.h>
24 #include <linux/platform_device.h>
25 #include <linux/uio_driver.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 <mach/common.h>
34 #include <asm/mach/map.h>
35 #include <mach/irqs.h>
36 #include <asm/mach-types.h>
37 #include <asm/mach/arch.h>
38 #include <asm/mach/time.h>
40 static struct map_desc sh7377_io_desc
[] __initdata
= {
41 /* create a 1:1 entity map for 0xe6xxxxxx
42 * used by CPGA, INTC and PFC.
45 .virtual = 0xe6000000,
46 .pfn
= __phys_to_pfn(0xe6000000),
48 .type
= MT_DEVICE_NONSHARED
52 void __init
sh7377_map_io(void)
54 iotable_init(sh7377_io_desc
, ARRAY_SIZE(sh7377_io_desc
));
58 static struct plat_sci_port scif0_platform_data
= {
59 .mapbase
= 0xe6c40000,
60 .flags
= UPF_BOOT_AUTOCONF
,
61 .scscr
= SCSCR_RE
| SCSCR_TE
,
62 .scbrr_algo_id
= SCBRR_ALGO_4
,
64 .irqs
= { evt2irq(0xc00), evt2irq(0xc00),
65 evt2irq(0xc00), evt2irq(0xc00) },
68 static struct platform_device scif0_device
= {
72 .platform_data
= &scif0_platform_data
,
77 static struct plat_sci_port scif1_platform_data
= {
78 .mapbase
= 0xe6c50000,
79 .flags
= UPF_BOOT_AUTOCONF
,
80 .scscr
= SCSCR_RE
| SCSCR_TE
,
81 .scbrr_algo_id
= SCBRR_ALGO_4
,
83 .irqs
= { evt2irq(0xc20), evt2irq(0xc20),
84 evt2irq(0xc20), evt2irq(0xc20) },
87 static struct platform_device scif1_device
= {
91 .platform_data
= &scif1_platform_data
,
96 static struct plat_sci_port scif2_platform_data
= {
97 .mapbase
= 0xe6c60000,
98 .flags
= UPF_BOOT_AUTOCONF
,
99 .scscr
= SCSCR_RE
| SCSCR_TE
,
100 .scbrr_algo_id
= SCBRR_ALGO_4
,
102 .irqs
= { evt2irq(0xc40), evt2irq(0xc40),
103 evt2irq(0xc40), evt2irq(0xc40) },
106 static struct platform_device scif2_device
= {
110 .platform_data
= &scif2_platform_data
,
115 static struct plat_sci_port scif3_platform_data
= {
116 .mapbase
= 0xe6c70000,
117 .flags
= UPF_BOOT_AUTOCONF
,
118 .scscr
= SCSCR_RE
| SCSCR_TE
,
119 .scbrr_algo_id
= SCBRR_ALGO_4
,
121 .irqs
= { evt2irq(0xc60), evt2irq(0xc60),
122 evt2irq(0xc60), evt2irq(0xc60) },
125 static struct platform_device scif3_device
= {
129 .platform_data
= &scif3_platform_data
,
134 static struct plat_sci_port scif4_platform_data
= {
135 .mapbase
= 0xe6c80000,
136 .flags
= UPF_BOOT_AUTOCONF
,
137 .scscr
= SCSCR_RE
| SCSCR_TE
,
138 .scbrr_algo_id
= SCBRR_ALGO_4
,
140 .irqs
= { evt2irq(0xd20), evt2irq(0xd20),
141 evt2irq(0xd20), evt2irq(0xd20) },
144 static struct platform_device scif4_device
= {
148 .platform_data
= &scif4_platform_data
,
153 static struct plat_sci_port scif5_platform_data
= {
154 .mapbase
= 0xe6cb0000,
155 .flags
= UPF_BOOT_AUTOCONF
,
156 .scscr
= SCSCR_RE
| SCSCR_TE
,
157 .scbrr_algo_id
= SCBRR_ALGO_4
,
159 .irqs
= { evt2irq(0xd40), evt2irq(0xd40),
160 evt2irq(0xd40), evt2irq(0xd40) },
163 static struct platform_device scif5_device
= {
167 .platform_data
= &scif5_platform_data
,
172 static struct plat_sci_port scif6_platform_data
= {
173 .mapbase
= 0xe6cc0000,
174 .flags
= UPF_BOOT_AUTOCONF
,
175 .scscr
= SCSCR_RE
| SCSCR_TE
,
176 .scbrr_algo_id
= SCBRR_ALGO_4
,
178 .irqs
= { intcs_evt2irq(0x1a80), intcs_evt2irq(0x1a80),
179 intcs_evt2irq(0x1a80), intcs_evt2irq(0x1a80) },
182 static struct platform_device scif6_device
= {
186 .platform_data
= &scif6_platform_data
,
191 static struct plat_sci_port scif7_platform_data
= {
192 .mapbase
= 0xe6c30000,
193 .flags
= UPF_BOOT_AUTOCONF
,
194 .scscr
= SCSCR_RE
| SCSCR_TE
,
195 .scbrr_algo_id
= SCBRR_ALGO_4
,
197 .irqs
= { evt2irq(0xd60), evt2irq(0xd60),
198 evt2irq(0xd60), evt2irq(0xd60) },
201 static struct platform_device scif7_device
= {
205 .platform_data
= &scif7_platform_data
,
209 static struct sh_timer_config cmt10_platform_data
= {
211 .channel_offset
= 0x10,
213 .clockevent_rating
= 125,
214 .clocksource_rating
= 125,
217 static struct resource cmt10_resources
[] = {
222 .flags
= IORESOURCE_MEM
,
225 .start
= evt2irq(0xb00), /* CMT1_CMT10 */
226 .flags
= IORESOURCE_IRQ
,
230 static struct platform_device cmt10_device
= {
234 .platform_data
= &cmt10_platform_data
,
236 .resource
= cmt10_resources
,
237 .num_resources
= ARRAY_SIZE(cmt10_resources
),
241 static struct uio_info vpu_platform_data
= {
244 .irq
= intcs_evt2irq(0x980),
247 static struct resource vpu_resources
[] = {
252 .flags
= IORESOURCE_MEM
,
256 static struct platform_device vpu_device
= {
257 .name
= "uio_pdrv_genirq",
260 .platform_data
= &vpu_platform_data
,
262 .resource
= vpu_resources
,
263 .num_resources
= ARRAY_SIZE(vpu_resources
),
267 static struct uio_info veu0_platform_data
= {
270 .irq
= intcs_evt2irq(0x700),
273 static struct resource veu0_resources
[] = {
278 .flags
= IORESOURCE_MEM
,
282 static struct platform_device veu0_device
= {
283 .name
= "uio_pdrv_genirq",
286 .platform_data
= &veu0_platform_data
,
288 .resource
= veu0_resources
,
289 .num_resources
= ARRAY_SIZE(veu0_resources
),
293 static struct uio_info veu1_platform_data
= {
296 .irq
= intcs_evt2irq(0x720),
299 static struct resource veu1_resources
[] = {
304 .flags
= IORESOURCE_MEM
,
308 static struct platform_device veu1_device
= {
309 .name
= "uio_pdrv_genirq",
312 .platform_data
= &veu1_platform_data
,
314 .resource
= veu1_resources
,
315 .num_resources
= ARRAY_SIZE(veu1_resources
),
319 static struct uio_info veu2_platform_data
= {
322 .irq
= intcs_evt2irq(0x740),
325 static struct resource veu2_resources
[] = {
330 .flags
= IORESOURCE_MEM
,
334 static struct platform_device veu2_device
= {
335 .name
= "uio_pdrv_genirq",
338 .platform_data
= &veu2_platform_data
,
340 .resource
= veu2_resources
,
341 .num_resources
= ARRAY_SIZE(veu2_resources
),
345 static struct uio_info veu3_platform_data
= {
348 .irq
= intcs_evt2irq(0x760),
351 static struct resource veu3_resources
[] = {
356 .flags
= IORESOURCE_MEM
,
360 static struct platform_device veu3_device
= {
361 .name
= "uio_pdrv_genirq",
364 .platform_data
= &veu3_platform_data
,
366 .resource
= veu3_resources
,
367 .num_resources
= ARRAY_SIZE(veu3_resources
),
371 static struct uio_info jpu_platform_data
= {
374 .irq
= intcs_evt2irq(0x560),
377 static struct resource jpu_resources
[] = {
382 .flags
= IORESOURCE_MEM
,
386 static struct platform_device jpu_device
= {
387 .name
= "uio_pdrv_genirq",
390 .platform_data
= &jpu_platform_data
,
392 .resource
= jpu_resources
,
393 .num_resources
= ARRAY_SIZE(jpu_resources
),
397 static struct uio_info spu0_platform_data
= {
400 .irq
= evt2irq(0x1800),
403 static struct resource spu0_resources
[] = {
408 .flags
= IORESOURCE_MEM
,
412 static struct platform_device spu0_device
= {
413 .name
= "uio_pdrv_genirq",
416 .platform_data
= &spu0_platform_data
,
418 .resource
= spu0_resources
,
419 .num_resources
= ARRAY_SIZE(spu0_resources
),
423 static struct uio_info spu1_platform_data
= {
426 .irq
= evt2irq(0x1820),
429 static struct resource spu1_resources
[] = {
434 .flags
= IORESOURCE_MEM
,
438 static struct platform_device spu1_device
= {
439 .name
= "uio_pdrv_genirq",
442 .platform_data
= &spu1_platform_data
,
444 .resource
= spu1_resources
,
445 .num_resources
= ARRAY_SIZE(spu1_resources
),
448 static struct platform_device
*sh7377_early_devices
[] __initdata
= {
460 static struct platform_device
*sh7377_devices
[] __initdata
= {
471 void __init
sh7377_add_standard_devices(void)
473 platform_add_devices(sh7377_early_devices
,
474 ARRAY_SIZE(sh7377_early_devices
));
476 platform_add_devices(sh7377_devices
,
477 ARRAY_SIZE(sh7377_devices
));
480 static void __init
sh7377_earlytimer_init(void)
483 shmobile_earlytimer_init();
486 #define SMSTPCR3 0xe615013c
487 #define SMSTPCR3_CMT1 (1 << 29)
489 void __init
sh7377_add_early_devices(void)
491 /* enable clock to CMT1 */
492 __raw_writel(__raw_readl(SMSTPCR3
) & ~SMSTPCR3_CMT1
, SMSTPCR3
);
494 early_platform_add_devices(sh7377_early_devices
,
495 ARRAY_SIZE(sh7377_early_devices
));
497 /* setup early console here as well */
498 shmobile_setup_console();
500 /* override timer setup with soc-specific code */
501 shmobile_timer
.init
= sh7377_earlytimer_init
;