4 * Copyright (C) 2006 - 2008 Paul Mundt
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
10 #include <linux/platform_device.h>
11 #include <linux/init.h>
12 #include <linux/serial.h>
13 #include <linux/serial_sci.h>
14 #include <linux/sh_timer.h>
15 #include <linux/sh_intc.h>
18 static struct plat_sci_port scif0_platform_data
= {
19 .mapbase
= 0xff923000,
20 .flags
= UPF_BOOT_AUTOCONF
,
21 .scscr
= SCSCR_RE
| SCSCR_TE
| SCSCR_REIE
| SCSCR_TOIE
,
22 .scbrr_algo_id
= SCBRR_ALGO_2
,
24 .irqs
= SCIx_IRQ_MUXED(evt2irq(0x9a0)),
27 static struct platform_device scif0_device
= {
31 .platform_data
= &scif0_platform_data
,
35 static struct plat_sci_port scif1_platform_data
= {
36 .mapbase
= 0xff924000,
37 .flags
= UPF_BOOT_AUTOCONF
,
38 .scscr
= SCSCR_RE
| SCSCR_TE
| SCSCR_REIE
| SCSCR_TOIE
,
39 .scbrr_algo_id
= SCBRR_ALGO_2
,
41 .irqs
= SCIx_IRQ_MUXED(evt2irq(0x9c0)),
44 static struct platform_device scif1_device
= {
48 .platform_data
= &scif1_platform_data
,
52 static struct plat_sci_port scif2_platform_data
= {
53 .mapbase
= 0xff925000,
54 .flags
= UPF_BOOT_AUTOCONF
,
55 .scscr
= SCSCR_RE
| SCSCR_TE
| SCSCR_REIE
| SCSCR_TOIE
,
56 .scbrr_algo_id
= SCBRR_ALGO_2
,
58 .irqs
= SCIx_IRQ_MUXED(evt2irq(0x9e0)),
61 static struct platform_device scif2_device
= {
65 .platform_data
= &scif2_platform_data
,
69 static struct plat_sci_port scif3_platform_data
= {
70 .mapbase
= 0xff926000,
71 .flags
= UPF_BOOT_AUTOCONF
,
72 .scscr
= SCSCR_RE
| SCSCR_TE
| SCSCR_REIE
| SCSCR_TOIE
,
73 .scbrr_algo_id
= SCBRR_ALGO_2
,
75 .irqs
= SCIx_IRQ_MUXED(evt2irq(0xa00)),
78 static struct platform_device scif3_device
= {
82 .platform_data
= &scif3_platform_data
,
86 static struct plat_sci_port scif4_platform_data
= {
87 .mapbase
= 0xff927000,
88 .flags
= UPF_BOOT_AUTOCONF
,
89 .scscr
= SCSCR_RE
| SCSCR_TE
| SCSCR_REIE
| SCSCR_TOIE
,
90 .scbrr_algo_id
= SCBRR_ALGO_2
,
92 .irqs
= SCIx_IRQ_MUXED(evt2irq(0xa20)),
95 static struct platform_device scif4_device
= {
99 .platform_data
= &scif4_platform_data
,
103 static struct plat_sci_port scif5_platform_data
= {
104 .mapbase
= 0xff928000,
105 .flags
= UPF_BOOT_AUTOCONF
,
106 .scscr
= SCSCR_RE
| SCSCR_TE
| SCSCR_REIE
| SCSCR_TOIE
,
107 .scbrr_algo_id
= SCBRR_ALGO_2
,
109 .irqs
= SCIx_IRQ_MUXED(evt2irq(0xa40)),
112 static struct platform_device scif5_device
= {
116 .platform_data
= &scif5_platform_data
,
120 static struct plat_sci_port scif6_platform_data
= {
121 .mapbase
= 0xff929000,
122 .flags
= UPF_BOOT_AUTOCONF
,
123 .scscr
= SCSCR_RE
| SCSCR_TE
| SCSCR_REIE
| SCSCR_TOIE
,
124 .scbrr_algo_id
= SCBRR_ALGO_2
,
126 .irqs
= SCIx_IRQ_MUXED(evt2irq(0xa60)),
129 static struct platform_device scif6_device
= {
133 .platform_data
= &scif6_platform_data
,
137 static struct plat_sci_port scif7_platform_data
= {
138 .mapbase
= 0xff92a000,
139 .flags
= UPF_BOOT_AUTOCONF
,
140 .scscr
= SCSCR_RE
| SCSCR_TE
| SCSCR_REIE
| SCSCR_TOIE
,
141 .scbrr_algo_id
= SCBRR_ALGO_2
,
143 .irqs
= SCIx_IRQ_MUXED(evt2irq(0xa80)),
146 static struct platform_device scif7_device
= {
150 .platform_data
= &scif7_platform_data
,
154 static struct plat_sci_port scif8_platform_data
= {
155 .mapbase
= 0xff92b000,
156 .flags
= UPF_BOOT_AUTOCONF
,
157 .scscr
= SCSCR_RE
| SCSCR_TE
| SCSCR_REIE
| SCSCR_TOIE
,
158 .scbrr_algo_id
= SCBRR_ALGO_2
,
160 .irqs
= SCIx_IRQ_MUXED(evt2irq(0xaa0)),
163 static struct platform_device scif8_device
= {
167 .platform_data
= &scif8_platform_data
,
171 static struct plat_sci_port scif9_platform_data
= {
172 .mapbase
= 0xff92c000,
173 .flags
= UPF_BOOT_AUTOCONF
,
174 .scscr
= SCSCR_RE
| SCSCR_TE
| SCSCR_REIE
| SCSCR_TOIE
,
175 .scbrr_algo_id
= SCBRR_ALGO_2
,
177 .irqs
= SCIx_IRQ_MUXED(evt2irq(0xac0)),
180 static struct platform_device scif9_device
= {
184 .platform_data
= &scif9_platform_data
,
188 static struct sh_timer_config tmu0_platform_data
= {
189 .channel_offset
= 0x04,
191 .clockevent_rating
= 200,
194 static struct resource tmu0_resources
[] = {
198 .flags
= IORESOURCE_MEM
,
201 .start
= evt2irq(0x400),
202 .flags
= IORESOURCE_IRQ
,
206 static struct platform_device tmu0_device
= {
210 .platform_data
= &tmu0_platform_data
,
212 .resource
= tmu0_resources
,
213 .num_resources
= ARRAY_SIZE(tmu0_resources
),
216 static struct sh_timer_config tmu1_platform_data
= {
217 .channel_offset
= 0x10,
219 .clocksource_rating
= 200,
222 static struct resource tmu1_resources
[] = {
226 .flags
= IORESOURCE_MEM
,
229 .start
= evt2irq(0x420),
230 .flags
= IORESOURCE_IRQ
,
234 static struct platform_device tmu1_device
= {
238 .platform_data
= &tmu1_platform_data
,
240 .resource
= tmu1_resources
,
241 .num_resources
= ARRAY_SIZE(tmu1_resources
),
244 static struct sh_timer_config tmu2_platform_data
= {
245 .channel_offset
= 0x1c,
249 static struct resource tmu2_resources
[] = {
253 .flags
= IORESOURCE_MEM
,
256 .start
= evt2irq(0x440),
257 .flags
= IORESOURCE_IRQ
,
261 static struct platform_device tmu2_device
= {
265 .platform_data
= &tmu2_platform_data
,
267 .resource
= tmu2_resources
,
268 .num_resources
= ARRAY_SIZE(tmu2_resources
),
271 static struct sh_timer_config tmu3_platform_data
= {
272 .channel_offset
= 0x04,
276 static struct resource tmu3_resources
[] = {
280 .flags
= IORESOURCE_MEM
,
283 .start
= evt2irq(0x460),
284 .flags
= IORESOURCE_IRQ
,
288 static struct platform_device tmu3_device
= {
292 .platform_data
= &tmu3_platform_data
,
294 .resource
= tmu3_resources
,
295 .num_resources
= ARRAY_SIZE(tmu3_resources
),
298 static struct sh_timer_config tmu4_platform_data
= {
299 .channel_offset
= 0x10,
303 static struct resource tmu4_resources
[] = {
307 .flags
= IORESOURCE_MEM
,
310 .start
= evt2irq(0x480),
311 .flags
= IORESOURCE_IRQ
,
315 static struct platform_device tmu4_device
= {
319 .platform_data
= &tmu4_platform_data
,
321 .resource
= tmu4_resources
,
322 .num_resources
= ARRAY_SIZE(tmu4_resources
),
325 static struct sh_timer_config tmu5_platform_data
= {
326 .channel_offset
= 0x1c,
330 static struct resource tmu5_resources
[] = {
334 .flags
= IORESOURCE_MEM
,
337 .start
= evt2irq(0x4a0),
338 .flags
= IORESOURCE_IRQ
,
342 static struct platform_device tmu5_device
= {
346 .platform_data
= &tmu5_platform_data
,
348 .resource
= tmu5_resources
,
349 .num_resources
= ARRAY_SIZE(tmu5_resources
),
352 static struct sh_timer_config tmu6_platform_data
= {
353 .channel_offset
= 0x04,
357 static struct resource tmu6_resources
[] = {
361 .flags
= IORESOURCE_MEM
,
364 .start
= evt2irq(0x4c0),
365 .flags
= IORESOURCE_IRQ
,
369 static struct platform_device tmu6_device
= {
373 .platform_data
= &tmu6_platform_data
,
375 .resource
= tmu6_resources
,
376 .num_resources
= ARRAY_SIZE(tmu6_resources
),
379 static struct sh_timer_config tmu7_platform_data
= {
380 .channel_offset
= 0x10,
384 static struct resource tmu7_resources
[] = {
388 .flags
= IORESOURCE_MEM
,
391 .start
= evt2irq(0x4e0),
392 .flags
= IORESOURCE_IRQ
,
396 static struct platform_device tmu7_device
= {
400 .platform_data
= &tmu7_platform_data
,
402 .resource
= tmu7_resources
,
403 .num_resources
= ARRAY_SIZE(tmu7_resources
),
406 static struct sh_timer_config tmu8_platform_data
= {
407 .channel_offset
= 0x1c,
411 static struct resource tmu8_resources
[] = {
415 .flags
= IORESOURCE_MEM
,
418 .start
= evt2irq(0x500),
419 .flags
= IORESOURCE_IRQ
,
423 static struct platform_device tmu8_device
= {
427 .platform_data
= &tmu8_platform_data
,
429 .resource
= tmu8_resources
,
430 .num_resources
= ARRAY_SIZE(tmu8_resources
),
433 static struct platform_device
*sh7770_devices
[] __initdata
= {
455 static int __init
sh7770_devices_setup(void)
457 return platform_add_devices(sh7770_devices
,
458 ARRAY_SIZE(sh7770_devices
));
460 arch_initcall(sh7770_devices_setup
);
462 static struct platform_device
*sh7770_early_devices
[] __initdata
= {
484 void __init
plat_early_device_setup(void)
486 early_platform_add_devices(sh7770_early_devices
,
487 ARRAY_SIZE(sh7770_early_devices
));
493 /* interrupt sources */
494 IRL_LLLL
, IRL_LLLH
, IRL_LLHL
, IRL_LLHH
,
495 IRL_LHLL
, IRL_LHLH
, IRL_LHHL
, IRL_LHHH
,
496 IRL_HLLL
, IRL_HLLH
, IRL_HLHL
, IRL_HLHH
,
497 IRL_HHLL
, IRL_HHLH
, IRL_HHHL
,
499 IRQ0
, IRQ1
, IRQ2
, IRQ3
, IRQ4
, IRQ5
,
502 TMU0
, TMU1
, TMU2
, TMU2_TICPI
,
503 TMU3
, TMU4
, TMU5
, TMU5_TICPI
,
505 HAC
, IPI
, SPDIF
, HUDI
, I2C
,
506 DMAC0_DMINT0
, DMAC0_DMINT1
, DMAC0_DMINT2
,
507 I2S0
, I2S1
, I2S2
, I2S3
,
508 SRC_RX
, SRC_TX
, SRC_SPDIF
,
509 DU
, VIDEO_IN
, REMOTE
, YUV
, USB
, ATAPI
, CAN
, GPS
, GFX2D
,
510 GFX3D_MBX
, GFX3D_DMAC
,
513 SCIF089
, SCIF1234
, SCIF567
,
515 BBDMAC_0_3
, BBDMAC_4_7
, BBDMAC_8_10
, BBDMAC_11_14
,
516 BBDMAC_15_18
, BBDMAC_19_22
, BBDMAC_23_26
, BBDMAC_27
,
517 BBDMAC_28
, BBDMAC_29
, BBDMAC_30
, BBDMAC_31
,
519 /* interrupt groups */
520 TMU
, DMAC
, I2S
, SRC
, GFX3D
, SPI
, SCIF
, BBDMAC
,
523 static struct intc_vect vectors
[] __initdata
= {
524 INTC_VECT(GPIO
, 0x3e0),
525 INTC_VECT(TMU0
, 0x400), INTC_VECT(TMU1
, 0x420),
526 INTC_VECT(TMU2
, 0x440), INTC_VECT(TMU2_TICPI
, 0x460),
527 INTC_VECT(TMU3
, 0x480), INTC_VECT(TMU4
, 0x4a0),
528 INTC_VECT(TMU5
, 0x4c0), INTC_VECT(TMU5_TICPI
, 0x4e0),
529 INTC_VECT(TMU6
, 0x500), INTC_VECT(TMU7
, 0x520),
530 INTC_VECT(TMU8
, 0x540),
531 INTC_VECT(HAC
, 0x580), INTC_VECT(IPI
, 0x5c0),
532 INTC_VECT(SPDIF
, 0x5e0),
533 INTC_VECT(HUDI
, 0x600), INTC_VECT(I2C
, 0x620),
534 INTC_VECT(DMAC0_DMINT0
, 0x640), INTC_VECT(DMAC0_DMINT1
, 0x660),
535 INTC_VECT(DMAC0_DMINT2
, 0x680),
536 INTC_VECT(I2S0
, 0x6a0), INTC_VECT(I2S1
, 0x6c0),
537 INTC_VECT(I2S2
, 0x6e0), INTC_VECT(I2S3
, 0x700),
538 INTC_VECT(SRC_RX
, 0x720), INTC_VECT(SRC_TX
, 0x740),
539 INTC_VECT(SRC_SPDIF
, 0x760),
540 INTC_VECT(DU
, 0x780), INTC_VECT(VIDEO_IN
, 0x7a0),
541 INTC_VECT(REMOTE
, 0x7c0), INTC_VECT(YUV
, 0x7e0),
542 INTC_VECT(USB
, 0x840), INTC_VECT(ATAPI
, 0x860),
543 INTC_VECT(CAN
, 0x880), INTC_VECT(GPS
, 0x8a0),
544 INTC_VECT(GFX2D
, 0x8c0),
545 INTC_VECT(GFX3D_MBX
, 0x900), INTC_VECT(GFX3D_DMAC
, 0x920),
546 INTC_VECT(EXBUS_ATA
, 0x940),
547 INTC_VECT(SPI0
, 0x960), INTC_VECT(SPI1
, 0x980),
548 INTC_VECT(SCIF089
, 0x9a0), INTC_VECT(SCIF1234
, 0x9c0),
549 INTC_VECT(SCIF1234
, 0x9e0), INTC_VECT(SCIF1234
, 0xa00),
550 INTC_VECT(SCIF1234
, 0xa20), INTC_VECT(SCIF567
, 0xa40),
551 INTC_VECT(SCIF567
, 0xa60), INTC_VECT(SCIF567
, 0xa80),
552 INTC_VECT(SCIF089
, 0xaa0), INTC_VECT(SCIF089
, 0xac0),
553 INTC_VECT(ADC
, 0xb20),
554 INTC_VECT(BBDMAC_0_3
, 0xba0), INTC_VECT(BBDMAC_0_3
, 0xbc0),
555 INTC_VECT(BBDMAC_0_3
, 0xbe0), INTC_VECT(BBDMAC_0_3
, 0xc00),
556 INTC_VECT(BBDMAC_4_7
, 0xc20), INTC_VECT(BBDMAC_4_7
, 0xc40),
557 INTC_VECT(BBDMAC_4_7
, 0xc60), INTC_VECT(BBDMAC_4_7
, 0xc80),
558 INTC_VECT(BBDMAC_8_10
, 0xca0), INTC_VECT(BBDMAC_8_10
, 0xcc0),
559 INTC_VECT(BBDMAC_8_10
, 0xce0), INTC_VECT(BBDMAC_11_14
, 0xd00),
560 INTC_VECT(BBDMAC_11_14
, 0xd20), INTC_VECT(BBDMAC_11_14
, 0xd40),
561 INTC_VECT(BBDMAC_11_14
, 0xd60), INTC_VECT(BBDMAC_15_18
, 0xd80),
562 INTC_VECT(BBDMAC_15_18
, 0xda0), INTC_VECT(BBDMAC_15_18
, 0xdc0),
563 INTC_VECT(BBDMAC_15_18
, 0xde0), INTC_VECT(BBDMAC_19_22
, 0xe00),
564 INTC_VECT(BBDMAC_19_22
, 0xe20), INTC_VECT(BBDMAC_19_22
, 0xe40),
565 INTC_VECT(BBDMAC_19_22
, 0xe60), INTC_VECT(BBDMAC_23_26
, 0xe80),
566 INTC_VECT(BBDMAC_23_26
, 0xea0), INTC_VECT(BBDMAC_23_26
, 0xec0),
567 INTC_VECT(BBDMAC_23_26
, 0xee0), INTC_VECT(BBDMAC_27
, 0xf00),
568 INTC_VECT(BBDMAC_28
, 0xf20), INTC_VECT(BBDMAC_29
, 0xf40),
569 INTC_VECT(BBDMAC_30
, 0xf60), INTC_VECT(BBDMAC_31
, 0xf80),
572 static struct intc_group groups
[] __initdata
= {
573 INTC_GROUP(TMU
, TMU0
, TMU1
, TMU2
, TMU2_TICPI
, TMU3
, TMU4
, TMU5
,
574 TMU5_TICPI
, TMU6
, TMU7
, TMU8
),
575 INTC_GROUP(DMAC
, DMAC0_DMINT0
, DMAC0_DMINT1
, DMAC0_DMINT2
),
576 INTC_GROUP(I2S
, I2S0
, I2S1
, I2S2
, I2S3
),
577 INTC_GROUP(SRC
, SRC_RX
, SRC_TX
, SRC_SPDIF
),
578 INTC_GROUP(GFX3D
, GFX3D_MBX
, GFX3D_DMAC
),
579 INTC_GROUP(SPI
, SPI0
, SPI1
),
580 INTC_GROUP(SCIF
, SCIF089
, SCIF1234
, SCIF567
),
582 BBDMAC_0_3
, BBDMAC_4_7
, BBDMAC_8_10
, BBDMAC_11_14
,
583 BBDMAC_15_18
, BBDMAC_19_22
, BBDMAC_23_26
, BBDMAC_27
,
584 BBDMAC_28
, BBDMAC_29
, BBDMAC_30
, BBDMAC_31
),
587 static struct intc_mask_reg mask_registers
[] __initdata
= {
588 { 0xffe00040, 0xffe00044, 32, /* INT2MSKR / INT2MSKCR */
589 { 0, BBDMAC
, ADC
, SCIF
, SPI
, EXBUS_ATA
, GFX3D
, GFX2D
,
590 GPS
, CAN
, ATAPI
, USB
, YUV
, REMOTE
, VIDEO_IN
, DU
, SRC
, I2S
,
591 DMAC
, I2C
, HUDI
, SPDIF
, IPI
, HAC
, TMU
, GPIO
} },
594 static struct intc_prio_reg prio_registers
[] __initdata
= {
595 { 0xffe00000, 0, 32, 8, /* INT2PRI0 */ { GPIO
, TMU0
, 0, HAC
} },
596 { 0xffe00004, 0, 32, 8, /* INT2PRI1 */ { IPI
, SPDIF
, HUDI
, I2C
} },
597 { 0xffe00008, 0, 32, 8, /* INT2PRI2 */ { DMAC
, I2S
, SRC
, DU
} },
598 { 0xffe0000c, 0, 32, 8, /* INT2PRI3 */ { VIDEO_IN
, REMOTE
, YUV
, USB
} },
599 { 0xffe00010, 0, 32, 8, /* INT2PRI4 */ { ATAPI
, CAN
, GPS
, GFX2D
} },
600 { 0xffe00014, 0, 32, 8, /* INT2PRI5 */ { 0, GFX3D
, EXBUS_ATA
, SPI
} },
601 { 0xffe00018, 0, 32, 8, /* INT2PRI6 */ { SCIF1234
, SCIF567
, SCIF089
} },
602 { 0xffe0001c, 0, 32, 8, /* INT2PRI7 */ { ADC
, 0, 0, BBDMAC_0_3
} },
603 { 0xffe00020, 0, 32, 8, /* INT2PRI8 */
604 { BBDMAC_4_7
, BBDMAC_8_10
, BBDMAC_11_14
, BBDMAC_15_18
} },
605 { 0xffe00024, 0, 32, 8, /* INT2PRI9 */
606 { BBDMAC_19_22
, BBDMAC_23_26
, BBDMAC_27
, BBDMAC_28
} },
607 { 0xffe00028, 0, 32, 8, /* INT2PRI10 */
608 { BBDMAC_29
, BBDMAC_30
, BBDMAC_31
} },
609 { 0xffe0002c, 0, 32, 8, /* INT2PRI11 */
610 { TMU1
, TMU2
, TMU2_TICPI
, TMU3
} },
611 { 0xffe00030, 0, 32, 8, /* INT2PRI12 */
612 { TMU4
, TMU5
, TMU5_TICPI
, TMU6
} },
613 { 0xffe00034, 0, 32, 8, /* INT2PRI13 */
617 static DECLARE_INTC_DESC(intc_desc
, "sh7770", vectors
, groups
,
618 mask_registers
, prio_registers
, NULL
);
620 /* Support for external interrupt pins in IRQ mode */
621 static struct intc_vect irq_vectors
[] __initdata
= {
622 INTC_VECT(IRQ0
, 0x240), INTC_VECT(IRQ1
, 0x280),
623 INTC_VECT(IRQ2
, 0x2c0), INTC_VECT(IRQ3
, 0x300),
624 INTC_VECT(IRQ4
, 0x340), INTC_VECT(IRQ5
, 0x380),
627 static struct intc_mask_reg irq_mask_registers
[] __initdata
= {
628 { 0xffd00044, 0xffd00064, 32, /* INTMSK0 / INTMSKCLR0 */
629 { IRQ0
, IRQ1
, IRQ2
, IRQ3
, IRQ4
, IRQ5
, } },
632 static struct intc_prio_reg irq_prio_registers
[] __initdata
= {
633 { 0xffd00010, 0, 32, 4, /* INTPRI */ { IRQ0
, IRQ1
, IRQ2
, IRQ3
,
637 static struct intc_sense_reg irq_sense_registers
[] __initdata
= {
638 { 0xffd0001c, 32, 2, /* ICR1 */ { IRQ0
, IRQ1
, IRQ2
, IRQ3
,
642 static DECLARE_INTC_DESC(intc_irq_desc
, "sh7770-irq", irq_vectors
,
643 NULL
, irq_mask_registers
, irq_prio_registers
,
644 irq_sense_registers
);
646 /* External interrupt pins in IRL mode */
647 static struct intc_vect irl_vectors
[] __initdata
= {
648 INTC_VECT(IRL_LLLL
, 0x200), INTC_VECT(IRL_LLLH
, 0x220),
649 INTC_VECT(IRL_LLHL
, 0x240), INTC_VECT(IRL_LLHH
, 0x260),
650 INTC_VECT(IRL_LHLL
, 0x280), INTC_VECT(IRL_LHLH
, 0x2a0),
651 INTC_VECT(IRL_LHHL
, 0x2c0), INTC_VECT(IRL_LHHH
, 0x2e0),
652 INTC_VECT(IRL_HLLL
, 0x300), INTC_VECT(IRL_HLLH
, 0x320),
653 INTC_VECT(IRL_HLHL
, 0x340), INTC_VECT(IRL_HLHH
, 0x360),
654 INTC_VECT(IRL_HHLL
, 0x380), INTC_VECT(IRL_HHLH
, 0x3a0),
655 INTC_VECT(IRL_HHHL
, 0x3c0),
658 static struct intc_mask_reg irl3210_mask_registers
[] __initdata
= {
659 { 0xffd40080, 0xffd40084, 32, /* INTMSK2 / INTMSKCLR2 */
660 { IRL_LLLL
, IRL_LLLH
, IRL_LLHL
, IRL_LLHH
,
661 IRL_LHLL
, IRL_LHLH
, IRL_LHHL
, IRL_LHHH
,
662 IRL_HLLL
, IRL_HLLH
, IRL_HLHL
, IRL_HLHH
,
663 IRL_HHLL
, IRL_HHLH
, IRL_HHHL
, } },
666 static struct intc_mask_reg irl7654_mask_registers
[] __initdata
= {
667 { 0xffd40080, 0xffd40084, 32, /* INTMSK2 / INTMSKCLR2 */
668 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
669 IRL_LLLL
, IRL_LLLH
, IRL_LLHL
, IRL_LLHH
,
670 IRL_LHLL
, IRL_LHLH
, IRL_LHHL
, IRL_LHHH
,
671 IRL_HLLL
, IRL_HLLH
, IRL_HLHL
, IRL_HLHH
,
672 IRL_HHLL
, IRL_HHLH
, IRL_HHHL
, } },
675 static DECLARE_INTC_DESC(intc_irl7654_desc
, "sh7780-irl7654", irl_vectors
,
676 NULL
, irl7654_mask_registers
, NULL
, NULL
);
678 static DECLARE_INTC_DESC(intc_irl3210_desc
, "sh7780-irl3210", irl_vectors
,
679 NULL
, irl3210_mask_registers
, NULL
, NULL
);
681 #define INTC_ICR0 0xffd00000
682 #define INTC_INTMSK0 0xffd00044
683 #define INTC_INTMSK1 0xffd00048
684 #define INTC_INTMSK2 0xffd40080
685 #define INTC_INTMSKCLR1 0xffd00068
686 #define INTC_INTMSKCLR2 0xffd40084
688 void __init
plat_irq_setup(void)
691 __raw_writel(0xff000000, INTC_INTMSK0
);
693 /* disable IRL3-0 + IRL7-4 */
694 __raw_writel(0xc0000000, INTC_INTMSK1
);
695 __raw_writel(0xfffefffe, INTC_INTMSK2
);
697 /* select IRL mode for IRL3-0 + IRL7-4 */
698 __raw_writel(__raw_readl(INTC_ICR0
) & ~0x00c00000, INTC_ICR0
);
700 /* disable holding function, ie enable "SH-4 Mode" */
701 __raw_writel(__raw_readl(INTC_ICR0
) | 0x00200000, INTC_ICR0
);
703 register_intc_controller(&intc_desc
);
706 void __init
plat_irq_setup_pins(int mode
)
710 /* select IRQ mode for IRL3-0 + IRL7-4 */
711 __raw_writel(__raw_readl(INTC_ICR0
) | 0x00c00000, INTC_ICR0
);
712 register_intc_controller(&intc_irq_desc
);
714 case IRQ_MODE_IRL7654
:
715 /* enable IRL7-4 but don't provide any masking */
716 __raw_writel(0x40000000, INTC_INTMSKCLR1
);
717 __raw_writel(0x0000fffe, INTC_INTMSKCLR2
);
719 case IRQ_MODE_IRL3210
:
720 /* enable IRL0-3 but don't provide any masking */
721 __raw_writel(0x80000000, INTC_INTMSKCLR1
);
722 __raw_writel(0xfffe0000, INTC_INTMSKCLR2
);
724 case IRQ_MODE_IRL7654_MASK
:
725 /* enable IRL7-4 and mask using cpu intc controller */
726 __raw_writel(0x40000000, INTC_INTMSKCLR1
);
727 register_intc_controller(&intc_irl7654_desc
);
729 case IRQ_MODE_IRL3210_MASK
:
730 /* enable IRL0-3 and mask using cpu intc controller */
731 __raw_writel(0x80000000, INTC_INTMSKCLR1
);
732 register_intc_controller(&intc_irl3210_desc
);