162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * SH7091/SH7750/SH7750S/SH7750R/SH7751/SH7751R Setup
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *  Copyright (C) 2006  Paul Mundt
662306a36Sopenharmony_ci *  Copyright (C) 2006  Jamie Lenehan
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci#include <linux/platform_device.h>
962306a36Sopenharmony_ci#include <linux/init.h>
1062306a36Sopenharmony_ci#include <linux/serial.h>
1162306a36Sopenharmony_ci#include <linux/io.h>
1262306a36Sopenharmony_ci#include <linux/sh_timer.h>
1362306a36Sopenharmony_ci#include <linux/sh_intc.h>
1462306a36Sopenharmony_ci#include <linux/serial_sci.h>
1562306a36Sopenharmony_ci#include <generated/machtypes.h>
1662306a36Sopenharmony_ci#include <asm/platform_early.h>
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_cistatic struct resource rtc_resources[] = {
1962306a36Sopenharmony_ci	[0] = {
2062306a36Sopenharmony_ci		.start	= 0xffc80000,
2162306a36Sopenharmony_ci		.end	= 0xffc80000 + 0x58 - 1,
2262306a36Sopenharmony_ci		.flags	= IORESOURCE_IO,
2362306a36Sopenharmony_ci	},
2462306a36Sopenharmony_ci	[1] = {
2562306a36Sopenharmony_ci		/* Shared Period/Carry/Alarm IRQ */
2662306a36Sopenharmony_ci		.start	= evt2irq(0x480),
2762306a36Sopenharmony_ci		.flags	= IORESOURCE_IRQ,
2862306a36Sopenharmony_ci	},
2962306a36Sopenharmony_ci};
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_cistatic struct platform_device rtc_device = {
3262306a36Sopenharmony_ci	.name		= "sh-rtc",
3362306a36Sopenharmony_ci	.id		= -1,
3462306a36Sopenharmony_ci	.num_resources	= ARRAY_SIZE(rtc_resources),
3562306a36Sopenharmony_ci	.resource	= rtc_resources,
3662306a36Sopenharmony_ci};
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_cistatic struct plat_sci_port sci_platform_data = {
3962306a36Sopenharmony_ci	.type		= PORT_SCI,
4062306a36Sopenharmony_ci};
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_cistatic struct resource sci_resources[] = {
4362306a36Sopenharmony_ci	DEFINE_RES_MEM(0xffe00000, 0x20),
4462306a36Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0x4e0)),
4562306a36Sopenharmony_ci};
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_cistatic struct platform_device sci_device = {
4862306a36Sopenharmony_ci	.name		= "sh-sci",
4962306a36Sopenharmony_ci	.id		= 0,
5062306a36Sopenharmony_ci	.resource	= sci_resources,
5162306a36Sopenharmony_ci	.num_resources	= ARRAY_SIZE(sci_resources),
5262306a36Sopenharmony_ci	.dev		= {
5362306a36Sopenharmony_ci		.platform_data	= &sci_platform_data,
5462306a36Sopenharmony_ci	},
5562306a36Sopenharmony_ci};
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_cistatic struct plat_sci_port scif_platform_data = {
5862306a36Sopenharmony_ci	.scscr		= SCSCR_REIE,
5962306a36Sopenharmony_ci	.type		= PORT_SCIF,
6062306a36Sopenharmony_ci};
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_cistatic struct resource scif_resources[] = {
6362306a36Sopenharmony_ci	DEFINE_RES_MEM(0xffe80000, 0x100),
6462306a36Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0x700)),
6562306a36Sopenharmony_ci};
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_cistatic struct platform_device scif_device = {
6862306a36Sopenharmony_ci	.name		= "sh-sci",
6962306a36Sopenharmony_ci	.id		= 1,
7062306a36Sopenharmony_ci	.resource	= scif_resources,
7162306a36Sopenharmony_ci	.num_resources	= ARRAY_SIZE(scif_resources),
7262306a36Sopenharmony_ci	.dev		= {
7362306a36Sopenharmony_ci		.platform_data	= &scif_platform_data,
7462306a36Sopenharmony_ci	},
7562306a36Sopenharmony_ci};
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_cistatic struct sh_timer_config tmu0_platform_data = {
7862306a36Sopenharmony_ci	.channels_mask = 7,
7962306a36Sopenharmony_ci};
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_cistatic struct resource tmu0_resources[] = {
8262306a36Sopenharmony_ci	DEFINE_RES_MEM(0xffd80000, 0x30),
8362306a36Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0x400)),
8462306a36Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0x420)),
8562306a36Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0x440)),
8662306a36Sopenharmony_ci};
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_cistatic struct platform_device tmu0_device = {
8962306a36Sopenharmony_ci	.name		= "sh-tmu",
9062306a36Sopenharmony_ci	.id		= 0,
9162306a36Sopenharmony_ci	.dev = {
9262306a36Sopenharmony_ci		.platform_data	= &tmu0_platform_data,
9362306a36Sopenharmony_ci	},
9462306a36Sopenharmony_ci	.resource	= tmu0_resources,
9562306a36Sopenharmony_ci	.num_resources	= ARRAY_SIZE(tmu0_resources),
9662306a36Sopenharmony_ci};
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci/* SH7750R, SH7751 and SH7751R all have two extra timer channels */
9962306a36Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
10062306a36Sopenharmony_ci	defined(CONFIG_CPU_SUBTYPE_SH7751) || \
10162306a36Sopenharmony_ci	defined(CONFIG_CPU_SUBTYPE_SH7751R)
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_cistatic struct sh_timer_config tmu1_platform_data = {
10462306a36Sopenharmony_ci	.channels_mask = 3,
10562306a36Sopenharmony_ci};
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_cistatic struct resource tmu1_resources[] = {
10862306a36Sopenharmony_ci	DEFINE_RES_MEM(0xfe100000, 0x20),
10962306a36Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0xb00)),
11062306a36Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0xb80)),
11162306a36Sopenharmony_ci};
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_cistatic struct platform_device tmu1_device = {
11462306a36Sopenharmony_ci	.name		= "sh-tmu",
11562306a36Sopenharmony_ci	.id		= 1,
11662306a36Sopenharmony_ci	.dev = {
11762306a36Sopenharmony_ci		.platform_data	= &tmu1_platform_data,
11862306a36Sopenharmony_ci	},
11962306a36Sopenharmony_ci	.resource	= tmu1_resources,
12062306a36Sopenharmony_ci	.num_resources	= ARRAY_SIZE(tmu1_resources),
12162306a36Sopenharmony_ci};
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#endif
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_cistatic struct platform_device *sh7750_devices[] __initdata = {
12662306a36Sopenharmony_ci	&rtc_device,
12762306a36Sopenharmony_ci	&tmu0_device,
12862306a36Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
12962306a36Sopenharmony_ci	defined(CONFIG_CPU_SUBTYPE_SH7751) || \
13062306a36Sopenharmony_ci	defined(CONFIG_CPU_SUBTYPE_SH7751R)
13162306a36Sopenharmony_ci	&tmu1_device,
13262306a36Sopenharmony_ci#endif
13362306a36Sopenharmony_ci};
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_cistatic int __init sh7750_devices_setup(void)
13662306a36Sopenharmony_ci{
13762306a36Sopenharmony_ci	if (mach_is_rts7751r2d()) {
13862306a36Sopenharmony_ci		platform_device_register(&scif_device);
13962306a36Sopenharmony_ci	} else {
14062306a36Sopenharmony_ci		platform_device_register(&sci_device);
14162306a36Sopenharmony_ci		platform_device_register(&scif_device);
14262306a36Sopenharmony_ci	}
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci	return platform_add_devices(sh7750_devices,
14562306a36Sopenharmony_ci				    ARRAY_SIZE(sh7750_devices));
14662306a36Sopenharmony_ci}
14762306a36Sopenharmony_ciarch_initcall(sh7750_devices_setup);
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_cistatic struct platform_device *sh7750_early_devices[] __initdata = {
15062306a36Sopenharmony_ci	&tmu0_device,
15162306a36Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
15262306a36Sopenharmony_ci	defined(CONFIG_CPU_SUBTYPE_SH7751) || \
15362306a36Sopenharmony_ci	defined(CONFIG_CPU_SUBTYPE_SH7751R)
15462306a36Sopenharmony_ci	&tmu1_device,
15562306a36Sopenharmony_ci#endif
15662306a36Sopenharmony_ci};
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_civoid __init plat_early_device_setup(void)
15962306a36Sopenharmony_ci{
16062306a36Sopenharmony_ci	struct platform_device *dev[1];
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci	if (mach_is_rts7751r2d()) {
16362306a36Sopenharmony_ci		scif_platform_data.scscr |= SCSCR_CKE1;
16462306a36Sopenharmony_ci		dev[0] = &scif_device;
16562306a36Sopenharmony_ci		sh_early_platform_add_devices(dev, 1);
16662306a36Sopenharmony_ci	} else {
16762306a36Sopenharmony_ci		dev[0] = &sci_device;
16862306a36Sopenharmony_ci		sh_early_platform_add_devices(dev, 1);
16962306a36Sopenharmony_ci		dev[0] = &scif_device;
17062306a36Sopenharmony_ci		sh_early_platform_add_devices(dev, 1);
17162306a36Sopenharmony_ci	}
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci	sh_early_platform_add_devices(sh7750_early_devices,
17462306a36Sopenharmony_ci				   ARRAY_SIZE(sh7750_early_devices));
17562306a36Sopenharmony_ci}
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_cienum {
17862306a36Sopenharmony_ci	UNUSED = 0,
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci	/* interrupt sources */
18162306a36Sopenharmony_ci	IRL0, IRL1, IRL2, IRL3, /* only IRLM mode supported */
18262306a36Sopenharmony_ci	HUDI, GPIOI, DMAC,
18362306a36Sopenharmony_ci	PCIC0_PCISERR, PCIC1_PCIERR, PCIC1_PCIPWDWN, PCIC1_PCIPWON,
18462306a36Sopenharmony_ci	PCIC1_PCIDMA0, PCIC1_PCIDMA1, PCIC1_PCIDMA2, PCIC1_PCIDMA3,
18562306a36Sopenharmony_ci	TMU3, TMU4, TMU0, TMU1, TMU2, RTC, SCI1, SCIF, WDT, REF,
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci	/* interrupt groups */
18862306a36Sopenharmony_ci	PCIC1,
18962306a36Sopenharmony_ci};
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_cistatic struct intc_vect vectors[] __initdata = {
19262306a36Sopenharmony_ci	INTC_VECT(HUDI, 0x600), INTC_VECT(GPIOI, 0x620),
19362306a36Sopenharmony_ci	INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
19462306a36Sopenharmony_ci	INTC_VECT(TMU2, 0x440), INTC_VECT(TMU2, 0x460),
19562306a36Sopenharmony_ci	INTC_VECT(RTC, 0x480), INTC_VECT(RTC, 0x4a0),
19662306a36Sopenharmony_ci	INTC_VECT(RTC, 0x4c0),
19762306a36Sopenharmony_ci	INTC_VECT(SCI1, 0x4e0), INTC_VECT(SCI1, 0x500),
19862306a36Sopenharmony_ci	INTC_VECT(SCI1, 0x520), INTC_VECT(SCI1, 0x540),
19962306a36Sopenharmony_ci	INTC_VECT(SCIF, 0x700), INTC_VECT(SCIF, 0x720),
20062306a36Sopenharmony_ci	INTC_VECT(SCIF, 0x740), INTC_VECT(SCIF, 0x760),
20162306a36Sopenharmony_ci	INTC_VECT(WDT, 0x560),
20262306a36Sopenharmony_ci	INTC_VECT(REF, 0x580), INTC_VECT(REF, 0x5a0),
20362306a36Sopenharmony_ci};
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_cistatic struct intc_prio_reg prio_registers[] __initdata = {
20662306a36Sopenharmony_ci	{ 0xffd00004, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },
20762306a36Sopenharmony_ci	{ 0xffd00008, 0, 16, 4, /* IPRB */ { WDT, REF, SCI1, 0 } },
20862306a36Sopenharmony_ci	{ 0xffd0000c, 0, 16, 4, /* IPRC */ { GPIOI, DMAC, SCIF, HUDI } },
20962306a36Sopenharmony_ci	{ 0xffd00010, 0, 16, 4, /* IPRD */ { IRL0, IRL1, IRL2, IRL3 } },
21062306a36Sopenharmony_ci	{ 0xfe080000, 0, 32, 4, /* INTPRI00 */ { 0, 0, 0, 0,
21162306a36Sopenharmony_ci						 TMU4, TMU3,
21262306a36Sopenharmony_ci						 PCIC1, PCIC0_PCISERR } },
21362306a36Sopenharmony_ci};
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_cistatic DECLARE_INTC_DESC(intc_desc, "sh7750", vectors, NULL,
21662306a36Sopenharmony_ci			 NULL, prio_registers, NULL);
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci/* SH7750, SH7750S, SH7751 and SH7091 all have 4-channel DMA controllers */
21962306a36Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7750) || \
22062306a36Sopenharmony_ci	defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
22162306a36Sopenharmony_ci	defined(CONFIG_CPU_SUBTYPE_SH7751) || \
22262306a36Sopenharmony_ci	defined(CONFIG_CPU_SUBTYPE_SH7091)
22362306a36Sopenharmony_cistatic struct intc_vect vectors_dma4[] __initdata = {
22462306a36Sopenharmony_ci	INTC_VECT(DMAC, 0x640), INTC_VECT(DMAC, 0x660),
22562306a36Sopenharmony_ci	INTC_VECT(DMAC, 0x680), INTC_VECT(DMAC, 0x6a0),
22662306a36Sopenharmony_ci	INTC_VECT(DMAC, 0x6c0),
22762306a36Sopenharmony_ci};
22862306a36Sopenharmony_ci
22962306a36Sopenharmony_cistatic DECLARE_INTC_DESC(intc_desc_dma4, "sh7750_dma4",
23062306a36Sopenharmony_ci			 vectors_dma4, NULL,
23162306a36Sopenharmony_ci			 NULL, prio_registers, NULL);
23262306a36Sopenharmony_ci#endif
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ci/* SH7750R and SH7751R both have 8-channel DMA controllers */
23562306a36Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || defined(CONFIG_CPU_SUBTYPE_SH7751R)
23662306a36Sopenharmony_cistatic struct intc_vect vectors_dma8[] __initdata = {
23762306a36Sopenharmony_ci	INTC_VECT(DMAC, 0x640), INTC_VECT(DMAC, 0x660),
23862306a36Sopenharmony_ci	INTC_VECT(DMAC, 0x680), INTC_VECT(DMAC, 0x6a0),
23962306a36Sopenharmony_ci	INTC_VECT(DMAC, 0x780), INTC_VECT(DMAC, 0x7a0),
24062306a36Sopenharmony_ci	INTC_VECT(DMAC, 0x7c0), INTC_VECT(DMAC, 0x7e0),
24162306a36Sopenharmony_ci	INTC_VECT(DMAC, 0x6c0),
24262306a36Sopenharmony_ci};
24362306a36Sopenharmony_ci
24462306a36Sopenharmony_cistatic DECLARE_INTC_DESC(intc_desc_dma8, "sh7750_dma8",
24562306a36Sopenharmony_ci			 vectors_dma8, NULL,
24662306a36Sopenharmony_ci			 NULL, prio_registers, NULL);
24762306a36Sopenharmony_ci#endif
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci/* SH7750R, SH7751 and SH7751R all have two extra timer channels */
25062306a36Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
25162306a36Sopenharmony_ci	defined(CONFIG_CPU_SUBTYPE_SH7751) || \
25262306a36Sopenharmony_ci	defined(CONFIG_CPU_SUBTYPE_SH7751R)
25362306a36Sopenharmony_cistatic struct intc_vect vectors_tmu34[] __initdata = {
25462306a36Sopenharmony_ci	INTC_VECT(TMU3, 0xb00), INTC_VECT(TMU4, 0xb80),
25562306a36Sopenharmony_ci};
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_cistatic struct intc_mask_reg mask_registers[] __initdata = {
25862306a36Sopenharmony_ci	{ 0xfe080040, 0xfe080060, 32, /* INTMSK00 / INTMSKCLR00 */
25962306a36Sopenharmony_ci	  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
26062306a36Sopenharmony_ci	    0, 0, 0, 0, 0, 0, TMU4, TMU3,
26162306a36Sopenharmony_ci	    PCIC1_PCIERR, PCIC1_PCIPWDWN, PCIC1_PCIPWON,
26262306a36Sopenharmony_ci	    PCIC1_PCIDMA0, PCIC1_PCIDMA1, PCIC1_PCIDMA2,
26362306a36Sopenharmony_ci	    PCIC1_PCIDMA3, PCIC0_PCISERR } },
26462306a36Sopenharmony_ci};
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_cistatic DECLARE_INTC_DESC(intc_desc_tmu34, "sh7750_tmu34",
26762306a36Sopenharmony_ci			 vectors_tmu34, NULL,
26862306a36Sopenharmony_ci			 mask_registers, prio_registers, NULL);
26962306a36Sopenharmony_ci#endif
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_ci/* SH7750S, SH7750R, SH7751 and SH7751R all have IRLM priority registers */
27262306a36Sopenharmony_cistatic struct intc_vect vectors_irlm[] __initdata = {
27362306a36Sopenharmony_ci	INTC_VECT(IRL0, 0x240), INTC_VECT(IRL1, 0x2a0),
27462306a36Sopenharmony_ci	INTC_VECT(IRL2, 0x300), INTC_VECT(IRL3, 0x360),
27562306a36Sopenharmony_ci};
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_cistatic DECLARE_INTC_DESC(intc_desc_irlm, "sh7750_irlm", vectors_irlm, NULL,
27862306a36Sopenharmony_ci			 NULL, prio_registers, NULL);
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ci/* SH7751 and SH7751R both have PCI */
28162306a36Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7751) || defined(CONFIG_CPU_SUBTYPE_SH7751R)
28262306a36Sopenharmony_cistatic struct intc_vect vectors_pci[] __initdata = {
28362306a36Sopenharmony_ci	INTC_VECT(PCIC0_PCISERR, 0xa00), INTC_VECT(PCIC1_PCIERR, 0xae0),
28462306a36Sopenharmony_ci	INTC_VECT(PCIC1_PCIPWDWN, 0xac0), INTC_VECT(PCIC1_PCIPWON, 0xaa0),
28562306a36Sopenharmony_ci	INTC_VECT(PCIC1_PCIDMA0, 0xa80), INTC_VECT(PCIC1_PCIDMA1, 0xa60),
28662306a36Sopenharmony_ci	INTC_VECT(PCIC1_PCIDMA2, 0xa40), INTC_VECT(PCIC1_PCIDMA3, 0xa20),
28762306a36Sopenharmony_ci};
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_cistatic struct intc_group groups_pci[] __initdata = {
29062306a36Sopenharmony_ci	INTC_GROUP(PCIC1, PCIC1_PCIERR, PCIC1_PCIPWDWN, PCIC1_PCIPWON,
29162306a36Sopenharmony_ci		   PCIC1_PCIDMA0, PCIC1_PCIDMA1, PCIC1_PCIDMA2, PCIC1_PCIDMA3),
29262306a36Sopenharmony_ci};
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_cistatic DECLARE_INTC_DESC(intc_desc_pci, "sh7750_pci", vectors_pci, groups_pci,
29562306a36Sopenharmony_ci			 mask_registers, prio_registers, NULL);
29662306a36Sopenharmony_ci#endif
29762306a36Sopenharmony_ci
29862306a36Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7750) || \
29962306a36Sopenharmony_ci	defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
30062306a36Sopenharmony_ci	defined(CONFIG_CPU_SUBTYPE_SH7091)
30162306a36Sopenharmony_civoid __init plat_irq_setup(void)
30262306a36Sopenharmony_ci{
30362306a36Sopenharmony_ci	/*
30462306a36Sopenharmony_ci	 * same vectors for SH7750, SH7750S and SH7091 except for IRLM,
30562306a36Sopenharmony_ci	 * see below..
30662306a36Sopenharmony_ci	 */
30762306a36Sopenharmony_ci	register_intc_controller(&intc_desc);
30862306a36Sopenharmony_ci	register_intc_controller(&intc_desc_dma4);
30962306a36Sopenharmony_ci}
31062306a36Sopenharmony_ci#endif
31162306a36Sopenharmony_ci
31262306a36Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7750R)
31362306a36Sopenharmony_civoid __init plat_irq_setup(void)
31462306a36Sopenharmony_ci{
31562306a36Sopenharmony_ci	register_intc_controller(&intc_desc);
31662306a36Sopenharmony_ci	register_intc_controller(&intc_desc_dma8);
31762306a36Sopenharmony_ci	register_intc_controller(&intc_desc_tmu34);
31862306a36Sopenharmony_ci}
31962306a36Sopenharmony_ci#endif
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7751)
32262306a36Sopenharmony_civoid __init plat_irq_setup(void)
32362306a36Sopenharmony_ci{
32462306a36Sopenharmony_ci	register_intc_controller(&intc_desc);
32562306a36Sopenharmony_ci	register_intc_controller(&intc_desc_dma4);
32662306a36Sopenharmony_ci	register_intc_controller(&intc_desc_tmu34);
32762306a36Sopenharmony_ci	register_intc_controller(&intc_desc_pci);
32862306a36Sopenharmony_ci}
32962306a36Sopenharmony_ci#endif
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7751R)
33262306a36Sopenharmony_civoid __init plat_irq_setup(void)
33362306a36Sopenharmony_ci{
33462306a36Sopenharmony_ci	register_intc_controller(&intc_desc);
33562306a36Sopenharmony_ci	register_intc_controller(&intc_desc_dma8);
33662306a36Sopenharmony_ci	register_intc_controller(&intc_desc_tmu34);
33762306a36Sopenharmony_ci	register_intc_controller(&intc_desc_pci);
33862306a36Sopenharmony_ci}
33962306a36Sopenharmony_ci#endif
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_ci#define INTC_ICR	0xffd00000UL
34262306a36Sopenharmony_ci#define INTC_ICR_IRLM   (1<<7)
34362306a36Sopenharmony_ci
34462306a36Sopenharmony_civoid __init plat_irq_setup_pins(int mode)
34562306a36Sopenharmony_ci{
34662306a36Sopenharmony_ci#if defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7091)
34762306a36Sopenharmony_ci	BUG(); /* impossible to mask interrupts on SH7750 and SH7091 */
34862306a36Sopenharmony_ci	return;
34962306a36Sopenharmony_ci#endif
35062306a36Sopenharmony_ci
35162306a36Sopenharmony_ci	switch (mode) {
35262306a36Sopenharmony_ci	case IRQ_MODE_IRQ: /* individual interrupt mode for IRL3-0 */
35362306a36Sopenharmony_ci		__raw_writew(__raw_readw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);
35462306a36Sopenharmony_ci		register_intc_controller(&intc_desc_irlm);
35562306a36Sopenharmony_ci		break;
35662306a36Sopenharmony_ci	default:
35762306a36Sopenharmony_ci		BUG();
35862306a36Sopenharmony_ci	}
35962306a36Sopenharmony_ci}
360