blob: c917882424a7cc252cb62183d4636c230bfee3b1 [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>
Kuninori Morimotoc317fc52012-06-25 03:43:19 -070036#include <mach/dma-register.h>
Magnus Damm2b7eda62010-02-05 11:14:58 +000037#include <mach/hardware.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
Magnus Damm33c96072010-05-20 14:41:00 +000063/* SCIFA0 */
Magnus Damm2b7eda62010-02-05 11:14:58 +000064static struct plat_sci_port scif0_platform_data = {
65 .mapbase = 0xe6c40000,
66 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +090067 .scscr = SCSCR_RE | SCSCR_TE,
68 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +000069 .type = PORT_SCIFA,
Magnus Damm33c96072010-05-20 14:41:00 +000070 .irqs = { evt2irq(0x0c00), evt2irq(0x0c00),
71 evt2irq(0x0c00), evt2irq(0x0c00) },
Magnus Damm2b7eda62010-02-05 11:14:58 +000072};
73
74static struct platform_device scif0_device = {
75 .name = "sh-sci",
76 .id = 0,
77 .dev = {
78 .platform_data = &scif0_platform_data,
79 },
80};
81
Magnus Damm33c96072010-05-20 14:41:00 +000082/* SCIFA1 */
Magnus Damm2b7eda62010-02-05 11:14:58 +000083static struct plat_sci_port scif1_platform_data = {
84 .mapbase = 0xe6c50000,
85 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +090086 .scscr = SCSCR_RE | SCSCR_TE,
87 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +000088 .type = PORT_SCIFA,
Magnus Damm33c96072010-05-20 14:41:00 +000089 .irqs = { evt2irq(0x0c20), evt2irq(0x0c20),
90 evt2irq(0x0c20), evt2irq(0x0c20) },
Magnus Damm2b7eda62010-02-05 11:14:58 +000091};
92
93static struct platform_device scif1_device = {
94 .name = "sh-sci",
95 .id = 1,
96 .dev = {
97 .platform_data = &scif1_platform_data,
98 },
99};
100
Magnus Damm33c96072010-05-20 14:41:00 +0000101/* SCIFA2 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000102static struct plat_sci_port scif2_platform_data = {
103 .mapbase = 0xe6c60000,
104 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +0900105 .scscr = SCSCR_RE | SCSCR_TE,
106 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +0000107 .type = PORT_SCIFA,
Magnus Damm33c96072010-05-20 14:41:00 +0000108 .irqs = { evt2irq(0x0c40), evt2irq(0x0c40),
109 evt2irq(0x0c40), evt2irq(0x0c40) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000110};
111
112static struct platform_device scif2_device = {
113 .name = "sh-sci",
114 .id = 2,
115 .dev = {
116 .platform_data = &scif2_platform_data,
117 },
118};
119
Magnus Damm33c96072010-05-20 14:41:00 +0000120/* SCIFA3 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000121static struct plat_sci_port scif3_platform_data = {
122 .mapbase = 0xe6c70000,
123 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +0900124 .scscr = SCSCR_RE | SCSCR_TE,
125 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +0000126 .type = PORT_SCIFA,
Magnus Damm33c96072010-05-20 14:41:00 +0000127 .irqs = { evt2irq(0x0c60), evt2irq(0x0c60),
128 evt2irq(0x0c60), evt2irq(0x0c60) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000129};
130
131static struct platform_device scif3_device = {
132 .name = "sh-sci",
133 .id = 3,
134 .dev = {
135 .platform_data = &scif3_platform_data,
136 },
137};
138
Magnus Damm33c96072010-05-20 14:41:00 +0000139/* SCIFA4 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000140static struct plat_sci_port scif4_platform_data = {
141 .mapbase = 0xe6c80000,
142 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +0900143 .scscr = SCSCR_RE | SCSCR_TE,
144 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +0000145 .type = PORT_SCIFA,
Magnus Damm33c96072010-05-20 14:41:00 +0000146 .irqs = { evt2irq(0x0d20), evt2irq(0x0d20),
147 evt2irq(0x0d20), evt2irq(0x0d20) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000148};
149
150static struct platform_device scif4_device = {
151 .name = "sh-sci",
152 .id = 4,
153 .dev = {
154 .platform_data = &scif4_platform_data,
155 },
156};
157
Magnus Damm33c96072010-05-20 14:41:00 +0000158/* SCIFA5 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000159static struct plat_sci_port scif5_platform_data = {
160 .mapbase = 0xe6cb0000,
161 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +0900162 .scscr = SCSCR_RE | SCSCR_TE,
163 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +0000164 .type = PORT_SCIFA,
Magnus Damm33c96072010-05-20 14:41:00 +0000165 .irqs = { evt2irq(0x0d40), evt2irq(0x0d40),
166 evt2irq(0x0d40), evt2irq(0x0d40) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000167};
168
169static struct platform_device scif5_device = {
170 .name = "sh-sci",
171 .id = 5,
172 .dev = {
173 .platform_data = &scif5_platform_data,
174 },
175};
176
Magnus Damm33c96072010-05-20 14:41:00 +0000177/* SCIFB */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000178static struct plat_sci_port scif6_platform_data = {
179 .mapbase = 0xe6c30000,
180 .flags = UPF_BOOT_AUTOCONF,
Paul Mundtf43dc232011-01-13 15:06:28 +0900181 .scscr = SCSCR_RE | SCSCR_TE,
182 .scbrr_algo_id = SCBRR_ALGO_4,
Guennadi Liakhovetskieb6e8605e2010-05-23 16:39:17 +0000183 .type = PORT_SCIFB,
Magnus Damm33c96072010-05-20 14:41:00 +0000184 .irqs = { evt2irq(0x0d60), evt2irq(0x0d60),
185 evt2irq(0x0d60), evt2irq(0x0d60) },
Magnus Damm2b7eda62010-02-05 11:14:58 +0000186};
187
188static struct platform_device scif6_device = {
189 .name = "sh-sci",
190 .id = 6,
191 .dev = {
192 .platform_data = &scif6_platform_data,
193 },
194};
195
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000196/* CMT */
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000197static struct sh_timer_config cmt2_platform_data = {
198 .name = "CMT2",
199 .channel_offset = 0x40,
200 .timer_bit = 5,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000201 .clockevent_rating = 125,
202 .clocksource_rating = 125,
203};
204
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000205static struct resource cmt2_resources[] = {
Magnus Damm2b7eda62010-02-05 11:14:58 +0000206 [0] = {
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000207 .name = "CMT2",
208 .start = 0xe6130040,
209 .end = 0xe613004b,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000210 .flags = IORESOURCE_MEM,
211 },
212 [1] = {
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000213 .start = evt2irq(0x0b80), /* CMT2 */
Magnus Damm2b7eda62010-02-05 11:14:58 +0000214 .flags = IORESOURCE_IRQ,
215 },
216};
217
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000218static struct platform_device cmt2_device = {
Magnus Damm2b7eda62010-02-05 11:14:58 +0000219 .name = "sh_cmt",
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000220 .id = 2,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000221 .dev = {
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000222 .platform_data = &cmt2_platform_data,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000223 },
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000224 .resource = cmt2_resources,
225 .num_resources = ARRAY_SIZE(cmt2_resources),
Magnus Damm2b7eda62010-02-05 11:14:58 +0000226};
227
Magnus Dammc6c049e2010-10-14 06:57:25 +0000228/* TMU */
229static struct sh_timer_config tmu00_platform_data = {
230 .name = "TMU00",
231 .channel_offset = 0x4,
232 .timer_bit = 0,
233 .clockevent_rating = 200,
234};
235
236static struct resource tmu00_resources[] = {
237 [0] = {
238 .name = "TMU00",
239 .start = 0xfff60008,
240 .end = 0xfff60013,
241 .flags = IORESOURCE_MEM,
242 },
243 [1] = {
244 .start = intcs_evt2irq(0xe80), /* TMU_TUNI0 */
245 .flags = IORESOURCE_IRQ,
246 },
247};
248
249static struct platform_device tmu00_device = {
250 .name = "sh_tmu",
251 .id = 0,
252 .dev = {
253 .platform_data = &tmu00_platform_data,
254 },
255 .resource = tmu00_resources,
256 .num_resources = ARRAY_SIZE(tmu00_resources),
257};
258
259static struct sh_timer_config tmu01_platform_data = {
260 .name = "TMU01",
261 .channel_offset = 0x10,
262 .timer_bit = 1,
263 .clocksource_rating = 200,
264};
265
266static struct resource tmu01_resources[] = {
267 [0] = {
268 .name = "TMU01",
269 .start = 0xfff60014,
270 .end = 0xfff6001f,
271 .flags = IORESOURCE_MEM,
272 },
273 [1] = {
274 .start = intcs_evt2irq(0xea0), /* TMU_TUNI1 */
275 .flags = IORESOURCE_IRQ,
276 },
277};
278
279static struct platform_device tmu01_device = {
280 .name = "sh_tmu",
281 .id = 1,
282 .dev = {
283 .platform_data = &tmu01_platform_data,
284 },
285 .resource = tmu01_resources,
286 .num_resources = ARRAY_SIZE(tmu01_resources),
287};
288
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000289/* I2C */
290static struct resource iic0_resources[] = {
291 [0] = {
292 .name = "IIC0",
293 .start = 0xFFF20000,
294 .end = 0xFFF20425 - 1,
295 .flags = IORESOURCE_MEM,
296 },
297 [1] = {
Magnus Damm33c96072010-05-20 14:41:00 +0000298 .start = intcs_evt2irq(0xe00), /* IIC0_ALI0 */
299 .end = intcs_evt2irq(0xe60), /* IIC0_DTEI0 */
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000300 .flags = IORESOURCE_IRQ,
301 },
302};
303
304static struct platform_device iic0_device = {
305 .name = "i2c-sh_mobile",
306 .id = 0, /* "i2c0" clock */
307 .num_resources = ARRAY_SIZE(iic0_resources),
308 .resource = iic0_resources,
309};
310
311static struct resource iic1_resources[] = {
312 [0] = {
313 .name = "IIC1",
314 .start = 0xE6C20000,
315 .end = 0xE6C20425 - 1,
316 .flags = IORESOURCE_MEM,
317 },
318 [1] = {
Magnus Damm33c96072010-05-20 14:41:00 +0000319 .start = evt2irq(0x780), /* IIC1_ALI1 */
320 .end = evt2irq(0x7e0), /* IIC1_DTEI1 */
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000321 .flags = IORESOURCE_IRQ,
322 },
323};
324
325static struct platform_device iic1_device = {
326 .name = "i2c-sh_mobile",
327 .id = 1, /* "i2c1" clock */
328 .num_resources = ARRAY_SIZE(iic1_resources),
329 .resource = iic1_resources,
330};
331
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000332/* DMA */
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000333static const struct sh_dmae_slave_config sh7372_dmae_slaves[] = {
334 {
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000335 .slave_id = SHDMA_SLAVE_SCIF0_TX,
336 .addr = 0xe6c40020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700337 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000338 .mid_rid = 0x21,
339 }, {
340 .slave_id = SHDMA_SLAVE_SCIF0_RX,
341 .addr = 0xe6c40024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700342 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000343 .mid_rid = 0x22,
344 }, {
345 .slave_id = SHDMA_SLAVE_SCIF1_TX,
346 .addr = 0xe6c50020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700347 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000348 .mid_rid = 0x25,
349 }, {
350 .slave_id = SHDMA_SLAVE_SCIF1_RX,
351 .addr = 0xe6c50024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700352 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000353 .mid_rid = 0x26,
354 }, {
355 .slave_id = SHDMA_SLAVE_SCIF2_TX,
356 .addr = 0xe6c60020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700357 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000358 .mid_rid = 0x29,
359 }, {
360 .slave_id = SHDMA_SLAVE_SCIF2_RX,
361 .addr = 0xe6c60024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700362 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000363 .mid_rid = 0x2a,
364 }, {
365 .slave_id = SHDMA_SLAVE_SCIF3_TX,
366 .addr = 0xe6c70020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700367 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000368 .mid_rid = 0x2d,
369 }, {
370 .slave_id = SHDMA_SLAVE_SCIF3_RX,
371 .addr = 0xe6c70024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700372 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000373 .mid_rid = 0x2e,
374 }, {
375 .slave_id = SHDMA_SLAVE_SCIF4_TX,
376 .addr = 0xe6c80020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700377 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000378 .mid_rid = 0x39,
379 }, {
380 .slave_id = SHDMA_SLAVE_SCIF4_RX,
381 .addr = 0xe6c80024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700382 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000383 .mid_rid = 0x3a,
384 }, {
385 .slave_id = SHDMA_SLAVE_SCIF5_TX,
386 .addr = 0xe6cb0020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700387 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000388 .mid_rid = 0x35,
389 }, {
390 .slave_id = SHDMA_SLAVE_SCIF5_RX,
391 .addr = 0xe6cb0024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700392 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000393 .mid_rid = 0x36,
394 }, {
395 .slave_id = SHDMA_SLAVE_SCIF6_TX,
396 .addr = 0xe6c30040,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700397 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000398 .mid_rid = 0x3d,
399 }, {
400 .slave_id = SHDMA_SLAVE_SCIF6_RX,
401 .addr = 0xe6c30060,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700402 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000403 .mid_rid = 0x3e,
404 }, {
Bastian Hecht40eaed72012-09-22 14:06:38 +0200405 .slave_id = SHDMA_SLAVE_FLCTL0_TX,
406 .addr = 0xe6a30050,
407 .chcr = CHCR_TX(XMIT_SZ_32BIT),
408 .mid_rid = 0x83,
409 }, {
410 .slave_id = SHDMA_SLAVE_FLCTL0_RX,
411 .addr = 0xe6a30050,
412 .chcr = CHCR_RX(XMIT_SZ_32BIT),
413 .mid_rid = 0x83,
414 }, {
415 .slave_id = SHDMA_SLAVE_FLCTL1_TX,
416 .addr = 0xe6a30060,
417 .chcr = CHCR_TX(XMIT_SZ_32BIT),
418 .mid_rid = 0x87,
419 }, {
420 .slave_id = SHDMA_SLAVE_FLCTL1_RX,
421 .addr = 0xe6a30060,
422 .chcr = CHCR_RX(XMIT_SZ_32BIT),
423 .mid_rid = 0x87,
424 }, {
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000425 .slave_id = SHDMA_SLAVE_SDHI0_TX,
426 .addr = 0xe6850030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700427 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000428 .mid_rid = 0xc1,
429 }, {
430 .slave_id = SHDMA_SLAVE_SDHI0_RX,
431 .addr = 0xe6850030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700432 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000433 .mid_rid = 0xc2,
434 }, {
435 .slave_id = SHDMA_SLAVE_SDHI1_TX,
436 .addr = 0xe6860030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700437 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000438 .mid_rid = 0xc9,
439 }, {
440 .slave_id = SHDMA_SLAVE_SDHI1_RX,
441 .addr = 0xe6860030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700442 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000443 .mid_rid = 0xca,
444 }, {
445 .slave_id = SHDMA_SLAVE_SDHI2_TX,
446 .addr = 0xe6870030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700447 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000448 .mid_rid = 0xcd,
449 }, {
450 .slave_id = SHDMA_SLAVE_SDHI2_RX,
451 .addr = 0xe6870030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700452 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000453 .mid_rid = 0xce,
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000454 }, {
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700455 .slave_id = SHDMA_SLAVE_FSIA_TX,
456 .addr = 0xfe1f0024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700457 .chcr = CHCR_TX(XMIT_SZ_32BIT),
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700458 .mid_rid = 0xb1,
459 }, {
460 .slave_id = SHDMA_SLAVE_FSIA_RX,
461 .addr = 0xfe1f0020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700462 .chcr = CHCR_RX(XMIT_SZ_32BIT),
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700463 .mid_rid = 0xb2,
464 }, {
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000465 .slave_id = SHDMA_SLAVE_MMCIF_TX,
466 .addr = 0xe6bd0034,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700467 .chcr = CHCR_TX(XMIT_SZ_32BIT),
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000468 .mid_rid = 0xd1,
469 }, {
470 .slave_id = SHDMA_SLAVE_MMCIF_RX,
471 .addr = 0xe6bd0034,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700472 .chcr = CHCR_RX(XMIT_SZ_32BIT),
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000473 .mid_rid = 0xd2,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000474 },
475};
476
Kuninori Morimoto4d6344f2012-06-20 11:30:32 +0200477#define SH7372_CHCLR (0x220 - 0x20)
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100478
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000479static const struct sh_dmae_channel sh7372_dmae_channels[] = {
480 {
481 .offset = 0,
482 .dmars = 0,
483 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100484 .chclr_offset = SH7372_CHCLR + 0,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000485 }, {
486 .offset = 0x10,
487 .dmars = 0,
488 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100489 .chclr_offset = SH7372_CHCLR + 0x10,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000490 }, {
491 .offset = 0x20,
492 .dmars = 4,
493 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100494 .chclr_offset = SH7372_CHCLR + 0x20,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000495 }, {
496 .offset = 0x30,
497 .dmars = 4,
498 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100499 .chclr_offset = SH7372_CHCLR + 0x30,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000500 }, {
501 .offset = 0x50,
502 .dmars = 8,
503 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100504 .chclr_offset = SH7372_CHCLR + 0x50,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000505 }, {
506 .offset = 0x60,
507 .dmars = 8,
508 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100509 .chclr_offset = SH7372_CHCLR + 0x60,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000510 }
511};
512
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000513static struct sh_dmae_pdata dma_platform_data = {
514 .slave = sh7372_dmae_slaves,
515 .slave_num = ARRAY_SIZE(sh7372_dmae_slaves),
516 .channel = sh7372_dmae_channels,
517 .channel_num = ARRAY_SIZE(sh7372_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700518 .ts_low_shift = TS_LOW_SHIFT,
519 .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
520 .ts_high_shift = TS_HI_SHIFT,
521 .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
522 .ts_shift = dma_ts_shift,
523 .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000524 .dmaor_init = DMAOR_DME,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100525 .chclr_present = 1,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000526};
527
528/* Resource order important! */
529static struct resource sh7372_dmae0_resources[] = {
530 {
531 /* Channel registers and DMAOR */
532 .start = 0xfe008020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100533 .end = 0xfe00828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000534 .flags = IORESOURCE_MEM,
535 },
536 {
537 /* DMARSx */
538 .start = 0xfe009000,
539 .end = 0xfe00900b,
540 .flags = IORESOURCE_MEM,
541 },
542 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900543 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000544 .start = evt2irq(0x20c0),
545 .end = evt2irq(0x20c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000546 .flags = IORESOURCE_IRQ,
547 },
548 {
549 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000550 .start = evt2irq(0x2000),
551 .end = evt2irq(0x20a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000552 .flags = IORESOURCE_IRQ,
553 },
554};
555
556/* Resource order important! */
557static struct resource sh7372_dmae1_resources[] = {
558 {
559 /* Channel registers and DMAOR */
560 .start = 0xfe018020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100561 .end = 0xfe01828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000562 .flags = IORESOURCE_MEM,
563 },
564 {
565 /* DMARSx */
566 .start = 0xfe019000,
567 .end = 0xfe01900b,
568 .flags = IORESOURCE_MEM,
569 },
570 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900571 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000572 .start = evt2irq(0x21c0),
573 .end = evt2irq(0x21c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000574 .flags = IORESOURCE_IRQ,
575 },
576 {
577 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000578 .start = evt2irq(0x2100),
579 .end = evt2irq(0x21a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000580 .flags = IORESOURCE_IRQ,
581 },
582};
583
584/* Resource order important! */
585static struct resource sh7372_dmae2_resources[] = {
586 {
587 /* Channel registers and DMAOR */
588 .start = 0xfe028020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100589 .end = 0xfe02828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000590 .flags = IORESOURCE_MEM,
591 },
592 {
593 /* DMARSx */
594 .start = 0xfe029000,
595 .end = 0xfe02900b,
596 .flags = IORESOURCE_MEM,
597 },
598 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900599 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000600 .start = evt2irq(0x22c0),
601 .end = evt2irq(0x22c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000602 .flags = IORESOURCE_IRQ,
603 },
604 {
605 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000606 .start = evt2irq(0x2200),
607 .end = evt2irq(0x22a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000608 .flags = IORESOURCE_IRQ,
609 },
610};
611
612static struct platform_device dma0_device = {
613 .name = "sh-dma-engine",
614 .id = 0,
615 .resource = sh7372_dmae0_resources,
616 .num_resources = ARRAY_SIZE(sh7372_dmae0_resources),
617 .dev = {
618 .platform_data = &dma_platform_data,
619 },
620};
621
622static struct platform_device dma1_device = {
623 .name = "sh-dma-engine",
624 .id = 1,
625 .resource = sh7372_dmae1_resources,
626 .num_resources = ARRAY_SIZE(sh7372_dmae1_resources),
627 .dev = {
628 .platform_data = &dma_platform_data,
629 },
630};
631
632static struct platform_device dma2_device = {
633 .name = "sh-dma-engine",
634 .id = 2,
635 .resource = sh7372_dmae2_resources,
636 .num_resources = ARRAY_SIZE(sh7372_dmae2_resources),
637 .dev = {
638 .platform_data = &dma_platform_data,
639 },
640};
641
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000642/*
643 * USB-DMAC
644 */
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000645static const struct sh_dmae_channel sh7372_usb_dmae_channels[] = {
646 {
647 .offset = 0,
648 }, {
649 .offset = 0x20,
650 },
651};
652
653/* USB DMAC0 */
654static const struct sh_dmae_slave_config sh7372_usb_dmae0_slaves[] = {
655 {
656 .slave_id = SHDMA_SLAVE_USB0_TX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700657 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000658 }, {
659 .slave_id = SHDMA_SLAVE_USB0_RX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700660 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000661 },
662};
663
664static struct sh_dmae_pdata usb_dma0_platform_data = {
665 .slave = sh7372_usb_dmae0_slaves,
666 .slave_num = ARRAY_SIZE(sh7372_usb_dmae0_slaves),
667 .channel = sh7372_usb_dmae_channels,
668 .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700669 .ts_low_shift = USBTS_LOW_SHIFT,
670 .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
671 .ts_high_shift = USBTS_HI_SHIFT,
672 .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
673 .ts_shift = dma_usbts_shift,
674 .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000675 .dmaor_init = DMAOR_DME,
676 .chcr_offset = 0x14,
677 .chcr_ie_bit = 1 << 5,
678 .dmaor_is_32bit = 1,
679 .needs_tend_set = 1,
680 .no_dmars = 1,
Guennadi Liakhovetskic8ddf032012-01-18 10:14:29 +0100681 .slave_only = 1,
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000682};
683
684static struct resource sh7372_usb_dmae0_resources[] = {
685 {
686 /* Channel registers and DMAOR */
687 .start = 0xe68a0020,
688 .end = 0xe68a0064 - 1,
689 .flags = IORESOURCE_MEM,
690 },
691 {
692 /* VCR/SWR/DMICR */
693 .start = 0xe68a0000,
694 .end = 0xe68a0014 - 1,
695 .flags = IORESOURCE_MEM,
696 },
697 {
698 /* IRQ for channels */
699 .start = evt2irq(0x0a00),
700 .end = evt2irq(0x0a00),
701 .flags = IORESOURCE_IRQ,
702 },
703};
704
705static struct platform_device usb_dma0_device = {
706 .name = "sh-dma-engine",
707 .id = 3,
708 .resource = sh7372_usb_dmae0_resources,
709 .num_resources = ARRAY_SIZE(sh7372_usb_dmae0_resources),
710 .dev = {
711 .platform_data = &usb_dma0_platform_data,
712 },
713};
714
715/* USB DMAC1 */
716static const struct sh_dmae_slave_config sh7372_usb_dmae1_slaves[] = {
717 {
718 .slave_id = SHDMA_SLAVE_USB1_TX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700719 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000720 }, {
721 .slave_id = SHDMA_SLAVE_USB1_RX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700722 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000723 },
724};
725
726static struct sh_dmae_pdata usb_dma1_platform_data = {
727 .slave = sh7372_usb_dmae1_slaves,
728 .slave_num = ARRAY_SIZE(sh7372_usb_dmae1_slaves),
729 .channel = sh7372_usb_dmae_channels,
730 .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700731 .ts_low_shift = USBTS_LOW_SHIFT,
732 .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
733 .ts_high_shift = USBTS_HI_SHIFT,
734 .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
735 .ts_shift = dma_usbts_shift,
736 .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000737 .dmaor_init = DMAOR_DME,
738 .chcr_offset = 0x14,
739 .chcr_ie_bit = 1 << 5,
740 .dmaor_is_32bit = 1,
741 .needs_tend_set = 1,
742 .no_dmars = 1,
Guennadi Liakhovetskic8ddf032012-01-18 10:14:29 +0100743 .slave_only = 1,
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000744};
745
746static struct resource sh7372_usb_dmae1_resources[] = {
747 {
748 /* Channel registers and DMAOR */
749 .start = 0xe68c0020,
750 .end = 0xe68c0064 - 1,
751 .flags = IORESOURCE_MEM,
752 },
753 {
754 /* VCR/SWR/DMICR */
755 .start = 0xe68c0000,
756 .end = 0xe68c0014 - 1,
757 .flags = IORESOURCE_MEM,
758 },
759 {
760 /* IRQ for channels */
761 .start = evt2irq(0x1d00),
762 .end = evt2irq(0x1d00),
763 .flags = IORESOURCE_IRQ,
764 },
765};
766
767static struct platform_device usb_dma1_device = {
768 .name = "sh-dma-engine",
769 .id = 4,
770 .resource = sh7372_usb_dmae1_resources,
771 .num_resources = ARRAY_SIZE(sh7372_usb_dmae1_resources),
772 .dev = {
773 .platform_data = &usb_dma1_platform_data,
774 },
775};
776
Magnus Damm68224712011-04-28 03:21:00 +0000777/* VPU */
778static struct uio_info vpu_platform_data = {
779 .name = "VPU5HG",
780 .version = "0",
781 .irq = intcs_evt2irq(0x980),
782};
783
784static struct resource vpu_resources[] = {
785 [0] = {
786 .name = "VPU",
787 .start = 0xfe900000,
788 .end = 0xfe900157,
789 .flags = IORESOURCE_MEM,
790 },
791};
792
793static struct platform_device vpu_device = {
794 .name = "uio_pdrv_genirq",
795 .id = 0,
796 .dev = {
797 .platform_data = &vpu_platform_data,
798 },
799 .resource = vpu_resources,
800 .num_resources = ARRAY_SIZE(vpu_resources),
801};
802
803/* VEU0 */
804static struct uio_info veu0_platform_data = {
805 .name = "VEU0",
806 .version = "0",
807 .irq = intcs_evt2irq(0x700),
808};
809
810static struct resource veu0_resources[] = {
811 [0] = {
812 .name = "VEU0",
813 .start = 0xfe920000,
814 .end = 0xfe9200cb,
815 .flags = IORESOURCE_MEM,
816 },
817};
818
819static struct platform_device veu0_device = {
820 .name = "uio_pdrv_genirq",
821 .id = 1,
822 .dev = {
823 .platform_data = &veu0_platform_data,
824 },
825 .resource = veu0_resources,
826 .num_resources = ARRAY_SIZE(veu0_resources),
827};
828
829/* VEU1 */
830static struct uio_info veu1_platform_data = {
831 .name = "VEU1",
832 .version = "0",
833 .irq = intcs_evt2irq(0x720),
834};
835
836static struct resource veu1_resources[] = {
837 [0] = {
838 .name = "VEU1",
839 .start = 0xfe924000,
840 .end = 0xfe9240cb,
841 .flags = IORESOURCE_MEM,
842 },
843};
844
845static struct platform_device veu1_device = {
846 .name = "uio_pdrv_genirq",
847 .id = 2,
848 .dev = {
849 .platform_data = &veu1_platform_data,
850 },
851 .resource = veu1_resources,
852 .num_resources = ARRAY_SIZE(veu1_resources),
853};
854
855/* VEU2 */
856static struct uio_info veu2_platform_data = {
857 .name = "VEU2",
858 .version = "0",
859 .irq = intcs_evt2irq(0x740),
860};
861
862static struct resource veu2_resources[] = {
863 [0] = {
864 .name = "VEU2",
865 .start = 0xfe928000,
866 .end = 0xfe928307,
867 .flags = IORESOURCE_MEM,
868 },
869};
870
871static struct platform_device veu2_device = {
872 .name = "uio_pdrv_genirq",
873 .id = 3,
874 .dev = {
875 .platform_data = &veu2_platform_data,
876 },
877 .resource = veu2_resources,
878 .num_resources = ARRAY_SIZE(veu2_resources),
879};
880
881/* VEU3 */
882static struct uio_info veu3_platform_data = {
883 .name = "VEU3",
884 .version = "0",
885 .irq = intcs_evt2irq(0x760),
886};
887
888static struct resource veu3_resources[] = {
889 [0] = {
890 .name = "VEU3",
891 .start = 0xfe92c000,
892 .end = 0xfe92c307,
893 .flags = IORESOURCE_MEM,
894 },
895};
896
897static struct platform_device veu3_device = {
898 .name = "uio_pdrv_genirq",
899 .id = 4,
900 .dev = {
901 .platform_data = &veu3_platform_data,
902 },
903 .resource = veu3_resources,
904 .num_resources = ARRAY_SIZE(veu3_resources),
905};
906
907/* JPU */
908static struct uio_info jpu_platform_data = {
909 .name = "JPU",
910 .version = "0",
911 .irq = intcs_evt2irq(0x560),
912};
913
914static struct resource jpu_resources[] = {
915 [0] = {
916 .name = "JPU",
917 .start = 0xfe980000,
918 .end = 0xfe9902d3,
919 .flags = IORESOURCE_MEM,
920 },
921};
922
923static struct platform_device jpu_device = {
924 .name = "uio_pdrv_genirq",
925 .id = 5,
926 .dev = {
927 .platform_data = &jpu_platform_data,
928 },
929 .resource = jpu_resources,
930 .num_resources = ARRAY_SIZE(jpu_resources),
931};
932
933/* SPU2DSP0 */
934static struct uio_info spu0_platform_data = {
935 .name = "SPU2DSP0",
936 .version = "0",
937 .irq = evt2irq(0x1800),
938};
939
940static struct resource spu0_resources[] = {
941 [0] = {
942 .name = "SPU2DSP0",
943 .start = 0xfe200000,
944 .end = 0xfe2fffff,
945 .flags = IORESOURCE_MEM,
946 },
947};
948
949static struct platform_device spu0_device = {
950 .name = "uio_pdrv_genirq",
951 .id = 6,
952 .dev = {
953 .platform_data = &spu0_platform_data,
954 },
955 .resource = spu0_resources,
956 .num_resources = ARRAY_SIZE(spu0_resources),
957};
958
959/* SPU2DSP1 */
960static struct uio_info spu1_platform_data = {
961 .name = "SPU2DSP1",
962 .version = "0",
963 .irq = evt2irq(0x1820),
964};
965
966static struct resource spu1_resources[] = {
967 [0] = {
968 .name = "SPU2DSP1",
969 .start = 0xfe300000,
970 .end = 0xfe3fffff,
971 .flags = IORESOURCE_MEM,
972 },
973};
974
975static struct platform_device spu1_device = {
976 .name = "uio_pdrv_genirq",
977 .id = 7,
978 .dev = {
979 .platform_data = &spu1_platform_data,
980 },
981 .resource = spu1_resources,
982 .num_resources = ARRAY_SIZE(spu1_resources),
983};
984
Magnus Damm2b7eda62010-02-05 11:14:58 +0000985static struct platform_device *sh7372_early_devices[] __initdata = {
986 &scif0_device,
987 &scif1_device,
988 &scif2_device,
989 &scif3_device,
990 &scif4_device,
991 &scif5_device,
992 &scif6_device,
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000993 &cmt2_device,
Magnus Dammc6c049e2010-10-14 06:57:25 +0000994 &tmu00_device,
995 &tmu01_device,
Magnus Damm934e4072010-10-13 07:22:11 +0000996};
997
998static struct platform_device *sh7372_late_devices[] __initdata = {
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000999 &iic0_device,
1000 &iic1_device,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +00001001 &dma0_device,
1002 &dma1_device,
1003 &dma2_device,
Kuninori Morimotoafe48042011-06-17 08:21:10 +00001004 &usb_dma0_device,
1005 &usb_dma1_device,
Magnus Damm68224712011-04-28 03:21:00 +00001006 &vpu_device,
1007 &veu0_device,
1008 &veu1_device,
1009 &veu2_device,
1010 &veu3_device,
1011 &jpu_device,
1012 &spu0_device,
1013 &spu1_device,
Magnus Damm2b7eda62010-02-05 11:14:58 +00001014};
1015
1016void __init sh7372_add_standard_devices(void)
1017{
Rafael J. Wysockiac18e022012-08-15 20:56:26 +02001018 struct pm_domain_device domain_devices[] = {
1019 { "A3RV", &vpu_device, },
1020 { "A4MP", &spu0_device, },
1021 { "A4MP", &spu1_device, },
1022 { "A3SP", &scif0_device, },
1023 { "A3SP", &scif1_device, },
1024 { "A3SP", &scif2_device, },
1025 { "A3SP", &scif3_device, },
1026 { "A3SP", &scif4_device, },
1027 { "A3SP", &scif5_device, },
1028 { "A3SP", &scif6_device, },
1029 { "A3SP", &iic1_device, },
1030 { "A3SP", &dma0_device, },
1031 { "A3SP", &dma1_device, },
1032 { "A3SP", &dma2_device, },
1033 { "A3SP", &usb_dma0_device, },
1034 { "A3SP", &usb_dma1_device, },
1035 { "A4R", &iic0_device, },
1036 { "A4R", &veu0_device, },
1037 { "A4R", &veu1_device, },
1038 { "A4R", &veu2_device, },
1039 { "A4R", &veu3_device, },
1040 { "A4R", &jpu_device, },
1041 { "A4R", &tmu00_device, },
1042 { "A4R", &tmu01_device, },
Rafael J. Wysockic37b7a72012-08-08 00:28:36 +02001043 };
1044
Rafael J. Wysockie7e59a42012-08-07 01:12:56 +02001045 sh7372_init_pm_domains();
Magnus Dammf7dadb32011-12-23 01:23:07 +01001046
Magnus Damm2b7eda62010-02-05 11:14:58 +00001047 platform_add_devices(sh7372_early_devices,
1048 ARRAY_SIZE(sh7372_early_devices));
Magnus Damm934e4072010-10-13 07:22:11 +00001049
1050 platform_add_devices(sh7372_late_devices,
1051 ARRAY_SIZE(sh7372_late_devices));
Magnus Damm33afebf2011-07-01 22:14:45 +02001052
Rafael J. Wysockiac18e022012-08-15 20:56:26 +02001053 rmobile_add_devices_to_domains(domain_devices,
1054 ARRAY_SIZE(domain_devices));
Magnus Damm2b7eda62010-02-05 11:14:58 +00001055}
1056
Magnus Damm17254bf2012-03-06 17:36:37 +09001057static void __init sh7372_earlytimer_init(void)
1058{
1059 sh7372_clock_init();
1060 shmobile_earlytimer_init();
1061}
1062
Magnus Damm2b7eda62010-02-05 11:14:58 +00001063void __init sh7372_add_early_devices(void)
1064{
Magnus Damm2b7eda62010-02-05 11:14:58 +00001065 early_platform_add_devices(sh7372_early_devices,
1066 ARRAY_SIZE(sh7372_early_devices));
Magnus Damm5d7220ec2012-02-29 21:37:19 +09001067
1068 /* setup early console here as well */
1069 shmobile_setup_console();
Magnus Damm17254bf2012-03-06 17:36:37 +09001070
1071 /* override timer setup with soc-specific code */
1072 shmobile_timer.init = sh7372_earlytimer_init;
Magnus Damm2b7eda62010-02-05 11:14:58 +00001073}
Magnus Damm3b7b7052012-03-28 15:53:40 +09001074
1075#ifdef CONFIG_USE_OF
1076
1077void __init sh7372_add_early_devices_dt(void)
1078{
1079 shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */
1080
1081 early_platform_add_devices(sh7372_early_devices,
1082 ARRAY_SIZE(sh7372_early_devices));
1083
1084 /* setup early console here as well */
1085 shmobile_setup_console();
1086}
1087
1088static const struct of_dev_auxdata sh7372_auxdata_lookup[] __initconst = {
1089 { }
1090};
1091
1092void __init sh7372_add_standard_devices_dt(void)
1093{
1094 /* clocks are setup late during boot in the case of DT */
1095 sh7372_clock_init();
1096
1097 platform_add_devices(sh7372_early_devices,
1098 ARRAY_SIZE(sh7372_early_devices));
1099
1100 of_platform_populate(NULL, of_default_bus_match_table,
1101 sh7372_auxdata_lookup, NULL);
1102}
1103
1104static const char *sh7372_boards_compat_dt[] __initdata = {
1105 "renesas,sh7372",
1106 NULL,
1107};
1108
1109DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
1110 .map_io = sh7372_map_io,
1111 .init_early = sh7372_add_early_devices_dt,
1112 .nr_irqs = NR_IRQS_LEGACY,
1113 .init_irq = sh7372_init_irq,
1114 .handle_irq = shmobile_handle_irq_intc,
1115 .init_machine = sh7372_add_standard_devices_dt,
1116 .timer = &shmobile_timer,
1117 .dt_compat = sh7372_boards_compat_dt,
1118MACHINE_END
1119
1120#endif /* CONFIG_USE_OF */