blob: 311878391e188f64dbb5fc46d737782e7e4666ae [file] [log] [blame]
Magnus Damm2b7eda62010-02-05 11:14:58 +00001/*
2 * sh7372 processor support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/platform_device.h>
Magnus Damm3b7b7052012-03-28 15:53:40 +090025#include <linux/of_platform.h>
Magnus Damm68224712011-04-28 03:21:00 +000026#include <linux/uio_driver.h>
Magnus Damm2b7eda62010-02-05 11:14:58 +000027#include <linux/delay.h>
28#include <linux/input.h>
29#include <linux/io.h>
30#include <linux/serial_sci.h>
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +000031#include <linux/sh_dma.h>
Magnus Damm2b7eda62010-02-05 11:14:58 +000032#include <linux/sh_intc.h>
33#include <linux/sh_timer.h>
Rafael J. Wysocki111058c2011-08-14 13:35:39 +020034#include <linux/pm_domain.h>
Arnd Bergmann426f1af2012-03-22 22:02:16 +000035#include <linux/dma-mapping.h>
Hideki EIRAKU3cfb8432013-01-21 19:54:27 +090036#include <linux/platform_data/sh_ipmmu.h>
Kuninori Morimotoc317fc52012-06-25 03:43:19 -070037#include <mach/dma-register.h>
Rob Herring250a2722012-01-03 16:57:33 -060038#include <mach/irqs.h>
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +000039#include <mach/sh7372.h>
Magnus Damm5d7220ec2012-02-29 21:37:19 +090040#include <mach/common.h>
41#include <asm/mach/map.h>
Magnus Damm2b7eda62010-02-05 11:14:58 +000042#include <asm/mach-types.h>
43#include <asm/mach/arch.h>
Magnus Damm17254bf2012-03-06 17:36:37 +090044#include <asm/mach/time.h>
Magnus Damm2b7eda62010-02-05 11:14:58 +000045
Magnus Damm5d7220ec2012-02-29 21:37:19 +090046static struct map_desc sh7372_io_desc[] __initdata = {
47 /* create a 1:1 entity map for 0xe6xxxxxx
48 * used by CPGA, INTC and PFC.
49 */
50 {
51 .virtual = 0xe6000000,
52 .pfn = __phys_to_pfn(0xe6000000),
53 .length = 256 << 20,
54 .type = MT_DEVICE_NONSHARED
55 },
56};
57
58void __init sh7372_map_io(void)
59{
60 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc));
61}
Magnus Damm2b7eda62010-02-05 11:14:58 +000062
Laurent Pinchart5967fe02012-12-15 23:51:27 +010063/* PFC */
64static struct resource sh7372_pfc_resources[] = {
65 [0] = {
66 .start = 0xe6050000,
67 .end = 0xe6057fff,
68 .flags = IORESOURCE_MEM,
69 },
70 [1] = {
71 .start = 0xe605800c,
72 .end = 0xe6058027,
73 .flags = IORESOURCE_MEM,
74 }
75};
76
77static struct platform_device sh7372_pfc_device = {
78 .name = "pfc-sh7372",
79 .id = -1,
80 .resource = sh7372_pfc_resources,
81 .num_resources = ARRAY_SIZE(sh7372_pfc_resources),
82};
83
84void __init sh7372_pinmux_init(void)
85{
86 platform_device_register(&sh7372_pfc_device);
87}
88
Magnus Damm33c96072010-05-20 14:41:00 +000089/* SCIFA0 */
Magnus Damm2b7eda62010-02-05 11:14:58 +000090static struct plat_sci_port scif0_platform_data = {
91 .mapbase = 0xe6c40000,
92 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +090093 .scscr = SCSCR_RE | SCSCR_TE,
94 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +000095 .type = PORT_SCIFA,
Magnus Damm33c96072010-05-20 14:41:00 +000096 .irqs = { evt2irq(0x0c00), evt2irq(0x0c00),
97 evt2irq(0x0c00), evt2irq(0x0c00) },
Magnus Damm2b7eda62010-02-05 11:14:58 +000098};
99
100static struct platform_device scif0_device = {
101 .name = "sh-sci",
102 .id = 0,
103 .dev = {
104 .platform_data = &scif0_platform_data,
105 },
106};
107
Magnus Damm33c96072010-05-20 14:41:00 +0000108/* SCIFA1 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000109static struct plat_sci_port scif1_platform_data = {
110 .mapbase = 0xe6c50000,
111 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +0900112 .scscr = SCSCR_RE | SCSCR_TE,
113 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +0000114 .type = PORT_SCIFA,
Magnus Damm33c96072010-05-20 14:41:00 +0000115 .irqs = { evt2irq(0x0c20), evt2irq(0x0c20),
116 evt2irq(0x0c20), evt2irq(0x0c20) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000117};
118
119static struct platform_device scif1_device = {
120 .name = "sh-sci",
121 .id = 1,
122 .dev = {
123 .platform_data = &scif1_platform_data,
124 },
125};
126
Magnus Damm33c96072010-05-20 14:41:00 +0000127/* SCIFA2 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000128static struct plat_sci_port scif2_platform_data = {
129 .mapbase = 0xe6c60000,
130 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +0900131 .scscr = SCSCR_RE | SCSCR_TE,
132 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +0000133 .type = PORT_SCIFA,
Magnus Damm33c96072010-05-20 14:41:00 +0000134 .irqs = { evt2irq(0x0c40), evt2irq(0x0c40),
135 evt2irq(0x0c40), evt2irq(0x0c40) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000136};
137
138static struct platform_device scif2_device = {
139 .name = "sh-sci",
140 .id = 2,
141 .dev = {
142 .platform_data = &scif2_platform_data,
143 },
144};
145
Magnus Damm33c96072010-05-20 14:41:00 +0000146/* SCIFA3 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000147static struct plat_sci_port scif3_platform_data = {
148 .mapbase = 0xe6c70000,
149 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +0900150 .scscr = SCSCR_RE | SCSCR_TE,
151 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +0000152 .type = PORT_SCIFA,
Magnus Damm33c96072010-05-20 14:41:00 +0000153 .irqs = { evt2irq(0x0c60), evt2irq(0x0c60),
154 evt2irq(0x0c60), evt2irq(0x0c60) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000155};
156
157static struct platform_device scif3_device = {
158 .name = "sh-sci",
159 .id = 3,
160 .dev = {
161 .platform_data = &scif3_platform_data,
162 },
163};
164
Magnus Damm33c96072010-05-20 14:41:00 +0000165/* SCIFA4 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000166static struct plat_sci_port scif4_platform_data = {
167 .mapbase = 0xe6c80000,
168 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +0900169 .scscr = SCSCR_RE | SCSCR_TE,
170 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +0000171 .type = PORT_SCIFA,
Magnus Damm33c96072010-05-20 14:41:00 +0000172 .irqs = { evt2irq(0x0d20), evt2irq(0x0d20),
173 evt2irq(0x0d20), evt2irq(0x0d20) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000174};
175
176static struct platform_device scif4_device = {
177 .name = "sh-sci",
178 .id = 4,
179 .dev = {
180 .platform_data = &scif4_platform_data,
181 },
182};
183
Magnus Damm33c96072010-05-20 14:41:00 +0000184/* SCIFA5 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000185static struct plat_sci_port scif5_platform_data = {
186 .mapbase = 0xe6cb0000,
187 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +0900188 .scscr = SCSCR_RE | SCSCR_TE,
189 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +0000190 .type = PORT_SCIFA,
Magnus Damm33c96072010-05-20 14:41:00 +0000191 .irqs = { evt2irq(0x0d40), evt2irq(0x0d40),
192 evt2irq(0x0d40), evt2irq(0x0d40) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000193};
194
195static struct platform_device scif5_device = {
196 .name = "sh-sci",
197 .id = 5,
198 .dev = {
199 .platform_data = &scif5_platform_data,
200 },
201};
202
Magnus Damm33c96072010-05-20 14:41:00 +0000203/* SCIFB */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000204static struct plat_sci_port scif6_platform_data = {
205 .mapbase = 0xe6c30000,
206 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +0900207 .scscr = SCSCR_RE | SCSCR_TE,
208 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +0000209 .type = PORT_SCIFB,
Magnus Damm33c96072010-05-20 14:41:00 +0000210 .irqs = { evt2irq(0x0d60), evt2irq(0x0d60),
211 evt2irq(0x0d60), evt2irq(0x0d60) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000212};
213
214static struct platform_device scif6_device = {
215 .name = "sh-sci",
216 .id = 6,
217 .dev = {
218 .platform_data = &scif6_platform_data,
219 },
220};
221
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000222/* CMT */
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000223static struct sh_timer_config cmt2_platform_data = {
224 .name = "CMT2",
225 .channel_offset = 0x40,
226 .timer_bit = 5,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000227 .clockevent_rating = 125,
228 .clocksource_rating = 125,
229};
230
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000231static struct resource cmt2_resources[] = {
Magnus Damm2b7eda62010-02-05 11:14:58 +0000232 [0] = {
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000233 .name = "CMT2",
234 .start = 0xe6130040,
235 .end = 0xe613004b,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000236 .flags = IORESOURCE_MEM,
237 },
238 [1] = {
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000239 .start = evt2irq(0x0b80), /* CMT2 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000240 .flags = IORESOURCE_IRQ,
241 },
242};
243
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000244static struct platform_device cmt2_device = {
Magnus Damm2b7eda62010-02-05 11:14:58 +0000245 .name = "sh_cmt",
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000246 .id = 2,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000247 .dev = {
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000248 .platform_data = &cmt2_platform_data,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000249 },
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000250 .resource = cmt2_resources,
251 .num_resources = ARRAY_SIZE(cmt2_resources),
Magnus Damm2b7eda62010-02-05 11:14:58 +0000252};
253
Magnus Dammc6c049e2010-10-14 06:57:25 +0000254/* TMU */
255static struct sh_timer_config tmu00_platform_data = {
256 .name = "TMU00",
257 .channel_offset = 0x4,
258 .timer_bit = 0,
259 .clockevent_rating = 200,
260};
261
262static struct resource tmu00_resources[] = {
263 [0] = {
264 .name = "TMU00",
265 .start = 0xfff60008,
266 .end = 0xfff60013,
267 .flags = IORESOURCE_MEM,
268 },
269 [1] = {
270 .start = intcs_evt2irq(0xe80), /* TMU_TUNI0 */
271 .flags = IORESOURCE_IRQ,
272 },
273};
274
275static struct platform_device tmu00_device = {
276 .name = "sh_tmu",
277 .id = 0,
278 .dev = {
279 .platform_data = &tmu00_platform_data,
280 },
281 .resource = tmu00_resources,
282 .num_resources = ARRAY_SIZE(tmu00_resources),
283};
284
285static struct sh_timer_config tmu01_platform_data = {
286 .name = "TMU01",
287 .channel_offset = 0x10,
288 .timer_bit = 1,
289 .clocksource_rating = 200,
290};
291
292static struct resource tmu01_resources[] = {
293 [0] = {
294 .name = "TMU01",
295 .start = 0xfff60014,
296 .end = 0xfff6001f,
297 .flags = IORESOURCE_MEM,
298 },
299 [1] = {
300 .start = intcs_evt2irq(0xea0), /* TMU_TUNI1 */
301 .flags = IORESOURCE_IRQ,
302 },
303};
304
305static struct platform_device tmu01_device = {
306 .name = "sh_tmu",
307 .id = 1,
308 .dev = {
309 .platform_data = &tmu01_platform_data,
310 },
311 .resource = tmu01_resources,
312 .num_resources = ARRAY_SIZE(tmu01_resources),
313};
314
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000315/* I2C */
316static struct resource iic0_resources[] = {
317 [0] = {
318 .name = "IIC0",
319 .start = 0xFFF20000,
320 .end = 0xFFF20425 - 1,
321 .flags = IORESOURCE_MEM,
322 },
323 [1] = {
Magnus Damm33c96072010-05-20 14:41:00 +0000324 .start = intcs_evt2irq(0xe00), /* IIC0_ALI0 */
325 .end = intcs_evt2irq(0xe60), /* IIC0_DTEI0 */
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000326 .flags = IORESOURCE_IRQ,
327 },
328};
329
330static struct platform_device iic0_device = {
331 .name = "i2c-sh_mobile",
332 .id = 0, /* "i2c0" clock */
333 .num_resources = ARRAY_SIZE(iic0_resources),
334 .resource = iic0_resources,
335};
336
337static struct resource iic1_resources[] = {
338 [0] = {
339 .name = "IIC1",
340 .start = 0xE6C20000,
341 .end = 0xE6C20425 - 1,
342 .flags = IORESOURCE_MEM,
343 },
344 [1] = {
Magnus Damm33c96072010-05-20 14:41:00 +0000345 .start = evt2irq(0x780), /* IIC1_ALI1 */
346 .end = evt2irq(0x7e0), /* IIC1_DTEI1 */
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000347 .flags = IORESOURCE_IRQ,
348 },
349};
350
351static struct platform_device iic1_device = {
352 .name = "i2c-sh_mobile",
353 .id = 1, /* "i2c1" clock */
354 .num_resources = ARRAY_SIZE(iic1_resources),
355 .resource = iic1_resources,
356};
357
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000358/* DMA */
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000359static const struct sh_dmae_slave_config sh7372_dmae_slaves[] = {
360 {
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000361 .slave_id = SHDMA_SLAVE_SCIF0_TX,
362 .addr = 0xe6c40020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700363 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000364 .mid_rid = 0x21,
365 }, {
366 .slave_id = SHDMA_SLAVE_SCIF0_RX,
367 .addr = 0xe6c40024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700368 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000369 .mid_rid = 0x22,
370 }, {
371 .slave_id = SHDMA_SLAVE_SCIF1_TX,
372 .addr = 0xe6c50020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700373 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000374 .mid_rid = 0x25,
375 }, {
376 .slave_id = SHDMA_SLAVE_SCIF1_RX,
377 .addr = 0xe6c50024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700378 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000379 .mid_rid = 0x26,
380 }, {
381 .slave_id = SHDMA_SLAVE_SCIF2_TX,
382 .addr = 0xe6c60020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700383 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000384 .mid_rid = 0x29,
385 }, {
386 .slave_id = SHDMA_SLAVE_SCIF2_RX,
387 .addr = 0xe6c60024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700388 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000389 .mid_rid = 0x2a,
390 }, {
391 .slave_id = SHDMA_SLAVE_SCIF3_TX,
392 .addr = 0xe6c70020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700393 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000394 .mid_rid = 0x2d,
395 }, {
396 .slave_id = SHDMA_SLAVE_SCIF3_RX,
397 .addr = 0xe6c70024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700398 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000399 .mid_rid = 0x2e,
400 }, {
401 .slave_id = SHDMA_SLAVE_SCIF4_TX,
402 .addr = 0xe6c80020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700403 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000404 .mid_rid = 0x39,
405 }, {
406 .slave_id = SHDMA_SLAVE_SCIF4_RX,
407 .addr = 0xe6c80024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700408 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000409 .mid_rid = 0x3a,
410 }, {
411 .slave_id = SHDMA_SLAVE_SCIF5_TX,
412 .addr = 0xe6cb0020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700413 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000414 .mid_rid = 0x35,
415 }, {
416 .slave_id = SHDMA_SLAVE_SCIF5_RX,
417 .addr = 0xe6cb0024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700418 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000419 .mid_rid = 0x36,
420 }, {
421 .slave_id = SHDMA_SLAVE_SCIF6_TX,
422 .addr = 0xe6c30040,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700423 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000424 .mid_rid = 0x3d,
425 }, {
426 .slave_id = SHDMA_SLAVE_SCIF6_RX,
427 .addr = 0xe6c30060,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700428 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000429 .mid_rid = 0x3e,
430 }, {
Bastian Hecht40eaed72012-09-22 14:06:38 +0200431 .slave_id = SHDMA_SLAVE_FLCTL0_TX,
432 .addr = 0xe6a30050,
433 .chcr = CHCR_TX(XMIT_SZ_32BIT),
434 .mid_rid = 0x83,
435 }, {
436 .slave_id = SHDMA_SLAVE_FLCTL0_RX,
437 .addr = 0xe6a30050,
438 .chcr = CHCR_RX(XMIT_SZ_32BIT),
439 .mid_rid = 0x83,
440 }, {
441 .slave_id = SHDMA_SLAVE_FLCTL1_TX,
442 .addr = 0xe6a30060,
443 .chcr = CHCR_TX(XMIT_SZ_32BIT),
444 .mid_rid = 0x87,
445 }, {
446 .slave_id = SHDMA_SLAVE_FLCTL1_RX,
447 .addr = 0xe6a30060,
448 .chcr = CHCR_RX(XMIT_SZ_32BIT),
449 .mid_rid = 0x87,
450 }, {
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000451 .slave_id = SHDMA_SLAVE_SDHI0_TX,
452 .addr = 0xe6850030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700453 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000454 .mid_rid = 0xc1,
455 }, {
456 .slave_id = SHDMA_SLAVE_SDHI0_RX,
457 .addr = 0xe6850030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700458 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000459 .mid_rid = 0xc2,
460 }, {
461 .slave_id = SHDMA_SLAVE_SDHI1_TX,
462 .addr = 0xe6860030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700463 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000464 .mid_rid = 0xc9,
465 }, {
466 .slave_id = SHDMA_SLAVE_SDHI1_RX,
467 .addr = 0xe6860030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700468 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000469 .mid_rid = 0xca,
470 }, {
471 .slave_id = SHDMA_SLAVE_SDHI2_TX,
472 .addr = 0xe6870030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700473 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000474 .mid_rid = 0xcd,
475 }, {
476 .slave_id = SHDMA_SLAVE_SDHI2_RX,
477 .addr = 0xe6870030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700478 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000479 .mid_rid = 0xce,
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000480 }, {
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700481 .slave_id = SHDMA_SLAVE_FSIA_TX,
482 .addr = 0xfe1f0024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700483 .chcr = CHCR_TX(XMIT_SZ_32BIT),
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700484 .mid_rid = 0xb1,
485 }, {
486 .slave_id = SHDMA_SLAVE_FSIA_RX,
487 .addr = 0xfe1f0020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700488 .chcr = CHCR_RX(XMIT_SZ_32BIT),
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700489 .mid_rid = 0xb2,
490 }, {
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000491 .slave_id = SHDMA_SLAVE_MMCIF_TX,
492 .addr = 0xe6bd0034,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700493 .chcr = CHCR_TX(XMIT_SZ_32BIT),
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000494 .mid_rid = 0xd1,
495 }, {
496 .slave_id = SHDMA_SLAVE_MMCIF_RX,
497 .addr = 0xe6bd0034,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700498 .chcr = CHCR_RX(XMIT_SZ_32BIT),
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000499 .mid_rid = 0xd2,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000500 },
501};
502
Kuninori Morimoto4d6344f2012-06-20 11:30:32 +0200503#define SH7372_CHCLR (0x220 - 0x20)
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100504
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000505static const struct sh_dmae_channel sh7372_dmae_channels[] = {
506 {
507 .offset = 0,
508 .dmars = 0,
509 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100510 .chclr_offset = SH7372_CHCLR + 0,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000511 }, {
512 .offset = 0x10,
513 .dmars = 0,
514 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100515 .chclr_offset = SH7372_CHCLR + 0x10,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000516 }, {
517 .offset = 0x20,
518 .dmars = 4,
519 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100520 .chclr_offset = SH7372_CHCLR + 0x20,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000521 }, {
522 .offset = 0x30,
523 .dmars = 4,
524 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100525 .chclr_offset = SH7372_CHCLR + 0x30,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000526 }, {
527 .offset = 0x50,
528 .dmars = 8,
529 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100530 .chclr_offset = SH7372_CHCLR + 0x50,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000531 }, {
532 .offset = 0x60,
533 .dmars = 8,
534 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100535 .chclr_offset = SH7372_CHCLR + 0x60,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000536 }
537};
538
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000539static struct sh_dmae_pdata dma_platform_data = {
540 .slave = sh7372_dmae_slaves,
541 .slave_num = ARRAY_SIZE(sh7372_dmae_slaves),
542 .channel = sh7372_dmae_channels,
543 .channel_num = ARRAY_SIZE(sh7372_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700544 .ts_low_shift = TS_LOW_SHIFT,
545 .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
546 .ts_high_shift = TS_HI_SHIFT,
547 .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
548 .ts_shift = dma_ts_shift,
549 .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000550 .dmaor_init = DMAOR_DME,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100551 .chclr_present = 1,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000552};
553
554/* Resource order important! */
555static struct resource sh7372_dmae0_resources[] = {
556 {
557 /* Channel registers and DMAOR */
558 .start = 0xfe008020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100559 .end = 0xfe00828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000560 .flags = IORESOURCE_MEM,
561 },
562 {
563 /* DMARSx */
564 .start = 0xfe009000,
565 .end = 0xfe00900b,
566 .flags = IORESOURCE_MEM,
567 },
568 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900569 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000570 .start = evt2irq(0x20c0),
571 .end = evt2irq(0x20c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000572 .flags = IORESOURCE_IRQ,
573 },
574 {
575 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000576 .start = evt2irq(0x2000),
577 .end = evt2irq(0x20a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000578 .flags = IORESOURCE_IRQ,
579 },
580};
581
582/* Resource order important! */
583static struct resource sh7372_dmae1_resources[] = {
584 {
585 /* Channel registers and DMAOR */
586 .start = 0xfe018020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100587 .end = 0xfe01828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000588 .flags = IORESOURCE_MEM,
589 },
590 {
591 /* DMARSx */
592 .start = 0xfe019000,
593 .end = 0xfe01900b,
594 .flags = IORESOURCE_MEM,
595 },
596 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900597 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000598 .start = evt2irq(0x21c0),
599 .end = evt2irq(0x21c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000600 .flags = IORESOURCE_IRQ,
601 },
602 {
603 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000604 .start = evt2irq(0x2100),
605 .end = evt2irq(0x21a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000606 .flags = IORESOURCE_IRQ,
607 },
608};
609
610/* Resource order important! */
611static struct resource sh7372_dmae2_resources[] = {
612 {
613 /* Channel registers and DMAOR */
614 .start = 0xfe028020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100615 .end = 0xfe02828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000616 .flags = IORESOURCE_MEM,
617 },
618 {
619 /* DMARSx */
620 .start = 0xfe029000,
621 .end = 0xfe02900b,
622 .flags = IORESOURCE_MEM,
623 },
624 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900625 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000626 .start = evt2irq(0x22c0),
627 .end = evt2irq(0x22c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000628 .flags = IORESOURCE_IRQ,
629 },
630 {
631 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000632 .start = evt2irq(0x2200),
633 .end = evt2irq(0x22a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000634 .flags = IORESOURCE_IRQ,
635 },
636};
637
638static struct platform_device dma0_device = {
639 .name = "sh-dma-engine",
640 .id = 0,
641 .resource = sh7372_dmae0_resources,
642 .num_resources = ARRAY_SIZE(sh7372_dmae0_resources),
643 .dev = {
644 .platform_data = &dma_platform_data,
645 },
646};
647
648static struct platform_device dma1_device = {
649 .name = "sh-dma-engine",
650 .id = 1,
651 .resource = sh7372_dmae1_resources,
652 .num_resources = ARRAY_SIZE(sh7372_dmae1_resources),
653 .dev = {
654 .platform_data = &dma_platform_data,
655 },
656};
657
658static struct platform_device dma2_device = {
659 .name = "sh-dma-engine",
660 .id = 2,
661 .resource = sh7372_dmae2_resources,
662 .num_resources = ARRAY_SIZE(sh7372_dmae2_resources),
663 .dev = {
664 .platform_data = &dma_platform_data,
665 },
666};
667
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000668/*
669 * USB-DMAC
670 */
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000671static const struct sh_dmae_channel sh7372_usb_dmae_channels[] = {
672 {
673 .offset = 0,
674 }, {
675 .offset = 0x20,
676 },
677};
678
679/* USB DMAC0 */
680static const struct sh_dmae_slave_config sh7372_usb_dmae0_slaves[] = {
681 {
682 .slave_id = SHDMA_SLAVE_USB0_TX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700683 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000684 }, {
685 .slave_id = SHDMA_SLAVE_USB0_RX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700686 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000687 },
688};
689
690static struct sh_dmae_pdata usb_dma0_platform_data = {
691 .slave = sh7372_usb_dmae0_slaves,
692 .slave_num = ARRAY_SIZE(sh7372_usb_dmae0_slaves),
693 .channel = sh7372_usb_dmae_channels,
694 .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700695 .ts_low_shift = USBTS_LOW_SHIFT,
696 .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
697 .ts_high_shift = USBTS_HI_SHIFT,
698 .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
699 .ts_shift = dma_usbts_shift,
700 .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000701 .dmaor_init = DMAOR_DME,
702 .chcr_offset = 0x14,
703 .chcr_ie_bit = 1 << 5,
704 .dmaor_is_32bit = 1,
705 .needs_tend_set = 1,
706 .no_dmars = 1,
Guennadi Liakhovetskic8ddf032012-01-18 10:14:29 +0100707 .slave_only = 1,
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000708};
709
710static struct resource sh7372_usb_dmae0_resources[] = {
711 {
712 /* Channel registers and DMAOR */
713 .start = 0xe68a0020,
714 .end = 0xe68a0064 - 1,
715 .flags = IORESOURCE_MEM,
716 },
717 {
718 /* VCR/SWR/DMICR */
719 .start = 0xe68a0000,
720 .end = 0xe68a0014 - 1,
721 .flags = IORESOURCE_MEM,
722 },
723 {
724 /* IRQ for channels */
725 .start = evt2irq(0x0a00),
726 .end = evt2irq(0x0a00),
727 .flags = IORESOURCE_IRQ,
728 },
729};
730
731static struct platform_device usb_dma0_device = {
732 .name = "sh-dma-engine",
733 .id = 3,
734 .resource = sh7372_usb_dmae0_resources,
735 .num_resources = ARRAY_SIZE(sh7372_usb_dmae0_resources),
736 .dev = {
737 .platform_data = &usb_dma0_platform_data,
738 },
739};
740
741/* USB DMAC1 */
742static const struct sh_dmae_slave_config sh7372_usb_dmae1_slaves[] = {
743 {
744 .slave_id = SHDMA_SLAVE_USB1_TX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700745 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000746 }, {
747 .slave_id = SHDMA_SLAVE_USB1_RX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700748 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000749 },
750};
751
752static struct sh_dmae_pdata usb_dma1_platform_data = {
753 .slave = sh7372_usb_dmae1_slaves,
754 .slave_num = ARRAY_SIZE(sh7372_usb_dmae1_slaves),
755 .channel = sh7372_usb_dmae_channels,
756 .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700757 .ts_low_shift = USBTS_LOW_SHIFT,
758 .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
759 .ts_high_shift = USBTS_HI_SHIFT,
760 .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
761 .ts_shift = dma_usbts_shift,
762 .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000763 .dmaor_init = DMAOR_DME,
764 .chcr_offset = 0x14,
765 .chcr_ie_bit = 1 << 5,
766 .dmaor_is_32bit = 1,
767 .needs_tend_set = 1,
768 .no_dmars = 1,
Guennadi Liakhovetskic8ddf032012-01-18 10:14:29 +0100769 .slave_only = 1,
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000770};
771
772static struct resource sh7372_usb_dmae1_resources[] = {
773 {
774 /* Channel registers and DMAOR */
775 .start = 0xe68c0020,
776 .end = 0xe68c0064 - 1,
777 .flags = IORESOURCE_MEM,
778 },
779 {
780 /* VCR/SWR/DMICR */
781 .start = 0xe68c0000,
782 .end = 0xe68c0014 - 1,
783 .flags = IORESOURCE_MEM,
784 },
785 {
786 /* IRQ for channels */
787 .start = evt2irq(0x1d00),
788 .end = evt2irq(0x1d00),
789 .flags = IORESOURCE_IRQ,
790 },
791};
792
793static struct platform_device usb_dma1_device = {
794 .name = "sh-dma-engine",
795 .id = 4,
796 .resource = sh7372_usb_dmae1_resources,
797 .num_resources = ARRAY_SIZE(sh7372_usb_dmae1_resources),
798 .dev = {
799 .platform_data = &usb_dma1_platform_data,
800 },
801};
802
Magnus Damm68224712011-04-28 03:21:00 +0000803/* VPU */
804static struct uio_info vpu_platform_data = {
805 .name = "VPU5HG",
806 .version = "0",
807 .irq = intcs_evt2irq(0x980),
808};
809
810static struct resource vpu_resources[] = {
811 [0] = {
812 .name = "VPU",
813 .start = 0xfe900000,
814 .end = 0xfe900157,
815 .flags = IORESOURCE_MEM,
816 },
817};
818
819static struct platform_device vpu_device = {
820 .name = "uio_pdrv_genirq",
821 .id = 0,
822 .dev = {
823 .platform_data = &vpu_platform_data,
824 },
825 .resource = vpu_resources,
826 .num_resources = ARRAY_SIZE(vpu_resources),
827};
828
829/* VEU0 */
830static struct uio_info veu0_platform_data = {
831 .name = "VEU0",
832 .version = "0",
833 .irq = intcs_evt2irq(0x700),
834};
835
836static struct resource veu0_resources[] = {
837 [0] = {
838 .name = "VEU0",
839 .start = 0xfe920000,
840 .end = 0xfe9200cb,
841 .flags = IORESOURCE_MEM,
842 },
843};
844
845static struct platform_device veu0_device = {
846 .name = "uio_pdrv_genirq",
847 .id = 1,
848 .dev = {
849 .platform_data = &veu0_platform_data,
850 },
851 .resource = veu0_resources,
852 .num_resources = ARRAY_SIZE(veu0_resources),
853};
854
855/* VEU1 */
856static struct uio_info veu1_platform_data = {
857 .name = "VEU1",
858 .version = "0",
859 .irq = intcs_evt2irq(0x720),
860};
861
862static struct resource veu1_resources[] = {
863 [0] = {
864 .name = "VEU1",
865 .start = 0xfe924000,
866 .end = 0xfe9240cb,
867 .flags = IORESOURCE_MEM,
868 },
869};
870
871static struct platform_device veu1_device = {
872 .name = "uio_pdrv_genirq",
873 .id = 2,
874 .dev = {
875 .platform_data = &veu1_platform_data,
876 },
877 .resource = veu1_resources,
878 .num_resources = ARRAY_SIZE(veu1_resources),
879};
880
881/* VEU2 */
882static struct uio_info veu2_platform_data = {
883 .name = "VEU2",
884 .version = "0",
885 .irq = intcs_evt2irq(0x740),
886};
887
888static struct resource veu2_resources[] = {
889 [0] = {
890 .name = "VEU2",
891 .start = 0xfe928000,
892 .end = 0xfe928307,
893 .flags = IORESOURCE_MEM,
894 },
895};
896
897static struct platform_device veu2_device = {
898 .name = "uio_pdrv_genirq",
899 .id = 3,
900 .dev = {
901 .platform_data = &veu2_platform_data,
902 },
903 .resource = veu2_resources,
904 .num_resources = ARRAY_SIZE(veu2_resources),
905};
906
907/* VEU3 */
908static struct uio_info veu3_platform_data = {
909 .name = "VEU3",
910 .version = "0",
911 .irq = intcs_evt2irq(0x760),
912};
913
914static struct resource veu3_resources[] = {
915 [0] = {
916 .name = "VEU3",
917 .start = 0xfe92c000,
918 .end = 0xfe92c307,
919 .flags = IORESOURCE_MEM,
920 },
921};
922
923static struct platform_device veu3_device = {
924 .name = "uio_pdrv_genirq",
925 .id = 4,
926 .dev = {
927 .platform_data = &veu3_platform_data,
928 },
929 .resource = veu3_resources,
930 .num_resources = ARRAY_SIZE(veu3_resources),
931};
932
933/* JPU */
934static struct uio_info jpu_platform_data = {
935 .name = "JPU",
936 .version = "0",
937 .irq = intcs_evt2irq(0x560),
938};
939
940static struct resource jpu_resources[] = {
941 [0] = {
942 .name = "JPU",
943 .start = 0xfe980000,
944 .end = 0xfe9902d3,
945 .flags = IORESOURCE_MEM,
946 },
947};
948
949static struct platform_device jpu_device = {
950 .name = "uio_pdrv_genirq",
951 .id = 5,
952 .dev = {
953 .platform_data = &jpu_platform_data,
954 },
955 .resource = jpu_resources,
956 .num_resources = ARRAY_SIZE(jpu_resources),
957};
958
959/* SPU2DSP0 */
960static struct uio_info spu0_platform_data = {
961 .name = "SPU2DSP0",
962 .version = "0",
963 .irq = evt2irq(0x1800),
964};
965
966static struct resource spu0_resources[] = {
967 [0] = {
968 .name = "SPU2DSP0",
969 .start = 0xfe200000,
970 .end = 0xfe2fffff,
971 .flags = IORESOURCE_MEM,
972 },
973};
974
975static struct platform_device spu0_device = {
976 .name = "uio_pdrv_genirq",
977 .id = 6,
978 .dev = {
979 .platform_data = &spu0_platform_data,
980 },
981 .resource = spu0_resources,
982 .num_resources = ARRAY_SIZE(spu0_resources),
983};
984
985/* SPU2DSP1 */
986static struct uio_info spu1_platform_data = {
987 .name = "SPU2DSP1",
988 .version = "0",
989 .irq = evt2irq(0x1820),
990};
991
992static struct resource spu1_resources[] = {
993 [0] = {
994 .name = "SPU2DSP1",
995 .start = 0xfe300000,
996 .end = 0xfe3fffff,
997 .flags = IORESOURCE_MEM,
998 },
999};
1000
1001static struct platform_device spu1_device = {
1002 .name = "uio_pdrv_genirq",
1003 .id = 7,
1004 .dev = {
1005 .platform_data = &spu1_platform_data,
1006 },
1007 .resource = spu1_resources,
1008 .num_resources = ARRAY_SIZE(spu1_resources),
1009};
1010
Hideki EIRAKU3cfb8432013-01-21 19:54:27 +09001011/* IPMMUI (an IPMMU module for ICB/LMB) */
1012static struct resource ipmmu_resources[] = {
1013 [0] = {
1014 .name = "IPMMUI",
1015 .start = 0xfe951000,
1016 .end = 0xfe9510ff,
1017 .flags = IORESOURCE_MEM,
1018 },
1019};
1020
1021static const char * const ipmmu_dev_names[] = {
1022 "sh_mobile_lcdc_fb.0",
1023 "sh_mobile_lcdc_fb.1",
1024 "sh_mobile_ceu.0",
1025 "uio_pdrv_genirq.0",
1026 "uio_pdrv_genirq.1",
1027 "uio_pdrv_genirq.2",
1028 "uio_pdrv_genirq.3",
1029 "uio_pdrv_genirq.4",
1030 "uio_pdrv_genirq.5",
1031};
1032
1033static struct shmobile_ipmmu_platform_data ipmmu_platform_data = {
1034 .dev_names = ipmmu_dev_names,
1035 .num_dev_names = ARRAY_SIZE(ipmmu_dev_names),
1036};
1037
1038static struct platform_device ipmmu_device = {
1039 .name = "ipmmu",
1040 .id = -1,
1041 .dev = {
1042 .platform_data = &ipmmu_platform_data,
1043 },
1044 .resource = ipmmu_resources,
1045 .num_resources = ARRAY_SIZE(ipmmu_resources),
1046};
1047
Magnus Damm2b7eda62010-02-05 11:14:58 +00001048static struct platform_device *sh7372_early_devices[] __initdata = {
1049 &scif0_device,
1050 &scif1_device,
1051 &scif2_device,
1052 &scif3_device,
1053 &scif4_device,
1054 &scif5_device,
1055 &scif6_device,
Magnus Damm0ed61fc2011-06-30 09:22:50 +00001056 &cmt2_device,
Magnus Dammc6c049e2010-10-14 06:57:25 +00001057 &tmu00_device,
1058 &tmu01_device,
Hideki EIRAKU3cfb8432013-01-21 19:54:27 +09001059 &ipmmu_device,
Magnus Damm934e4072010-10-13 07:22:11 +00001060};
1061
1062static struct platform_device *sh7372_late_devices[] __initdata = {
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +00001063 &iic0_device,
1064 &iic1_device,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +00001065 &dma0_device,
1066 &dma1_device,
1067 &dma2_device,
Kuninori Morimotoafe48042011-06-17 08:21:10 +00001068 &usb_dma0_device,
1069 &usb_dma1_device,
Magnus Damm68224712011-04-28 03:21:00 +00001070 &vpu_device,
1071 &veu0_device,
1072 &veu1_device,
1073 &veu2_device,
1074 &veu3_device,
1075 &jpu_device,
1076 &spu0_device,
1077 &spu1_device,
Magnus Damm2b7eda62010-02-05 11:14:58 +00001078};
1079
1080void __init sh7372_add_standard_devices(void)
1081{
Rafael J. Wysockiac18e022012-08-15 20:56:26 +02001082 struct pm_domain_device domain_devices[] = {
1083 { "A3RV", &vpu_device, },
1084 { "A4MP", &spu0_device, },
1085 { "A4MP", &spu1_device, },
1086 { "A3SP", &scif0_device, },
1087 { "A3SP", &scif1_device, },
1088 { "A3SP", &scif2_device, },
1089 { "A3SP", &scif3_device, },
1090 { "A3SP", &scif4_device, },
1091 { "A3SP", &scif5_device, },
1092 { "A3SP", &scif6_device, },
1093 { "A3SP", &iic1_device, },
1094 { "A3SP", &dma0_device, },
1095 { "A3SP", &dma1_device, },
1096 { "A3SP", &dma2_device, },
1097 { "A3SP", &usb_dma0_device, },
1098 { "A3SP", &usb_dma1_device, },
1099 { "A4R", &iic0_device, },
1100 { "A4R", &veu0_device, },
1101 { "A4R", &veu1_device, },
1102 { "A4R", &veu2_device, },
1103 { "A4R", &veu3_device, },
1104 { "A4R", &jpu_device, },
1105 { "A4R", &tmu00_device, },
1106 { "A4R", &tmu01_device, },
Rafael J. Wysockic37b7a72012-08-08 00:28:36 +02001107 };
1108
Rafael J. Wysockie7e59a42012-08-07 01:12:56 +02001109 sh7372_init_pm_domains();
Magnus Dammf7dadb32011-12-23 01:23:07 +01001110
Magnus Damm2b7eda62010-02-05 11:14:58 +00001111 platform_add_devices(sh7372_early_devices,
1112 ARRAY_SIZE(sh7372_early_devices));
Magnus Damm934e4072010-10-13 07:22:11 +00001113
1114 platform_add_devices(sh7372_late_devices,
1115 ARRAY_SIZE(sh7372_late_devices));
Magnus Damm33afebf2011-07-01 22:14:45 +02001116
Rafael J. Wysockiac18e022012-08-15 20:56:26 +02001117 rmobile_add_devices_to_domains(domain_devices,
1118 ARRAY_SIZE(domain_devices));
Magnus Damm2b7eda62010-02-05 11:14:58 +00001119}
1120
Stephen Warren6bb27d72012-11-08 12:40:59 -07001121void __init sh7372_earlytimer_init(void)
Magnus Damm17254bf2012-03-06 17:36:37 +09001122{
1123 sh7372_clock_init();
1124 shmobile_earlytimer_init();
1125}
1126
Magnus Damm2b7eda62010-02-05 11:14:58 +00001127void __init sh7372_add_early_devices(void)
1128{
Magnus Damm2b7eda62010-02-05 11:14:58 +00001129 early_platform_add_devices(sh7372_early_devices,
1130 ARRAY_SIZE(sh7372_early_devices));
Magnus Damm5d7220ec2012-02-29 21:37:19 +09001131
1132 /* setup early console here as well */
1133 shmobile_setup_console();
Magnus Damm2b7eda62010-02-05 11:14:58 +00001134}
Magnus Damm3b7b7052012-03-28 15:53:40 +09001135
1136#ifdef CONFIG_USE_OF
1137
1138void __init sh7372_add_early_devices_dt(void)
1139{
1140 shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */
1141
1142 early_platform_add_devices(sh7372_early_devices,
1143 ARRAY_SIZE(sh7372_early_devices));
1144
1145 /* setup early console here as well */
1146 shmobile_setup_console();
1147}
1148
Magnus Damm3b7b7052012-03-28 15:53:40 +09001149void __init sh7372_add_standard_devices_dt(void)
1150{
1151 /* clocks are setup late during boot in the case of DT */
1152 sh7372_clock_init();
1153
1154 platform_add_devices(sh7372_early_devices,
1155 ARRAY_SIZE(sh7372_early_devices));
1156
Magnus Damm975e5af2013-07-01 14:41:55 +09001157 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
Magnus Damm3b7b7052012-03-28 15:53:40 +09001158}
1159
1160static const char *sh7372_boards_compat_dt[] __initdata = {
1161 "renesas,sh7372",
1162 NULL,
1163};
1164
1165DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
1166 .map_io = sh7372_map_io,
1167 .init_early = sh7372_add_early_devices_dt,
1168 .nr_irqs = NR_IRQS_LEGACY,
1169 .init_irq = sh7372_init_irq,
1170 .handle_irq = shmobile_handle_irq_intc,
1171 .init_machine = sh7372_add_standard_devices_dt,
Magnus Damm3b7b7052012-03-28 15:53:40 +09001172 .dt_compat = sh7372_boards_compat_dt,
1173MACHINE_END
1174
1175#endif /* CONFIG_USE_OF */