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/irqchip.h>
26 #include <linux/platform_device.h>
27 #include <linux/of_platform.h>
28 #include <linux/delay.h>
29 #include <linux/input.h>
31 #include <linux/serial_sci.h>
32 #include <linux/sh_dma.h>
33 #include <linux/sh_intc.h>
34 #include <linux/sh_timer.h>
35 #include <linux/platform_data/sh_ipmmu.h>
36 #include <linux/platform_data/irq-renesas-intc-irqpin.h>
37 #include <mach/dma-register.h>
38 #include <mach/hardware.h>
39 #include <mach/irqs.h>
40 #include <mach/sh73a0.h>
41 #include <mach/common.h>
42 #include <asm/mach-types.h>
43 #include <asm/mach/map.h>
44 #include <asm/mach/arch.h>
45 #include <asm/mach/time.h>
47 static struct map_desc sh73a0_io_desc
[] __initdata
= {
48 /* create a 1:1 entity map for 0xe6xxxxxx
49 * used by CPGA, INTC and PFC.
52 .virtual = 0xe6000000,
53 .pfn
= __phys_to_pfn(0xe6000000),
55 .type
= MT_DEVICE_NONSHARED
59 void __init
sh73a0_map_io(void)
61 iotable_init(sh73a0_io_desc
, ARRAY_SIZE(sh73a0_io_desc
));
64 static struct resource sh73a0_pfc_resources
[] = {
68 .flags
= IORESOURCE_MEM
,
73 .flags
= IORESOURCE_MEM
,
77 static struct platform_device sh73a0_pfc_device
= {
80 .resource
= sh73a0_pfc_resources
,
81 .num_resources
= ARRAY_SIZE(sh73a0_pfc_resources
),
84 void __init
sh73a0_pinmux_init(void)
86 platform_device_register(&sh73a0_pfc_device
);
89 static struct plat_sci_port scif0_platform_data
= {
90 .mapbase
= 0xe6c40000,
91 .flags
= UPF_BOOT_AUTOCONF
,
92 .scscr
= SCSCR_RE
| SCSCR_TE
,
93 .scbrr_algo_id
= SCBRR_ALGO_4
,
95 .irqs
= { gic_spi(72), gic_spi(72),
96 gic_spi(72), gic_spi(72) },
99 static struct platform_device scif0_device
= {
103 .platform_data
= &scif0_platform_data
,
107 static struct plat_sci_port scif1_platform_data
= {
108 .mapbase
= 0xe6c50000,
109 .flags
= UPF_BOOT_AUTOCONF
,
110 .scscr
= SCSCR_RE
| SCSCR_TE
,
111 .scbrr_algo_id
= SCBRR_ALGO_4
,
113 .irqs
= { gic_spi(73), gic_spi(73),
114 gic_spi(73), gic_spi(73) },
117 static struct platform_device scif1_device
= {
121 .platform_data
= &scif1_platform_data
,
125 static struct plat_sci_port scif2_platform_data
= {
126 .mapbase
= 0xe6c60000,
127 .flags
= UPF_BOOT_AUTOCONF
,
128 .scscr
= SCSCR_RE
| SCSCR_TE
,
129 .scbrr_algo_id
= SCBRR_ALGO_4
,
131 .irqs
= { gic_spi(74), gic_spi(74),
132 gic_spi(74), gic_spi(74) },
135 static struct platform_device scif2_device
= {
139 .platform_data
= &scif2_platform_data
,
143 static struct plat_sci_port scif3_platform_data
= {
144 .mapbase
= 0xe6c70000,
145 .flags
= UPF_BOOT_AUTOCONF
,
146 .scscr
= SCSCR_RE
| SCSCR_TE
,
147 .scbrr_algo_id
= SCBRR_ALGO_4
,
149 .irqs
= { gic_spi(75), gic_spi(75),
150 gic_spi(75), gic_spi(75) },
153 static struct platform_device scif3_device
= {
157 .platform_data
= &scif3_platform_data
,
161 static struct plat_sci_port scif4_platform_data
= {
162 .mapbase
= 0xe6c80000,
163 .flags
= UPF_BOOT_AUTOCONF
,
164 .scscr
= SCSCR_RE
| SCSCR_TE
,
165 .scbrr_algo_id
= SCBRR_ALGO_4
,
167 .irqs
= { gic_spi(78), gic_spi(78),
168 gic_spi(78), gic_spi(78) },
171 static struct platform_device scif4_device
= {
175 .platform_data
= &scif4_platform_data
,
179 static struct plat_sci_port scif5_platform_data
= {
180 .mapbase
= 0xe6cb0000,
181 .flags
= UPF_BOOT_AUTOCONF
,
182 .scscr
= SCSCR_RE
| SCSCR_TE
,
183 .scbrr_algo_id
= SCBRR_ALGO_4
,
185 .irqs
= { gic_spi(79), gic_spi(79),
186 gic_spi(79), gic_spi(79) },
189 static struct platform_device scif5_device
= {
193 .platform_data
= &scif5_platform_data
,
197 static struct plat_sci_port scif6_platform_data
= {
198 .mapbase
= 0xe6cc0000,
199 .flags
= UPF_BOOT_AUTOCONF
,
200 .scscr
= SCSCR_RE
| SCSCR_TE
,
201 .scbrr_algo_id
= SCBRR_ALGO_4
,
203 .irqs
= { gic_spi(156), gic_spi(156),
204 gic_spi(156), gic_spi(156) },
207 static struct platform_device scif6_device
= {
211 .platform_data
= &scif6_platform_data
,
215 static struct plat_sci_port scif7_platform_data
= {
216 .mapbase
= 0xe6cd0000,
217 .flags
= UPF_BOOT_AUTOCONF
,
218 .scscr
= SCSCR_RE
| SCSCR_TE
,
219 .scbrr_algo_id
= SCBRR_ALGO_4
,
221 .irqs
= { gic_spi(143), gic_spi(143),
222 gic_spi(143), gic_spi(143) },
225 static struct platform_device scif7_device
= {
229 .platform_data
= &scif7_platform_data
,
233 static struct plat_sci_port scif8_platform_data
= {
234 .mapbase
= 0xe6c30000,
235 .flags
= UPF_BOOT_AUTOCONF
,
236 .scscr
= SCSCR_RE
| SCSCR_TE
,
237 .scbrr_algo_id
= SCBRR_ALGO_4
,
239 .irqs
= { gic_spi(80), gic_spi(80),
240 gic_spi(80), gic_spi(80) },
243 static struct platform_device scif8_device
= {
247 .platform_data
= &scif8_platform_data
,
251 static struct sh_timer_config cmt10_platform_data
= {
253 .channel_offset
= 0x10,
255 .clockevent_rating
= 80,
256 .clocksource_rating
= 125,
259 static struct resource cmt10_resources
[] = {
264 .flags
= IORESOURCE_MEM
,
267 .start
= gic_spi(65),
268 .flags
= IORESOURCE_IRQ
,
272 static struct platform_device cmt10_device
= {
276 .platform_data
= &cmt10_platform_data
,
278 .resource
= cmt10_resources
,
279 .num_resources
= ARRAY_SIZE(cmt10_resources
),
283 static struct sh_timer_config tmu00_platform_data
= {
285 .channel_offset
= 0x4,
287 .clockevent_rating
= 200,
290 static struct resource tmu00_resources
[] = {
295 .flags
= IORESOURCE_MEM
,
298 .start
= intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */
299 .flags
= IORESOURCE_IRQ
,
303 static struct platform_device tmu00_device
= {
307 .platform_data
= &tmu00_platform_data
,
309 .resource
= tmu00_resources
,
310 .num_resources
= ARRAY_SIZE(tmu00_resources
),
313 static struct sh_timer_config tmu01_platform_data
= {
315 .channel_offset
= 0x10,
317 .clocksource_rating
= 200,
320 static struct resource tmu01_resources
[] = {
325 .flags
= IORESOURCE_MEM
,
328 .start
= intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */
329 .flags
= IORESOURCE_IRQ
,
333 static struct platform_device tmu01_device
= {
337 .platform_data
= &tmu01_platform_data
,
339 .resource
= tmu01_resources
,
340 .num_resources
= ARRAY_SIZE(tmu01_resources
),
343 static struct resource i2c0_resources
[] = {
347 .end
= 0xe6820425 - 1,
348 .flags
= IORESOURCE_MEM
,
351 .start
= gic_spi(167),
353 .flags
= IORESOURCE_IRQ
,
357 static struct resource i2c1_resources
[] = {
361 .end
= 0xe6822425 - 1,
362 .flags
= IORESOURCE_MEM
,
365 .start
= gic_spi(51),
367 .flags
= IORESOURCE_IRQ
,
371 static struct resource i2c2_resources
[] = {
375 .end
= 0xe6824425 - 1,
376 .flags
= IORESOURCE_MEM
,
379 .start
= gic_spi(171),
381 .flags
= IORESOURCE_IRQ
,
385 static struct resource i2c3_resources
[] = {
389 .end
= 0xe6826425 - 1,
390 .flags
= IORESOURCE_MEM
,
393 .start
= gic_spi(183),
395 .flags
= IORESOURCE_IRQ
,
399 static struct resource i2c4_resources
[] = {
403 .end
= 0xe6828425 - 1,
404 .flags
= IORESOURCE_MEM
,
407 .start
= gic_spi(187),
409 .flags
= IORESOURCE_IRQ
,
413 static struct platform_device i2c0_device
= {
414 .name
= "i2c-sh_mobile",
416 .resource
= i2c0_resources
,
417 .num_resources
= ARRAY_SIZE(i2c0_resources
),
420 static struct platform_device i2c1_device
= {
421 .name
= "i2c-sh_mobile",
423 .resource
= i2c1_resources
,
424 .num_resources
= ARRAY_SIZE(i2c1_resources
),
427 static struct platform_device i2c2_device
= {
428 .name
= "i2c-sh_mobile",
430 .resource
= i2c2_resources
,
431 .num_resources
= ARRAY_SIZE(i2c2_resources
),
434 static struct platform_device i2c3_device
= {
435 .name
= "i2c-sh_mobile",
437 .resource
= i2c3_resources
,
438 .num_resources
= ARRAY_SIZE(i2c3_resources
),
441 static struct platform_device i2c4_device
= {
442 .name
= "i2c-sh_mobile",
444 .resource
= i2c4_resources
,
445 .num_resources
= ARRAY_SIZE(i2c4_resources
),
448 static const struct sh_dmae_slave_config sh73a0_dmae_slaves
[] = {
450 .slave_id
= SHDMA_SLAVE_SCIF0_TX
,
452 .chcr
= CHCR_TX(XMIT_SZ_8BIT
),
455 .slave_id
= SHDMA_SLAVE_SCIF0_RX
,
457 .chcr
= CHCR_RX(XMIT_SZ_8BIT
),
460 .slave_id
= SHDMA_SLAVE_SCIF1_TX
,
462 .chcr
= CHCR_TX(XMIT_SZ_8BIT
),
465 .slave_id
= SHDMA_SLAVE_SCIF1_RX
,
467 .chcr
= CHCR_RX(XMIT_SZ_8BIT
),
470 .slave_id
= SHDMA_SLAVE_SCIF2_TX
,
472 .chcr
= CHCR_TX(XMIT_SZ_8BIT
),
475 .slave_id
= SHDMA_SLAVE_SCIF2_RX
,
477 .chcr
= CHCR_RX(XMIT_SZ_8BIT
),
480 .slave_id
= SHDMA_SLAVE_SCIF3_TX
,
482 .chcr
= CHCR_TX(XMIT_SZ_8BIT
),
485 .slave_id
= SHDMA_SLAVE_SCIF3_RX
,
487 .chcr
= CHCR_RX(XMIT_SZ_8BIT
),
490 .slave_id
= SHDMA_SLAVE_SCIF4_TX
,
492 .chcr
= CHCR_TX(XMIT_SZ_8BIT
),
495 .slave_id
= SHDMA_SLAVE_SCIF4_RX
,
497 .chcr
= CHCR_RX(XMIT_SZ_8BIT
),
500 .slave_id
= SHDMA_SLAVE_SCIF5_TX
,
502 .chcr
= CHCR_TX(XMIT_SZ_8BIT
),
505 .slave_id
= SHDMA_SLAVE_SCIF5_RX
,
507 .chcr
= CHCR_RX(XMIT_SZ_8BIT
),
510 .slave_id
= SHDMA_SLAVE_SCIF6_TX
,
512 .chcr
= CHCR_TX(XMIT_SZ_8BIT
),
515 .slave_id
= SHDMA_SLAVE_SCIF6_RX
,
517 .chcr
= CHCR_RX(XMIT_SZ_8BIT
),
520 .slave_id
= SHDMA_SLAVE_SCIF7_TX
,
522 .chcr
= CHCR_TX(XMIT_SZ_8BIT
),
525 .slave_id
= SHDMA_SLAVE_SCIF7_RX
,
527 .chcr
= CHCR_RX(XMIT_SZ_8BIT
),
530 .slave_id
= SHDMA_SLAVE_SCIF8_TX
,
532 .chcr
= CHCR_TX(XMIT_SZ_8BIT
),
535 .slave_id
= SHDMA_SLAVE_SCIF8_RX
,
537 .chcr
= CHCR_RX(XMIT_SZ_8BIT
),
540 .slave_id
= SHDMA_SLAVE_SDHI0_TX
,
542 .chcr
= CHCR_TX(XMIT_SZ_16BIT
),
545 .slave_id
= SHDMA_SLAVE_SDHI0_RX
,
547 .chcr
= CHCR_RX(XMIT_SZ_16BIT
),
550 .slave_id
= SHDMA_SLAVE_SDHI1_TX
,
552 .chcr
= CHCR_TX(XMIT_SZ_16BIT
),
555 .slave_id
= SHDMA_SLAVE_SDHI1_RX
,
557 .chcr
= CHCR_RX(XMIT_SZ_16BIT
),
560 .slave_id
= SHDMA_SLAVE_SDHI2_TX
,
562 .chcr
= CHCR_TX(XMIT_SZ_16BIT
),
565 .slave_id
= SHDMA_SLAVE_SDHI2_RX
,
567 .chcr
= CHCR_RX(XMIT_SZ_16BIT
),
570 .slave_id
= SHDMA_SLAVE_MMCIF_TX
,
572 .chcr
= CHCR_TX(XMIT_SZ_32BIT
),
575 .slave_id
= SHDMA_SLAVE_MMCIF_RX
,
577 .chcr
= CHCR_RX(XMIT_SZ_32BIT
),
582 #define DMAE_CHANNEL(_offset) \
584 .offset = _offset - 0x20, \
585 .dmars = _offset - 0x20 + 0x40, \
588 static const struct sh_dmae_channel sh73a0_dmae_channels
[] = {
589 DMAE_CHANNEL(0x8000),
590 DMAE_CHANNEL(0x8080),
591 DMAE_CHANNEL(0x8100),
592 DMAE_CHANNEL(0x8180),
593 DMAE_CHANNEL(0x8200),
594 DMAE_CHANNEL(0x8280),
595 DMAE_CHANNEL(0x8300),
596 DMAE_CHANNEL(0x8380),
597 DMAE_CHANNEL(0x8400),
598 DMAE_CHANNEL(0x8480),
599 DMAE_CHANNEL(0x8500),
600 DMAE_CHANNEL(0x8580),
601 DMAE_CHANNEL(0x8600),
602 DMAE_CHANNEL(0x8680),
603 DMAE_CHANNEL(0x8700),
604 DMAE_CHANNEL(0x8780),
605 DMAE_CHANNEL(0x8800),
606 DMAE_CHANNEL(0x8880),
607 DMAE_CHANNEL(0x8900),
608 DMAE_CHANNEL(0x8980),
611 static struct sh_dmae_pdata sh73a0_dmae_platform_data
= {
612 .slave
= sh73a0_dmae_slaves
,
613 .slave_num
= ARRAY_SIZE(sh73a0_dmae_slaves
),
614 .channel
= sh73a0_dmae_channels
,
615 .channel_num
= ARRAY_SIZE(sh73a0_dmae_channels
),
616 .ts_low_shift
= TS_LOW_SHIFT
,
617 .ts_low_mask
= TS_LOW_BIT
<< TS_LOW_SHIFT
,
618 .ts_high_shift
= TS_HI_SHIFT
,
619 .ts_high_mask
= TS_HI_BIT
<< TS_HI_SHIFT
,
620 .ts_shift
= dma_ts_shift
,
621 .ts_shift_num
= ARRAY_SIZE(dma_ts_shift
),
622 .dmaor_init
= DMAOR_DME
,
625 static struct resource sh73a0_dmae_resources
[] = {
627 /* Registers including DMAOR and channels including DMARSx */
629 .end
= 0xfe008a00 - 1,
630 .flags
= IORESOURCE_MEM
,
634 .start
= gic_spi(129),
636 .flags
= IORESOURCE_IRQ
,
639 /* IRQ for channels 0-19 */
640 .start
= gic_spi(109),
642 .flags
= IORESOURCE_IRQ
,
646 static struct platform_device dma0_device
= {
647 .name
= "sh-dma-engine",
649 .resource
= sh73a0_dmae_resources
,
650 .num_resources
= ARRAY_SIZE(sh73a0_dmae_resources
),
652 .platform_data
= &sh73a0_dmae_platform_data
,
657 static const struct sh_dmae_slave_config sh73a0_mpdma_slaves
[] = {
659 .slave_id
= SHDMA_SLAVE_FSI2A_RX
,
661 .chcr
= CHCR_RX(XMIT_SZ_32BIT
),
662 .mid_rid
= 0xd6, /* CHECK ME */
664 .slave_id
= SHDMA_SLAVE_FSI2A_TX
,
666 .chcr
= CHCR_TX(XMIT_SZ_32BIT
),
667 .mid_rid
= 0xd5, /* CHECK ME */
669 .slave_id
= SHDMA_SLAVE_FSI2C_RX
,
671 .chcr
= CHCR_RX(XMIT_SZ_32BIT
),
672 .mid_rid
= 0xda, /* CHECK ME */
674 .slave_id
= SHDMA_SLAVE_FSI2C_TX
,
676 .chcr
= CHCR_TX(XMIT_SZ_32BIT
),
677 .mid_rid
= 0xd9, /* CHECK ME */
679 .slave_id
= SHDMA_SLAVE_FSI2B_RX
,
681 .chcr
= CHCR_RX(XMIT_SZ_32BIT
),
682 .mid_rid
= 0x8e, /* CHECK ME */
684 .slave_id
= SHDMA_SLAVE_FSI2B_TX
,
686 .chcr
= CHCR_RX(XMIT_SZ_32BIT
),
687 .mid_rid
= 0x8d, /* CHECK ME */
689 .slave_id
= SHDMA_SLAVE_FSI2D_RX
,
691 .chcr
= CHCR_RX(XMIT_SZ_32BIT
),
692 .mid_rid
= 0x9a, /* CHECK ME */
696 #define MPDMA_CHANNEL(a, b, c) \
701 .chclr_offset = (0x220 - 0x20) + a \
704 static const struct sh_dmae_channel sh73a0_mpdma_channels
[] = {
705 MPDMA_CHANNEL(0x00, 0, 0),
706 MPDMA_CHANNEL(0x10, 0, 8),
707 MPDMA_CHANNEL(0x20, 4, 0),
708 MPDMA_CHANNEL(0x30, 4, 8),
709 MPDMA_CHANNEL(0x50, 8, 0),
710 MPDMA_CHANNEL(0x70, 8, 8),
713 static struct sh_dmae_pdata sh73a0_mpdma_platform_data
= {
714 .slave
= sh73a0_mpdma_slaves
,
715 .slave_num
= ARRAY_SIZE(sh73a0_mpdma_slaves
),
716 .channel
= sh73a0_mpdma_channels
,
717 .channel_num
= ARRAY_SIZE(sh73a0_mpdma_channels
),
718 .ts_low_shift
= TS_LOW_SHIFT
,
719 .ts_low_mask
= TS_LOW_BIT
<< TS_LOW_SHIFT
,
720 .ts_high_shift
= TS_HI_SHIFT
,
721 .ts_high_mask
= TS_HI_BIT
<< TS_HI_SHIFT
,
722 .ts_shift
= dma_ts_shift
,
723 .ts_shift_num
= ARRAY_SIZE(dma_ts_shift
),
724 .dmaor_init
= DMAOR_DME
,
728 /* Resource order important! */
729 static struct resource sh73a0_mpdma_resources
[] = {
731 /* Channel registers and DMAOR */
734 .flags
= IORESOURCE_MEM
,
740 .flags
= IORESOURCE_MEM
,
744 .start
= gic_spi(181),
746 .flags
= IORESOURCE_IRQ
,
749 /* IRQ for channels 0-5 */
750 .start
= gic_spi(175),
752 .flags
= IORESOURCE_IRQ
,
756 static struct platform_device mpdma0_device
= {
757 .name
= "sh-dma-engine",
759 .resource
= sh73a0_mpdma_resources
,
760 .num_resources
= ARRAY_SIZE(sh73a0_mpdma_resources
),
762 .platform_data
= &sh73a0_mpdma_platform_data
,
766 static struct resource pmu_resources
[] = {
768 .start
= gic_spi(55),
770 .flags
= IORESOURCE_IRQ
,
773 .start
= gic_spi(56),
775 .flags
= IORESOURCE_IRQ
,
779 static struct platform_device pmu_device
= {
782 .num_resources
= ARRAY_SIZE(pmu_resources
),
783 .resource
= pmu_resources
,
786 /* an IPMMU module for ICB */
787 static struct resource ipmmu_resources
[] = {
792 .flags
= IORESOURCE_MEM
,
796 static const char * const ipmmu_dev_names
[] = {
797 "sh_mobile_lcdc_fb.0",
800 static struct shmobile_ipmmu_platform_data ipmmu_platform_data
= {
801 .dev_names
= ipmmu_dev_names
,
802 .num_dev_names
= ARRAY_SIZE(ipmmu_dev_names
),
805 static struct platform_device ipmmu_device
= {
809 .platform_data
= &ipmmu_platform_data
,
811 .resource
= ipmmu_resources
,
812 .num_resources
= ARRAY_SIZE(ipmmu_resources
),
815 static struct renesas_intc_irqpin_config irqpin0_platform_data
= {
816 .irq_base
= irq_pin(0), /* IRQ0 -> IRQ7 */
819 static struct resource irqpin0_resources
[] = {
820 DEFINE_RES_MEM(0xe6900000, 4), /* ICR1A */
821 DEFINE_RES_MEM(0xe6900010, 4), /* INTPRI00A */
822 DEFINE_RES_MEM(0xe6900020, 1), /* INTREQ00A */
823 DEFINE_RES_MEM(0xe6900040, 1), /* INTMSK00A */
824 DEFINE_RES_MEM(0xe6900060, 1), /* INTMSKCLR00A */
825 DEFINE_RES_IRQ(gic_spi(1)), /* IRQ0 */
826 DEFINE_RES_IRQ(gic_spi(2)), /* IRQ1 */
827 DEFINE_RES_IRQ(gic_spi(3)), /* IRQ2 */
828 DEFINE_RES_IRQ(gic_spi(4)), /* IRQ3 */
829 DEFINE_RES_IRQ(gic_spi(5)), /* IRQ4 */
830 DEFINE_RES_IRQ(gic_spi(6)), /* IRQ5 */
831 DEFINE_RES_IRQ(gic_spi(7)), /* IRQ6 */
832 DEFINE_RES_IRQ(gic_spi(8)), /* IRQ7 */
835 static struct platform_device irqpin0_device
= {
836 .name
= "renesas_intc_irqpin",
838 .resource
= irqpin0_resources
,
839 .num_resources
= ARRAY_SIZE(irqpin0_resources
),
841 .platform_data
= &irqpin0_platform_data
,
845 static struct renesas_intc_irqpin_config irqpin1_platform_data
= {
846 .irq_base
= irq_pin(8), /* IRQ8 -> IRQ15 */
847 .control_parent
= true, /* Disable spurious IRQ10 */
850 static struct resource irqpin1_resources
[] = {
851 DEFINE_RES_MEM(0xe6900004, 4), /* ICR2A */
852 DEFINE_RES_MEM(0xe6900014, 4), /* INTPRI10A */
853 DEFINE_RES_MEM(0xe6900024, 1), /* INTREQ10A */
854 DEFINE_RES_MEM(0xe6900044, 1), /* INTMSK10A */
855 DEFINE_RES_MEM(0xe6900064, 1), /* INTMSKCLR10A */
856 DEFINE_RES_IRQ(gic_spi(9)), /* IRQ8 */
857 DEFINE_RES_IRQ(gic_spi(10)), /* IRQ9 */
858 DEFINE_RES_IRQ(gic_spi(11)), /* IRQ10 */
859 DEFINE_RES_IRQ(gic_spi(12)), /* IRQ11 */
860 DEFINE_RES_IRQ(gic_spi(13)), /* IRQ12 */
861 DEFINE_RES_IRQ(gic_spi(14)), /* IRQ13 */
862 DEFINE_RES_IRQ(gic_spi(15)), /* IRQ14 */
863 DEFINE_RES_IRQ(gic_spi(16)), /* IRQ15 */
866 static struct platform_device irqpin1_device
= {
867 .name
= "renesas_intc_irqpin",
869 .resource
= irqpin1_resources
,
870 .num_resources
= ARRAY_SIZE(irqpin1_resources
),
872 .platform_data
= &irqpin1_platform_data
,
876 static struct renesas_intc_irqpin_config irqpin2_platform_data
= {
877 .irq_base
= irq_pin(16), /* IRQ16 -> IRQ23 */
880 static struct resource irqpin2_resources
[] = {
881 DEFINE_RES_MEM(0xe6900008, 4), /* ICR3A */
882 DEFINE_RES_MEM(0xe6900018, 4), /* INTPRI20A */
883 DEFINE_RES_MEM(0xe6900028, 1), /* INTREQ20A */
884 DEFINE_RES_MEM(0xe6900048, 1), /* INTMSK20A */
885 DEFINE_RES_MEM(0xe6900068, 1), /* INTMSKCLR20A */
886 DEFINE_RES_IRQ(gic_spi(17)), /* IRQ16 */
887 DEFINE_RES_IRQ(gic_spi(18)), /* IRQ17 */
888 DEFINE_RES_IRQ(gic_spi(19)), /* IRQ18 */
889 DEFINE_RES_IRQ(gic_spi(20)), /* IRQ19 */
890 DEFINE_RES_IRQ(gic_spi(21)), /* IRQ20 */
891 DEFINE_RES_IRQ(gic_spi(22)), /* IRQ21 */
892 DEFINE_RES_IRQ(gic_spi(23)), /* IRQ22 */
893 DEFINE_RES_IRQ(gic_spi(24)), /* IRQ23 */
896 static struct platform_device irqpin2_device
= {
897 .name
= "renesas_intc_irqpin",
899 .resource
= irqpin2_resources
,
900 .num_resources
= ARRAY_SIZE(irqpin2_resources
),
902 .platform_data
= &irqpin2_platform_data
,
906 static struct renesas_intc_irqpin_config irqpin3_platform_data
= {
907 .irq_base
= irq_pin(24), /* IRQ24 -> IRQ31 */
910 static struct resource irqpin3_resources
[] = {
911 DEFINE_RES_MEM(0xe690000c, 4), /* ICR4A */
912 DEFINE_RES_MEM(0xe690001c, 4), /* INTPRI30A */
913 DEFINE_RES_MEM(0xe690002c, 1), /* INTREQ30A */
914 DEFINE_RES_MEM(0xe690004c, 1), /* INTMSK30A */
915 DEFINE_RES_MEM(0xe690006c, 1), /* INTMSKCLR30A */
916 DEFINE_RES_IRQ(gic_spi(25)), /* IRQ24 */
917 DEFINE_RES_IRQ(gic_spi(26)), /* IRQ25 */
918 DEFINE_RES_IRQ(gic_spi(27)), /* IRQ26 */
919 DEFINE_RES_IRQ(gic_spi(28)), /* IRQ27 */
920 DEFINE_RES_IRQ(gic_spi(29)), /* IRQ28 */
921 DEFINE_RES_IRQ(gic_spi(30)), /* IRQ29 */
922 DEFINE_RES_IRQ(gic_spi(31)), /* IRQ30 */
923 DEFINE_RES_IRQ(gic_spi(32)), /* IRQ31 */
926 static struct platform_device irqpin3_device
= {
927 .name
= "renesas_intc_irqpin",
929 .resource
= irqpin3_resources
,
930 .num_resources
= ARRAY_SIZE(irqpin3_resources
),
932 .platform_data
= &irqpin3_platform_data
,
936 static struct platform_device
*sh73a0_devices_dt
[] __initdata
= {
949 static struct platform_device
*sh73a0_early_devices
[] __initdata
= {
955 static struct platform_device
*sh73a0_late_devices
[] __initdata
= {
970 #define SRCR2 IOMEM(0xe61580b0)
972 void __init
sh73a0_add_standard_devices(void)
974 /* Clear software reset bit on SY-DMAC module */
975 __raw_writel(__raw_readl(SRCR2
) & ~(1 << 18), SRCR2
);
977 platform_add_devices(sh73a0_devices_dt
,
978 ARRAY_SIZE(sh73a0_devices_dt
));
979 platform_add_devices(sh73a0_early_devices
,
980 ARRAY_SIZE(sh73a0_early_devices
));
981 platform_add_devices(sh73a0_late_devices
,
982 ARRAY_SIZE(sh73a0_late_devices
));
985 /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
986 void __init __weak
sh73a0_register_twd(void) { }
988 void __init
sh73a0_earlytimer_init(void)
991 shmobile_earlytimer_init();
992 sh73a0_register_twd();
995 void __init
sh73a0_add_early_devices(void)
997 early_platform_add_devices(sh73a0_devices_dt
,
998 ARRAY_SIZE(sh73a0_devices_dt
));
999 early_platform_add_devices(sh73a0_early_devices
,
1000 ARRAY_SIZE(sh73a0_early_devices
));
1002 /* setup early console here as well */
1003 shmobile_setup_console();
1006 #ifdef CONFIG_USE_OF
1008 void __init
sh73a0_init_delay(void)
1010 shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */
1013 static const struct of_dev_auxdata sh73a0_auxdata_lookup
[] __initconst
= {
1017 void __init
sh73a0_add_standard_devices_dt(void)
1019 /* clocks are setup late during boot in the case of DT */
1020 sh73a0_clock_init();
1022 platform_add_devices(sh73a0_devices_dt
,
1023 ARRAY_SIZE(sh73a0_devices_dt
));
1024 of_platform_populate(NULL
, of_default_bus_match_table
,
1025 sh73a0_auxdata_lookup
, NULL
);
1028 static const char *sh73a0_boards_compat_dt
[] __initdata
= {
1033 DT_MACHINE_START(SH73A0_DT
, "Generic SH73A0 (Flattened Device Tree)")
1034 .smp
= smp_ops(sh73a0_smp_ops
),
1035 .map_io
= sh73a0_map_io
,
1036 .init_early
= sh73a0_init_delay
,
1037 .nr_irqs
= NR_IRQS_LEGACY
,
1038 .init_irq
= irqchip_init
,
1039 .init_machine
= sh73a0_add_standard_devices_dt
,
1040 .dt_compat
= sh73a0_boards_compat_dt
,
1042 #endif /* CONFIG_USE_OF */