18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * SH7724 Setup
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2009 Renesas Solutions Corp.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Kuninori Morimoto <morimoto.kuninori@renesas.com>
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * Based on SH7723 Setup
108c2ecf20Sopenharmony_ci * Copyright (C) 2008  Paul Mundt
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
138c2ecf20Sopenharmony_ci#include <linux/init.h>
148c2ecf20Sopenharmony_ci#include <linux/serial.h>
158c2ecf20Sopenharmony_ci#include <linux/mm.h>
168c2ecf20Sopenharmony_ci#include <linux/serial_sci.h>
178c2ecf20Sopenharmony_ci#include <linux/uio_driver.h>
188c2ecf20Sopenharmony_ci#include <linux/sh_dma.h>
198c2ecf20Sopenharmony_ci#include <linux/sh_timer.h>
208c2ecf20Sopenharmony_ci#include <linux/sh_intc.h>
218c2ecf20Sopenharmony_ci#include <linux/io.h>
228c2ecf20Sopenharmony_ci#include <linux/notifier.h>
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#include <asm/suspend.h>
258c2ecf20Sopenharmony_ci#include <asm/clock.h>
268c2ecf20Sopenharmony_ci#include <asm/mmzone.h>
278c2ecf20Sopenharmony_ci#include <asm/platform_early.h>
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#include <cpu/dma-register.h>
308c2ecf20Sopenharmony_ci#include <cpu/sh7724.h>
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/* DMA */
338c2ecf20Sopenharmony_cistatic const struct sh_dmae_slave_config sh7724_dmae_slaves[] = {
348c2ecf20Sopenharmony_ci	{
358c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SCIF0_TX,
368c2ecf20Sopenharmony_ci		.addr		= 0xffe0000c,
378c2ecf20Sopenharmony_ci		.chcr		= DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
388c2ecf20Sopenharmony_ci		.mid_rid	= 0x21,
398c2ecf20Sopenharmony_ci	}, {
408c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SCIF0_RX,
418c2ecf20Sopenharmony_ci		.addr		= 0xffe00014,
428c2ecf20Sopenharmony_ci		.chcr		= DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
438c2ecf20Sopenharmony_ci		.mid_rid	= 0x22,
448c2ecf20Sopenharmony_ci	}, {
458c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SCIF1_TX,
468c2ecf20Sopenharmony_ci		.addr		= 0xffe1000c,
478c2ecf20Sopenharmony_ci		.chcr		= DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
488c2ecf20Sopenharmony_ci		.mid_rid	= 0x25,
498c2ecf20Sopenharmony_ci	}, {
508c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SCIF1_RX,
518c2ecf20Sopenharmony_ci		.addr		= 0xffe10014,
528c2ecf20Sopenharmony_ci		.chcr		= DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
538c2ecf20Sopenharmony_ci		.mid_rid	= 0x26,
548c2ecf20Sopenharmony_ci	}, {
558c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SCIF2_TX,
568c2ecf20Sopenharmony_ci		.addr		= 0xffe2000c,
578c2ecf20Sopenharmony_ci		.chcr		= DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
588c2ecf20Sopenharmony_ci		.mid_rid	= 0x29,
598c2ecf20Sopenharmony_ci	}, {
608c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SCIF2_RX,
618c2ecf20Sopenharmony_ci		.addr		= 0xffe20014,
628c2ecf20Sopenharmony_ci		.chcr		= DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
638c2ecf20Sopenharmony_ci		.mid_rid	= 0x2a,
648c2ecf20Sopenharmony_ci	}, {
658c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SCIF3_TX,
668c2ecf20Sopenharmony_ci		.addr		= 0xa4e30020,
678c2ecf20Sopenharmony_ci		.chcr		= DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
688c2ecf20Sopenharmony_ci		.mid_rid	= 0x2d,
698c2ecf20Sopenharmony_ci	}, {
708c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SCIF3_RX,
718c2ecf20Sopenharmony_ci		.addr		= 0xa4e30024,
728c2ecf20Sopenharmony_ci		.chcr		= DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
738c2ecf20Sopenharmony_ci		.mid_rid	= 0x2e,
748c2ecf20Sopenharmony_ci	}, {
758c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SCIF4_TX,
768c2ecf20Sopenharmony_ci		.addr		= 0xa4e40020,
778c2ecf20Sopenharmony_ci		.chcr		= DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
788c2ecf20Sopenharmony_ci		.mid_rid	= 0x31,
798c2ecf20Sopenharmony_ci	}, {
808c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SCIF4_RX,
818c2ecf20Sopenharmony_ci		.addr		= 0xa4e40024,
828c2ecf20Sopenharmony_ci		.chcr		= DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
838c2ecf20Sopenharmony_ci		.mid_rid	= 0x32,
848c2ecf20Sopenharmony_ci	}, {
858c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SCIF5_TX,
868c2ecf20Sopenharmony_ci		.addr		= 0xa4e50020,
878c2ecf20Sopenharmony_ci		.chcr		= DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
888c2ecf20Sopenharmony_ci		.mid_rid	= 0x35,
898c2ecf20Sopenharmony_ci	}, {
908c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SCIF5_RX,
918c2ecf20Sopenharmony_ci		.addr		= 0xa4e50024,
928c2ecf20Sopenharmony_ci		.chcr		= DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_8BIT),
938c2ecf20Sopenharmony_ci		.mid_rid	= 0x36,
948c2ecf20Sopenharmony_ci	}, {
958c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_USB0D0_TX,
968c2ecf20Sopenharmony_ci		.addr		= 0xA4D80100,
978c2ecf20Sopenharmony_ci		.chcr		= DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
988c2ecf20Sopenharmony_ci		.mid_rid	= 0x73,
998c2ecf20Sopenharmony_ci	}, {
1008c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_USB0D0_RX,
1018c2ecf20Sopenharmony_ci		.addr		= 0xA4D80100,
1028c2ecf20Sopenharmony_ci		.chcr		= DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
1038c2ecf20Sopenharmony_ci		.mid_rid	= 0x73,
1048c2ecf20Sopenharmony_ci	}, {
1058c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_USB0D1_TX,
1068c2ecf20Sopenharmony_ci		.addr		= 0xA4D80120,
1078c2ecf20Sopenharmony_ci		.chcr		= DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
1088c2ecf20Sopenharmony_ci		.mid_rid	= 0x77,
1098c2ecf20Sopenharmony_ci	}, {
1108c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_USB0D1_RX,
1118c2ecf20Sopenharmony_ci		.addr		= 0xA4D80120,
1128c2ecf20Sopenharmony_ci		.chcr		= DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
1138c2ecf20Sopenharmony_ci		.mid_rid	= 0x77,
1148c2ecf20Sopenharmony_ci	}, {
1158c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_USB1D0_TX,
1168c2ecf20Sopenharmony_ci		.addr		= 0xA4D90100,
1178c2ecf20Sopenharmony_ci		.chcr		= DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
1188c2ecf20Sopenharmony_ci		.mid_rid	= 0xab,
1198c2ecf20Sopenharmony_ci	}, {
1208c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_USB1D0_RX,
1218c2ecf20Sopenharmony_ci		.addr		= 0xA4D90100,
1228c2ecf20Sopenharmony_ci		.chcr		= DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
1238c2ecf20Sopenharmony_ci		.mid_rid	= 0xab,
1248c2ecf20Sopenharmony_ci	}, {
1258c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_USB1D1_TX,
1268c2ecf20Sopenharmony_ci		.addr		= 0xA4D90120,
1278c2ecf20Sopenharmony_ci		.chcr		= DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
1288c2ecf20Sopenharmony_ci		.mid_rid	= 0xaf,
1298c2ecf20Sopenharmony_ci	}, {
1308c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_USB1D1_RX,
1318c2ecf20Sopenharmony_ci		.addr		= 0xA4D90120,
1328c2ecf20Sopenharmony_ci		.chcr		= DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_32BIT),
1338c2ecf20Sopenharmony_ci		.mid_rid	= 0xaf,
1348c2ecf20Sopenharmony_ci	}, {
1358c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SDHI0_TX,
1368c2ecf20Sopenharmony_ci		.addr		= 0x04ce0030,
1378c2ecf20Sopenharmony_ci		.chcr		= DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_16BIT),
1388c2ecf20Sopenharmony_ci		.mid_rid	= 0xc1,
1398c2ecf20Sopenharmony_ci	}, {
1408c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SDHI0_RX,
1418c2ecf20Sopenharmony_ci		.addr		= 0x04ce0030,
1428c2ecf20Sopenharmony_ci		.chcr		= DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_16BIT),
1438c2ecf20Sopenharmony_ci		.mid_rid	= 0xc2,
1448c2ecf20Sopenharmony_ci	}, {
1458c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SDHI1_TX,
1468c2ecf20Sopenharmony_ci		.addr		= 0x04cf0030,
1478c2ecf20Sopenharmony_ci		.chcr		= DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL(XMIT_SZ_16BIT),
1488c2ecf20Sopenharmony_ci		.mid_rid	= 0xc9,
1498c2ecf20Sopenharmony_ci	}, {
1508c2ecf20Sopenharmony_ci		.slave_id	= SHDMA_SLAVE_SDHI1_RX,
1518c2ecf20Sopenharmony_ci		.addr		= 0x04cf0030,
1528c2ecf20Sopenharmony_ci		.chcr		= DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL(XMIT_SZ_16BIT),
1538c2ecf20Sopenharmony_ci		.mid_rid	= 0xca,
1548c2ecf20Sopenharmony_ci	},
1558c2ecf20Sopenharmony_ci};
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_cistatic const struct sh_dmae_channel sh7724_dmae_channels[] = {
1588c2ecf20Sopenharmony_ci	{
1598c2ecf20Sopenharmony_ci		.offset = 0,
1608c2ecf20Sopenharmony_ci		.dmars = 0,
1618c2ecf20Sopenharmony_ci		.dmars_bit = 0,
1628c2ecf20Sopenharmony_ci	}, {
1638c2ecf20Sopenharmony_ci		.offset = 0x10,
1648c2ecf20Sopenharmony_ci		.dmars = 0,
1658c2ecf20Sopenharmony_ci		.dmars_bit = 8,
1668c2ecf20Sopenharmony_ci	}, {
1678c2ecf20Sopenharmony_ci		.offset = 0x20,
1688c2ecf20Sopenharmony_ci		.dmars = 4,
1698c2ecf20Sopenharmony_ci		.dmars_bit = 0,
1708c2ecf20Sopenharmony_ci	}, {
1718c2ecf20Sopenharmony_ci		.offset = 0x30,
1728c2ecf20Sopenharmony_ci		.dmars = 4,
1738c2ecf20Sopenharmony_ci		.dmars_bit = 8,
1748c2ecf20Sopenharmony_ci	}, {
1758c2ecf20Sopenharmony_ci		.offset = 0x50,
1768c2ecf20Sopenharmony_ci		.dmars = 8,
1778c2ecf20Sopenharmony_ci		.dmars_bit = 0,
1788c2ecf20Sopenharmony_ci	}, {
1798c2ecf20Sopenharmony_ci		.offset = 0x60,
1808c2ecf20Sopenharmony_ci		.dmars = 8,
1818c2ecf20Sopenharmony_ci		.dmars_bit = 8,
1828c2ecf20Sopenharmony_ci	}
1838c2ecf20Sopenharmony_ci};
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_cistatic const unsigned int ts_shift[] = TS_SHIFT;
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_cistatic struct sh_dmae_pdata dma_platform_data = {
1888c2ecf20Sopenharmony_ci	.slave		= sh7724_dmae_slaves,
1898c2ecf20Sopenharmony_ci	.slave_num	= ARRAY_SIZE(sh7724_dmae_slaves),
1908c2ecf20Sopenharmony_ci	.channel	= sh7724_dmae_channels,
1918c2ecf20Sopenharmony_ci	.channel_num	= ARRAY_SIZE(sh7724_dmae_channels),
1928c2ecf20Sopenharmony_ci	.ts_low_shift	= CHCR_TS_LOW_SHIFT,
1938c2ecf20Sopenharmony_ci	.ts_low_mask	= CHCR_TS_LOW_MASK,
1948c2ecf20Sopenharmony_ci	.ts_high_shift	= CHCR_TS_HIGH_SHIFT,
1958c2ecf20Sopenharmony_ci	.ts_high_mask	= CHCR_TS_HIGH_MASK,
1968c2ecf20Sopenharmony_ci	.ts_shift	= ts_shift,
1978c2ecf20Sopenharmony_ci	.ts_shift_num	= ARRAY_SIZE(ts_shift),
1988c2ecf20Sopenharmony_ci	.dmaor_init	= DMAOR_INIT,
1998c2ecf20Sopenharmony_ci};
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci/* Resource order important! */
2028c2ecf20Sopenharmony_cistatic struct resource sh7724_dmae0_resources[] = {
2038c2ecf20Sopenharmony_ci	{
2048c2ecf20Sopenharmony_ci		/* Channel registers and DMAOR */
2058c2ecf20Sopenharmony_ci		.start	= 0xfe008020,
2068c2ecf20Sopenharmony_ci		.end	= 0xfe00808f,
2078c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
2088c2ecf20Sopenharmony_ci	},
2098c2ecf20Sopenharmony_ci	{
2108c2ecf20Sopenharmony_ci		/* DMARSx */
2118c2ecf20Sopenharmony_ci		.start	= 0xfe009000,
2128c2ecf20Sopenharmony_ci		.end	= 0xfe00900b,
2138c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
2148c2ecf20Sopenharmony_ci	},
2158c2ecf20Sopenharmony_ci	{
2168c2ecf20Sopenharmony_ci		.name	= "error_irq",
2178c2ecf20Sopenharmony_ci		.start	= evt2irq(0xbc0),
2188c2ecf20Sopenharmony_ci		.end	= evt2irq(0xbc0),
2198c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IRQ,
2208c2ecf20Sopenharmony_ci	},
2218c2ecf20Sopenharmony_ci	{
2228c2ecf20Sopenharmony_ci		/* IRQ for channels 0-3 */
2238c2ecf20Sopenharmony_ci		.start	= evt2irq(0x800),
2248c2ecf20Sopenharmony_ci		.end	= evt2irq(0x860),
2258c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IRQ,
2268c2ecf20Sopenharmony_ci	},
2278c2ecf20Sopenharmony_ci	{
2288c2ecf20Sopenharmony_ci		/* IRQ for channels 4-5 */
2298c2ecf20Sopenharmony_ci		.start	= evt2irq(0xb80),
2308c2ecf20Sopenharmony_ci		.end	= evt2irq(0xba0),
2318c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IRQ,
2328c2ecf20Sopenharmony_ci	},
2338c2ecf20Sopenharmony_ci};
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci/* Resource order important! */
2368c2ecf20Sopenharmony_cistatic struct resource sh7724_dmae1_resources[] = {
2378c2ecf20Sopenharmony_ci	{
2388c2ecf20Sopenharmony_ci		/* Channel registers and DMAOR */
2398c2ecf20Sopenharmony_ci		.start	= 0xfdc08020,
2408c2ecf20Sopenharmony_ci		.end	= 0xfdc0808f,
2418c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
2428c2ecf20Sopenharmony_ci	},
2438c2ecf20Sopenharmony_ci	{
2448c2ecf20Sopenharmony_ci		/* DMARSx */
2458c2ecf20Sopenharmony_ci		.start	= 0xfdc09000,
2468c2ecf20Sopenharmony_ci		.end	= 0xfdc0900b,
2478c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
2488c2ecf20Sopenharmony_ci	},
2498c2ecf20Sopenharmony_ci	{
2508c2ecf20Sopenharmony_ci		.name	= "error_irq",
2518c2ecf20Sopenharmony_ci		.start	= evt2irq(0xb40),
2528c2ecf20Sopenharmony_ci		.end	= evt2irq(0xb40),
2538c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IRQ,
2548c2ecf20Sopenharmony_ci	},
2558c2ecf20Sopenharmony_ci	{
2568c2ecf20Sopenharmony_ci		/* IRQ for channels 0-3 */
2578c2ecf20Sopenharmony_ci		.start	= evt2irq(0x700),
2588c2ecf20Sopenharmony_ci		.end	= evt2irq(0x760),
2598c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IRQ,
2608c2ecf20Sopenharmony_ci	},
2618c2ecf20Sopenharmony_ci	{
2628c2ecf20Sopenharmony_ci		/* IRQ for channels 4-5 */
2638c2ecf20Sopenharmony_ci		.start	= evt2irq(0xb00),
2648c2ecf20Sopenharmony_ci		.end	= evt2irq(0xb20),
2658c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IRQ,
2668c2ecf20Sopenharmony_ci	},
2678c2ecf20Sopenharmony_ci};
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_cistatic struct platform_device dma0_device = {
2708c2ecf20Sopenharmony_ci	.name		= "sh-dma-engine",
2718c2ecf20Sopenharmony_ci	.id		= 0,
2728c2ecf20Sopenharmony_ci	.resource	= sh7724_dmae0_resources,
2738c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(sh7724_dmae0_resources),
2748c2ecf20Sopenharmony_ci	.dev		= {
2758c2ecf20Sopenharmony_ci		.platform_data	= &dma_platform_data,
2768c2ecf20Sopenharmony_ci	},
2778c2ecf20Sopenharmony_ci};
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_cistatic struct platform_device dma1_device = {
2808c2ecf20Sopenharmony_ci	.name		= "sh-dma-engine",
2818c2ecf20Sopenharmony_ci	.id		= 1,
2828c2ecf20Sopenharmony_ci	.resource	= sh7724_dmae1_resources,
2838c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(sh7724_dmae1_resources),
2848c2ecf20Sopenharmony_ci	.dev		= {
2858c2ecf20Sopenharmony_ci		.platform_data	= &dma_platform_data,
2868c2ecf20Sopenharmony_ci	},
2878c2ecf20Sopenharmony_ci};
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci/* Serial */
2908c2ecf20Sopenharmony_cistatic struct plat_sci_port scif0_platform_data = {
2918c2ecf20Sopenharmony_ci	.scscr		= SCSCR_REIE,
2928c2ecf20Sopenharmony_ci	.type           = PORT_SCIF,
2938c2ecf20Sopenharmony_ci	.regtype	= SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
2948c2ecf20Sopenharmony_ci};
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_cistatic struct resource scif0_resources[] = {
2978c2ecf20Sopenharmony_ci	DEFINE_RES_MEM(0xffe00000, 0x100),
2988c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0xc00)),
2998c2ecf20Sopenharmony_ci};
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_cistatic struct platform_device scif0_device = {
3028c2ecf20Sopenharmony_ci	.name		= "sh-sci",
3038c2ecf20Sopenharmony_ci	.id		= 0,
3048c2ecf20Sopenharmony_ci	.resource	= scif0_resources,
3058c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(scif0_resources),
3068c2ecf20Sopenharmony_ci	.dev		= {
3078c2ecf20Sopenharmony_ci		.platform_data	= &scif0_platform_data,
3088c2ecf20Sopenharmony_ci	},
3098c2ecf20Sopenharmony_ci};
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_cistatic struct plat_sci_port scif1_platform_data = {
3128c2ecf20Sopenharmony_ci	.scscr		= SCSCR_REIE,
3138c2ecf20Sopenharmony_ci	.type           = PORT_SCIF,
3148c2ecf20Sopenharmony_ci	.regtype	= SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
3158c2ecf20Sopenharmony_ci};
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_cistatic struct resource scif1_resources[] = {
3188c2ecf20Sopenharmony_ci	DEFINE_RES_MEM(0xffe10000, 0x100),
3198c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0xc20)),
3208c2ecf20Sopenharmony_ci};
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_cistatic struct platform_device scif1_device = {
3238c2ecf20Sopenharmony_ci	.name		= "sh-sci",
3248c2ecf20Sopenharmony_ci	.id		= 1,
3258c2ecf20Sopenharmony_ci	.resource	= scif1_resources,
3268c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(scif1_resources),
3278c2ecf20Sopenharmony_ci	.dev		= {
3288c2ecf20Sopenharmony_ci		.platform_data	= &scif1_platform_data,
3298c2ecf20Sopenharmony_ci	},
3308c2ecf20Sopenharmony_ci};
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_cistatic struct plat_sci_port scif2_platform_data = {
3338c2ecf20Sopenharmony_ci	.scscr		= SCSCR_REIE,
3348c2ecf20Sopenharmony_ci	.type           = PORT_SCIF,
3358c2ecf20Sopenharmony_ci	.regtype	= SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
3368c2ecf20Sopenharmony_ci};
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_cistatic struct resource scif2_resources[] = {
3398c2ecf20Sopenharmony_ci	DEFINE_RES_MEM(0xffe20000, 0x100),
3408c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0xc40)),
3418c2ecf20Sopenharmony_ci};
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_cistatic struct platform_device scif2_device = {
3448c2ecf20Sopenharmony_ci	.name		= "sh-sci",
3458c2ecf20Sopenharmony_ci	.id		= 2,
3468c2ecf20Sopenharmony_ci	.resource	= scif2_resources,
3478c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(scif2_resources),
3488c2ecf20Sopenharmony_ci	.dev		= {
3498c2ecf20Sopenharmony_ci		.platform_data	= &scif2_platform_data,
3508c2ecf20Sopenharmony_ci	},
3518c2ecf20Sopenharmony_ci};
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_cistatic struct plat_sci_port scif3_platform_data = {
3548c2ecf20Sopenharmony_ci	.sampling_rate	= 8,
3558c2ecf20Sopenharmony_ci	.type           = PORT_SCIFA,
3568c2ecf20Sopenharmony_ci};
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_cistatic struct resource scif3_resources[] = {
3598c2ecf20Sopenharmony_ci	DEFINE_RES_MEM(0xa4e30000, 0x100),
3608c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0x900)),
3618c2ecf20Sopenharmony_ci};
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_cistatic struct platform_device scif3_device = {
3648c2ecf20Sopenharmony_ci	.name		= "sh-sci",
3658c2ecf20Sopenharmony_ci	.id		= 3,
3668c2ecf20Sopenharmony_ci	.resource	= scif3_resources,
3678c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(scif3_resources),
3688c2ecf20Sopenharmony_ci	.dev		= {
3698c2ecf20Sopenharmony_ci		.platform_data	= &scif3_platform_data,
3708c2ecf20Sopenharmony_ci	},
3718c2ecf20Sopenharmony_ci};
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_cistatic struct plat_sci_port scif4_platform_data = {
3748c2ecf20Sopenharmony_ci	.sampling_rate	= 8,
3758c2ecf20Sopenharmony_ci	.type           = PORT_SCIFA,
3768c2ecf20Sopenharmony_ci};
3778c2ecf20Sopenharmony_ci
3788c2ecf20Sopenharmony_cistatic struct resource scif4_resources[] = {
3798c2ecf20Sopenharmony_ci	DEFINE_RES_MEM(0xa4e40000, 0x100),
3808c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0xd00)),
3818c2ecf20Sopenharmony_ci};
3828c2ecf20Sopenharmony_ci
3838c2ecf20Sopenharmony_cistatic struct platform_device scif4_device = {
3848c2ecf20Sopenharmony_ci	.name		= "sh-sci",
3858c2ecf20Sopenharmony_ci	.id		= 4,
3868c2ecf20Sopenharmony_ci	.resource	= scif4_resources,
3878c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(scif4_resources),
3888c2ecf20Sopenharmony_ci	.dev		= {
3898c2ecf20Sopenharmony_ci		.platform_data	= &scif4_platform_data,
3908c2ecf20Sopenharmony_ci	},
3918c2ecf20Sopenharmony_ci};
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_cistatic struct plat_sci_port scif5_platform_data = {
3948c2ecf20Sopenharmony_ci	.sampling_rate	= 8,
3958c2ecf20Sopenharmony_ci	.type           = PORT_SCIFA,
3968c2ecf20Sopenharmony_ci};
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_cistatic struct resource scif5_resources[] = {
3998c2ecf20Sopenharmony_ci	DEFINE_RES_MEM(0xa4e50000, 0x100),
4008c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0xfa0)),
4018c2ecf20Sopenharmony_ci};
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_cistatic struct platform_device scif5_device = {
4048c2ecf20Sopenharmony_ci	.name		= "sh-sci",
4058c2ecf20Sopenharmony_ci	.id		= 5,
4068c2ecf20Sopenharmony_ci	.resource	= scif5_resources,
4078c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(scif5_resources),
4088c2ecf20Sopenharmony_ci	.dev		= {
4098c2ecf20Sopenharmony_ci		.platform_data	= &scif5_platform_data,
4108c2ecf20Sopenharmony_ci	},
4118c2ecf20Sopenharmony_ci};
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_ci/* RTC */
4148c2ecf20Sopenharmony_cistatic struct resource rtc_resources[] = {
4158c2ecf20Sopenharmony_ci	[0] = {
4168c2ecf20Sopenharmony_ci		.start	= 0xa465fec0,
4178c2ecf20Sopenharmony_ci		.end	= 0xa465fec0 + 0x58 - 1,
4188c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IO,
4198c2ecf20Sopenharmony_ci	},
4208c2ecf20Sopenharmony_ci	[1] = {
4218c2ecf20Sopenharmony_ci		/* Period IRQ */
4228c2ecf20Sopenharmony_ci		.start	= evt2irq(0xaa0),
4238c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IRQ,
4248c2ecf20Sopenharmony_ci	},
4258c2ecf20Sopenharmony_ci	[2] = {
4268c2ecf20Sopenharmony_ci		/* Carry IRQ */
4278c2ecf20Sopenharmony_ci		.start	= evt2irq(0xac0),
4288c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IRQ,
4298c2ecf20Sopenharmony_ci	},
4308c2ecf20Sopenharmony_ci	[3] = {
4318c2ecf20Sopenharmony_ci		/* Alarm IRQ */
4328c2ecf20Sopenharmony_ci		.start	= evt2irq(0xa80),
4338c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_IRQ,
4348c2ecf20Sopenharmony_ci	},
4358c2ecf20Sopenharmony_ci};
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_cistatic struct platform_device rtc_device = {
4388c2ecf20Sopenharmony_ci	.name		= "sh-rtc",
4398c2ecf20Sopenharmony_ci	.id		= -1,
4408c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(rtc_resources),
4418c2ecf20Sopenharmony_ci	.resource	= rtc_resources,
4428c2ecf20Sopenharmony_ci};
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci/* I2C0 */
4458c2ecf20Sopenharmony_cistatic struct resource iic0_resources[] = {
4468c2ecf20Sopenharmony_ci	[0] = {
4478c2ecf20Sopenharmony_ci		.name	= "IIC0",
4488c2ecf20Sopenharmony_ci		.start  = 0x04470000,
4498c2ecf20Sopenharmony_ci		.end    = 0x04470018 - 1,
4508c2ecf20Sopenharmony_ci		.flags  = IORESOURCE_MEM,
4518c2ecf20Sopenharmony_ci	},
4528c2ecf20Sopenharmony_ci	[1] = {
4538c2ecf20Sopenharmony_ci		.start  = evt2irq(0xe00),
4548c2ecf20Sopenharmony_ci		.end    = evt2irq(0xe60),
4558c2ecf20Sopenharmony_ci		.flags  = IORESOURCE_IRQ,
4568c2ecf20Sopenharmony_ci	},
4578c2ecf20Sopenharmony_ci};
4588c2ecf20Sopenharmony_ci
4598c2ecf20Sopenharmony_cistatic struct platform_device iic0_device = {
4608c2ecf20Sopenharmony_ci	.name           = "i2c-sh_mobile",
4618c2ecf20Sopenharmony_ci	.id             = 0, /* "i2c0" clock */
4628c2ecf20Sopenharmony_ci	.num_resources  = ARRAY_SIZE(iic0_resources),
4638c2ecf20Sopenharmony_ci	.resource       = iic0_resources,
4648c2ecf20Sopenharmony_ci};
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_ci/* I2C1 */
4678c2ecf20Sopenharmony_cistatic struct resource iic1_resources[] = {
4688c2ecf20Sopenharmony_ci	[0] = {
4698c2ecf20Sopenharmony_ci		.name	= "IIC1",
4708c2ecf20Sopenharmony_ci		.start  = 0x04750000,
4718c2ecf20Sopenharmony_ci		.end    = 0x04750018 - 1,
4728c2ecf20Sopenharmony_ci		.flags  = IORESOURCE_MEM,
4738c2ecf20Sopenharmony_ci	},
4748c2ecf20Sopenharmony_ci	[1] = {
4758c2ecf20Sopenharmony_ci		.start  = evt2irq(0xd80),
4768c2ecf20Sopenharmony_ci		.end    = evt2irq(0xde0),
4778c2ecf20Sopenharmony_ci		.flags  = IORESOURCE_IRQ,
4788c2ecf20Sopenharmony_ci	},
4798c2ecf20Sopenharmony_ci};
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_cistatic struct platform_device iic1_device = {
4828c2ecf20Sopenharmony_ci	.name           = "i2c-sh_mobile",
4838c2ecf20Sopenharmony_ci	.id             = 1, /* "i2c1" clock */
4848c2ecf20Sopenharmony_ci	.num_resources  = ARRAY_SIZE(iic1_resources),
4858c2ecf20Sopenharmony_ci	.resource       = iic1_resources,
4868c2ecf20Sopenharmony_ci};
4878c2ecf20Sopenharmony_ci
4888c2ecf20Sopenharmony_ci/* VPU */
4898c2ecf20Sopenharmony_cistatic struct uio_info vpu_platform_data = {
4908c2ecf20Sopenharmony_ci	.name = "VPU5F",
4918c2ecf20Sopenharmony_ci	.version = "0",
4928c2ecf20Sopenharmony_ci	.irq = evt2irq(0x980),
4938c2ecf20Sopenharmony_ci};
4948c2ecf20Sopenharmony_ci
4958c2ecf20Sopenharmony_cistatic struct resource vpu_resources[] = {
4968c2ecf20Sopenharmony_ci	[0] = {
4978c2ecf20Sopenharmony_ci		.name	= "VPU",
4988c2ecf20Sopenharmony_ci		.start	= 0xfe900000,
4998c2ecf20Sopenharmony_ci		.end	= 0xfe902807,
5008c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
5018c2ecf20Sopenharmony_ci	},
5028c2ecf20Sopenharmony_ci	[1] = {
5038c2ecf20Sopenharmony_ci		/* place holder for contiguous memory */
5048c2ecf20Sopenharmony_ci	},
5058c2ecf20Sopenharmony_ci};
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_cistatic struct platform_device vpu_device = {
5088c2ecf20Sopenharmony_ci	.name		= "uio_pdrv_genirq",
5098c2ecf20Sopenharmony_ci	.id		= 0,
5108c2ecf20Sopenharmony_ci	.dev = {
5118c2ecf20Sopenharmony_ci		.platform_data	= &vpu_platform_data,
5128c2ecf20Sopenharmony_ci	},
5138c2ecf20Sopenharmony_ci	.resource	= vpu_resources,
5148c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(vpu_resources),
5158c2ecf20Sopenharmony_ci};
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci/* VEU0 */
5188c2ecf20Sopenharmony_cistatic struct uio_info veu0_platform_data = {
5198c2ecf20Sopenharmony_ci	.name = "VEU3F0",
5208c2ecf20Sopenharmony_ci	.version = "0",
5218c2ecf20Sopenharmony_ci	.irq = evt2irq(0xc60),
5228c2ecf20Sopenharmony_ci};
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_cistatic struct resource veu0_resources[] = {
5258c2ecf20Sopenharmony_ci	[0] = {
5268c2ecf20Sopenharmony_ci		.name	= "VEU3F0",
5278c2ecf20Sopenharmony_ci		.start	= 0xfe920000,
5288c2ecf20Sopenharmony_ci		.end	= 0xfe9200cb,
5298c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
5308c2ecf20Sopenharmony_ci	},
5318c2ecf20Sopenharmony_ci	[1] = {
5328c2ecf20Sopenharmony_ci		/* place holder for contiguous memory */
5338c2ecf20Sopenharmony_ci	},
5348c2ecf20Sopenharmony_ci};
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_cistatic struct platform_device veu0_device = {
5378c2ecf20Sopenharmony_ci	.name		= "uio_pdrv_genirq",
5388c2ecf20Sopenharmony_ci	.id		= 1,
5398c2ecf20Sopenharmony_ci	.dev = {
5408c2ecf20Sopenharmony_ci		.platform_data	= &veu0_platform_data,
5418c2ecf20Sopenharmony_ci	},
5428c2ecf20Sopenharmony_ci	.resource	= veu0_resources,
5438c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(veu0_resources),
5448c2ecf20Sopenharmony_ci};
5458c2ecf20Sopenharmony_ci
5468c2ecf20Sopenharmony_ci/* VEU1 */
5478c2ecf20Sopenharmony_cistatic struct uio_info veu1_platform_data = {
5488c2ecf20Sopenharmony_ci	.name = "VEU3F1",
5498c2ecf20Sopenharmony_ci	.version = "0",
5508c2ecf20Sopenharmony_ci	.irq = evt2irq(0x8c0),
5518c2ecf20Sopenharmony_ci};
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_cistatic struct resource veu1_resources[] = {
5548c2ecf20Sopenharmony_ci	[0] = {
5558c2ecf20Sopenharmony_ci		.name	= "VEU3F1",
5568c2ecf20Sopenharmony_ci		.start	= 0xfe924000,
5578c2ecf20Sopenharmony_ci		.end	= 0xfe9240cb,
5588c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
5598c2ecf20Sopenharmony_ci	},
5608c2ecf20Sopenharmony_ci	[1] = {
5618c2ecf20Sopenharmony_ci		/* place holder for contiguous memory */
5628c2ecf20Sopenharmony_ci	},
5638c2ecf20Sopenharmony_ci};
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_cistatic struct platform_device veu1_device = {
5668c2ecf20Sopenharmony_ci	.name		= "uio_pdrv_genirq",
5678c2ecf20Sopenharmony_ci	.id		= 2,
5688c2ecf20Sopenharmony_ci	.dev = {
5698c2ecf20Sopenharmony_ci		.platform_data	= &veu1_platform_data,
5708c2ecf20Sopenharmony_ci	},
5718c2ecf20Sopenharmony_ci	.resource	= veu1_resources,
5728c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(veu1_resources),
5738c2ecf20Sopenharmony_ci};
5748c2ecf20Sopenharmony_ci
5758c2ecf20Sopenharmony_ci/* BEU0 */
5768c2ecf20Sopenharmony_cistatic struct uio_info beu0_platform_data = {
5778c2ecf20Sopenharmony_ci	.name = "BEU0",
5788c2ecf20Sopenharmony_ci	.version = "0",
5798c2ecf20Sopenharmony_ci	.irq = evt2irq(0x8A0),
5808c2ecf20Sopenharmony_ci};
5818c2ecf20Sopenharmony_ci
5828c2ecf20Sopenharmony_cistatic struct resource beu0_resources[] = {
5838c2ecf20Sopenharmony_ci	[0] = {
5848c2ecf20Sopenharmony_ci		.name	= "BEU0",
5858c2ecf20Sopenharmony_ci		.start	= 0xfe930000,
5868c2ecf20Sopenharmony_ci		.end	= 0xfe933400,
5878c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
5888c2ecf20Sopenharmony_ci	},
5898c2ecf20Sopenharmony_ci	[1] = {
5908c2ecf20Sopenharmony_ci		/* place holder for contiguous memory */
5918c2ecf20Sopenharmony_ci	},
5928c2ecf20Sopenharmony_ci};
5938c2ecf20Sopenharmony_ci
5948c2ecf20Sopenharmony_cistatic struct platform_device beu0_device = {
5958c2ecf20Sopenharmony_ci	.name		= "uio_pdrv_genirq",
5968c2ecf20Sopenharmony_ci	.id		= 6,
5978c2ecf20Sopenharmony_ci	.dev = {
5988c2ecf20Sopenharmony_ci		.platform_data	= &beu0_platform_data,
5998c2ecf20Sopenharmony_ci	},
6008c2ecf20Sopenharmony_ci	.resource	= beu0_resources,
6018c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(beu0_resources),
6028c2ecf20Sopenharmony_ci};
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci/* BEU1 */
6058c2ecf20Sopenharmony_cistatic struct uio_info beu1_platform_data = {
6068c2ecf20Sopenharmony_ci	.name = "BEU1",
6078c2ecf20Sopenharmony_ci	.version = "0",
6088c2ecf20Sopenharmony_ci	.irq = evt2irq(0xA00),
6098c2ecf20Sopenharmony_ci};
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_cistatic struct resource beu1_resources[] = {
6128c2ecf20Sopenharmony_ci	[0] = {
6138c2ecf20Sopenharmony_ci		.name	= "BEU1",
6148c2ecf20Sopenharmony_ci		.start	= 0xfe940000,
6158c2ecf20Sopenharmony_ci		.end	= 0xfe943400,
6168c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
6178c2ecf20Sopenharmony_ci	},
6188c2ecf20Sopenharmony_ci	[1] = {
6198c2ecf20Sopenharmony_ci		/* place holder for contiguous memory */
6208c2ecf20Sopenharmony_ci	},
6218c2ecf20Sopenharmony_ci};
6228c2ecf20Sopenharmony_ci
6238c2ecf20Sopenharmony_cistatic struct platform_device beu1_device = {
6248c2ecf20Sopenharmony_ci	.name		= "uio_pdrv_genirq",
6258c2ecf20Sopenharmony_ci	.id		= 7,
6268c2ecf20Sopenharmony_ci	.dev = {
6278c2ecf20Sopenharmony_ci		.platform_data	= &beu1_platform_data,
6288c2ecf20Sopenharmony_ci	},
6298c2ecf20Sopenharmony_ci	.resource	= beu1_resources,
6308c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(beu1_resources),
6318c2ecf20Sopenharmony_ci};
6328c2ecf20Sopenharmony_ci
6338c2ecf20Sopenharmony_cistatic struct sh_timer_config cmt_platform_data = {
6348c2ecf20Sopenharmony_ci	.channels_mask = 0x20,
6358c2ecf20Sopenharmony_ci};
6368c2ecf20Sopenharmony_ci
6378c2ecf20Sopenharmony_cistatic struct resource cmt_resources[] = {
6388c2ecf20Sopenharmony_ci	DEFINE_RES_MEM(0x044a0000, 0x70),
6398c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0xf00)),
6408c2ecf20Sopenharmony_ci};
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_cistatic struct platform_device cmt_device = {
6438c2ecf20Sopenharmony_ci	.name		= "sh-cmt-32",
6448c2ecf20Sopenharmony_ci	.id		= 0,
6458c2ecf20Sopenharmony_ci	.dev = {
6468c2ecf20Sopenharmony_ci		.platform_data	= &cmt_platform_data,
6478c2ecf20Sopenharmony_ci	},
6488c2ecf20Sopenharmony_ci	.resource	= cmt_resources,
6498c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(cmt_resources),
6508c2ecf20Sopenharmony_ci};
6518c2ecf20Sopenharmony_ci
6528c2ecf20Sopenharmony_cistatic struct sh_timer_config tmu0_platform_data = {
6538c2ecf20Sopenharmony_ci	.channels_mask = 7,
6548c2ecf20Sopenharmony_ci};
6558c2ecf20Sopenharmony_ci
6568c2ecf20Sopenharmony_cistatic struct resource tmu0_resources[] = {
6578c2ecf20Sopenharmony_ci	DEFINE_RES_MEM(0xffd80000, 0x2c),
6588c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0x400)),
6598c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0x420)),
6608c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0x440)),
6618c2ecf20Sopenharmony_ci};
6628c2ecf20Sopenharmony_ci
6638c2ecf20Sopenharmony_cistatic struct platform_device tmu0_device = {
6648c2ecf20Sopenharmony_ci	.name		= "sh-tmu",
6658c2ecf20Sopenharmony_ci	.id		= 0,
6668c2ecf20Sopenharmony_ci	.dev = {
6678c2ecf20Sopenharmony_ci		.platform_data	= &tmu0_platform_data,
6688c2ecf20Sopenharmony_ci	},
6698c2ecf20Sopenharmony_ci	.resource	= tmu0_resources,
6708c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(tmu0_resources),
6718c2ecf20Sopenharmony_ci};
6728c2ecf20Sopenharmony_ci
6738c2ecf20Sopenharmony_cistatic struct sh_timer_config tmu1_platform_data = {
6748c2ecf20Sopenharmony_ci	.channels_mask = 7,
6758c2ecf20Sopenharmony_ci};
6768c2ecf20Sopenharmony_ci
6778c2ecf20Sopenharmony_cistatic struct resource tmu1_resources[] = {
6788c2ecf20Sopenharmony_ci	DEFINE_RES_MEM(0xffd90000, 0x2c),
6798c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0x920)),
6808c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0x940)),
6818c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(evt2irq(0x960)),
6828c2ecf20Sopenharmony_ci};
6838c2ecf20Sopenharmony_ci
6848c2ecf20Sopenharmony_cistatic struct platform_device tmu1_device = {
6858c2ecf20Sopenharmony_ci	.name		= "sh-tmu",
6868c2ecf20Sopenharmony_ci	.id		= 1,
6878c2ecf20Sopenharmony_ci	.dev = {
6888c2ecf20Sopenharmony_ci		.platform_data	= &tmu1_platform_data,
6898c2ecf20Sopenharmony_ci	},
6908c2ecf20Sopenharmony_ci	.resource	= tmu1_resources,
6918c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(tmu1_resources),
6928c2ecf20Sopenharmony_ci};
6938c2ecf20Sopenharmony_ci
6948c2ecf20Sopenharmony_ci/* JPU */
6958c2ecf20Sopenharmony_cistatic struct uio_info jpu_platform_data = {
6968c2ecf20Sopenharmony_ci	.name = "JPU",
6978c2ecf20Sopenharmony_ci	.version = "0",
6988c2ecf20Sopenharmony_ci	.irq = evt2irq(0x560),
6998c2ecf20Sopenharmony_ci};
7008c2ecf20Sopenharmony_ci
7018c2ecf20Sopenharmony_cistatic struct resource jpu_resources[] = {
7028c2ecf20Sopenharmony_ci	[0] = {
7038c2ecf20Sopenharmony_ci		.name	= "JPU",
7048c2ecf20Sopenharmony_ci		.start	= 0xfe980000,
7058c2ecf20Sopenharmony_ci		.end	= 0xfe9902d3,
7068c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
7078c2ecf20Sopenharmony_ci	},
7088c2ecf20Sopenharmony_ci	[1] = {
7098c2ecf20Sopenharmony_ci		/* place holder for contiguous memory */
7108c2ecf20Sopenharmony_ci	},
7118c2ecf20Sopenharmony_ci};
7128c2ecf20Sopenharmony_ci
7138c2ecf20Sopenharmony_cistatic struct platform_device jpu_device = {
7148c2ecf20Sopenharmony_ci	.name		= "uio_pdrv_genirq",
7158c2ecf20Sopenharmony_ci	.id		= 3,
7168c2ecf20Sopenharmony_ci	.dev = {
7178c2ecf20Sopenharmony_ci		.platform_data	= &jpu_platform_data,
7188c2ecf20Sopenharmony_ci	},
7198c2ecf20Sopenharmony_ci	.resource	= jpu_resources,
7208c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(jpu_resources),
7218c2ecf20Sopenharmony_ci};
7228c2ecf20Sopenharmony_ci
7238c2ecf20Sopenharmony_ci/* SPU2DSP0 */
7248c2ecf20Sopenharmony_cistatic struct uio_info spu0_platform_data = {
7258c2ecf20Sopenharmony_ci	.name = "SPU2DSP0",
7268c2ecf20Sopenharmony_ci	.version = "0",
7278c2ecf20Sopenharmony_ci	.irq = evt2irq(0xcc0),
7288c2ecf20Sopenharmony_ci};
7298c2ecf20Sopenharmony_ci
7308c2ecf20Sopenharmony_cistatic struct resource spu0_resources[] = {
7318c2ecf20Sopenharmony_ci	[0] = {
7328c2ecf20Sopenharmony_ci		.name	= "SPU2DSP0",
7338c2ecf20Sopenharmony_ci		.start	= 0xFE200000,
7348c2ecf20Sopenharmony_ci		.end	= 0xFE2FFFFF,
7358c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
7368c2ecf20Sopenharmony_ci	},
7378c2ecf20Sopenharmony_ci	[1] = {
7388c2ecf20Sopenharmony_ci		/* place holder for contiguous memory */
7398c2ecf20Sopenharmony_ci	},
7408c2ecf20Sopenharmony_ci};
7418c2ecf20Sopenharmony_ci
7428c2ecf20Sopenharmony_cistatic struct platform_device spu0_device = {
7438c2ecf20Sopenharmony_ci	.name		= "uio_pdrv_genirq",
7448c2ecf20Sopenharmony_ci	.id		= 4,
7458c2ecf20Sopenharmony_ci	.dev = {
7468c2ecf20Sopenharmony_ci		.platform_data	= &spu0_platform_data,
7478c2ecf20Sopenharmony_ci	},
7488c2ecf20Sopenharmony_ci	.resource	= spu0_resources,
7498c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(spu0_resources),
7508c2ecf20Sopenharmony_ci};
7518c2ecf20Sopenharmony_ci
7528c2ecf20Sopenharmony_ci/* SPU2DSP1 */
7538c2ecf20Sopenharmony_cistatic struct uio_info spu1_platform_data = {
7548c2ecf20Sopenharmony_ci	.name = "SPU2DSP1",
7558c2ecf20Sopenharmony_ci	.version = "0",
7568c2ecf20Sopenharmony_ci	.irq = evt2irq(0xce0),
7578c2ecf20Sopenharmony_ci};
7588c2ecf20Sopenharmony_ci
7598c2ecf20Sopenharmony_cistatic struct resource spu1_resources[] = {
7608c2ecf20Sopenharmony_ci	[0] = {
7618c2ecf20Sopenharmony_ci		.name	= "SPU2DSP1",
7628c2ecf20Sopenharmony_ci		.start	= 0xFE300000,
7638c2ecf20Sopenharmony_ci		.end	= 0xFE3FFFFF,
7648c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
7658c2ecf20Sopenharmony_ci	},
7668c2ecf20Sopenharmony_ci	[1] = {
7678c2ecf20Sopenharmony_ci		/* place holder for contiguous memory */
7688c2ecf20Sopenharmony_ci	},
7698c2ecf20Sopenharmony_ci};
7708c2ecf20Sopenharmony_ci
7718c2ecf20Sopenharmony_cistatic struct platform_device spu1_device = {
7728c2ecf20Sopenharmony_ci	.name		= "uio_pdrv_genirq",
7738c2ecf20Sopenharmony_ci	.id		= 5,
7748c2ecf20Sopenharmony_ci	.dev = {
7758c2ecf20Sopenharmony_ci		.platform_data	= &spu1_platform_data,
7768c2ecf20Sopenharmony_ci	},
7778c2ecf20Sopenharmony_ci	.resource	= spu1_resources,
7788c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(spu1_resources),
7798c2ecf20Sopenharmony_ci};
7808c2ecf20Sopenharmony_ci
7818c2ecf20Sopenharmony_cistatic struct platform_device *sh7724_devices[] __initdata = {
7828c2ecf20Sopenharmony_ci	&scif0_device,
7838c2ecf20Sopenharmony_ci	&scif1_device,
7848c2ecf20Sopenharmony_ci	&scif2_device,
7858c2ecf20Sopenharmony_ci	&scif3_device,
7868c2ecf20Sopenharmony_ci	&scif4_device,
7878c2ecf20Sopenharmony_ci	&scif5_device,
7888c2ecf20Sopenharmony_ci	&cmt_device,
7898c2ecf20Sopenharmony_ci	&tmu0_device,
7908c2ecf20Sopenharmony_ci	&tmu1_device,
7918c2ecf20Sopenharmony_ci	&dma0_device,
7928c2ecf20Sopenharmony_ci	&dma1_device,
7938c2ecf20Sopenharmony_ci	&rtc_device,
7948c2ecf20Sopenharmony_ci	&iic0_device,
7958c2ecf20Sopenharmony_ci	&iic1_device,
7968c2ecf20Sopenharmony_ci	&vpu_device,
7978c2ecf20Sopenharmony_ci	&veu0_device,
7988c2ecf20Sopenharmony_ci	&veu1_device,
7998c2ecf20Sopenharmony_ci	&beu0_device,
8008c2ecf20Sopenharmony_ci	&beu1_device,
8018c2ecf20Sopenharmony_ci	&jpu_device,
8028c2ecf20Sopenharmony_ci	&spu0_device,
8038c2ecf20Sopenharmony_ci	&spu1_device,
8048c2ecf20Sopenharmony_ci};
8058c2ecf20Sopenharmony_ci
8068c2ecf20Sopenharmony_cistatic int __init sh7724_devices_setup(void)
8078c2ecf20Sopenharmony_ci{
8088c2ecf20Sopenharmony_ci	platform_resource_setup_memory(&vpu_device, "vpu", 2 << 20);
8098c2ecf20Sopenharmony_ci	platform_resource_setup_memory(&veu0_device, "veu0", 2 << 20);
8108c2ecf20Sopenharmony_ci	platform_resource_setup_memory(&veu1_device, "veu1", 2 << 20);
8118c2ecf20Sopenharmony_ci	platform_resource_setup_memory(&jpu_device,  "jpu",  2 << 20);
8128c2ecf20Sopenharmony_ci	platform_resource_setup_memory(&spu0_device, "spu0", 2 << 20);
8138c2ecf20Sopenharmony_ci	platform_resource_setup_memory(&spu1_device, "spu1", 2 << 20);
8148c2ecf20Sopenharmony_ci
8158c2ecf20Sopenharmony_ci	return platform_add_devices(sh7724_devices,
8168c2ecf20Sopenharmony_ci				    ARRAY_SIZE(sh7724_devices));
8178c2ecf20Sopenharmony_ci}
8188c2ecf20Sopenharmony_ciarch_initcall(sh7724_devices_setup);
8198c2ecf20Sopenharmony_ci
8208c2ecf20Sopenharmony_cistatic struct platform_device *sh7724_early_devices[] __initdata = {
8218c2ecf20Sopenharmony_ci	&scif0_device,
8228c2ecf20Sopenharmony_ci	&scif1_device,
8238c2ecf20Sopenharmony_ci	&scif2_device,
8248c2ecf20Sopenharmony_ci	&scif3_device,
8258c2ecf20Sopenharmony_ci	&scif4_device,
8268c2ecf20Sopenharmony_ci	&scif5_device,
8278c2ecf20Sopenharmony_ci	&cmt_device,
8288c2ecf20Sopenharmony_ci	&tmu0_device,
8298c2ecf20Sopenharmony_ci	&tmu1_device,
8308c2ecf20Sopenharmony_ci};
8318c2ecf20Sopenharmony_ci
8328c2ecf20Sopenharmony_civoid __init plat_early_device_setup(void)
8338c2ecf20Sopenharmony_ci{
8348c2ecf20Sopenharmony_ci	sh_early_platform_add_devices(sh7724_early_devices,
8358c2ecf20Sopenharmony_ci				   ARRAY_SIZE(sh7724_early_devices));
8368c2ecf20Sopenharmony_ci}
8378c2ecf20Sopenharmony_ci
8388c2ecf20Sopenharmony_ci#define RAMCR_CACHE_L2FC	0x0002
8398c2ecf20Sopenharmony_ci#define RAMCR_CACHE_L2E		0x0001
8408c2ecf20Sopenharmony_ci#define L2_CACHE_ENABLE		(RAMCR_CACHE_L2E|RAMCR_CACHE_L2FC)
8418c2ecf20Sopenharmony_ci
8428c2ecf20Sopenharmony_civoid l2_cache_init(void)
8438c2ecf20Sopenharmony_ci{
8448c2ecf20Sopenharmony_ci	/* Enable L2 cache */
8458c2ecf20Sopenharmony_ci	__raw_writel(L2_CACHE_ENABLE, RAMCR);
8468c2ecf20Sopenharmony_ci}
8478c2ecf20Sopenharmony_ci
8488c2ecf20Sopenharmony_cienum {
8498c2ecf20Sopenharmony_ci	UNUSED = 0,
8508c2ecf20Sopenharmony_ci	ENABLED,
8518c2ecf20Sopenharmony_ci	DISABLED,
8528c2ecf20Sopenharmony_ci
8538c2ecf20Sopenharmony_ci	/* interrupt sources */
8548c2ecf20Sopenharmony_ci	IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
8558c2ecf20Sopenharmony_ci	HUDI,
8568c2ecf20Sopenharmony_ci	DMAC1A_DEI0, DMAC1A_DEI1, DMAC1A_DEI2, DMAC1A_DEI3,
8578c2ecf20Sopenharmony_ci	_2DG_TRI, _2DG_INI, _2DG_CEI,
8588c2ecf20Sopenharmony_ci	DMAC0A_DEI0, DMAC0A_DEI1, DMAC0A_DEI2, DMAC0A_DEI3,
8598c2ecf20Sopenharmony_ci	VIO_CEU0, VIO_BEU0, VIO_VEU1, VIO_VOU,
8608c2ecf20Sopenharmony_ci	SCIFA3,
8618c2ecf20Sopenharmony_ci	VPU,
8628c2ecf20Sopenharmony_ci	TPU,
8638c2ecf20Sopenharmony_ci	CEU1,
8648c2ecf20Sopenharmony_ci	BEU1,
8658c2ecf20Sopenharmony_ci	USB0, USB1,
8668c2ecf20Sopenharmony_ci	ATAPI,
8678c2ecf20Sopenharmony_ci	RTC_ATI, RTC_PRI, RTC_CUI,
8688c2ecf20Sopenharmony_ci	DMAC1B_DEI4, DMAC1B_DEI5, DMAC1B_DADERR,
8698c2ecf20Sopenharmony_ci	DMAC0B_DEI4, DMAC0B_DEI5, DMAC0B_DADERR,
8708c2ecf20Sopenharmony_ci	KEYSC,
8718c2ecf20Sopenharmony_ci	SCIF_SCIF0, SCIF_SCIF1, SCIF_SCIF2,
8728c2ecf20Sopenharmony_ci	VEU0,
8738c2ecf20Sopenharmony_ci	MSIOF_MSIOFI0, MSIOF_MSIOFI1,
8748c2ecf20Sopenharmony_ci	SPU_SPUI0, SPU_SPUI1,
8758c2ecf20Sopenharmony_ci	SCIFA4,
8768c2ecf20Sopenharmony_ci	ICB,
8778c2ecf20Sopenharmony_ci	ETHI,
8788c2ecf20Sopenharmony_ci	I2C1_ALI, I2C1_TACKI, I2C1_WAITI, I2C1_DTEI,
8798c2ecf20Sopenharmony_ci	I2C0_ALI, I2C0_TACKI, I2C0_WAITI, I2C0_DTEI,
8808c2ecf20Sopenharmony_ci	CMT,
8818c2ecf20Sopenharmony_ci	TSIF,
8828c2ecf20Sopenharmony_ci	FSI,
8838c2ecf20Sopenharmony_ci	SCIFA5,
8848c2ecf20Sopenharmony_ci	TMU0_TUNI0, TMU0_TUNI1, TMU0_TUNI2,
8858c2ecf20Sopenharmony_ci	IRDA,
8868c2ecf20Sopenharmony_ci	JPU,
8878c2ecf20Sopenharmony_ci	_2DDMAC,
8888c2ecf20Sopenharmony_ci	MMC_MMC2I, MMC_MMC3I,
8898c2ecf20Sopenharmony_ci	LCDC,
8908c2ecf20Sopenharmony_ci	TMU1_TUNI0, TMU1_TUNI1, TMU1_TUNI2,
8918c2ecf20Sopenharmony_ci
8928c2ecf20Sopenharmony_ci	/* interrupt groups */
8938c2ecf20Sopenharmony_ci	DMAC1A, _2DG, DMAC0A, VIO, USB, RTC,
8948c2ecf20Sopenharmony_ci	DMAC1B, DMAC0B, I2C0, I2C1, SDHI0, SDHI1, SPU, MMCIF,
8958c2ecf20Sopenharmony_ci};
8968c2ecf20Sopenharmony_ci
8978c2ecf20Sopenharmony_cistatic struct intc_vect vectors[] __initdata = {
8988c2ecf20Sopenharmony_ci	INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
8998c2ecf20Sopenharmony_ci	INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
9008c2ecf20Sopenharmony_ci	INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
9018c2ecf20Sopenharmony_ci	INTC_VECT(IRQ6, 0x6c0), INTC_VECT(IRQ7, 0x6e0),
9028c2ecf20Sopenharmony_ci
9038c2ecf20Sopenharmony_ci	INTC_VECT(DMAC1A_DEI0, 0x700),
9048c2ecf20Sopenharmony_ci	INTC_VECT(DMAC1A_DEI1, 0x720),
9058c2ecf20Sopenharmony_ci	INTC_VECT(DMAC1A_DEI2, 0x740),
9068c2ecf20Sopenharmony_ci	INTC_VECT(DMAC1A_DEI3, 0x760),
9078c2ecf20Sopenharmony_ci
9088c2ecf20Sopenharmony_ci	INTC_VECT(_2DG_TRI, 0x780),
9098c2ecf20Sopenharmony_ci	INTC_VECT(_2DG_INI, 0x7A0),
9108c2ecf20Sopenharmony_ci	INTC_VECT(_2DG_CEI, 0x7C0),
9118c2ecf20Sopenharmony_ci
9128c2ecf20Sopenharmony_ci	INTC_VECT(DMAC0A_DEI0, 0x800),
9138c2ecf20Sopenharmony_ci	INTC_VECT(DMAC0A_DEI1, 0x820),
9148c2ecf20Sopenharmony_ci	INTC_VECT(DMAC0A_DEI2, 0x840),
9158c2ecf20Sopenharmony_ci	INTC_VECT(DMAC0A_DEI3, 0x860),
9168c2ecf20Sopenharmony_ci
9178c2ecf20Sopenharmony_ci	INTC_VECT(VIO_CEU0, 0x880),
9188c2ecf20Sopenharmony_ci	INTC_VECT(VIO_BEU0, 0x8A0),
9198c2ecf20Sopenharmony_ci	INTC_VECT(VIO_VEU1, 0x8C0),
9208c2ecf20Sopenharmony_ci	INTC_VECT(VIO_VOU,  0x8E0),
9218c2ecf20Sopenharmony_ci
9228c2ecf20Sopenharmony_ci	INTC_VECT(SCIFA3, 0x900),
9238c2ecf20Sopenharmony_ci	INTC_VECT(VPU,    0x980),
9248c2ecf20Sopenharmony_ci	INTC_VECT(TPU,    0x9A0),
9258c2ecf20Sopenharmony_ci	INTC_VECT(CEU1,   0x9E0),
9268c2ecf20Sopenharmony_ci	INTC_VECT(BEU1,   0xA00),
9278c2ecf20Sopenharmony_ci	INTC_VECT(USB0,   0xA20),
9288c2ecf20Sopenharmony_ci	INTC_VECT(USB1,   0xA40),
9298c2ecf20Sopenharmony_ci	INTC_VECT(ATAPI,  0xA60),
9308c2ecf20Sopenharmony_ci
9318c2ecf20Sopenharmony_ci	INTC_VECT(RTC_ATI, 0xA80),
9328c2ecf20Sopenharmony_ci	INTC_VECT(RTC_PRI, 0xAA0),
9338c2ecf20Sopenharmony_ci	INTC_VECT(RTC_CUI, 0xAC0),
9348c2ecf20Sopenharmony_ci
9358c2ecf20Sopenharmony_ci	INTC_VECT(DMAC1B_DEI4, 0xB00),
9368c2ecf20Sopenharmony_ci	INTC_VECT(DMAC1B_DEI5, 0xB20),
9378c2ecf20Sopenharmony_ci	INTC_VECT(DMAC1B_DADERR, 0xB40),
9388c2ecf20Sopenharmony_ci
9398c2ecf20Sopenharmony_ci	INTC_VECT(DMAC0B_DEI4, 0xB80),
9408c2ecf20Sopenharmony_ci	INTC_VECT(DMAC0B_DEI5, 0xBA0),
9418c2ecf20Sopenharmony_ci	INTC_VECT(DMAC0B_DADERR, 0xBC0),
9428c2ecf20Sopenharmony_ci
9438c2ecf20Sopenharmony_ci	INTC_VECT(KEYSC,      0xBE0),
9448c2ecf20Sopenharmony_ci	INTC_VECT(SCIF_SCIF0, 0xC00),
9458c2ecf20Sopenharmony_ci	INTC_VECT(SCIF_SCIF1, 0xC20),
9468c2ecf20Sopenharmony_ci	INTC_VECT(SCIF_SCIF2, 0xC40),
9478c2ecf20Sopenharmony_ci	INTC_VECT(VEU0,       0xC60),
9488c2ecf20Sopenharmony_ci	INTC_VECT(MSIOF_MSIOFI0, 0xC80),
9498c2ecf20Sopenharmony_ci	INTC_VECT(MSIOF_MSIOFI1, 0xCA0),
9508c2ecf20Sopenharmony_ci	INTC_VECT(SPU_SPUI0, 0xCC0),
9518c2ecf20Sopenharmony_ci	INTC_VECT(SPU_SPUI1, 0xCE0),
9528c2ecf20Sopenharmony_ci	INTC_VECT(SCIFA4,    0xD00),
9538c2ecf20Sopenharmony_ci
9548c2ecf20Sopenharmony_ci	INTC_VECT(ICB,  0xD20),
9558c2ecf20Sopenharmony_ci	INTC_VECT(ETHI, 0xD60),
9568c2ecf20Sopenharmony_ci
9578c2ecf20Sopenharmony_ci	INTC_VECT(I2C1_ALI, 0xD80),
9588c2ecf20Sopenharmony_ci	INTC_VECT(I2C1_TACKI, 0xDA0),
9598c2ecf20Sopenharmony_ci	INTC_VECT(I2C1_WAITI, 0xDC0),
9608c2ecf20Sopenharmony_ci	INTC_VECT(I2C1_DTEI, 0xDE0),
9618c2ecf20Sopenharmony_ci
9628c2ecf20Sopenharmony_ci	INTC_VECT(I2C0_ALI, 0xE00),
9638c2ecf20Sopenharmony_ci	INTC_VECT(I2C0_TACKI, 0xE20),
9648c2ecf20Sopenharmony_ci	INTC_VECT(I2C0_WAITI, 0xE40),
9658c2ecf20Sopenharmony_ci	INTC_VECT(I2C0_DTEI, 0xE60),
9668c2ecf20Sopenharmony_ci
9678c2ecf20Sopenharmony_ci	INTC_VECT(SDHI0, 0xE80),
9688c2ecf20Sopenharmony_ci	INTC_VECT(SDHI0, 0xEA0),
9698c2ecf20Sopenharmony_ci	INTC_VECT(SDHI0, 0xEC0),
9708c2ecf20Sopenharmony_ci	INTC_VECT(SDHI0, 0xEE0),
9718c2ecf20Sopenharmony_ci
9728c2ecf20Sopenharmony_ci	INTC_VECT(CMT,    0xF00),
9738c2ecf20Sopenharmony_ci	INTC_VECT(TSIF,   0xF20),
9748c2ecf20Sopenharmony_ci	INTC_VECT(FSI,    0xF80),
9758c2ecf20Sopenharmony_ci	INTC_VECT(SCIFA5, 0xFA0),
9768c2ecf20Sopenharmony_ci
9778c2ecf20Sopenharmony_ci	INTC_VECT(TMU0_TUNI0, 0x400),
9788c2ecf20Sopenharmony_ci	INTC_VECT(TMU0_TUNI1, 0x420),
9798c2ecf20Sopenharmony_ci	INTC_VECT(TMU0_TUNI2, 0x440),
9808c2ecf20Sopenharmony_ci
9818c2ecf20Sopenharmony_ci	INTC_VECT(IRDA,    0x480),
9828c2ecf20Sopenharmony_ci
9838c2ecf20Sopenharmony_ci	INTC_VECT(SDHI1, 0x4E0),
9848c2ecf20Sopenharmony_ci	INTC_VECT(SDHI1, 0x500),
9858c2ecf20Sopenharmony_ci	INTC_VECT(SDHI1, 0x520),
9868c2ecf20Sopenharmony_ci
9878c2ecf20Sopenharmony_ci	INTC_VECT(JPU, 0x560),
9888c2ecf20Sopenharmony_ci	INTC_VECT(_2DDMAC, 0x4A0),
9898c2ecf20Sopenharmony_ci
9908c2ecf20Sopenharmony_ci	INTC_VECT(MMC_MMC2I, 0x5A0),
9918c2ecf20Sopenharmony_ci	INTC_VECT(MMC_MMC3I, 0x5C0),
9928c2ecf20Sopenharmony_ci
9938c2ecf20Sopenharmony_ci	INTC_VECT(LCDC, 0xF40),
9948c2ecf20Sopenharmony_ci
9958c2ecf20Sopenharmony_ci	INTC_VECT(TMU1_TUNI0, 0x920),
9968c2ecf20Sopenharmony_ci	INTC_VECT(TMU1_TUNI1, 0x940),
9978c2ecf20Sopenharmony_ci	INTC_VECT(TMU1_TUNI2, 0x960),
9988c2ecf20Sopenharmony_ci};
9998c2ecf20Sopenharmony_ci
10008c2ecf20Sopenharmony_cistatic struct intc_group groups[] __initdata = {
10018c2ecf20Sopenharmony_ci	INTC_GROUP(DMAC1A, DMAC1A_DEI0, DMAC1A_DEI1, DMAC1A_DEI2, DMAC1A_DEI3),
10028c2ecf20Sopenharmony_ci	INTC_GROUP(_2DG, _2DG_TRI, _2DG_INI, _2DG_CEI),
10038c2ecf20Sopenharmony_ci	INTC_GROUP(DMAC0A, DMAC0A_DEI0, DMAC0A_DEI1, DMAC0A_DEI2, DMAC0A_DEI3),
10048c2ecf20Sopenharmony_ci	INTC_GROUP(VIO, VIO_CEU0, VIO_BEU0, VIO_VEU1, VIO_VOU),
10058c2ecf20Sopenharmony_ci	INTC_GROUP(USB, USB0, USB1),
10068c2ecf20Sopenharmony_ci	INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
10078c2ecf20Sopenharmony_ci	INTC_GROUP(DMAC1B, DMAC1B_DEI4, DMAC1B_DEI5, DMAC1B_DADERR),
10088c2ecf20Sopenharmony_ci	INTC_GROUP(DMAC0B, DMAC0B_DEI4, DMAC0B_DEI5, DMAC0B_DADERR),
10098c2ecf20Sopenharmony_ci	INTC_GROUP(I2C0, I2C0_ALI, I2C0_TACKI, I2C0_WAITI, I2C0_DTEI),
10108c2ecf20Sopenharmony_ci	INTC_GROUP(I2C1, I2C1_ALI, I2C1_TACKI, I2C1_WAITI, I2C1_DTEI),
10118c2ecf20Sopenharmony_ci	INTC_GROUP(SPU, SPU_SPUI0, SPU_SPUI1),
10128c2ecf20Sopenharmony_ci	INTC_GROUP(MMCIF, MMC_MMC2I, MMC_MMC3I),
10138c2ecf20Sopenharmony_ci};
10148c2ecf20Sopenharmony_ci
10158c2ecf20Sopenharmony_cistatic struct intc_mask_reg mask_registers[] __initdata = {
10168c2ecf20Sopenharmony_ci	{ 0xa4080080, 0xa40800c0, 8, /* IMR0 / IMCR0 */
10178c2ecf20Sopenharmony_ci	  { 0, TMU1_TUNI2, TMU1_TUNI1, TMU1_TUNI0,
10188c2ecf20Sopenharmony_ci	    0, ENABLED, ENABLED, ENABLED } },
10198c2ecf20Sopenharmony_ci	{ 0xa4080084, 0xa40800c4, 8, /* IMR1 / IMCR1 */
10208c2ecf20Sopenharmony_ci	  { VIO_VOU, VIO_VEU1, VIO_BEU0, VIO_CEU0,
10218c2ecf20Sopenharmony_ci	    DMAC0A_DEI3, DMAC0A_DEI2, DMAC0A_DEI1, DMAC0A_DEI0 } },
10228c2ecf20Sopenharmony_ci	{ 0xa4080088, 0xa40800c8, 8, /* IMR2 / IMCR2 */
10238c2ecf20Sopenharmony_ci	  { 0, 0, 0, VPU, ATAPI, ETHI, 0, SCIFA3 } },
10248c2ecf20Sopenharmony_ci	{ 0xa408008c, 0xa40800cc, 8, /* IMR3 / IMCR3 */
10258c2ecf20Sopenharmony_ci	  { DMAC1A_DEI3, DMAC1A_DEI2, DMAC1A_DEI1, DMAC1A_DEI0,
10268c2ecf20Sopenharmony_ci	    SPU_SPUI1, SPU_SPUI0, BEU1, IRDA } },
10278c2ecf20Sopenharmony_ci	{ 0xa4080090, 0xa40800d0, 8, /* IMR4 / IMCR4 */
10288c2ecf20Sopenharmony_ci	  { 0, TMU0_TUNI2, TMU0_TUNI1, TMU0_TUNI0,
10298c2ecf20Sopenharmony_ci	    JPU, 0, 0, LCDC } },
10308c2ecf20Sopenharmony_ci	{ 0xa4080094, 0xa40800d4, 8, /* IMR5 / IMCR5 */
10318c2ecf20Sopenharmony_ci	  { KEYSC, DMAC0B_DADERR, DMAC0B_DEI5, DMAC0B_DEI4,
10328c2ecf20Sopenharmony_ci	    VEU0, SCIF_SCIF2, SCIF_SCIF1, SCIF_SCIF0 } },
10338c2ecf20Sopenharmony_ci	{ 0xa4080098, 0xa40800d8, 8, /* IMR6 / IMCR6 */
10348c2ecf20Sopenharmony_ci	  { 0, 0, ICB, SCIFA4,
10358c2ecf20Sopenharmony_ci	    CEU1, 0, MSIOF_MSIOFI1, MSIOF_MSIOFI0 } },
10368c2ecf20Sopenharmony_ci	{ 0xa408009c, 0xa40800dc, 8, /* IMR7 / IMCR7 */
10378c2ecf20Sopenharmony_ci	  { I2C0_DTEI, I2C0_WAITI, I2C0_TACKI, I2C0_ALI,
10388c2ecf20Sopenharmony_ci	    I2C1_DTEI, I2C1_WAITI, I2C1_TACKI, I2C1_ALI } },
10398c2ecf20Sopenharmony_ci	{ 0xa40800a0, 0xa40800e0, 8, /* IMR8 / IMCR8 */
10408c2ecf20Sopenharmony_ci	  { DISABLED, ENABLED, ENABLED, ENABLED,
10418c2ecf20Sopenharmony_ci	    0, 0, SCIFA5, FSI } },
10428c2ecf20Sopenharmony_ci	{ 0xa40800a4, 0xa40800e4, 8, /* IMR9 / IMCR9 */
10438c2ecf20Sopenharmony_ci	  { 0, 0, 0, CMT, 0, USB1, USB0, 0 } },
10448c2ecf20Sopenharmony_ci	{ 0xa40800a8, 0xa40800e8, 8, /* IMR10 / IMCR10 */
10458c2ecf20Sopenharmony_ci	  { 0, DMAC1B_DADERR, DMAC1B_DEI5, DMAC1B_DEI4,
10468c2ecf20Sopenharmony_ci	    0, RTC_CUI, RTC_PRI, RTC_ATI } },
10478c2ecf20Sopenharmony_ci	{ 0xa40800ac, 0xa40800ec, 8, /* IMR11 / IMCR11 */
10488c2ecf20Sopenharmony_ci	  { 0, _2DG_CEI, _2DG_INI, _2DG_TRI,
10498c2ecf20Sopenharmony_ci	    0, TPU, 0, TSIF } },
10508c2ecf20Sopenharmony_ci	{ 0xa40800b0, 0xa40800f0, 8, /* IMR12 / IMCR12 */
10518c2ecf20Sopenharmony_ci	  { 0, 0, MMC_MMC3I, MMC_MMC2I, 0, 0, 0, _2DDMAC } },
10528c2ecf20Sopenharmony_ci	{ 0xa4140044, 0xa4140064, 8, /* INTMSK00 / INTMSKCLR00 */
10538c2ecf20Sopenharmony_ci	  { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
10548c2ecf20Sopenharmony_ci};
10558c2ecf20Sopenharmony_ci
10568c2ecf20Sopenharmony_cistatic struct intc_prio_reg prio_registers[] __initdata = {
10578c2ecf20Sopenharmony_ci	{ 0xa4080000, 0, 16, 4, /* IPRA */ { TMU0_TUNI0, TMU0_TUNI1,
10588c2ecf20Sopenharmony_ci					     TMU0_TUNI2, IRDA } },
10598c2ecf20Sopenharmony_ci	{ 0xa4080004, 0, 16, 4, /* IPRB */ { JPU, LCDC, DMAC1A, BEU1 } },
10608c2ecf20Sopenharmony_ci	{ 0xa4080008, 0, 16, 4, /* IPRC */ { TMU1_TUNI0, TMU1_TUNI1,
10618c2ecf20Sopenharmony_ci					     TMU1_TUNI2, SPU } },
10628c2ecf20Sopenharmony_ci	{ 0xa408000c, 0, 16, 4, /* IPRD */ { 0, MMCIF, 0, ATAPI } },
10638c2ecf20Sopenharmony_ci	{ 0xa4080010, 0, 16, 4, /* IPRE */ { DMAC0A, VIO, SCIFA3, VPU } },
10648c2ecf20Sopenharmony_ci	{ 0xa4080014, 0, 16, 4, /* IPRF */ { KEYSC, DMAC0B, USB, CMT } },
10658c2ecf20Sopenharmony_ci	{ 0xa4080018, 0, 16, 4, /* IPRG */ { SCIF_SCIF0, SCIF_SCIF1,
10668c2ecf20Sopenharmony_ci					     SCIF_SCIF2, VEU0 } },
10678c2ecf20Sopenharmony_ci	{ 0xa408001c, 0, 16, 4, /* IPRH */ { MSIOF_MSIOFI0, MSIOF_MSIOFI1,
10688c2ecf20Sopenharmony_ci					     I2C1, I2C0 } },
10698c2ecf20Sopenharmony_ci	{ 0xa4080020, 0, 16, 4, /* IPRI */ { SCIFA4, ICB, TSIF, _2DG } },
10708c2ecf20Sopenharmony_ci	{ 0xa4080024, 0, 16, 4, /* IPRJ */ { CEU1, ETHI, FSI, SDHI1 } },
10718c2ecf20Sopenharmony_ci	{ 0xa4080028, 0, 16, 4, /* IPRK */ { RTC, DMAC1B, 0, SDHI0 } },
10728c2ecf20Sopenharmony_ci	{ 0xa408002c, 0, 16, 4, /* IPRL */ { SCIFA5, 0, TPU, _2DDMAC } },
10738c2ecf20Sopenharmony_ci	{ 0xa4140010, 0, 32, 4, /* INTPRI00 */
10748c2ecf20Sopenharmony_ci	  { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
10758c2ecf20Sopenharmony_ci};
10768c2ecf20Sopenharmony_ci
10778c2ecf20Sopenharmony_cistatic struct intc_sense_reg sense_registers[] __initdata = {
10788c2ecf20Sopenharmony_ci	{ 0xa414001c, 16, 2, /* ICR1 */
10798c2ecf20Sopenharmony_ci	  { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
10808c2ecf20Sopenharmony_ci};
10818c2ecf20Sopenharmony_ci
10828c2ecf20Sopenharmony_cistatic struct intc_mask_reg ack_registers[] __initdata = {
10838c2ecf20Sopenharmony_ci	{ 0xa4140024, 0, 8, /* INTREQ00 */
10848c2ecf20Sopenharmony_ci	  { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
10858c2ecf20Sopenharmony_ci};
10868c2ecf20Sopenharmony_ci
10878c2ecf20Sopenharmony_cistatic struct intc_desc intc_desc __initdata = {
10888c2ecf20Sopenharmony_ci	.name = "sh7724",
10898c2ecf20Sopenharmony_ci	.force_enable = ENABLED,
10908c2ecf20Sopenharmony_ci	.force_disable = DISABLED,
10918c2ecf20Sopenharmony_ci	.hw = INTC_HW_DESC(vectors, groups, mask_registers,
10928c2ecf20Sopenharmony_ci			   prio_registers, sense_registers, ack_registers),
10938c2ecf20Sopenharmony_ci};
10948c2ecf20Sopenharmony_ci
10958c2ecf20Sopenharmony_civoid __init plat_irq_setup(void)
10968c2ecf20Sopenharmony_ci{
10978c2ecf20Sopenharmony_ci	register_intc_controller(&intc_desc);
10988c2ecf20Sopenharmony_ci}
10998c2ecf20Sopenharmony_ci
11008c2ecf20Sopenharmony_cistatic struct {
11018c2ecf20Sopenharmony_ci	/* BSC */
11028c2ecf20Sopenharmony_ci	unsigned long mmselr;
11038c2ecf20Sopenharmony_ci	unsigned long cs0bcr;
11048c2ecf20Sopenharmony_ci	unsigned long cs4bcr;
11058c2ecf20Sopenharmony_ci	unsigned long cs5abcr;
11068c2ecf20Sopenharmony_ci	unsigned long cs5bbcr;
11078c2ecf20Sopenharmony_ci	unsigned long cs6abcr;
11088c2ecf20Sopenharmony_ci	unsigned long cs6bbcr;
11098c2ecf20Sopenharmony_ci	unsigned long cs4wcr;
11108c2ecf20Sopenharmony_ci	unsigned long cs5awcr;
11118c2ecf20Sopenharmony_ci	unsigned long cs5bwcr;
11128c2ecf20Sopenharmony_ci	unsigned long cs6awcr;
11138c2ecf20Sopenharmony_ci	unsigned long cs6bwcr;
11148c2ecf20Sopenharmony_ci	/* INTC */
11158c2ecf20Sopenharmony_ci	unsigned short ipra;
11168c2ecf20Sopenharmony_ci	unsigned short iprb;
11178c2ecf20Sopenharmony_ci	unsigned short iprc;
11188c2ecf20Sopenharmony_ci	unsigned short iprd;
11198c2ecf20Sopenharmony_ci	unsigned short ipre;
11208c2ecf20Sopenharmony_ci	unsigned short iprf;
11218c2ecf20Sopenharmony_ci	unsigned short iprg;
11228c2ecf20Sopenharmony_ci	unsigned short iprh;
11238c2ecf20Sopenharmony_ci	unsigned short ipri;
11248c2ecf20Sopenharmony_ci	unsigned short iprj;
11258c2ecf20Sopenharmony_ci	unsigned short iprk;
11268c2ecf20Sopenharmony_ci	unsigned short iprl;
11278c2ecf20Sopenharmony_ci	unsigned char imr0;
11288c2ecf20Sopenharmony_ci	unsigned char imr1;
11298c2ecf20Sopenharmony_ci	unsigned char imr2;
11308c2ecf20Sopenharmony_ci	unsigned char imr3;
11318c2ecf20Sopenharmony_ci	unsigned char imr4;
11328c2ecf20Sopenharmony_ci	unsigned char imr5;
11338c2ecf20Sopenharmony_ci	unsigned char imr6;
11348c2ecf20Sopenharmony_ci	unsigned char imr7;
11358c2ecf20Sopenharmony_ci	unsigned char imr8;
11368c2ecf20Sopenharmony_ci	unsigned char imr9;
11378c2ecf20Sopenharmony_ci	unsigned char imr10;
11388c2ecf20Sopenharmony_ci	unsigned char imr11;
11398c2ecf20Sopenharmony_ci	unsigned char imr12;
11408c2ecf20Sopenharmony_ci	/* RWDT */
11418c2ecf20Sopenharmony_ci	unsigned short rwtcnt;
11428c2ecf20Sopenharmony_ci	unsigned short rwtcsr;
11438c2ecf20Sopenharmony_ci	/* CPG */
11448c2ecf20Sopenharmony_ci	unsigned long irdaclk;
11458c2ecf20Sopenharmony_ci	unsigned long spuclk;
11468c2ecf20Sopenharmony_ci} sh7724_rstandby_state;
11478c2ecf20Sopenharmony_ci
11488c2ecf20Sopenharmony_cistatic int sh7724_pre_sleep_notifier_call(struct notifier_block *nb,
11498c2ecf20Sopenharmony_ci					  unsigned long flags, void *unused)
11508c2ecf20Sopenharmony_ci{
11518c2ecf20Sopenharmony_ci	if (!(flags & SUSP_SH_RSTANDBY))
11528c2ecf20Sopenharmony_ci		return NOTIFY_DONE;
11538c2ecf20Sopenharmony_ci
11548c2ecf20Sopenharmony_ci	/* BCR */
11558c2ecf20Sopenharmony_ci	sh7724_rstandby_state.mmselr = __raw_readl(0xff800020); /* MMSELR */
11568c2ecf20Sopenharmony_ci	sh7724_rstandby_state.mmselr |= 0xa5a50000;
11578c2ecf20Sopenharmony_ci	sh7724_rstandby_state.cs0bcr = __raw_readl(0xfec10004); /* CS0BCR */
11588c2ecf20Sopenharmony_ci	sh7724_rstandby_state.cs4bcr = __raw_readl(0xfec10010); /* CS4BCR */
11598c2ecf20Sopenharmony_ci	sh7724_rstandby_state.cs5abcr = __raw_readl(0xfec10014); /* CS5ABCR */
11608c2ecf20Sopenharmony_ci	sh7724_rstandby_state.cs5bbcr = __raw_readl(0xfec10018); /* CS5BBCR */
11618c2ecf20Sopenharmony_ci	sh7724_rstandby_state.cs6abcr = __raw_readl(0xfec1001c); /* CS6ABCR */
11628c2ecf20Sopenharmony_ci	sh7724_rstandby_state.cs6bbcr = __raw_readl(0xfec10020); /* CS6BBCR */
11638c2ecf20Sopenharmony_ci	sh7724_rstandby_state.cs4wcr = __raw_readl(0xfec10030); /* CS4WCR */
11648c2ecf20Sopenharmony_ci	sh7724_rstandby_state.cs5awcr = __raw_readl(0xfec10034); /* CS5AWCR */
11658c2ecf20Sopenharmony_ci	sh7724_rstandby_state.cs5bwcr = __raw_readl(0xfec10038); /* CS5BWCR */
11668c2ecf20Sopenharmony_ci	sh7724_rstandby_state.cs6awcr = __raw_readl(0xfec1003c); /* CS6AWCR */
11678c2ecf20Sopenharmony_ci	sh7724_rstandby_state.cs6bwcr = __raw_readl(0xfec10040); /* CS6BWCR */
11688c2ecf20Sopenharmony_ci
11698c2ecf20Sopenharmony_ci	/* INTC */
11708c2ecf20Sopenharmony_ci	sh7724_rstandby_state.ipra = __raw_readw(0xa4080000); /* IPRA */
11718c2ecf20Sopenharmony_ci	sh7724_rstandby_state.iprb = __raw_readw(0xa4080004); /* IPRB */
11728c2ecf20Sopenharmony_ci	sh7724_rstandby_state.iprc = __raw_readw(0xa4080008); /* IPRC */
11738c2ecf20Sopenharmony_ci	sh7724_rstandby_state.iprd = __raw_readw(0xa408000c); /* IPRD */
11748c2ecf20Sopenharmony_ci	sh7724_rstandby_state.ipre = __raw_readw(0xa4080010); /* IPRE */
11758c2ecf20Sopenharmony_ci	sh7724_rstandby_state.iprf = __raw_readw(0xa4080014); /* IPRF */
11768c2ecf20Sopenharmony_ci	sh7724_rstandby_state.iprg = __raw_readw(0xa4080018); /* IPRG */
11778c2ecf20Sopenharmony_ci	sh7724_rstandby_state.iprh = __raw_readw(0xa408001c); /* IPRH */
11788c2ecf20Sopenharmony_ci	sh7724_rstandby_state.ipri = __raw_readw(0xa4080020); /* IPRI */
11798c2ecf20Sopenharmony_ci	sh7724_rstandby_state.iprj = __raw_readw(0xa4080024); /* IPRJ */
11808c2ecf20Sopenharmony_ci	sh7724_rstandby_state.iprk = __raw_readw(0xa4080028); /* IPRK */
11818c2ecf20Sopenharmony_ci	sh7724_rstandby_state.iprl = __raw_readw(0xa408002c); /* IPRL */
11828c2ecf20Sopenharmony_ci	sh7724_rstandby_state.imr0 = __raw_readb(0xa4080080); /* IMR0 */
11838c2ecf20Sopenharmony_ci	sh7724_rstandby_state.imr1 = __raw_readb(0xa4080084); /* IMR1 */
11848c2ecf20Sopenharmony_ci	sh7724_rstandby_state.imr2 = __raw_readb(0xa4080088); /* IMR2 */
11858c2ecf20Sopenharmony_ci	sh7724_rstandby_state.imr3 = __raw_readb(0xa408008c); /* IMR3 */
11868c2ecf20Sopenharmony_ci	sh7724_rstandby_state.imr4 = __raw_readb(0xa4080090); /* IMR4 */
11878c2ecf20Sopenharmony_ci	sh7724_rstandby_state.imr5 = __raw_readb(0xa4080094); /* IMR5 */
11888c2ecf20Sopenharmony_ci	sh7724_rstandby_state.imr6 = __raw_readb(0xa4080098); /* IMR6 */
11898c2ecf20Sopenharmony_ci	sh7724_rstandby_state.imr7 = __raw_readb(0xa408009c); /* IMR7 */
11908c2ecf20Sopenharmony_ci	sh7724_rstandby_state.imr8 = __raw_readb(0xa40800a0); /* IMR8 */
11918c2ecf20Sopenharmony_ci	sh7724_rstandby_state.imr9 = __raw_readb(0xa40800a4); /* IMR9 */
11928c2ecf20Sopenharmony_ci	sh7724_rstandby_state.imr10 = __raw_readb(0xa40800a8); /* IMR10 */
11938c2ecf20Sopenharmony_ci	sh7724_rstandby_state.imr11 = __raw_readb(0xa40800ac); /* IMR11 */
11948c2ecf20Sopenharmony_ci	sh7724_rstandby_state.imr12 = __raw_readb(0xa40800b0); /* IMR12 */
11958c2ecf20Sopenharmony_ci
11968c2ecf20Sopenharmony_ci	/* RWDT */
11978c2ecf20Sopenharmony_ci	sh7724_rstandby_state.rwtcnt = __raw_readb(0xa4520000); /* RWTCNT */
11988c2ecf20Sopenharmony_ci	sh7724_rstandby_state.rwtcnt |= 0x5a00;
11998c2ecf20Sopenharmony_ci	sh7724_rstandby_state.rwtcsr = __raw_readb(0xa4520004); /* RWTCSR */
12008c2ecf20Sopenharmony_ci	sh7724_rstandby_state.rwtcsr |= 0xa500;
12018c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.rwtcsr & 0x07, 0xa4520004);
12028c2ecf20Sopenharmony_ci
12038c2ecf20Sopenharmony_ci	/* CPG */
12048c2ecf20Sopenharmony_ci	sh7724_rstandby_state.irdaclk = __raw_readl(0xa4150018); /* IRDACLKCR */
12058c2ecf20Sopenharmony_ci	sh7724_rstandby_state.spuclk = __raw_readl(0xa415003c); /* SPUCLKCR */
12068c2ecf20Sopenharmony_ci
12078c2ecf20Sopenharmony_ci	return NOTIFY_DONE;
12088c2ecf20Sopenharmony_ci}
12098c2ecf20Sopenharmony_ci
12108c2ecf20Sopenharmony_cistatic int sh7724_post_sleep_notifier_call(struct notifier_block *nb,
12118c2ecf20Sopenharmony_ci					   unsigned long flags, void *unused)
12128c2ecf20Sopenharmony_ci{
12138c2ecf20Sopenharmony_ci	if (!(flags & SUSP_SH_RSTANDBY))
12148c2ecf20Sopenharmony_ci		return NOTIFY_DONE;
12158c2ecf20Sopenharmony_ci
12168c2ecf20Sopenharmony_ci	/* BCR */
12178c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.mmselr, 0xff800020); /* MMSELR */
12188c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.cs0bcr, 0xfec10004); /* CS0BCR */
12198c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.cs4bcr, 0xfec10010); /* CS4BCR */
12208c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.cs5abcr, 0xfec10014); /* CS5ABCR */
12218c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.cs5bbcr, 0xfec10018); /* CS5BBCR */
12228c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.cs6abcr, 0xfec1001c); /* CS6ABCR */
12238c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.cs6bbcr, 0xfec10020); /* CS6BBCR */
12248c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.cs4wcr, 0xfec10030); /* CS4WCR */
12258c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.cs5awcr, 0xfec10034); /* CS5AWCR */
12268c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.cs5bwcr, 0xfec10038); /* CS5BWCR */
12278c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.cs6awcr, 0xfec1003c); /* CS6AWCR */
12288c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.cs6bwcr, 0xfec10040); /* CS6BWCR */
12298c2ecf20Sopenharmony_ci
12308c2ecf20Sopenharmony_ci	/* INTC */
12318c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.ipra, 0xa4080000); /* IPRA */
12328c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.iprb, 0xa4080004); /* IPRB */
12338c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.iprc, 0xa4080008); /* IPRC */
12348c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.iprd, 0xa408000c); /* IPRD */
12358c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.ipre, 0xa4080010); /* IPRE */
12368c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.iprf, 0xa4080014); /* IPRF */
12378c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.iprg, 0xa4080018); /* IPRG */
12388c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.iprh, 0xa408001c); /* IPRH */
12398c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.ipri, 0xa4080020); /* IPRI */
12408c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.iprj, 0xa4080024); /* IPRJ */
12418c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.iprk, 0xa4080028); /* IPRK */
12428c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.iprl, 0xa408002c); /* IPRL */
12438c2ecf20Sopenharmony_ci	__raw_writeb(sh7724_rstandby_state.imr0, 0xa4080080); /* IMR0 */
12448c2ecf20Sopenharmony_ci	__raw_writeb(sh7724_rstandby_state.imr1, 0xa4080084); /* IMR1 */
12458c2ecf20Sopenharmony_ci	__raw_writeb(sh7724_rstandby_state.imr2, 0xa4080088); /* IMR2 */
12468c2ecf20Sopenharmony_ci	__raw_writeb(sh7724_rstandby_state.imr3, 0xa408008c); /* IMR3 */
12478c2ecf20Sopenharmony_ci	__raw_writeb(sh7724_rstandby_state.imr4, 0xa4080090); /* IMR4 */
12488c2ecf20Sopenharmony_ci	__raw_writeb(sh7724_rstandby_state.imr5, 0xa4080094); /* IMR5 */
12498c2ecf20Sopenharmony_ci	__raw_writeb(sh7724_rstandby_state.imr6, 0xa4080098); /* IMR6 */
12508c2ecf20Sopenharmony_ci	__raw_writeb(sh7724_rstandby_state.imr7, 0xa408009c); /* IMR7 */
12518c2ecf20Sopenharmony_ci	__raw_writeb(sh7724_rstandby_state.imr8, 0xa40800a0); /* IMR8 */
12528c2ecf20Sopenharmony_ci	__raw_writeb(sh7724_rstandby_state.imr9, 0xa40800a4); /* IMR9 */
12538c2ecf20Sopenharmony_ci	__raw_writeb(sh7724_rstandby_state.imr10, 0xa40800a8); /* IMR10 */
12548c2ecf20Sopenharmony_ci	__raw_writeb(sh7724_rstandby_state.imr11, 0xa40800ac); /* IMR11 */
12558c2ecf20Sopenharmony_ci	__raw_writeb(sh7724_rstandby_state.imr12, 0xa40800b0); /* IMR12 */
12568c2ecf20Sopenharmony_ci
12578c2ecf20Sopenharmony_ci	/* RWDT */
12588c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.rwtcnt, 0xa4520000); /* RWTCNT */
12598c2ecf20Sopenharmony_ci	__raw_writew(sh7724_rstandby_state.rwtcsr, 0xa4520004); /* RWTCSR */
12608c2ecf20Sopenharmony_ci
12618c2ecf20Sopenharmony_ci	/* CPG */
12628c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.irdaclk, 0xa4150018); /* IRDACLKCR */
12638c2ecf20Sopenharmony_ci	__raw_writel(sh7724_rstandby_state.spuclk, 0xa415003c); /* SPUCLKCR */
12648c2ecf20Sopenharmony_ci
12658c2ecf20Sopenharmony_ci	return NOTIFY_DONE;
12668c2ecf20Sopenharmony_ci}
12678c2ecf20Sopenharmony_ci
12688c2ecf20Sopenharmony_cistatic struct notifier_block sh7724_pre_sleep_notifier = {
12698c2ecf20Sopenharmony_ci	.notifier_call = sh7724_pre_sleep_notifier_call,
12708c2ecf20Sopenharmony_ci	.priority = SH_MOBILE_PRE(SH_MOBILE_SLEEP_CPU),
12718c2ecf20Sopenharmony_ci};
12728c2ecf20Sopenharmony_ci
12738c2ecf20Sopenharmony_cistatic struct notifier_block sh7724_post_sleep_notifier = {
12748c2ecf20Sopenharmony_ci	.notifier_call = sh7724_post_sleep_notifier_call,
12758c2ecf20Sopenharmony_ci	.priority = SH_MOBILE_POST(SH_MOBILE_SLEEP_CPU),
12768c2ecf20Sopenharmony_ci};
12778c2ecf20Sopenharmony_ci
12788c2ecf20Sopenharmony_cistatic int __init sh7724_sleep_setup(void)
12798c2ecf20Sopenharmony_ci{
12808c2ecf20Sopenharmony_ci	atomic_notifier_chain_register(&sh_mobile_pre_sleep_notifier_list,
12818c2ecf20Sopenharmony_ci				       &sh7724_pre_sleep_notifier);
12828c2ecf20Sopenharmony_ci
12838c2ecf20Sopenharmony_ci	atomic_notifier_chain_register(&sh_mobile_post_sleep_notifier_list,
12848c2ecf20Sopenharmony_ci				       &sh7724_post_sleep_notifier);
12858c2ecf20Sopenharmony_ci	return 0;
12868c2ecf20Sopenharmony_ci}
12878c2ecf20Sopenharmony_ciarch_initcall(sh7724_sleep_setup);
12888c2ecf20Sopenharmony_ci
1289