blob: e81c38538e13f12e639e0ffa47a140cd21f4e1f7 [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.
Magnus Damm2b7eda62010-02-05 11:14:58 +000015 */
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/interrupt.h>
19#include <linux/irq.h>
20#include <linux/platform_device.h>
Magnus Damm3b7b7052012-03-28 15:53:40 +090021#include <linux/of_platform.h>
Magnus Damm68224712011-04-28 03:21:00 +000022#include <linux/uio_driver.h>
Magnus Damm2b7eda62010-02-05 11:14:58 +000023#include <linux/delay.h>
24#include <linux/input.h>
25#include <linux/io.h>
26#include <linux/serial_sci.h>
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +000027#include <linux/sh_dma.h>
Magnus Damm2b7eda62010-02-05 11:14:58 +000028#include <linux/sh_timer.h>
Rafael J. Wysocki111058c2011-08-14 13:35:39 +020029#include <linux/pm_domain.h>
Arnd Bergmann426f1af2012-03-22 22:02:16 +000030#include <linux/dma-mapping.h>
Hideki EIRAKU3cfb8432013-01-21 19:54:27 +090031#include <linux/platform_data/sh_ipmmu.h>
Geert Uytterhoeven113522e2014-06-20 18:53:08 +020032
Magnus Damm5d7220ec2012-02-29 21:37:19 +090033#include <asm/mach/map.h>
Magnus Damm2b7eda62010-02-05 11:14:58 +000034#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
Magnus Damm17254bf2012-03-06 17:36:37 +090036#include <asm/mach/time.h>
Geert Uytterhoeven113522e2014-06-20 18:53:08 +020037
Magnus Dammfd44aa52014-06-17 16:47:37 +090038#include "common.h"
Magnus Damm74ac0de2014-06-17 16:47:13 +090039#include "dma-register.h"
Geert Uytterhoeven86155b32014-08-20 15:39:23 +020040#include "intc.h"
Magnus Dammb6bab122014-06-17 16:47:29 +090041#include "irqs.h"
Magnus Damm6b8b0cb2014-06-17 16:47:45 +090042#include "pm-rmobile.h"
Geert Uytterhoeven113522e2014-06-20 18:53:08 +020043#include "sh7372.h"
Magnus Damm2b7eda62010-02-05 11:14:58 +000044
Magnus Damm5d7220ec2012-02-29 21:37:19 +090045static struct map_desc sh7372_io_desc[] __initdata = {
46 /* create a 1:1 entity map for 0xe6xxxxxx
47 * used by CPGA, INTC and PFC.
48 */
49 {
50 .virtual = 0xe6000000,
51 .pfn = __phys_to_pfn(0xe6000000),
52 .length = 256 << 20,
53 .type = MT_DEVICE_NONSHARED
54 },
55};
56
57void __init sh7372_map_io(void)
58{
59 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc));
60}
Magnus Damm2b7eda62010-02-05 11:14:58 +000061
Laurent Pinchart5967fe02012-12-15 23:51:27 +010062/* PFC */
63static struct resource sh7372_pfc_resources[] = {
64 [0] = {
65 .start = 0xe6050000,
66 .end = 0xe6057fff,
67 .flags = IORESOURCE_MEM,
68 },
69 [1] = {
70 .start = 0xe605800c,
71 .end = 0xe6058027,
72 .flags = IORESOURCE_MEM,
73 }
74};
75
76static struct platform_device sh7372_pfc_device = {
77 .name = "pfc-sh7372",
78 .id = -1,
79 .resource = sh7372_pfc_resources,
80 .num_resources = ARRAY_SIZE(sh7372_pfc_resources),
81};
82
83void __init sh7372_pinmux_init(void)
84{
85 platform_device_register(&sh7372_pfc_device);
86}
87
Laurent Pinchartc6a0d862013-12-06 10:59:21 +010088/* SCIF */
89#define SH7372_SCIF(scif_type, index, baseaddr, irq) \
90static struct plat_sci_port scif##index##_platform_data = { \
91 .type = scif_type, \
Laurent Pinchartc6a0d862013-12-06 10:59:21 +010092 .flags = UPF_BOOT_AUTOCONF, \
Laurent Pinchartc6a0d862013-12-06 10:59:21 +010093 .scscr = SCSCR_RE | SCSCR_TE, \
94}; \
95 \
Laurent Pinchartd39f98b2013-12-06 10:59:30 +010096static struct resource scif##index##_resources[] = { \
97 DEFINE_RES_MEM(baseaddr, 0x100), \
98 DEFINE_RES_IRQ(irq), \
99}; \
100 \
Laurent Pinchartc6a0d862013-12-06 10:59:21 +0100101static struct platform_device scif##index##_device = { \
102 .name = "sh-sci", \
103 .id = index, \
Laurent Pinchartd39f98b2013-12-06 10:59:30 +0100104 .resource = scif##index##_resources, \
105 .num_resources = ARRAY_SIZE(scif##index##_resources), \
Laurent Pinchartc6a0d862013-12-06 10:59:21 +0100106 .dev = { \
107 .platform_data = &scif##index##_platform_data, \
108 }, \
109}
Magnus Damm2b7eda62010-02-05 11:14:58 +0000110
Laurent Pinchartc6a0d862013-12-06 10:59:21 +0100111SH7372_SCIF(PORT_SCIFA, 0, 0xe6c40000, evt2irq(0x0c00));
112SH7372_SCIF(PORT_SCIFA, 1, 0xe6c50000, evt2irq(0x0c20));
113SH7372_SCIF(PORT_SCIFA, 2, 0xe6c60000, evt2irq(0x0c40));
114SH7372_SCIF(PORT_SCIFA, 3, 0xe6c70000, evt2irq(0x0c60));
115SH7372_SCIF(PORT_SCIFA, 4, 0xe6c80000, evt2irq(0x0d20));
116SH7372_SCIF(PORT_SCIFA, 5, 0xe6cb0000, evt2irq(0x0d40));
117SH7372_SCIF(PORT_SCIFB, 6, 0xe6c30000, evt2irq(0x0d60));
Magnus Damm2b7eda62010-02-05 11:14:58 +0000118
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000119/* CMT */
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000120static struct sh_timer_config cmt2_platform_data = {
Laurent Pinchart386f60a2014-04-23 13:15:09 +0200121 .channels_mask = 0x20,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000122};
123
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000124static struct resource cmt2_resources[] = {
Laurent Pinchart386f60a2014-04-23 13:15:09 +0200125 DEFINE_RES_MEM(0xe6130000, 0x50),
126 DEFINE_RES_IRQ(evt2irq(0x0b80)),
Magnus Damm2b7eda62010-02-05 11:14:58 +0000127};
128
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000129static struct platform_device cmt2_device = {
Laurent Pinchart386f60a2014-04-23 13:15:09 +0200130 .name = "sh-cmt-32-fast",
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000131 .id = 2,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000132 .dev = {
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000133 .platform_data = &cmt2_platform_data,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000134 },
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000135 .resource = cmt2_resources,
136 .num_resources = ARRAY_SIZE(cmt2_resources),
Magnus Damm2b7eda62010-02-05 11:14:58 +0000137};
138
Magnus Dammc6c049e2010-10-14 06:57:25 +0000139/* TMU */
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200140static struct sh_timer_config tmu0_platform_data = {
141 .channels_mask = 7,
Magnus Dammc6c049e2010-10-14 06:57:25 +0000142};
143
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200144static struct resource tmu0_resources[] = {
145 DEFINE_RES_MEM(0xfff60000, 0x2c),
146 DEFINE_RES_IRQ(intcs_evt2irq(0xe80)),
147 DEFINE_RES_IRQ(intcs_evt2irq(0xea0)),
148 DEFINE_RES_IRQ(intcs_evt2irq(0xec0)),
Magnus Dammc6c049e2010-10-14 06:57:25 +0000149};
150
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200151static struct platform_device tmu0_device = {
152 .name = "sh-tmu",
Magnus Dammc6c049e2010-10-14 06:57:25 +0000153 .id = 0,
154 .dev = {
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200155 .platform_data = &tmu0_platform_data,
Magnus Dammc6c049e2010-10-14 06:57:25 +0000156 },
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200157 .resource = tmu0_resources,
158 .num_resources = ARRAY_SIZE(tmu0_resources),
Magnus Dammc6c049e2010-10-14 06:57:25 +0000159};
160
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000161/* I2C */
162static struct resource iic0_resources[] = {
163 [0] = {
164 .name = "IIC0",
165 .start = 0xFFF20000,
166 .end = 0xFFF20425 - 1,
167 .flags = IORESOURCE_MEM,
168 },
169 [1] = {
Magnus Damm33c96072010-05-20 14:41:00 +0000170 .start = intcs_evt2irq(0xe00), /* IIC0_ALI0 */
171 .end = intcs_evt2irq(0xe60), /* IIC0_DTEI0 */
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000172 .flags = IORESOURCE_IRQ,
173 },
174};
175
176static struct platform_device iic0_device = {
177 .name = "i2c-sh_mobile",
178 .id = 0, /* "i2c0" clock */
179 .num_resources = ARRAY_SIZE(iic0_resources),
180 .resource = iic0_resources,
181};
182
183static struct resource iic1_resources[] = {
184 [0] = {
185 .name = "IIC1",
186 .start = 0xE6C20000,
187 .end = 0xE6C20425 - 1,
188 .flags = IORESOURCE_MEM,
189 },
190 [1] = {
Magnus Damm33c96072010-05-20 14:41:00 +0000191 .start = evt2irq(0x780), /* IIC1_ALI1 */
192 .end = evt2irq(0x7e0), /* IIC1_DTEI1 */
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000193 .flags = IORESOURCE_IRQ,
194 },
195};
196
197static struct platform_device iic1_device = {
198 .name = "i2c-sh_mobile",
199 .id = 1, /* "i2c1" clock */
200 .num_resources = ARRAY_SIZE(iic1_resources),
201 .resource = iic1_resources,
202};
203
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000204/* DMA */
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000205static const struct sh_dmae_slave_config sh7372_dmae_slaves[] = {
206 {
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000207 .slave_id = SHDMA_SLAVE_SCIF0_TX,
208 .addr = 0xe6c40020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700209 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000210 .mid_rid = 0x21,
211 }, {
212 .slave_id = SHDMA_SLAVE_SCIF0_RX,
213 .addr = 0xe6c40024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700214 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000215 .mid_rid = 0x22,
216 }, {
217 .slave_id = SHDMA_SLAVE_SCIF1_TX,
218 .addr = 0xe6c50020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700219 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000220 .mid_rid = 0x25,
221 }, {
222 .slave_id = SHDMA_SLAVE_SCIF1_RX,
223 .addr = 0xe6c50024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700224 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000225 .mid_rid = 0x26,
226 }, {
227 .slave_id = SHDMA_SLAVE_SCIF2_TX,
228 .addr = 0xe6c60020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700229 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000230 .mid_rid = 0x29,
231 }, {
232 .slave_id = SHDMA_SLAVE_SCIF2_RX,
233 .addr = 0xe6c60024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700234 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000235 .mid_rid = 0x2a,
236 }, {
237 .slave_id = SHDMA_SLAVE_SCIF3_TX,
238 .addr = 0xe6c70020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700239 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000240 .mid_rid = 0x2d,
241 }, {
242 .slave_id = SHDMA_SLAVE_SCIF3_RX,
243 .addr = 0xe6c70024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700244 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000245 .mid_rid = 0x2e,
246 }, {
247 .slave_id = SHDMA_SLAVE_SCIF4_TX,
248 .addr = 0xe6c80020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700249 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000250 .mid_rid = 0x39,
251 }, {
252 .slave_id = SHDMA_SLAVE_SCIF4_RX,
253 .addr = 0xe6c80024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700254 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000255 .mid_rid = 0x3a,
256 }, {
257 .slave_id = SHDMA_SLAVE_SCIF5_TX,
258 .addr = 0xe6cb0020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700259 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000260 .mid_rid = 0x35,
261 }, {
262 .slave_id = SHDMA_SLAVE_SCIF5_RX,
263 .addr = 0xe6cb0024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700264 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000265 .mid_rid = 0x36,
266 }, {
267 .slave_id = SHDMA_SLAVE_SCIF6_TX,
268 .addr = 0xe6c30040,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700269 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000270 .mid_rid = 0x3d,
271 }, {
272 .slave_id = SHDMA_SLAVE_SCIF6_RX,
273 .addr = 0xe6c30060,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700274 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000275 .mid_rid = 0x3e,
276 }, {
Bastian Hecht40eaed72012-09-22 14:06:38 +0200277 .slave_id = SHDMA_SLAVE_FLCTL0_TX,
278 .addr = 0xe6a30050,
279 .chcr = CHCR_TX(XMIT_SZ_32BIT),
280 .mid_rid = 0x83,
281 }, {
282 .slave_id = SHDMA_SLAVE_FLCTL0_RX,
283 .addr = 0xe6a30050,
284 .chcr = CHCR_RX(XMIT_SZ_32BIT),
285 .mid_rid = 0x83,
286 }, {
287 .slave_id = SHDMA_SLAVE_FLCTL1_TX,
288 .addr = 0xe6a30060,
289 .chcr = CHCR_TX(XMIT_SZ_32BIT),
290 .mid_rid = 0x87,
291 }, {
292 .slave_id = SHDMA_SLAVE_FLCTL1_RX,
293 .addr = 0xe6a30060,
294 .chcr = CHCR_RX(XMIT_SZ_32BIT),
295 .mid_rid = 0x87,
296 }, {
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000297 .slave_id = SHDMA_SLAVE_SDHI0_TX,
298 .addr = 0xe6850030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700299 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000300 .mid_rid = 0xc1,
301 }, {
302 .slave_id = SHDMA_SLAVE_SDHI0_RX,
303 .addr = 0xe6850030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700304 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000305 .mid_rid = 0xc2,
306 }, {
307 .slave_id = SHDMA_SLAVE_SDHI1_TX,
308 .addr = 0xe6860030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700309 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000310 .mid_rid = 0xc9,
311 }, {
312 .slave_id = SHDMA_SLAVE_SDHI1_RX,
313 .addr = 0xe6860030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700314 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000315 .mid_rid = 0xca,
316 }, {
317 .slave_id = SHDMA_SLAVE_SDHI2_TX,
318 .addr = 0xe6870030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700319 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000320 .mid_rid = 0xcd,
321 }, {
322 .slave_id = SHDMA_SLAVE_SDHI2_RX,
323 .addr = 0xe6870030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700324 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000325 .mid_rid = 0xce,
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000326 }, {
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700327 .slave_id = SHDMA_SLAVE_FSIA_TX,
328 .addr = 0xfe1f0024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700329 .chcr = CHCR_TX(XMIT_SZ_32BIT),
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700330 .mid_rid = 0xb1,
331 }, {
332 .slave_id = SHDMA_SLAVE_FSIA_RX,
333 .addr = 0xfe1f0020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700334 .chcr = CHCR_RX(XMIT_SZ_32BIT),
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700335 .mid_rid = 0xb2,
336 }, {
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000337 .slave_id = SHDMA_SLAVE_MMCIF_TX,
338 .addr = 0xe6bd0034,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700339 .chcr = CHCR_TX(XMIT_SZ_32BIT),
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000340 .mid_rid = 0xd1,
341 }, {
342 .slave_id = SHDMA_SLAVE_MMCIF_RX,
343 .addr = 0xe6bd0034,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700344 .chcr = CHCR_RX(XMIT_SZ_32BIT),
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000345 .mid_rid = 0xd2,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000346 },
347};
348
Kuninori Morimoto4d6344f2012-06-20 11:30:32 +0200349#define SH7372_CHCLR (0x220 - 0x20)
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100350
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000351static const struct sh_dmae_channel sh7372_dmae_channels[] = {
352 {
353 .offset = 0,
354 .dmars = 0,
355 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100356 .chclr_offset = SH7372_CHCLR + 0,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000357 }, {
358 .offset = 0x10,
359 .dmars = 0,
360 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100361 .chclr_offset = SH7372_CHCLR + 0x10,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000362 }, {
363 .offset = 0x20,
364 .dmars = 4,
365 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100366 .chclr_offset = SH7372_CHCLR + 0x20,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000367 }, {
368 .offset = 0x30,
369 .dmars = 4,
370 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100371 .chclr_offset = SH7372_CHCLR + 0x30,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000372 }, {
373 .offset = 0x50,
374 .dmars = 8,
375 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100376 .chclr_offset = SH7372_CHCLR + 0x50,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000377 }, {
378 .offset = 0x60,
379 .dmars = 8,
380 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100381 .chclr_offset = SH7372_CHCLR + 0x60,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000382 }
383};
384
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000385static struct sh_dmae_pdata dma_platform_data = {
386 .slave = sh7372_dmae_slaves,
387 .slave_num = ARRAY_SIZE(sh7372_dmae_slaves),
388 .channel = sh7372_dmae_channels,
389 .channel_num = ARRAY_SIZE(sh7372_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700390 .ts_low_shift = TS_LOW_SHIFT,
391 .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
392 .ts_high_shift = TS_HI_SHIFT,
393 .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
394 .ts_shift = dma_ts_shift,
395 .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000396 .dmaor_init = DMAOR_DME,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100397 .chclr_present = 1,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000398};
399
400/* Resource order important! */
401static struct resource sh7372_dmae0_resources[] = {
402 {
403 /* Channel registers and DMAOR */
404 .start = 0xfe008020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100405 .end = 0xfe00828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000406 .flags = IORESOURCE_MEM,
407 },
408 {
409 /* DMARSx */
410 .start = 0xfe009000,
411 .end = 0xfe00900b,
412 .flags = IORESOURCE_MEM,
413 },
414 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900415 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000416 .start = evt2irq(0x20c0),
417 .end = evt2irq(0x20c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000418 .flags = IORESOURCE_IRQ,
419 },
420 {
421 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000422 .start = evt2irq(0x2000),
423 .end = evt2irq(0x20a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000424 .flags = IORESOURCE_IRQ,
425 },
426};
427
428/* Resource order important! */
429static struct resource sh7372_dmae1_resources[] = {
430 {
431 /* Channel registers and DMAOR */
432 .start = 0xfe018020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100433 .end = 0xfe01828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000434 .flags = IORESOURCE_MEM,
435 },
436 {
437 /* DMARSx */
438 .start = 0xfe019000,
439 .end = 0xfe01900b,
440 .flags = IORESOURCE_MEM,
441 },
442 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900443 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000444 .start = evt2irq(0x21c0),
445 .end = evt2irq(0x21c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000446 .flags = IORESOURCE_IRQ,
447 },
448 {
449 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000450 .start = evt2irq(0x2100),
451 .end = evt2irq(0x21a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000452 .flags = IORESOURCE_IRQ,
453 },
454};
455
456/* Resource order important! */
457static struct resource sh7372_dmae2_resources[] = {
458 {
459 /* Channel registers and DMAOR */
460 .start = 0xfe028020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100461 .end = 0xfe02828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000462 .flags = IORESOURCE_MEM,
463 },
464 {
465 /* DMARSx */
466 .start = 0xfe029000,
467 .end = 0xfe02900b,
468 .flags = IORESOURCE_MEM,
469 },
470 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900471 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000472 .start = evt2irq(0x22c0),
473 .end = evt2irq(0x22c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000474 .flags = IORESOURCE_IRQ,
475 },
476 {
477 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000478 .start = evt2irq(0x2200),
479 .end = evt2irq(0x22a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000480 .flags = IORESOURCE_IRQ,
481 },
482};
483
484static struct platform_device dma0_device = {
485 .name = "sh-dma-engine",
486 .id = 0,
487 .resource = sh7372_dmae0_resources,
488 .num_resources = ARRAY_SIZE(sh7372_dmae0_resources),
489 .dev = {
490 .platform_data = &dma_platform_data,
491 },
492};
493
494static struct platform_device dma1_device = {
495 .name = "sh-dma-engine",
496 .id = 1,
497 .resource = sh7372_dmae1_resources,
498 .num_resources = ARRAY_SIZE(sh7372_dmae1_resources),
499 .dev = {
500 .platform_data = &dma_platform_data,
501 },
502};
503
504static struct platform_device dma2_device = {
505 .name = "sh-dma-engine",
506 .id = 2,
507 .resource = sh7372_dmae2_resources,
508 .num_resources = ARRAY_SIZE(sh7372_dmae2_resources),
509 .dev = {
510 .platform_data = &dma_platform_data,
511 },
512};
513
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000514/*
515 * USB-DMAC
516 */
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000517static const struct sh_dmae_channel sh7372_usb_dmae_channels[] = {
518 {
519 .offset = 0,
520 }, {
521 .offset = 0x20,
522 },
523};
524
525/* USB DMAC0 */
526static const struct sh_dmae_slave_config sh7372_usb_dmae0_slaves[] = {
527 {
528 .slave_id = SHDMA_SLAVE_USB0_TX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700529 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000530 }, {
531 .slave_id = SHDMA_SLAVE_USB0_RX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700532 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000533 },
534};
535
536static struct sh_dmae_pdata usb_dma0_platform_data = {
537 .slave = sh7372_usb_dmae0_slaves,
538 .slave_num = ARRAY_SIZE(sh7372_usb_dmae0_slaves),
539 .channel = sh7372_usb_dmae_channels,
540 .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700541 .ts_low_shift = USBTS_LOW_SHIFT,
542 .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
543 .ts_high_shift = USBTS_HI_SHIFT,
544 .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
545 .ts_shift = dma_usbts_shift,
546 .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000547 .dmaor_init = DMAOR_DME,
548 .chcr_offset = 0x14,
549 .chcr_ie_bit = 1 << 5,
550 .dmaor_is_32bit = 1,
551 .needs_tend_set = 1,
552 .no_dmars = 1,
Guennadi Liakhovetskic8ddf032012-01-18 10:14:29 +0100553 .slave_only = 1,
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000554};
555
556static struct resource sh7372_usb_dmae0_resources[] = {
557 {
558 /* Channel registers and DMAOR */
559 .start = 0xe68a0020,
560 .end = 0xe68a0064 - 1,
561 .flags = IORESOURCE_MEM,
562 },
563 {
564 /* VCR/SWR/DMICR */
565 .start = 0xe68a0000,
566 .end = 0xe68a0014 - 1,
567 .flags = IORESOURCE_MEM,
568 },
569 {
570 /* IRQ for channels */
571 .start = evt2irq(0x0a00),
572 .end = evt2irq(0x0a00),
573 .flags = IORESOURCE_IRQ,
574 },
575};
576
577static struct platform_device usb_dma0_device = {
578 .name = "sh-dma-engine",
579 .id = 3,
580 .resource = sh7372_usb_dmae0_resources,
581 .num_resources = ARRAY_SIZE(sh7372_usb_dmae0_resources),
582 .dev = {
583 .platform_data = &usb_dma0_platform_data,
584 },
585};
586
587/* USB DMAC1 */
588static const struct sh_dmae_slave_config sh7372_usb_dmae1_slaves[] = {
589 {
590 .slave_id = SHDMA_SLAVE_USB1_TX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700591 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000592 }, {
593 .slave_id = SHDMA_SLAVE_USB1_RX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700594 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000595 },
596};
597
598static struct sh_dmae_pdata usb_dma1_platform_data = {
599 .slave = sh7372_usb_dmae1_slaves,
600 .slave_num = ARRAY_SIZE(sh7372_usb_dmae1_slaves),
601 .channel = sh7372_usb_dmae_channels,
602 .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700603 .ts_low_shift = USBTS_LOW_SHIFT,
604 .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
605 .ts_high_shift = USBTS_HI_SHIFT,
606 .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
607 .ts_shift = dma_usbts_shift,
608 .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000609 .dmaor_init = DMAOR_DME,
610 .chcr_offset = 0x14,
611 .chcr_ie_bit = 1 << 5,
612 .dmaor_is_32bit = 1,
613 .needs_tend_set = 1,
614 .no_dmars = 1,
Guennadi Liakhovetskic8ddf032012-01-18 10:14:29 +0100615 .slave_only = 1,
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000616};
617
618static struct resource sh7372_usb_dmae1_resources[] = {
619 {
620 /* Channel registers and DMAOR */
621 .start = 0xe68c0020,
622 .end = 0xe68c0064 - 1,
623 .flags = IORESOURCE_MEM,
624 },
625 {
626 /* VCR/SWR/DMICR */
627 .start = 0xe68c0000,
628 .end = 0xe68c0014 - 1,
629 .flags = IORESOURCE_MEM,
630 },
631 {
632 /* IRQ for channels */
633 .start = evt2irq(0x1d00),
634 .end = evt2irq(0x1d00),
635 .flags = IORESOURCE_IRQ,
636 },
637};
638
639static struct platform_device usb_dma1_device = {
640 .name = "sh-dma-engine",
641 .id = 4,
642 .resource = sh7372_usb_dmae1_resources,
643 .num_resources = ARRAY_SIZE(sh7372_usb_dmae1_resources),
644 .dev = {
645 .platform_data = &usb_dma1_platform_data,
646 },
647};
648
Magnus Damm68224712011-04-28 03:21:00 +0000649/* VPU */
650static struct uio_info vpu_platform_data = {
651 .name = "VPU5HG",
652 .version = "0",
653 .irq = intcs_evt2irq(0x980),
654};
655
656static struct resource vpu_resources[] = {
657 [0] = {
658 .name = "VPU",
659 .start = 0xfe900000,
660 .end = 0xfe900157,
661 .flags = IORESOURCE_MEM,
662 },
663};
664
665static struct platform_device vpu_device = {
666 .name = "uio_pdrv_genirq",
667 .id = 0,
668 .dev = {
669 .platform_data = &vpu_platform_data,
670 },
671 .resource = vpu_resources,
672 .num_resources = ARRAY_SIZE(vpu_resources),
673};
674
675/* VEU0 */
676static struct uio_info veu0_platform_data = {
677 .name = "VEU0",
678 .version = "0",
679 .irq = intcs_evt2irq(0x700),
680};
681
682static struct resource veu0_resources[] = {
683 [0] = {
684 .name = "VEU0",
685 .start = 0xfe920000,
686 .end = 0xfe9200cb,
687 .flags = IORESOURCE_MEM,
688 },
689};
690
691static struct platform_device veu0_device = {
692 .name = "uio_pdrv_genirq",
693 .id = 1,
694 .dev = {
695 .platform_data = &veu0_platform_data,
696 },
697 .resource = veu0_resources,
698 .num_resources = ARRAY_SIZE(veu0_resources),
699};
700
701/* VEU1 */
702static struct uio_info veu1_platform_data = {
703 .name = "VEU1",
704 .version = "0",
705 .irq = intcs_evt2irq(0x720),
706};
707
708static struct resource veu1_resources[] = {
709 [0] = {
710 .name = "VEU1",
711 .start = 0xfe924000,
712 .end = 0xfe9240cb,
713 .flags = IORESOURCE_MEM,
714 },
715};
716
717static struct platform_device veu1_device = {
718 .name = "uio_pdrv_genirq",
719 .id = 2,
720 .dev = {
721 .platform_data = &veu1_platform_data,
722 },
723 .resource = veu1_resources,
724 .num_resources = ARRAY_SIZE(veu1_resources),
725};
726
727/* VEU2 */
728static struct uio_info veu2_platform_data = {
729 .name = "VEU2",
730 .version = "0",
731 .irq = intcs_evt2irq(0x740),
732};
733
734static struct resource veu2_resources[] = {
735 [0] = {
736 .name = "VEU2",
737 .start = 0xfe928000,
738 .end = 0xfe928307,
739 .flags = IORESOURCE_MEM,
740 },
741};
742
743static struct platform_device veu2_device = {
744 .name = "uio_pdrv_genirq",
745 .id = 3,
746 .dev = {
747 .platform_data = &veu2_platform_data,
748 },
749 .resource = veu2_resources,
750 .num_resources = ARRAY_SIZE(veu2_resources),
751};
752
753/* VEU3 */
754static struct uio_info veu3_platform_data = {
755 .name = "VEU3",
756 .version = "0",
757 .irq = intcs_evt2irq(0x760),
758};
759
760static struct resource veu3_resources[] = {
761 [0] = {
762 .name = "VEU3",
763 .start = 0xfe92c000,
764 .end = 0xfe92c307,
765 .flags = IORESOURCE_MEM,
766 },
767};
768
769static struct platform_device veu3_device = {
770 .name = "uio_pdrv_genirq",
771 .id = 4,
772 .dev = {
773 .platform_data = &veu3_platform_data,
774 },
775 .resource = veu3_resources,
776 .num_resources = ARRAY_SIZE(veu3_resources),
777};
778
779/* JPU */
780static struct uio_info jpu_platform_data = {
781 .name = "JPU",
782 .version = "0",
783 .irq = intcs_evt2irq(0x560),
784};
785
786static struct resource jpu_resources[] = {
787 [0] = {
788 .name = "JPU",
789 .start = 0xfe980000,
790 .end = 0xfe9902d3,
791 .flags = IORESOURCE_MEM,
792 },
793};
794
795static struct platform_device jpu_device = {
796 .name = "uio_pdrv_genirq",
797 .id = 5,
798 .dev = {
799 .platform_data = &jpu_platform_data,
800 },
801 .resource = jpu_resources,
802 .num_resources = ARRAY_SIZE(jpu_resources),
803};
804
805/* SPU2DSP0 */
806static struct uio_info spu0_platform_data = {
807 .name = "SPU2DSP0",
808 .version = "0",
809 .irq = evt2irq(0x1800),
810};
811
812static struct resource spu0_resources[] = {
813 [0] = {
814 .name = "SPU2DSP0",
815 .start = 0xfe200000,
816 .end = 0xfe2fffff,
817 .flags = IORESOURCE_MEM,
818 },
819};
820
821static struct platform_device spu0_device = {
822 .name = "uio_pdrv_genirq",
823 .id = 6,
824 .dev = {
825 .platform_data = &spu0_platform_data,
826 },
827 .resource = spu0_resources,
828 .num_resources = ARRAY_SIZE(spu0_resources),
829};
830
831/* SPU2DSP1 */
832static struct uio_info spu1_platform_data = {
833 .name = "SPU2DSP1",
834 .version = "0",
835 .irq = evt2irq(0x1820),
836};
837
838static struct resource spu1_resources[] = {
839 [0] = {
840 .name = "SPU2DSP1",
841 .start = 0xfe300000,
842 .end = 0xfe3fffff,
843 .flags = IORESOURCE_MEM,
844 },
845};
846
847static struct platform_device spu1_device = {
848 .name = "uio_pdrv_genirq",
849 .id = 7,
850 .dev = {
851 .platform_data = &spu1_platform_data,
852 },
853 .resource = spu1_resources,
854 .num_resources = ARRAY_SIZE(spu1_resources),
855};
856
Hideki EIRAKU3cfb8432013-01-21 19:54:27 +0900857/* IPMMUI (an IPMMU module for ICB/LMB) */
858static struct resource ipmmu_resources[] = {
859 [0] = {
860 .name = "IPMMUI",
861 .start = 0xfe951000,
862 .end = 0xfe9510ff,
863 .flags = IORESOURCE_MEM,
864 },
865};
866
867static const char * const ipmmu_dev_names[] = {
868 "sh_mobile_lcdc_fb.0",
869 "sh_mobile_lcdc_fb.1",
870 "sh_mobile_ceu.0",
871 "uio_pdrv_genirq.0",
872 "uio_pdrv_genirq.1",
873 "uio_pdrv_genirq.2",
874 "uio_pdrv_genirq.3",
875 "uio_pdrv_genirq.4",
876 "uio_pdrv_genirq.5",
877};
878
879static struct shmobile_ipmmu_platform_data ipmmu_platform_data = {
880 .dev_names = ipmmu_dev_names,
881 .num_dev_names = ARRAY_SIZE(ipmmu_dev_names),
882};
883
884static struct platform_device ipmmu_device = {
885 .name = "ipmmu",
886 .id = -1,
887 .dev = {
888 .platform_data = &ipmmu_platform_data,
889 },
890 .resource = ipmmu_resources,
891 .num_resources = ARRAY_SIZE(ipmmu_resources),
892};
893
Magnus Damm2b7eda62010-02-05 11:14:58 +0000894static struct platform_device *sh7372_early_devices[] __initdata = {
895 &scif0_device,
896 &scif1_device,
897 &scif2_device,
898 &scif3_device,
899 &scif4_device,
900 &scif5_device,
901 &scif6_device,
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000902 &cmt2_device,
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200903 &tmu0_device,
Hideki EIRAKU3cfb8432013-01-21 19:54:27 +0900904 &ipmmu_device,
Magnus Damm934e4072010-10-13 07:22:11 +0000905};
906
907static struct platform_device *sh7372_late_devices[] __initdata = {
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000908 &iic0_device,
909 &iic1_device,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000910 &dma0_device,
911 &dma1_device,
912 &dma2_device,
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000913 &usb_dma0_device,
914 &usb_dma1_device,
Magnus Damm68224712011-04-28 03:21:00 +0000915 &vpu_device,
916 &veu0_device,
917 &veu1_device,
918 &veu2_device,
919 &veu3_device,
920 &jpu_device,
921 &spu0_device,
922 &spu1_device,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000923};
924
925void __init sh7372_add_standard_devices(void)
926{
Geert Uytterhoeven9eda01b2014-08-29 15:26:19 +0200927 static struct pm_domain_device domain_devices[] __initdata = {
Rafael J. Wysockiac18e022012-08-15 20:56:26 +0200928 { "A3RV", &vpu_device, },
929 { "A4MP", &spu0_device, },
930 { "A4MP", &spu1_device, },
931 { "A3SP", &scif0_device, },
932 { "A3SP", &scif1_device, },
933 { "A3SP", &scif2_device, },
934 { "A3SP", &scif3_device, },
935 { "A3SP", &scif4_device, },
936 { "A3SP", &scif5_device, },
937 { "A3SP", &scif6_device, },
938 { "A3SP", &iic1_device, },
939 { "A3SP", &dma0_device, },
940 { "A3SP", &dma1_device, },
941 { "A3SP", &dma2_device, },
942 { "A3SP", &usb_dma0_device, },
943 { "A3SP", &usb_dma1_device, },
944 { "A4R", &iic0_device, },
945 { "A4R", &veu0_device, },
946 { "A4R", &veu1_device, },
947 { "A4R", &veu2_device, },
948 { "A4R", &veu3_device, },
949 { "A4R", &jpu_device, },
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200950 { "A4R", &tmu0_device, },
Rafael J. Wysockic37b7a72012-08-08 00:28:36 +0200951 };
952
Rafael J. Wysockie7e59a42012-08-07 01:12:56 +0200953 sh7372_init_pm_domains();
Magnus Dammf7dadb32011-12-23 01:23:07 +0100954
Magnus Damm2b7eda62010-02-05 11:14:58 +0000955 platform_add_devices(sh7372_early_devices,
956 ARRAY_SIZE(sh7372_early_devices));
Magnus Damm934e4072010-10-13 07:22:11 +0000957
958 platform_add_devices(sh7372_late_devices,
959 ARRAY_SIZE(sh7372_late_devices));
Magnus Damm33afebf2011-07-01 22:14:45 +0200960
Rafael J. Wysockiac18e022012-08-15 20:56:26 +0200961 rmobile_add_devices_to_domains(domain_devices,
962 ARRAY_SIZE(domain_devices));
Magnus Damm2b7eda62010-02-05 11:14:58 +0000963}
964
Stephen Warren6bb27d72012-11-08 12:40:59 -0700965void __init sh7372_earlytimer_init(void)
Magnus Damm17254bf2012-03-06 17:36:37 +0900966{
967 sh7372_clock_init();
968 shmobile_earlytimer_init();
969}
970
Magnus Damm2b7eda62010-02-05 11:14:58 +0000971void __init sh7372_add_early_devices(void)
972{
Magnus Damm2b7eda62010-02-05 11:14:58 +0000973 early_platform_add_devices(sh7372_early_devices,
974 ARRAY_SIZE(sh7372_early_devices));
Magnus Damm5d7220ec2012-02-29 21:37:19 +0900975
976 /* setup early console here as well */
977 shmobile_setup_console();
Magnus Damm2b7eda62010-02-05 11:14:58 +0000978}
Magnus Damm3b7b7052012-03-28 15:53:40 +0900979
980#ifdef CONFIG_USE_OF
981
982void __init sh7372_add_early_devices_dt(void)
983{
Magnus Damm39b22e22014-08-20 22:02:36 +0900984 shmobile_init_delay();
Magnus Damm3b7b7052012-03-28 15:53:40 +0900985
Geert Uytterhoeven1fba31f2014-04-15 14:33:59 +0200986 sh7372_add_early_devices();
Magnus Damm3b7b7052012-03-28 15:53:40 +0900987}
988
Magnus Damm3b7b7052012-03-28 15:53:40 +0900989void __init sh7372_add_standard_devices_dt(void)
990{
991 /* clocks are setup late during boot in the case of DT */
992 sh7372_clock_init();
993
994 platform_add_devices(sh7372_early_devices,
995 ARRAY_SIZE(sh7372_early_devices));
996
Magnus Damm975e5af2013-07-01 14:41:55 +0900997 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
Magnus Damm3b7b7052012-03-28 15:53:40 +0900998}
999
1000static const char *sh7372_boards_compat_dt[] __initdata = {
1001 "renesas,sh7372",
1002 NULL,
1003};
1004
1005DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
1006 .map_io = sh7372_map_io,
1007 .init_early = sh7372_add_early_devices_dt,
Magnus Damm3b7b7052012-03-28 15:53:40 +09001008 .init_irq = sh7372_init_irq,
1009 .handle_irq = shmobile_handle_irq_intc,
1010 .init_machine = sh7372_add_standard_devices_dt,
Magnus Damm3b7b7052012-03-28 15:53:40 +09001011 .dt_compat = sh7372_boards_compat_dt,
1012MACHINE_END
1013
1014#endif /* CONFIG_USE_OF */