10207a2efSKuninori Morimoto /*
20207a2efSKuninori Morimoto  * SH7724 Setup
30207a2efSKuninori Morimoto  *
40207a2efSKuninori Morimoto  * Copyright (C) 2009 Renesas Solutions Corp.
50207a2efSKuninori Morimoto  *
60207a2efSKuninori Morimoto  * Kuninori Morimoto <morimoto.kuninori@renesas.com>
70207a2efSKuninori Morimoto  *
80207a2efSKuninori Morimoto  * Based on SH7723 Setup
90207a2efSKuninori Morimoto  * Copyright (C) 2008  Paul Mundt
100207a2efSKuninori Morimoto  *
110207a2efSKuninori Morimoto  * This file is subject to the terms and conditions of the GNU General Public
120207a2efSKuninori Morimoto  * License.  See the file "COPYING" in the main directory of this archive
130207a2efSKuninori Morimoto  * for more details.
140207a2efSKuninori Morimoto  */
150207a2efSKuninori Morimoto #include <linux/platform_device.h>
160207a2efSKuninori Morimoto #include <linux/init.h>
170207a2efSKuninori Morimoto #include <linux/serial.h>
180207a2efSKuninori Morimoto #include <linux/mm.h>
190207a2efSKuninori Morimoto #include <linux/serial_sci.h>
200207a2efSKuninori Morimoto #include <linux/uio_driver.h>
2146a12f74SPaul Mundt #include <linux/sh_timer.h>
220207a2efSKuninori Morimoto #include <linux/io.h>
230207a2efSKuninori Morimoto #include <asm/clock.h>
240207a2efSKuninori Morimoto #include <asm/mmzone.h>
25593a0c89SMagnus Damm #include <cpu/sh7724.h>
260207a2efSKuninori Morimoto 
270207a2efSKuninori Morimoto /* Serial */
280207a2efSKuninori Morimoto static struct plat_sci_port sci_platform_data[] = {
290207a2efSKuninori Morimoto 	{
300207a2efSKuninori Morimoto 		.mapbase        = 0xffe00000,
310207a2efSKuninori Morimoto 		.flags          = UPF_BOOT_AUTOCONF,
320207a2efSKuninori Morimoto 		.type           = PORT_SCIF,
330207a2efSKuninori Morimoto 		.irqs           = { 80, 80, 80, 80 },
343b226e15SPaul Mundt 		.clk		= "scif0",
350207a2efSKuninori Morimoto 	}, {
360207a2efSKuninori Morimoto 		.mapbase        = 0xffe10000,
370207a2efSKuninori Morimoto 		.flags          = UPF_BOOT_AUTOCONF,
380207a2efSKuninori Morimoto 		.type           = PORT_SCIF,
390207a2efSKuninori Morimoto 		.irqs           = { 81, 81, 81, 81 },
403b226e15SPaul Mundt 		.clk		= "scif1",
410207a2efSKuninori Morimoto 	}, {
420207a2efSKuninori Morimoto 		.mapbase        = 0xffe20000,
430207a2efSKuninori Morimoto 		.flags          = UPF_BOOT_AUTOCONF,
440207a2efSKuninori Morimoto 		.type           = PORT_SCIF,
450207a2efSKuninori Morimoto 		.irqs           = { 82, 82, 82, 82 },
463b226e15SPaul Mundt 		.clk		= "scif2",
470207a2efSKuninori Morimoto 	}, {
480207a2efSKuninori Morimoto 		.mapbase	= 0xa4e30000,
490207a2efSKuninori Morimoto 		.flags		= UPF_BOOT_AUTOCONF,
500207a2efSKuninori Morimoto 		.type		= PORT_SCIFA,
510207a2efSKuninori Morimoto 		.irqs		= { 56, 56, 56, 56 },
523b226e15SPaul Mundt 		.clk		= "scif3",
530207a2efSKuninori Morimoto 	}, {
540207a2efSKuninori Morimoto 		.mapbase	= 0xa4e40000,
550207a2efSKuninori Morimoto 		.flags		= UPF_BOOT_AUTOCONF,
560207a2efSKuninori Morimoto 		.type		= PORT_SCIFA,
570207a2efSKuninori Morimoto 		.irqs		= { 88, 88, 88, 88 },
583b226e15SPaul Mundt 		.clk		= "scif4",
590207a2efSKuninori Morimoto 	}, {
600207a2efSKuninori Morimoto 		.mapbase	= 0xa4e50000,
610207a2efSKuninori Morimoto 		.flags		= UPF_BOOT_AUTOCONF,
620207a2efSKuninori Morimoto 		.type		= PORT_SCIFA,
630207a2efSKuninori Morimoto 		.irqs		= { 109, 109, 109, 109 },
643b226e15SPaul Mundt 		.clk		= "scif5",
650207a2efSKuninori Morimoto 	}, {
660207a2efSKuninori Morimoto 		.flags = 0,
670207a2efSKuninori Morimoto 	}
680207a2efSKuninori Morimoto };
690207a2efSKuninori Morimoto 
700207a2efSKuninori Morimoto static struct platform_device sci_device = {
710207a2efSKuninori Morimoto 	.name		= "sh-sci",
720207a2efSKuninori Morimoto 	.id		= -1,
730207a2efSKuninori Morimoto 	.dev		= {
740207a2efSKuninori Morimoto 		.platform_data	= sci_platform_data,
750207a2efSKuninori Morimoto 	},
760207a2efSKuninori Morimoto };
770207a2efSKuninori Morimoto 
780207a2efSKuninori Morimoto /* RTC */
790207a2efSKuninori Morimoto static struct resource rtc_resources[] = {
800207a2efSKuninori Morimoto 	[0] = {
810207a2efSKuninori Morimoto 		.start	= 0xa465fec0,
820207a2efSKuninori Morimoto 		.end	= 0xa465fec0 + 0x58 - 1,
830207a2efSKuninori Morimoto 		.flags	= IORESOURCE_IO,
840207a2efSKuninori Morimoto 	},
850207a2efSKuninori Morimoto 	[1] = {
860207a2efSKuninori Morimoto 		/* Period IRQ */
870207a2efSKuninori Morimoto 		.start	= 69,
880207a2efSKuninori Morimoto 		.flags	= IORESOURCE_IRQ,
890207a2efSKuninori Morimoto 	},
900207a2efSKuninori Morimoto 	[2] = {
910207a2efSKuninori Morimoto 		/* Carry IRQ */
920207a2efSKuninori Morimoto 		.start	= 70,
930207a2efSKuninori Morimoto 		.flags	= IORESOURCE_IRQ,
940207a2efSKuninori Morimoto 	},
950207a2efSKuninori Morimoto 	[3] = {
960207a2efSKuninori Morimoto 		/* Alarm IRQ */
970207a2efSKuninori Morimoto 		.start	= 68,
980207a2efSKuninori Morimoto 		.flags	= IORESOURCE_IRQ,
990207a2efSKuninori Morimoto 	},
1000207a2efSKuninori Morimoto };
1010207a2efSKuninori Morimoto 
1020207a2efSKuninori Morimoto static struct platform_device rtc_device = {
1030207a2efSKuninori Morimoto 	.name		= "sh-rtc",
1040207a2efSKuninori Morimoto 	.id		= -1,
1050207a2efSKuninori Morimoto 	.num_resources	= ARRAY_SIZE(rtc_resources),
1060207a2efSKuninori Morimoto 	.resource	= rtc_resources,
107593a0c89SMagnus Damm 	.archdata = {
108593a0c89SMagnus Damm 		.hwblk_id = HWBLK_RTC,
109593a0c89SMagnus Damm 	},
1100207a2efSKuninori Morimoto };
1110207a2efSKuninori Morimoto 
11240c7e8beSKuninori Morimoto /* I2C0 */
11340c7e8beSKuninori Morimoto static struct resource iic0_resources[] = {
11440c7e8beSKuninori Morimoto 	[0] = {
11540c7e8beSKuninori Morimoto 		.name	= "IIC0",
11640c7e8beSKuninori Morimoto 		.start  = 0x04470000,
11740c7e8beSKuninori Morimoto 		.end    = 0x04470018 - 1,
11840c7e8beSKuninori Morimoto 		.flags  = IORESOURCE_MEM,
11940c7e8beSKuninori Morimoto 	},
12040c7e8beSKuninori Morimoto 	[1] = {
12140c7e8beSKuninori Morimoto 		.start  = 96,
12240c7e8beSKuninori Morimoto 		.end    = 99,
12340c7e8beSKuninori Morimoto 		.flags  = IORESOURCE_IRQ,
12440c7e8beSKuninori Morimoto 	},
12540c7e8beSKuninori Morimoto };
12640c7e8beSKuninori Morimoto 
12740c7e8beSKuninori Morimoto static struct platform_device iic0_device = {
12840c7e8beSKuninori Morimoto 	.name           = "i2c-sh_mobile",
12940c7e8beSKuninori Morimoto 	.id             = 0, /* "i2c0" clock */
13040c7e8beSKuninori Morimoto 	.num_resources  = ARRAY_SIZE(iic0_resources),
13140c7e8beSKuninori Morimoto 	.resource       = iic0_resources,
132593a0c89SMagnus Damm 	.archdata = {
133593a0c89SMagnus Damm 		.hwblk_id = HWBLK_IIC0,
134593a0c89SMagnus Damm 	},
13540c7e8beSKuninori Morimoto };
13640c7e8beSKuninori Morimoto 
13740c7e8beSKuninori Morimoto /* I2C1 */
13840c7e8beSKuninori Morimoto static struct resource iic1_resources[] = {
13940c7e8beSKuninori Morimoto 	[0] = {
14040c7e8beSKuninori Morimoto 		.name	= "IIC1",
14140c7e8beSKuninori Morimoto 		.start  = 0x04750000,
14240c7e8beSKuninori Morimoto 		.end    = 0x04750018 - 1,
14340c7e8beSKuninori Morimoto 		.flags  = IORESOURCE_MEM,
14440c7e8beSKuninori Morimoto 	},
14540c7e8beSKuninori Morimoto 	[1] = {
14640c7e8beSKuninori Morimoto 		.start  = 92,
14740c7e8beSKuninori Morimoto 		.end    = 95,
14840c7e8beSKuninori Morimoto 		.flags  = IORESOURCE_IRQ,
14940c7e8beSKuninori Morimoto 	},
15040c7e8beSKuninori Morimoto };
15140c7e8beSKuninori Morimoto 
15240c7e8beSKuninori Morimoto static struct platform_device iic1_device = {
15340c7e8beSKuninori Morimoto 	.name           = "i2c-sh_mobile",
15440c7e8beSKuninori Morimoto 	.id             = 1, /* "i2c1" clock */
15540c7e8beSKuninori Morimoto 	.num_resources  = ARRAY_SIZE(iic1_resources),
15640c7e8beSKuninori Morimoto 	.resource       = iic1_resources,
157593a0c89SMagnus Damm 	.archdata = {
158593a0c89SMagnus Damm 		.hwblk_id = HWBLK_IIC1,
159593a0c89SMagnus Damm 	},
16040c7e8beSKuninori Morimoto };
16140c7e8beSKuninori Morimoto 
162cd5b9ef7SKuninori Morimoto /* VPU */
163cd5b9ef7SKuninori Morimoto static struct uio_info vpu_platform_data = {
164cd5b9ef7SKuninori Morimoto 	.name = "VPU5F",
165cd5b9ef7SKuninori Morimoto 	.version = "0",
166cd5b9ef7SKuninori Morimoto 	.irq = 60,
167cd5b9ef7SKuninori Morimoto };
168cd5b9ef7SKuninori Morimoto 
169cd5b9ef7SKuninori Morimoto static struct resource vpu_resources[] = {
170cd5b9ef7SKuninori Morimoto 	[0] = {
171cd5b9ef7SKuninori Morimoto 		.name	= "VPU",
172cd5b9ef7SKuninori Morimoto 		.start	= 0xfe900000,
173cd5b9ef7SKuninori Morimoto 		.end	= 0xfe902807,
174cd5b9ef7SKuninori Morimoto 		.flags	= IORESOURCE_MEM,
175cd5b9ef7SKuninori Morimoto 	},
176cd5b9ef7SKuninori Morimoto 	[1] = {
177cd5b9ef7SKuninori Morimoto 		/* place holder for contiguous memory */
178cd5b9ef7SKuninori Morimoto 	},
179cd5b9ef7SKuninori Morimoto };
180cd5b9ef7SKuninori Morimoto 
181cd5b9ef7SKuninori Morimoto static struct platform_device vpu_device = {
182cd5b9ef7SKuninori Morimoto 	.name		= "uio_pdrv_genirq",
183cd5b9ef7SKuninori Morimoto 	.id		= 0,
184cd5b9ef7SKuninori Morimoto 	.dev = {
185cd5b9ef7SKuninori Morimoto 		.platform_data	= &vpu_platform_data,
186cd5b9ef7SKuninori Morimoto 	},
187cd5b9ef7SKuninori Morimoto 	.resource	= vpu_resources,
188cd5b9ef7SKuninori Morimoto 	.num_resources	= ARRAY_SIZE(vpu_resources),
189593a0c89SMagnus Damm 	.archdata = {
190593a0c89SMagnus Damm 		.hwblk_id = HWBLK_VPU,
191593a0c89SMagnus Damm 	},
192cd5b9ef7SKuninori Morimoto };
193cd5b9ef7SKuninori Morimoto 
194ad95b78cSKuninori Morimoto /* VEU0 */
195ad95b78cSKuninori Morimoto static struct uio_info veu0_platform_data = {
196ad95b78cSKuninori Morimoto 	.name = "VEU3F0",
197ad95b78cSKuninori Morimoto 	.version = "0",
198ad95b78cSKuninori Morimoto 	.irq = 83,
199ad95b78cSKuninori Morimoto };
200ad95b78cSKuninori Morimoto 
201ad95b78cSKuninori Morimoto static struct resource veu0_resources[] = {
202ad95b78cSKuninori Morimoto 	[0] = {
203ad95b78cSKuninori Morimoto 		.name	= "VEU3F0",
204ad95b78cSKuninori Morimoto 		.start	= 0xfe920000,
205ad95b78cSKuninori Morimoto 		.end	= 0xfe9200cb - 1,
206ad95b78cSKuninori Morimoto 		.flags	= IORESOURCE_MEM,
207ad95b78cSKuninori Morimoto 	},
208ad95b78cSKuninori Morimoto 	[1] = {
209ad95b78cSKuninori Morimoto 		/* place holder for contiguous memory */
210ad95b78cSKuninori Morimoto 	},
211ad95b78cSKuninori Morimoto };
212ad95b78cSKuninori Morimoto 
213ad95b78cSKuninori Morimoto static struct platform_device veu0_device = {
214ad95b78cSKuninori Morimoto 	.name		= "uio_pdrv_genirq",
215ad95b78cSKuninori Morimoto 	.id		= 1,
216ad95b78cSKuninori Morimoto 	.dev = {
217ad95b78cSKuninori Morimoto 		.platform_data	= &veu0_platform_data,
218ad95b78cSKuninori Morimoto 	},
219ad95b78cSKuninori Morimoto 	.resource	= veu0_resources,
220ad95b78cSKuninori Morimoto 	.num_resources	= ARRAY_SIZE(veu0_resources),
221593a0c89SMagnus Damm 	.archdata = {
222593a0c89SMagnus Damm 		.hwblk_id = HWBLK_VEU0,
223593a0c89SMagnus Damm 	},
224ad95b78cSKuninori Morimoto };
225ad95b78cSKuninori Morimoto 
226ad95b78cSKuninori Morimoto /* VEU1 */
227ad95b78cSKuninori Morimoto static struct uio_info veu1_platform_data = {
228ad95b78cSKuninori Morimoto 	.name = "VEU3F1",
229ad95b78cSKuninori Morimoto 	.version = "0",
230ad95b78cSKuninori Morimoto 	.irq = 54,
231ad95b78cSKuninori Morimoto };
232ad95b78cSKuninori Morimoto 
233ad95b78cSKuninori Morimoto static struct resource veu1_resources[] = {
234ad95b78cSKuninori Morimoto 	[0] = {
235ad95b78cSKuninori Morimoto 		.name	= "VEU3F1",
236ad95b78cSKuninori Morimoto 		.start	= 0xfe924000,
237ad95b78cSKuninori Morimoto 		.end	= 0xfe9240cb - 1,
238ad95b78cSKuninori Morimoto 		.flags	= IORESOURCE_MEM,
239ad95b78cSKuninori Morimoto 	},
240ad95b78cSKuninori Morimoto 	[1] = {
241ad95b78cSKuninori Morimoto 		/* place holder for contiguous memory */
242ad95b78cSKuninori Morimoto 	},
243ad95b78cSKuninori Morimoto };
244ad95b78cSKuninori Morimoto 
245ad95b78cSKuninori Morimoto static struct platform_device veu1_device = {
246ad95b78cSKuninori Morimoto 	.name		= "uio_pdrv_genirq",
247ad95b78cSKuninori Morimoto 	.id		= 2,
248ad95b78cSKuninori Morimoto 	.dev = {
249ad95b78cSKuninori Morimoto 		.platform_data	= &veu1_platform_data,
250ad95b78cSKuninori Morimoto 	},
251ad95b78cSKuninori Morimoto 	.resource	= veu1_resources,
252ad95b78cSKuninori Morimoto 	.num_resources	= ARRAY_SIZE(veu1_resources),
253593a0c89SMagnus Damm 	.archdata = {
254593a0c89SMagnus Damm 		.hwblk_id = HWBLK_VEU1,
255593a0c89SMagnus Damm 	},
256ad95b78cSKuninori Morimoto };
257ad95b78cSKuninori Morimoto 
25846a12f74SPaul Mundt static struct sh_timer_config cmt_platform_data = {
2596a3395beSPaul Mundt 	.name = "CMT",
2606a3395beSPaul Mundt 	.channel_offset = 0x60,
2616a3395beSPaul Mundt 	.timer_bit = 5,
2626a3395beSPaul Mundt 	.clk = "cmt0",
2636a3395beSPaul Mundt 	.clockevent_rating = 125,
2646a3395beSPaul Mundt 	.clocksource_rating = 200,
2656a3395beSPaul Mundt };
2666a3395beSPaul Mundt 
2676a3395beSPaul Mundt static struct resource cmt_resources[] = {
2686a3395beSPaul Mundt 	[0] = {
2696a3395beSPaul Mundt 		.name	= "CMT",
2706a3395beSPaul Mundt 		.start	= 0x044a0060,
2716a3395beSPaul Mundt 		.end	= 0x044a006b,
2726a3395beSPaul Mundt 		.flags	= IORESOURCE_MEM,
2736a3395beSPaul Mundt 	},
2746a3395beSPaul Mundt 	[1] = {
2756a3395beSPaul Mundt 		.start	= 104,
2766a3395beSPaul Mundt 		.flags	= IORESOURCE_IRQ,
2776a3395beSPaul Mundt 	},
2786a3395beSPaul Mundt };
2796a3395beSPaul Mundt 
2806a3395beSPaul Mundt static struct platform_device cmt_device = {
2816a3395beSPaul Mundt 	.name		= "sh_cmt",
2826a3395beSPaul Mundt 	.id		= 0,
2836a3395beSPaul Mundt 	.dev = {
2846a3395beSPaul Mundt 		.platform_data	= &cmt_platform_data,
2856a3395beSPaul Mundt 	},
2866a3395beSPaul Mundt 	.resource	= cmt_resources,
2876a3395beSPaul Mundt 	.num_resources	= ARRAY_SIZE(cmt_resources),
288593a0c89SMagnus Damm 	.archdata = {
289593a0c89SMagnus Damm 		.hwblk_id = HWBLK_CMT,
290593a0c89SMagnus Damm 	},
2916a3395beSPaul Mundt };
2926a3395beSPaul Mundt 
2936a3501b6SMagnus Damm static struct sh_timer_config tmu0_platform_data = {
2946a3501b6SMagnus Damm 	.name = "TMU0",
2956a3501b6SMagnus Damm 	.channel_offset = 0x04,
2966a3501b6SMagnus Damm 	.timer_bit = 0,
2976a3501b6SMagnus Damm 	.clk = "tmu0",
2986a3501b6SMagnus Damm 	.clockevent_rating = 200,
2996a3501b6SMagnus Damm };
3006a3501b6SMagnus Damm 
3016a3501b6SMagnus Damm static struct resource tmu0_resources[] = {
3026a3501b6SMagnus Damm 	[0] = {
3036a3501b6SMagnus Damm 		.name	= "TMU0",
3046a3501b6SMagnus Damm 		.start	= 0xffd80008,
3056a3501b6SMagnus Damm 		.end	= 0xffd80013,
3066a3501b6SMagnus Damm 		.flags	= IORESOURCE_MEM,
3076a3501b6SMagnus Damm 	},
3086a3501b6SMagnus Damm 	[1] = {
3096a3501b6SMagnus Damm 		.start	= 16,
3106a3501b6SMagnus Damm 		.flags	= IORESOURCE_IRQ,
3116a3501b6SMagnus Damm 	},
3126a3501b6SMagnus Damm };
3136a3501b6SMagnus Damm 
3146a3501b6SMagnus Damm static struct platform_device tmu0_device = {
3156a3501b6SMagnus Damm 	.name		= "sh_tmu",
3166a3501b6SMagnus Damm 	.id		= 0,
3176a3501b6SMagnus Damm 	.dev = {
3186a3501b6SMagnus Damm 		.platform_data	= &tmu0_platform_data,
3196a3501b6SMagnus Damm 	},
3206a3501b6SMagnus Damm 	.resource	= tmu0_resources,
3216a3501b6SMagnus Damm 	.num_resources	= ARRAY_SIZE(tmu0_resources),
322593a0c89SMagnus Damm 	.archdata = {
323593a0c89SMagnus Damm 		.hwblk_id = HWBLK_TMU0,
324593a0c89SMagnus Damm 	},
3256a3501b6SMagnus Damm };
3266a3501b6SMagnus Damm 
3276a3501b6SMagnus Damm static struct sh_timer_config tmu1_platform_data = {
3286a3501b6SMagnus Damm 	.name = "TMU1",
3296a3501b6SMagnus Damm 	.channel_offset = 0x10,
3306a3501b6SMagnus Damm 	.timer_bit = 1,
3316a3501b6SMagnus Damm 	.clk = "tmu0",
3326a3501b6SMagnus Damm 	.clocksource_rating = 200,
3336a3501b6SMagnus Damm };
3346a3501b6SMagnus Damm 
3356a3501b6SMagnus Damm static struct resource tmu1_resources[] = {
3366a3501b6SMagnus Damm 	[0] = {
3376a3501b6SMagnus Damm 		.name	= "TMU1",
3386a3501b6SMagnus Damm 		.start	= 0xffd80014,
3396a3501b6SMagnus Damm 		.end	= 0xffd8001f,
3406a3501b6SMagnus Damm 		.flags	= IORESOURCE_MEM,
3416a3501b6SMagnus Damm 	},
3426a3501b6SMagnus Damm 	[1] = {
3436a3501b6SMagnus Damm 		.start	= 17,
3446a3501b6SMagnus Damm 		.flags	= IORESOURCE_IRQ,
3456a3501b6SMagnus Damm 	},
3466a3501b6SMagnus Damm };
3476a3501b6SMagnus Damm 
3486a3501b6SMagnus Damm static struct platform_device tmu1_device = {
3496a3501b6SMagnus Damm 	.name		= "sh_tmu",
3506a3501b6SMagnus Damm 	.id		= 1,
3516a3501b6SMagnus Damm 	.dev = {
3526a3501b6SMagnus Damm 		.platform_data	= &tmu1_platform_data,
3536a3501b6SMagnus Damm 	},
3546a3501b6SMagnus Damm 	.resource	= tmu1_resources,
3556a3501b6SMagnus Damm 	.num_resources	= ARRAY_SIZE(tmu1_resources),
356593a0c89SMagnus Damm 	.archdata = {
357593a0c89SMagnus Damm 		.hwblk_id = HWBLK_TMU0,
358593a0c89SMagnus Damm 	},
3596a3501b6SMagnus Damm };
3606a3501b6SMagnus Damm 
3616a3501b6SMagnus Damm static struct sh_timer_config tmu2_platform_data = {
3626a3501b6SMagnus Damm 	.name = "TMU2",
3636a3501b6SMagnus Damm 	.channel_offset = 0x1c,
3646a3501b6SMagnus Damm 	.timer_bit = 2,
3656a3501b6SMagnus Damm 	.clk = "tmu0",
3666a3501b6SMagnus Damm };
3676a3501b6SMagnus Damm 
3686a3501b6SMagnus Damm static struct resource tmu2_resources[] = {
3696a3501b6SMagnus Damm 	[0] = {
3706a3501b6SMagnus Damm 		.name	= "TMU2",
3716a3501b6SMagnus Damm 		.start	= 0xffd80020,
3726a3501b6SMagnus Damm 		.end	= 0xffd8002b,
3736a3501b6SMagnus Damm 		.flags	= IORESOURCE_MEM,
3746a3501b6SMagnus Damm 	},
3756a3501b6SMagnus Damm 	[1] = {
3766a3501b6SMagnus Damm 		.start	= 18,
3776a3501b6SMagnus Damm 		.flags	= IORESOURCE_IRQ,
3786a3501b6SMagnus Damm 	},
3796a3501b6SMagnus Damm };
3806a3501b6SMagnus Damm 
3816a3501b6SMagnus Damm static struct platform_device tmu2_device = {
3826a3501b6SMagnus Damm 	.name		= "sh_tmu",
3836a3501b6SMagnus Damm 	.id		= 2,
3846a3501b6SMagnus Damm 	.dev = {
3856a3501b6SMagnus Damm 		.platform_data	= &tmu2_platform_data,
3866a3501b6SMagnus Damm 	},
3876a3501b6SMagnus Damm 	.resource	= tmu2_resources,
3886a3501b6SMagnus Damm 	.num_resources	= ARRAY_SIZE(tmu2_resources),
389593a0c89SMagnus Damm 	.archdata = {
390593a0c89SMagnus Damm 		.hwblk_id = HWBLK_TMU0,
391593a0c89SMagnus Damm 	},
3926a3501b6SMagnus Damm };
3936a3501b6SMagnus Damm 
3946a3501b6SMagnus Damm 
3956a3501b6SMagnus Damm static struct sh_timer_config tmu3_platform_data = {
3966a3501b6SMagnus Damm 	.name = "TMU3",
3976a3501b6SMagnus Damm 	.channel_offset = 0x04,
3986a3501b6SMagnus Damm 	.timer_bit = 0,
3996a3501b6SMagnus Damm 	.clk = "tmu1",
4006a3501b6SMagnus Damm };
4016a3501b6SMagnus Damm 
4026a3501b6SMagnus Damm static struct resource tmu3_resources[] = {
4036a3501b6SMagnus Damm 	[0] = {
4046a3501b6SMagnus Damm 		.name	= "TMU3",
4056a3501b6SMagnus Damm 		.start	= 0xffd90008,
4066a3501b6SMagnus Damm 		.end	= 0xffd90013,
4076a3501b6SMagnus Damm 		.flags	= IORESOURCE_MEM,
4086a3501b6SMagnus Damm 	},
4096a3501b6SMagnus Damm 	[1] = {
4106a3501b6SMagnus Damm 		.start	= 57,
4116a3501b6SMagnus Damm 		.flags	= IORESOURCE_IRQ,
4126a3501b6SMagnus Damm 	},
4136a3501b6SMagnus Damm };
4146a3501b6SMagnus Damm 
4156a3501b6SMagnus Damm static struct platform_device tmu3_device = {
4166a3501b6SMagnus Damm 	.name		= "sh_tmu",
4176a3501b6SMagnus Damm 	.id		= 3,
4186a3501b6SMagnus Damm 	.dev = {
4196a3501b6SMagnus Damm 		.platform_data	= &tmu3_platform_data,
4206a3501b6SMagnus Damm 	},
4216a3501b6SMagnus Damm 	.resource	= tmu3_resources,
4226a3501b6SMagnus Damm 	.num_resources	= ARRAY_SIZE(tmu3_resources),
423593a0c89SMagnus Damm 	.archdata = {
424593a0c89SMagnus Damm 		.hwblk_id = HWBLK_TMU1,
425593a0c89SMagnus Damm 	},
4266a3501b6SMagnus Damm };
4276a3501b6SMagnus Damm 
4286a3501b6SMagnus Damm static struct sh_timer_config tmu4_platform_data = {
4296a3501b6SMagnus Damm 	.name = "TMU4",
4306a3501b6SMagnus Damm 	.channel_offset = 0x10,
4316a3501b6SMagnus Damm 	.timer_bit = 1,
4326a3501b6SMagnus Damm 	.clk = "tmu1",
4336a3501b6SMagnus Damm };
4346a3501b6SMagnus Damm 
4356a3501b6SMagnus Damm static struct resource tmu4_resources[] = {
4366a3501b6SMagnus Damm 	[0] = {
4376a3501b6SMagnus Damm 		.name	= "TMU4",
4386a3501b6SMagnus Damm 		.start	= 0xffd90014,
4396a3501b6SMagnus Damm 		.end	= 0xffd9001f,
4406a3501b6SMagnus Damm 		.flags	= IORESOURCE_MEM,
4416a3501b6SMagnus Damm 	},
4426a3501b6SMagnus Damm 	[1] = {
4436a3501b6SMagnus Damm 		.start	= 58,
4446a3501b6SMagnus Damm 		.flags	= IORESOURCE_IRQ,
4456a3501b6SMagnus Damm 	},
4466a3501b6SMagnus Damm };
4476a3501b6SMagnus Damm 
4486a3501b6SMagnus Damm static struct platform_device tmu4_device = {
4496a3501b6SMagnus Damm 	.name		= "sh_tmu",
4506a3501b6SMagnus Damm 	.id		= 4,
4516a3501b6SMagnus Damm 	.dev = {
4526a3501b6SMagnus Damm 		.platform_data	= &tmu4_platform_data,
4536a3501b6SMagnus Damm 	},
4546a3501b6SMagnus Damm 	.resource	= tmu4_resources,
4556a3501b6SMagnus Damm 	.num_resources	= ARRAY_SIZE(tmu4_resources),
456593a0c89SMagnus Damm 	.archdata = {
457593a0c89SMagnus Damm 		.hwblk_id = HWBLK_TMU1,
458593a0c89SMagnus Damm 	},
4596a3501b6SMagnus Damm };
4606a3501b6SMagnus Damm 
4616a3501b6SMagnus Damm static struct sh_timer_config tmu5_platform_data = {
4626a3501b6SMagnus Damm 	.name = "TMU5",
4636a3501b6SMagnus Damm 	.channel_offset = 0x1c,
4646a3501b6SMagnus Damm 	.timer_bit = 2,
4656a3501b6SMagnus Damm 	.clk = "tmu1",
4666a3501b6SMagnus Damm };
4676a3501b6SMagnus Damm 
4686a3501b6SMagnus Damm static struct resource tmu5_resources[] = {
4696a3501b6SMagnus Damm 	[0] = {
4706a3501b6SMagnus Damm 		.name	= "TMU5",
4716a3501b6SMagnus Damm 		.start	= 0xffd90020,
4726a3501b6SMagnus Damm 		.end	= 0xffd9002b,
4736a3501b6SMagnus Damm 		.flags	= IORESOURCE_MEM,
4746a3501b6SMagnus Damm 	},
4756a3501b6SMagnus Damm 	[1] = {
4766a3501b6SMagnus Damm 		.start	= 57,
4776a3501b6SMagnus Damm 		.flags	= IORESOURCE_IRQ,
4786a3501b6SMagnus Damm 	},
4796a3501b6SMagnus Damm };
4806a3501b6SMagnus Damm 
4816a3501b6SMagnus Damm static struct platform_device tmu5_device = {
4826a3501b6SMagnus Damm 	.name		= "sh_tmu",
4836a3501b6SMagnus Damm 	.id		= 5,
4846a3501b6SMagnus Damm 	.dev = {
4856a3501b6SMagnus Damm 		.platform_data	= &tmu5_platform_data,
4866a3501b6SMagnus Damm 	},
4876a3501b6SMagnus Damm 	.resource	= tmu5_resources,
4886a3501b6SMagnus Damm 	.num_resources	= ARRAY_SIZE(tmu5_resources),
489593a0c89SMagnus Damm 	.archdata = {
490593a0c89SMagnus Damm 		.hwblk_id = HWBLK_TMU1,
491593a0c89SMagnus Damm 	},
4926a3501b6SMagnus Damm };
4936a3501b6SMagnus Damm 
494f168dd00SKuninori Morimoto /* JPU */
495f168dd00SKuninori Morimoto static struct uio_info jpu_platform_data = {
496f168dd00SKuninori Morimoto 	.name = "JPU",
497f168dd00SKuninori Morimoto 	.version = "0",
498f168dd00SKuninori Morimoto 	.irq = 27,
499f168dd00SKuninori Morimoto };
500f168dd00SKuninori Morimoto 
501f168dd00SKuninori Morimoto static struct resource jpu_resources[] = {
502f168dd00SKuninori Morimoto 	[0] = {
503f168dd00SKuninori Morimoto 		.name	= "JPU",
504f168dd00SKuninori Morimoto 		.start	= 0xfe980000,
505f168dd00SKuninori Morimoto 		.end	= 0xfe9902d3,
506f168dd00SKuninori Morimoto 		.flags	= IORESOURCE_MEM,
507f168dd00SKuninori Morimoto 	},
508f168dd00SKuninori Morimoto 	[1] = {
509f168dd00SKuninori Morimoto 		/* place holder for contiguous memory */
510f168dd00SKuninori Morimoto 	},
511f168dd00SKuninori Morimoto };
512f168dd00SKuninori Morimoto 
513f168dd00SKuninori Morimoto static struct platform_device jpu_device = {
514f168dd00SKuninori Morimoto 	.name		= "uio_pdrv_genirq",
515f168dd00SKuninori Morimoto 	.id		= 3,
516f168dd00SKuninori Morimoto 	.dev = {
517f168dd00SKuninori Morimoto 		.platform_data	= &jpu_platform_data,
518f168dd00SKuninori Morimoto 	},
519f168dd00SKuninori Morimoto 	.resource	= jpu_resources,
520f168dd00SKuninori Morimoto 	.num_resources	= ARRAY_SIZE(jpu_resources),
521593a0c89SMagnus Damm 	.archdata = {
522593a0c89SMagnus Damm 		.hwblk_id = HWBLK_JPU,
523593a0c89SMagnus Damm 	},
524f168dd00SKuninori Morimoto };
525f168dd00SKuninori Morimoto 
5260207a2efSKuninori Morimoto static struct platform_device *sh7724_devices[] __initdata = {
5276a3395beSPaul Mundt 	&cmt_device,
5286a3501b6SMagnus Damm 	&tmu0_device,
5296a3501b6SMagnus Damm 	&tmu1_device,
5306a3501b6SMagnus Damm 	&tmu2_device,
5316a3501b6SMagnus Damm 	&tmu3_device,
5326a3501b6SMagnus Damm 	&tmu4_device,
5336a3501b6SMagnus Damm 	&tmu5_device,
5340207a2efSKuninori Morimoto 	&sci_device,
5350207a2efSKuninori Morimoto 	&rtc_device,
53640c7e8beSKuninori Morimoto 	&iic0_device,
53740c7e8beSKuninori Morimoto 	&iic1_device,
538cd5b9ef7SKuninori Morimoto 	&vpu_device,
539ad95b78cSKuninori Morimoto 	&veu0_device,
540ad95b78cSKuninori Morimoto 	&veu1_device,
541f168dd00SKuninori Morimoto 	&jpu_device,
5420207a2efSKuninori Morimoto };
5430207a2efSKuninori Morimoto 
5440207a2efSKuninori Morimoto static int __init sh7724_devices_setup(void)
5450207a2efSKuninori Morimoto {
546cd5b9ef7SKuninori Morimoto 	platform_resource_setup_memory(&vpu_device, "vpu", 2 << 20);
547ad95b78cSKuninori Morimoto 	platform_resource_setup_memory(&veu0_device, "veu0", 2 << 20);
548ad95b78cSKuninori Morimoto 	platform_resource_setup_memory(&veu1_device, "veu1", 2 << 20);
549f168dd00SKuninori Morimoto 	platform_resource_setup_memory(&jpu_device,  "jpu",  2 << 20);
5500207a2efSKuninori Morimoto 
5510207a2efSKuninori Morimoto 	return platform_add_devices(sh7724_devices,
5520207a2efSKuninori Morimoto 				    ARRAY_SIZE(sh7724_devices));
5530207a2efSKuninori Morimoto }
554955c9863SMagnus Damm arch_initcall(sh7724_devices_setup);
5550207a2efSKuninori Morimoto 
5568fb2bae4SPaul Mundt static struct platform_device *sh7724_early_devices[] __initdata = {
5578fb2bae4SPaul Mundt 	&cmt_device,
5586a3501b6SMagnus Damm 	&tmu0_device,
5596a3501b6SMagnus Damm 	&tmu1_device,
5606a3501b6SMagnus Damm 	&tmu2_device,
5616a3501b6SMagnus Damm 	&tmu3_device,
5626a3501b6SMagnus Damm 	&tmu4_device,
5636a3501b6SMagnus Damm 	&tmu5_device,
5648fb2bae4SPaul Mundt };
5658fb2bae4SPaul Mundt 
5668fb2bae4SPaul Mundt void __init plat_early_device_setup(void)
5678fb2bae4SPaul Mundt {
5688fb2bae4SPaul Mundt 	early_platform_add_devices(sh7724_early_devices,
5698fb2bae4SPaul Mundt 				   ARRAY_SIZE(sh7724_early_devices));
5708fb2bae4SPaul Mundt }
5718fb2bae4SPaul Mundt 
572b4bd9eb0SKuninori Morimoto #define RAMCR_CACHE_L2FC	0x0002
573b4bd9eb0SKuninori Morimoto #define RAMCR_CACHE_L2E		0x0001
574b4bd9eb0SKuninori Morimoto #define L2_CACHE_ENABLE		(RAMCR_CACHE_L2E|RAMCR_CACHE_L2FC)
575b4bd9eb0SKuninori Morimoto void __uses_jump_to_uncached l2_cache_init(void)
576b4bd9eb0SKuninori Morimoto {
577b4bd9eb0SKuninori Morimoto 	/* Enable L2 cache */
578b4bd9eb0SKuninori Morimoto 	ctrl_outl(L2_CACHE_ENABLE, RAMCR);
579b4bd9eb0SKuninori Morimoto }
580b4bd9eb0SKuninori Morimoto 
5810207a2efSKuninori Morimoto enum {
5820207a2efSKuninori Morimoto 	UNUSED = 0,
5830207a2efSKuninori Morimoto 
5840207a2efSKuninori Morimoto 	/* interrupt sources */
5850207a2efSKuninori Morimoto 	IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
5860207a2efSKuninori Morimoto 	HUDI,
5870207a2efSKuninori Morimoto 	DMAC1A_DEI0, DMAC1A_DEI1, DMAC1A_DEI2, DMAC1A_DEI3,
588c5eeff1fSKuninori Morimoto 	_2DG_TRI, _2DG_INI, _2DG_CEI,
5890207a2efSKuninori Morimoto 	DMAC0A_DEI0, DMAC0A_DEI1, DMAC0A_DEI2, DMAC0A_DEI3,
590c5eeff1fSKuninori Morimoto 	VIO_CEU0, VIO_BEU0, VIO_VEU1, VIO_VOU,
591c5eeff1fSKuninori Morimoto 	SCIFA3,
592c5eeff1fSKuninori Morimoto 	VPU,
593c5eeff1fSKuninori Morimoto 	TPU,
594c5eeff1fSKuninori Morimoto 	CEU1,
595c5eeff1fSKuninori Morimoto 	BEU1,
596c5eeff1fSKuninori Morimoto 	USB0, USB1,
5970207a2efSKuninori Morimoto 	ATAPI,
5980207a2efSKuninori Morimoto 	RTC_ATI, RTC_PRI, RTC_CUI,
5990207a2efSKuninori Morimoto 	DMAC1B_DEI4, DMAC1B_DEI5, DMAC1B_DADERR,
6000207a2efSKuninori Morimoto 	DMAC0B_DEI4, DMAC0B_DEI5, DMAC0B_DADERR,
601c5eeff1fSKuninori Morimoto 	KEYSC,
6020207a2efSKuninori Morimoto 	SCIF_SCIF0, SCIF_SCIF1, SCIF_SCIF2,
603c5eeff1fSKuninori Morimoto 	VEU0,
6040207a2efSKuninori Morimoto 	MSIOF_MSIOFI0, MSIOF_MSIOFI1,
6050207a2efSKuninori Morimoto 	SPU_SPUI0, SPU_SPUI1,
606c5eeff1fSKuninori Morimoto 	SCIFA4,
607c5eeff1fSKuninori Morimoto 	ICB,
6080207a2efSKuninori Morimoto 	ETHI,
6090207a2efSKuninori Morimoto 	I2C1_ALI, I2C1_TACKI, I2C1_WAITI, I2C1_DTEI,
6100207a2efSKuninori Morimoto 	I2C0_ALI, I2C0_TACKI, I2C0_WAITI, I2C0_DTEI,
611c5eeff1fSKuninori Morimoto 	SDHI0_SDHII0, SDHI0_SDHII1, SDHI0_SDHII2, SDHI0_SDHII3,
612c5eeff1fSKuninori Morimoto 	CMT,
613c5eeff1fSKuninori Morimoto 	TSIF,
614c5eeff1fSKuninori Morimoto 	FSI,
615c5eeff1fSKuninori Morimoto 	SCIFA5,
6160207a2efSKuninori Morimoto 	TMU0_TUNI0, TMU0_TUNI1, TMU0_TUNI2,
617c5eeff1fSKuninori Morimoto 	IRDA,
6180207a2efSKuninori Morimoto 	SDHI1_SDHII0, SDHI1_SDHII1, SDHI1_SDHII2,
619c5eeff1fSKuninori Morimoto 	JPU,
620c5eeff1fSKuninori Morimoto 	_2DDMAC,
621c5eeff1fSKuninori Morimoto 	MMC_MMC2I, MMC_MMC3I,
622c5eeff1fSKuninori Morimoto 	LCDC,
6230207a2efSKuninori Morimoto 	TMU1_TUNI0, TMU1_TUNI1, TMU1_TUNI2,
6240207a2efSKuninori Morimoto 
6250207a2efSKuninori Morimoto 	/* interrupt groups */
626c5eeff1fSKuninori Morimoto 	DMAC1A, _2DG, DMAC0A, VIO, USB, RTC,
627c5eeff1fSKuninori Morimoto 	DMAC1B, DMAC0B, I2C0, I2C1, SDHI0, SDHI1, SPU, MMCIF,
6280207a2efSKuninori Morimoto };
6290207a2efSKuninori Morimoto 
6300207a2efSKuninori Morimoto static struct intc_vect vectors[] __initdata = {
6310207a2efSKuninori Morimoto 	INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
6320207a2efSKuninori Morimoto 	INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
6330207a2efSKuninori Morimoto 	INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
6340207a2efSKuninori Morimoto 	INTC_VECT(IRQ6, 0x6c0), INTC_VECT(IRQ7, 0x6e0),
6350207a2efSKuninori Morimoto 
6360207a2efSKuninori Morimoto 	INTC_VECT(DMAC1A_DEI0, 0x700),
6370207a2efSKuninori Morimoto 	INTC_VECT(DMAC1A_DEI1, 0x720),
6380207a2efSKuninori Morimoto 	INTC_VECT(DMAC1A_DEI2, 0x740),
6390207a2efSKuninori Morimoto 	INTC_VECT(DMAC1A_DEI3, 0x760),
6400207a2efSKuninori Morimoto 
6410207a2efSKuninori Morimoto 	INTC_VECT(_2DG_TRI, 0x780),
6420207a2efSKuninori Morimoto 	INTC_VECT(_2DG_INI, 0x7A0),
6430207a2efSKuninori Morimoto 	INTC_VECT(_2DG_CEI, 0x7C0),
6440207a2efSKuninori Morimoto 
6450207a2efSKuninori Morimoto 	INTC_VECT(DMAC0A_DEI0, 0x800),
6460207a2efSKuninori Morimoto 	INTC_VECT(DMAC0A_DEI1, 0x820),
6470207a2efSKuninori Morimoto 	INTC_VECT(DMAC0A_DEI2, 0x840),
6480207a2efSKuninori Morimoto 	INTC_VECT(DMAC0A_DEI3, 0x860),
6490207a2efSKuninori Morimoto 
650c5eeff1fSKuninori Morimoto 	INTC_VECT(VIO_CEU0, 0x880),
651c5eeff1fSKuninori Morimoto 	INTC_VECT(VIO_BEU0, 0x8A0),
652c5eeff1fSKuninori Morimoto 	INTC_VECT(VIO_VEU1, 0x8C0),
653c5eeff1fSKuninori Morimoto 	INTC_VECT(VIO_VOU,  0x8E0),
6540207a2efSKuninori Morimoto 
655c5eeff1fSKuninori Morimoto 	INTC_VECT(SCIFA3, 0x900),
656c5eeff1fSKuninori Morimoto 	INTC_VECT(VPU,    0x980),
657c5eeff1fSKuninori Morimoto 	INTC_VECT(TPU,    0x9A0),
658c5eeff1fSKuninori Morimoto 	INTC_VECT(CEU1,   0x9E0),
659c5eeff1fSKuninori Morimoto 	INTC_VECT(BEU1,   0xA00),
660c5eeff1fSKuninori Morimoto 	INTC_VECT(USB0,   0xA20),
661c5eeff1fSKuninori Morimoto 	INTC_VECT(USB1,   0xA40),
6620207a2efSKuninori Morimoto 	INTC_VECT(ATAPI,  0xA60),
6630207a2efSKuninori Morimoto 
6640207a2efSKuninori Morimoto 	INTC_VECT(RTC_ATI, 0xA80),
6650207a2efSKuninori Morimoto 	INTC_VECT(RTC_PRI, 0xAA0),
6660207a2efSKuninori Morimoto 	INTC_VECT(RTC_CUI, 0xAC0),
6670207a2efSKuninori Morimoto 
6680207a2efSKuninori Morimoto 	INTC_VECT(DMAC1B_DEI4, 0xB00),
6690207a2efSKuninori Morimoto 	INTC_VECT(DMAC1B_DEI5, 0xB20),
6700207a2efSKuninori Morimoto 	INTC_VECT(DMAC1B_DADERR, 0xB40),
6710207a2efSKuninori Morimoto 
6720207a2efSKuninori Morimoto 	INTC_VECT(DMAC0B_DEI4, 0xB80),
6730207a2efSKuninori Morimoto 	INTC_VECT(DMAC0B_DEI5, 0xBA0),
6740207a2efSKuninori Morimoto 	INTC_VECT(DMAC0B_DADERR, 0xBC0),
6750207a2efSKuninori Morimoto 
676c5eeff1fSKuninori Morimoto 	INTC_VECT(KEYSC,      0xBE0),
6770207a2efSKuninori Morimoto 	INTC_VECT(SCIF_SCIF0, 0xC00),
6780207a2efSKuninori Morimoto 	INTC_VECT(SCIF_SCIF1, 0xC20),
6790207a2efSKuninori Morimoto 	INTC_VECT(SCIF_SCIF2, 0xC40),
680c5eeff1fSKuninori Morimoto 	INTC_VECT(VEU0,       0xC60),
6810207a2efSKuninori Morimoto 	INTC_VECT(MSIOF_MSIOFI0, 0xC80),
6820207a2efSKuninori Morimoto 	INTC_VECT(MSIOF_MSIOFI1, 0xCA0),
6830207a2efSKuninori Morimoto 	INTC_VECT(SPU_SPUI0, 0xCC0),
6840207a2efSKuninori Morimoto 	INTC_VECT(SPU_SPUI1, 0xCE0),
685c5eeff1fSKuninori Morimoto 	INTC_VECT(SCIFA4,    0xD00),
6860207a2efSKuninori Morimoto 
687c5eeff1fSKuninori Morimoto 	INTC_VECT(ICB,  0xD20),
6880207a2efSKuninori Morimoto 	INTC_VECT(ETHI, 0xD60),
6890207a2efSKuninori Morimoto 
6900207a2efSKuninori Morimoto 	INTC_VECT(I2C1_ALI, 0xD80),
6910207a2efSKuninori Morimoto 	INTC_VECT(I2C1_TACKI, 0xDA0),
6920207a2efSKuninori Morimoto 	INTC_VECT(I2C1_WAITI, 0xDC0),
6930207a2efSKuninori Morimoto 	INTC_VECT(I2C1_DTEI, 0xDE0),
6940207a2efSKuninori Morimoto 
6950207a2efSKuninori Morimoto 	INTC_VECT(I2C0_ALI, 0xE00),
6960207a2efSKuninori Morimoto 	INTC_VECT(I2C0_TACKI, 0xE20),
6970207a2efSKuninori Morimoto 	INTC_VECT(I2C0_WAITI, 0xE40),
6980207a2efSKuninori Morimoto 	INTC_VECT(I2C0_DTEI, 0xE60),
6990207a2efSKuninori Morimoto 
7000207a2efSKuninori Morimoto 	INTC_VECT(SDHI0_SDHII0, 0xE80),
7010207a2efSKuninori Morimoto 	INTC_VECT(SDHI0_SDHII1, 0xEA0),
7020207a2efSKuninori Morimoto 	INTC_VECT(SDHI0_SDHII2, 0xEC0),
703c5eeff1fSKuninori Morimoto 	INTC_VECT(SDHI0_SDHII3, 0xEE0),
7040207a2efSKuninori Morimoto 
705c5eeff1fSKuninori Morimoto 	INTC_VECT(CMT,    0xF00),
706c5eeff1fSKuninori Morimoto 	INTC_VECT(TSIF,   0xF20),
707c5eeff1fSKuninori Morimoto 	INTC_VECT(FSI,    0xF80),
708c5eeff1fSKuninori Morimoto 	INTC_VECT(SCIFA5, 0xFA0),
7090207a2efSKuninori Morimoto 
7100207a2efSKuninori Morimoto 	INTC_VECT(TMU0_TUNI0, 0x400),
7110207a2efSKuninori Morimoto 	INTC_VECT(TMU0_TUNI1, 0x420),
7120207a2efSKuninori Morimoto 	INTC_VECT(TMU0_TUNI2, 0x440),
7130207a2efSKuninori Morimoto 
714c5eeff1fSKuninori Morimoto 	INTC_VECT(IRDA,    0x480),
7150207a2efSKuninori Morimoto 
7160207a2efSKuninori Morimoto 	INTC_VECT(SDHI1_SDHII0, 0x4E0),
7170207a2efSKuninori Morimoto 	INTC_VECT(SDHI1_SDHII1, 0x500),
7180207a2efSKuninori Morimoto 	INTC_VECT(SDHI1_SDHII2, 0x520),
7190207a2efSKuninori Morimoto 
720c5eeff1fSKuninori Morimoto 	INTC_VECT(JPU, 0x560),
721c5eeff1fSKuninori Morimoto 	INTC_VECT(_2DDMAC, 0x4A0),
7220207a2efSKuninori Morimoto 
723c5eeff1fSKuninori Morimoto 	INTC_VECT(MMC_MMC2I, 0x5A0),
724c5eeff1fSKuninori Morimoto 	INTC_VECT(MMC_MMC3I, 0x5C0),
7250207a2efSKuninori Morimoto 
726c5eeff1fSKuninori Morimoto 	INTC_VECT(LCDC, 0xF40),
7270207a2efSKuninori Morimoto 
7280207a2efSKuninori Morimoto 	INTC_VECT(TMU1_TUNI0, 0x920),
7290207a2efSKuninori Morimoto 	INTC_VECT(TMU1_TUNI1, 0x940),
7300207a2efSKuninori Morimoto 	INTC_VECT(TMU1_TUNI2, 0x960),
7310207a2efSKuninori Morimoto };
7320207a2efSKuninori Morimoto 
7330207a2efSKuninori Morimoto static struct intc_group groups[] __initdata = {
7340207a2efSKuninori Morimoto 	INTC_GROUP(DMAC1A, DMAC1A_DEI0, DMAC1A_DEI1, DMAC1A_DEI2, DMAC1A_DEI3),
735c5eeff1fSKuninori Morimoto 	INTC_GROUP(_2DG, _2DG_TRI, _2DG_INI, _2DG_CEI),
7360207a2efSKuninori Morimoto 	INTC_GROUP(DMAC0A, DMAC0A_DEI0, DMAC0A_DEI1, DMAC0A_DEI2, DMAC0A_DEI3),
737c5eeff1fSKuninori Morimoto 	INTC_GROUP(VIO, VIO_CEU0, VIO_BEU0, VIO_VEU1, VIO_VOU),
738c5eeff1fSKuninori Morimoto 	INTC_GROUP(USB, USB0, USB1),
7390207a2efSKuninori Morimoto 	INTC_GROUP(RTC, RTC_ATI, RTC_PRI, RTC_CUI),
7400207a2efSKuninori Morimoto 	INTC_GROUP(DMAC1B, DMAC1B_DEI4, DMAC1B_DEI5, DMAC1B_DADERR),
7410207a2efSKuninori Morimoto 	INTC_GROUP(DMAC0B, DMAC0B_DEI4, DMAC0B_DEI5, DMAC0B_DADERR),
7420207a2efSKuninori Morimoto 	INTC_GROUP(I2C0, I2C0_ALI, I2C0_TACKI, I2C0_WAITI, I2C0_DTEI),
7430207a2efSKuninori Morimoto 	INTC_GROUP(I2C1, I2C1_ALI, I2C1_TACKI, I2C1_WAITI, I2C1_DTEI),
744c5eeff1fSKuninori Morimoto 	INTC_GROUP(SDHI0, SDHI0_SDHII0, SDHI0_SDHII1, SDHI0_SDHII2, SDHI0_SDHII3),
7450207a2efSKuninori Morimoto 	INTC_GROUP(SDHI1, SDHI1_SDHII0, SDHI1_SDHII1, SDHI1_SDHII2),
7460207a2efSKuninori Morimoto 	INTC_GROUP(SPU, SPU_SPUI0, SPU_SPUI1),
747c5eeff1fSKuninori Morimoto 	INTC_GROUP(MMCIF, MMC_MMC2I, MMC_MMC3I),
7480207a2efSKuninori Morimoto };
7490207a2efSKuninori Morimoto 
7500207a2efSKuninori Morimoto static struct intc_mask_reg mask_registers[] __initdata = {
7510207a2efSKuninori Morimoto 	{ 0xa4080080, 0xa40800c0, 8, /* IMR0 / IMCR0 */
7520207a2efSKuninori Morimoto 	  { 0, TMU1_TUNI2, TMU1_TUNI1, TMU1_TUNI0,
753c5eeff1fSKuninori Morimoto 	    0, SDHI1_SDHII2, SDHI1_SDHII1, SDHI1_SDHII0 } },
7540207a2efSKuninori Morimoto 	{ 0xa4080084, 0xa40800c4, 8, /* IMR1 / IMCR1 */
755c5eeff1fSKuninori Morimoto 	  { VIO_VOU, VIO_VEU1, VIO_BEU0, VIO_CEU0,
7560207a2efSKuninori Morimoto 	    DMAC0A_DEI3, DMAC0A_DEI2, DMAC0A_DEI1, DMAC0A_DEI0 } },
7570207a2efSKuninori Morimoto 	{ 0xa4080088, 0xa40800c8, 8, /* IMR2 / IMCR2 */
758c5eeff1fSKuninori Morimoto 	  { 0, 0, 0, VPU, ATAPI, ETHI, 0, SCIFA3 } },
7590207a2efSKuninori Morimoto 	{ 0xa408008c, 0xa40800cc, 8, /* IMR3 / IMCR3 */
7600207a2efSKuninori Morimoto 	  { DMAC1A_DEI3, DMAC1A_DEI2, DMAC1A_DEI1, DMAC1A_DEI0,
761c5eeff1fSKuninori Morimoto 	    SPU_SPUI1, SPU_SPUI0, BEU1, IRDA } },
7620207a2efSKuninori Morimoto 	{ 0xa4080090, 0xa40800d0, 8, /* IMR4 / IMCR4 */
7630207a2efSKuninori Morimoto 	  { 0, TMU0_TUNI2, TMU0_TUNI1, TMU0_TUNI0,
764c5eeff1fSKuninori Morimoto 	    JPU, 0, 0, LCDC } },
7650207a2efSKuninori Morimoto 	{ 0xa4080094, 0xa40800d4, 8, /* IMR5 / IMCR5 */
766c5eeff1fSKuninori Morimoto 	  { KEYSC, DMAC0B_DADERR, DMAC0B_DEI5, DMAC0B_DEI4,
767c5eeff1fSKuninori Morimoto 	    VEU0, SCIF_SCIF2, SCIF_SCIF1, SCIF_SCIF0 } },
7680207a2efSKuninori Morimoto 	{ 0xa4080098, 0xa40800d8, 8, /* IMR6 / IMCR6 */
769c5eeff1fSKuninori Morimoto 	  { 0, 0, ICB, SCIFA4,
770c5eeff1fSKuninori Morimoto 	    CEU1, 0, MSIOF_MSIOFI1, MSIOF_MSIOFI0 } },
7710207a2efSKuninori Morimoto 	{ 0xa408009c, 0xa40800dc, 8, /* IMR7 / IMCR7 */
7720207a2efSKuninori Morimoto 	  { I2C0_DTEI, I2C0_WAITI, I2C0_TACKI, I2C0_ALI,
7730207a2efSKuninori Morimoto 	    I2C1_DTEI, I2C1_WAITI, I2C1_TACKI, I2C1_ALI } },
7740207a2efSKuninori Morimoto 	{ 0xa40800a0, 0xa40800e0, 8, /* IMR8 / IMCR8 */
775c5eeff1fSKuninori Morimoto 	  { SDHI0_SDHII3, SDHI0_SDHII2, SDHI0_SDHII1, SDHI0_SDHII0,
776c5eeff1fSKuninori Morimoto 	    0, 0, SCIFA5, FSI } },
7770207a2efSKuninori Morimoto 	{ 0xa40800a4, 0xa40800e4, 8, /* IMR9 / IMCR9 */
778c5eeff1fSKuninori Morimoto 	  { 0, 0, 0, CMT, 0, USB1, USB0, 0 } },
7790207a2efSKuninori Morimoto 	{ 0xa40800a8, 0xa40800e8, 8, /* IMR10 / IMCR10 */
7800207a2efSKuninori Morimoto 	  { 0, DMAC1B_DADERR, DMAC1B_DEI5, DMAC1B_DEI4,
781c5eeff1fSKuninori Morimoto 	    0, RTC_CUI, RTC_PRI, RTC_ATI } },
7820207a2efSKuninori Morimoto 	{ 0xa40800ac, 0xa40800ec, 8, /* IMR11 / IMCR11 */
783c5eeff1fSKuninori Morimoto 	  { 0, _2DG_CEI, _2DG_INI, _2DG_TRI,
784c5eeff1fSKuninori Morimoto 	    0, TPU, 0, TSIF } },
7850207a2efSKuninori Morimoto 	{ 0xa40800b0, 0xa40800f0, 8, /* IMR12 / IMCR12 */
786c5eeff1fSKuninori Morimoto 	  { 0, 0, MMC_MMC3I, MMC_MMC2I, 0, 0, 0, _2DDMAC } },
7870207a2efSKuninori Morimoto 	{ 0xa4140044, 0xa4140064, 8, /* INTMSK00 / INTMSKCLR00 */
7880207a2efSKuninori Morimoto 	  { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
7890207a2efSKuninori Morimoto };
7900207a2efSKuninori Morimoto 
7910207a2efSKuninori Morimoto static struct intc_prio_reg prio_registers[] __initdata = {
7920207a2efSKuninori Morimoto 	{ 0xa4080000, 0, 16, 4, /* IPRA */ { TMU0_TUNI0, TMU0_TUNI1,
793c5eeff1fSKuninori Morimoto 					     TMU0_TUNI2, IRDA } },
794c5eeff1fSKuninori Morimoto 	{ 0xa4080004, 0, 16, 4, /* IPRB */ { JPU, LCDC, DMAC1A, BEU1 } },
7950207a2efSKuninori Morimoto 	{ 0xa4080008, 0, 16, 4, /* IPRC */ { TMU1_TUNI0, TMU1_TUNI1,
7960207a2efSKuninori Morimoto 					     TMU1_TUNI2, SPU } },
797c5eeff1fSKuninori Morimoto 	{ 0xa408000c, 0, 16, 4, /* IPRD */ { 0, MMCIF, 0, ATAPI } },
798c5eeff1fSKuninori Morimoto 	{ 0xa4080010, 0, 16, 4, /* IPRE */ { DMAC0A, VIO, SCIFA3, VPU } },
799c5eeff1fSKuninori Morimoto 	{ 0xa4080014, 0, 16, 4, /* IPRF */ { KEYSC, DMAC0B, USB, CMT } },
8000207a2efSKuninori Morimoto 	{ 0xa4080018, 0, 16, 4, /* IPRG */ { SCIF_SCIF0, SCIF_SCIF1,
801c5eeff1fSKuninori Morimoto 					     SCIF_SCIF2, VEU0 } },
8020207a2efSKuninori Morimoto 	{ 0xa408001c, 0, 16, 4, /* IPRH */ { MSIOF_MSIOFI0, MSIOF_MSIOFI1,
8030207a2efSKuninori Morimoto 					     I2C1, I2C0 } },
804c5eeff1fSKuninori Morimoto 	{ 0xa4080020, 0, 16, 4, /* IPRI */ { SCIFA4, ICB, TSIF, _2DG } },
805c5eeff1fSKuninori Morimoto 	{ 0xa4080024, 0, 16, 4, /* IPRJ */ { CEU1, ETHI, FSI, SDHI1 } },
806c5eeff1fSKuninori Morimoto 	{ 0xa4080028, 0, 16, 4, /* IPRK */ { RTC, DMAC1B, 0, SDHI0 } },
807c5eeff1fSKuninori Morimoto 	{ 0xa408002c, 0, 16, 4, /* IPRL */ { SCIFA5, 0, TPU, _2DDMAC } },
8080207a2efSKuninori Morimoto 	{ 0xa4140010, 0, 32, 4, /* INTPRI00 */
8090207a2efSKuninori Morimoto 	  { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
8100207a2efSKuninori Morimoto };
8110207a2efSKuninori Morimoto 
8120207a2efSKuninori Morimoto static struct intc_sense_reg sense_registers[] __initdata = {
8130207a2efSKuninori Morimoto 	{ 0xa414001c, 16, 2, /* ICR1 */
8140207a2efSKuninori Morimoto 	  { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
8150207a2efSKuninori Morimoto };
8160207a2efSKuninori Morimoto 
8170207a2efSKuninori Morimoto static struct intc_mask_reg ack_registers[] __initdata = {
8180207a2efSKuninori Morimoto 	{ 0xa4140024, 0, 8, /* INTREQ00 */
8190207a2efSKuninori Morimoto 	  { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
8200207a2efSKuninori Morimoto };
8210207a2efSKuninori Morimoto 
8220207a2efSKuninori Morimoto static DECLARE_INTC_DESC_ACK(intc_desc, "sh7724", vectors, groups,
8230207a2efSKuninori Morimoto 			     mask_registers, prio_registers, sense_registers,
8240207a2efSKuninori Morimoto 			     ack_registers);
8250207a2efSKuninori Morimoto 
8260207a2efSKuninori Morimoto void __init plat_irq_setup(void)
8270207a2efSKuninori Morimoto {
8280207a2efSKuninori Morimoto 	register_intc_controller(&intc_desc);
8290207a2efSKuninori Morimoto }
830