blob: d646c8d12423a600332f5e5876f75445426fdca3 [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_timer.h>
Rafael J. Wysocki111058c2011-08-14 13:35:39 +020033#include <linux/pm_domain.h>
Arnd Bergmann426f1af2012-03-22 22:02:16 +000034#include <linux/dma-mapping.h>
Hideki EIRAKU3cfb8432013-01-21 19:54:27 +090035#include <linux/platform_data/sh_ipmmu.h>
Geert Uytterhoeven113522e2014-06-20 18:53:08 +020036
Magnus Damm5d7220ec2012-02-29 21:37:19 +090037#include <asm/mach/map.h>
Magnus Damm2b7eda62010-02-05 11:14:58 +000038#include <asm/mach-types.h>
39#include <asm/mach/arch.h>
Magnus Damm17254bf2012-03-06 17:36:37 +090040#include <asm/mach/time.h>
Geert Uytterhoeven113522e2014-06-20 18:53:08 +020041
Magnus Dammfd44aa52014-06-17 16:47:37 +090042#include "common.h"
Magnus Damm74ac0de2014-06-17 16:47:13 +090043#include "dma-register.h"
Geert Uytterhoeven86155b32014-08-20 15:39:23 +020044#include "intc.h"
Magnus Dammb6bab122014-06-17 16:47:29 +090045#include "irqs.h"
Magnus Damm6b8b0cb2014-06-17 16:47:45 +090046#include "pm-rmobile.h"
Geert Uytterhoeven113522e2014-06-20 18:53:08 +020047#include "sh7372.h"
Magnus Damm2b7eda62010-02-05 11:14:58 +000048
Magnus Damm5d7220ec2012-02-29 21:37:19 +090049static struct map_desc sh7372_io_desc[] __initdata = {
50 /* create a 1:1 entity map for 0xe6xxxxxx
51 * used by CPGA, INTC and PFC.
52 */
53 {
54 .virtual = 0xe6000000,
55 .pfn = __phys_to_pfn(0xe6000000),
56 .length = 256 << 20,
57 .type = MT_DEVICE_NONSHARED
58 },
59};
60
61void __init sh7372_map_io(void)
62{
63 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc));
64}
Magnus Damm2b7eda62010-02-05 11:14:58 +000065
Laurent Pinchart5967fe02012-12-15 23:51:27 +010066/* PFC */
67static struct resource sh7372_pfc_resources[] = {
68 [0] = {
69 .start = 0xe6050000,
70 .end = 0xe6057fff,
71 .flags = IORESOURCE_MEM,
72 },
73 [1] = {
74 .start = 0xe605800c,
75 .end = 0xe6058027,
76 .flags = IORESOURCE_MEM,
77 }
78};
79
80static struct platform_device sh7372_pfc_device = {
81 .name = "pfc-sh7372",
82 .id = -1,
83 .resource = sh7372_pfc_resources,
84 .num_resources = ARRAY_SIZE(sh7372_pfc_resources),
85};
86
87void __init sh7372_pinmux_init(void)
88{
89 platform_device_register(&sh7372_pfc_device);
90}
91
Laurent Pinchartc6a0d862013-12-06 10:59:21 +010092/* SCIF */
93#define SH7372_SCIF(scif_type, index, baseaddr, irq) \
94static struct plat_sci_port scif##index##_platform_data = { \
95 .type = scif_type, \
Laurent Pinchartc6a0d862013-12-06 10:59:21 +010096 .flags = UPF_BOOT_AUTOCONF, \
Laurent Pinchartc6a0d862013-12-06 10:59:21 +010097 .scscr = SCSCR_RE | SCSCR_TE, \
98}; \
99 \
Laurent Pinchartd39f98b2013-12-06 10:59:30 +0100100static struct resource scif##index##_resources[] = { \
101 DEFINE_RES_MEM(baseaddr, 0x100), \
102 DEFINE_RES_IRQ(irq), \
103}; \
104 \
Laurent Pinchartc6a0d862013-12-06 10:59:21 +0100105static struct platform_device scif##index##_device = { \
106 .name = "sh-sci", \
107 .id = index, \
Laurent Pinchartd39f98b2013-12-06 10:59:30 +0100108 .resource = scif##index##_resources, \
109 .num_resources = ARRAY_SIZE(scif##index##_resources), \
Laurent Pinchartc6a0d862013-12-06 10:59:21 +0100110 .dev = { \
111 .platform_data = &scif##index##_platform_data, \
112 }, \
113}
Magnus Damm2b7eda62010-02-05 11:14:58 +0000114
Laurent Pinchartc6a0d862013-12-06 10:59:21 +0100115SH7372_SCIF(PORT_SCIFA, 0, 0xe6c40000, evt2irq(0x0c00));
116SH7372_SCIF(PORT_SCIFA, 1, 0xe6c50000, evt2irq(0x0c20));
117SH7372_SCIF(PORT_SCIFA, 2, 0xe6c60000, evt2irq(0x0c40));
118SH7372_SCIF(PORT_SCIFA, 3, 0xe6c70000, evt2irq(0x0c60));
119SH7372_SCIF(PORT_SCIFA, 4, 0xe6c80000, evt2irq(0x0d20));
120SH7372_SCIF(PORT_SCIFA, 5, 0xe6cb0000, evt2irq(0x0d40));
121SH7372_SCIF(PORT_SCIFB, 6, 0xe6c30000, evt2irq(0x0d60));
Magnus Damm2b7eda62010-02-05 11:14:58 +0000122
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000123/* CMT */
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000124static struct sh_timer_config cmt2_platform_data = {
Laurent Pinchart386f60a2014-04-23 13:15:09 +0200125 .channels_mask = 0x20,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000126};
127
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000128static struct resource cmt2_resources[] = {
Laurent Pinchart386f60a2014-04-23 13:15:09 +0200129 DEFINE_RES_MEM(0xe6130000, 0x50),
130 DEFINE_RES_IRQ(evt2irq(0x0b80)),
Magnus Damm2b7eda62010-02-05 11:14:58 +0000131};
132
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000133static struct platform_device cmt2_device = {
Laurent Pinchart386f60a2014-04-23 13:15:09 +0200134 .name = "sh-cmt-32-fast",
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000135 .id = 2,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000136 .dev = {
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000137 .platform_data = &cmt2_platform_data,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000138 },
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000139 .resource = cmt2_resources,
140 .num_resources = ARRAY_SIZE(cmt2_resources),
Magnus Damm2b7eda62010-02-05 11:14:58 +0000141};
142
Magnus Dammc6c049e2010-10-14 06:57:25 +0000143/* TMU */
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200144static struct sh_timer_config tmu0_platform_data = {
145 .channels_mask = 7,
Magnus Dammc6c049e2010-10-14 06:57:25 +0000146};
147
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200148static struct resource tmu0_resources[] = {
149 DEFINE_RES_MEM(0xfff60000, 0x2c),
150 DEFINE_RES_IRQ(intcs_evt2irq(0xe80)),
151 DEFINE_RES_IRQ(intcs_evt2irq(0xea0)),
152 DEFINE_RES_IRQ(intcs_evt2irq(0xec0)),
Magnus Dammc6c049e2010-10-14 06:57:25 +0000153};
154
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200155static struct platform_device tmu0_device = {
156 .name = "sh-tmu",
Magnus Dammc6c049e2010-10-14 06:57:25 +0000157 .id = 0,
158 .dev = {
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200159 .platform_data = &tmu0_platform_data,
Magnus Dammc6c049e2010-10-14 06:57:25 +0000160 },
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200161 .resource = tmu0_resources,
162 .num_resources = ARRAY_SIZE(tmu0_resources),
Magnus Dammc6c049e2010-10-14 06:57:25 +0000163};
164
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000165/* I2C */
166static struct resource iic0_resources[] = {
167 [0] = {
168 .name = "IIC0",
169 .start = 0xFFF20000,
170 .end = 0xFFF20425 - 1,
171 .flags = IORESOURCE_MEM,
172 },
173 [1] = {
Magnus Damm33c96072010-05-20 14:41:00 +0000174 .start = intcs_evt2irq(0xe00), /* IIC0_ALI0 */
175 .end = intcs_evt2irq(0xe60), /* IIC0_DTEI0 */
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000176 .flags = IORESOURCE_IRQ,
177 },
178};
179
180static struct platform_device iic0_device = {
181 .name = "i2c-sh_mobile",
182 .id = 0, /* "i2c0" clock */
183 .num_resources = ARRAY_SIZE(iic0_resources),
184 .resource = iic0_resources,
185};
186
187static struct resource iic1_resources[] = {
188 [0] = {
189 .name = "IIC1",
190 .start = 0xE6C20000,
191 .end = 0xE6C20425 - 1,
192 .flags = IORESOURCE_MEM,
193 },
194 [1] = {
Magnus Damm33c96072010-05-20 14:41:00 +0000195 .start = evt2irq(0x780), /* IIC1_ALI1 */
196 .end = evt2irq(0x7e0), /* IIC1_DTEI1 */
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000197 .flags = IORESOURCE_IRQ,
198 },
199};
200
201static struct platform_device iic1_device = {
202 .name = "i2c-sh_mobile",
203 .id = 1, /* "i2c1" clock */
204 .num_resources = ARRAY_SIZE(iic1_resources),
205 .resource = iic1_resources,
206};
207
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000208/* DMA */
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000209static const struct sh_dmae_slave_config sh7372_dmae_slaves[] = {
210 {
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000211 .slave_id = SHDMA_SLAVE_SCIF0_TX,
212 .addr = 0xe6c40020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700213 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000214 .mid_rid = 0x21,
215 }, {
216 .slave_id = SHDMA_SLAVE_SCIF0_RX,
217 .addr = 0xe6c40024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700218 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000219 .mid_rid = 0x22,
220 }, {
221 .slave_id = SHDMA_SLAVE_SCIF1_TX,
222 .addr = 0xe6c50020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700223 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000224 .mid_rid = 0x25,
225 }, {
226 .slave_id = SHDMA_SLAVE_SCIF1_RX,
227 .addr = 0xe6c50024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700228 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000229 .mid_rid = 0x26,
230 }, {
231 .slave_id = SHDMA_SLAVE_SCIF2_TX,
232 .addr = 0xe6c60020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700233 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000234 .mid_rid = 0x29,
235 }, {
236 .slave_id = SHDMA_SLAVE_SCIF2_RX,
237 .addr = 0xe6c60024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700238 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000239 .mid_rid = 0x2a,
240 }, {
241 .slave_id = SHDMA_SLAVE_SCIF3_TX,
242 .addr = 0xe6c70020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700243 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000244 .mid_rid = 0x2d,
245 }, {
246 .slave_id = SHDMA_SLAVE_SCIF3_RX,
247 .addr = 0xe6c70024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700248 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000249 .mid_rid = 0x2e,
250 }, {
251 .slave_id = SHDMA_SLAVE_SCIF4_TX,
252 .addr = 0xe6c80020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700253 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000254 .mid_rid = 0x39,
255 }, {
256 .slave_id = SHDMA_SLAVE_SCIF4_RX,
257 .addr = 0xe6c80024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700258 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000259 .mid_rid = 0x3a,
260 }, {
261 .slave_id = SHDMA_SLAVE_SCIF5_TX,
262 .addr = 0xe6cb0020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700263 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000264 .mid_rid = 0x35,
265 }, {
266 .slave_id = SHDMA_SLAVE_SCIF5_RX,
267 .addr = 0xe6cb0024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700268 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000269 .mid_rid = 0x36,
270 }, {
271 .slave_id = SHDMA_SLAVE_SCIF6_TX,
272 .addr = 0xe6c30040,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700273 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000274 .mid_rid = 0x3d,
275 }, {
276 .slave_id = SHDMA_SLAVE_SCIF6_RX,
277 .addr = 0xe6c30060,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700278 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000279 .mid_rid = 0x3e,
280 }, {
Bastian Hecht40eaed72012-09-22 14:06:38 +0200281 .slave_id = SHDMA_SLAVE_FLCTL0_TX,
282 .addr = 0xe6a30050,
283 .chcr = CHCR_TX(XMIT_SZ_32BIT),
284 .mid_rid = 0x83,
285 }, {
286 .slave_id = SHDMA_SLAVE_FLCTL0_RX,
287 .addr = 0xe6a30050,
288 .chcr = CHCR_RX(XMIT_SZ_32BIT),
289 .mid_rid = 0x83,
290 }, {
291 .slave_id = SHDMA_SLAVE_FLCTL1_TX,
292 .addr = 0xe6a30060,
293 .chcr = CHCR_TX(XMIT_SZ_32BIT),
294 .mid_rid = 0x87,
295 }, {
296 .slave_id = SHDMA_SLAVE_FLCTL1_RX,
297 .addr = 0xe6a30060,
298 .chcr = CHCR_RX(XMIT_SZ_32BIT),
299 .mid_rid = 0x87,
300 }, {
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000301 .slave_id = SHDMA_SLAVE_SDHI0_TX,
302 .addr = 0xe6850030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700303 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000304 .mid_rid = 0xc1,
305 }, {
306 .slave_id = SHDMA_SLAVE_SDHI0_RX,
307 .addr = 0xe6850030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700308 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000309 .mid_rid = 0xc2,
310 }, {
311 .slave_id = SHDMA_SLAVE_SDHI1_TX,
312 .addr = 0xe6860030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700313 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000314 .mid_rid = 0xc9,
315 }, {
316 .slave_id = SHDMA_SLAVE_SDHI1_RX,
317 .addr = 0xe6860030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700318 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000319 .mid_rid = 0xca,
320 }, {
321 .slave_id = SHDMA_SLAVE_SDHI2_TX,
322 .addr = 0xe6870030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700323 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000324 .mid_rid = 0xcd,
325 }, {
326 .slave_id = SHDMA_SLAVE_SDHI2_RX,
327 .addr = 0xe6870030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700328 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000329 .mid_rid = 0xce,
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000330 }, {
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700331 .slave_id = SHDMA_SLAVE_FSIA_TX,
332 .addr = 0xfe1f0024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700333 .chcr = CHCR_TX(XMIT_SZ_32BIT),
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700334 .mid_rid = 0xb1,
335 }, {
336 .slave_id = SHDMA_SLAVE_FSIA_RX,
337 .addr = 0xfe1f0020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700338 .chcr = CHCR_RX(XMIT_SZ_32BIT),
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700339 .mid_rid = 0xb2,
340 }, {
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000341 .slave_id = SHDMA_SLAVE_MMCIF_TX,
342 .addr = 0xe6bd0034,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700343 .chcr = CHCR_TX(XMIT_SZ_32BIT),
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000344 .mid_rid = 0xd1,
345 }, {
346 .slave_id = SHDMA_SLAVE_MMCIF_RX,
347 .addr = 0xe6bd0034,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700348 .chcr = CHCR_RX(XMIT_SZ_32BIT),
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000349 .mid_rid = 0xd2,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000350 },
351};
352
Kuninori Morimoto4d6344f2012-06-20 11:30:32 +0200353#define SH7372_CHCLR (0x220 - 0x20)
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100354
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000355static const struct sh_dmae_channel sh7372_dmae_channels[] = {
356 {
357 .offset = 0,
358 .dmars = 0,
359 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100360 .chclr_offset = SH7372_CHCLR + 0,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000361 }, {
362 .offset = 0x10,
363 .dmars = 0,
364 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100365 .chclr_offset = SH7372_CHCLR + 0x10,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000366 }, {
367 .offset = 0x20,
368 .dmars = 4,
369 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100370 .chclr_offset = SH7372_CHCLR + 0x20,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000371 }, {
372 .offset = 0x30,
373 .dmars = 4,
374 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100375 .chclr_offset = SH7372_CHCLR + 0x30,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000376 }, {
377 .offset = 0x50,
378 .dmars = 8,
379 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100380 .chclr_offset = SH7372_CHCLR + 0x50,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000381 }, {
382 .offset = 0x60,
383 .dmars = 8,
384 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100385 .chclr_offset = SH7372_CHCLR + 0x60,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000386 }
387};
388
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000389static struct sh_dmae_pdata dma_platform_data = {
390 .slave = sh7372_dmae_slaves,
391 .slave_num = ARRAY_SIZE(sh7372_dmae_slaves),
392 .channel = sh7372_dmae_channels,
393 .channel_num = ARRAY_SIZE(sh7372_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700394 .ts_low_shift = TS_LOW_SHIFT,
395 .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
396 .ts_high_shift = TS_HI_SHIFT,
397 .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
398 .ts_shift = dma_ts_shift,
399 .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000400 .dmaor_init = DMAOR_DME,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100401 .chclr_present = 1,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000402};
403
404/* Resource order important! */
405static struct resource sh7372_dmae0_resources[] = {
406 {
407 /* Channel registers and DMAOR */
408 .start = 0xfe008020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100409 .end = 0xfe00828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000410 .flags = IORESOURCE_MEM,
411 },
412 {
413 /* DMARSx */
414 .start = 0xfe009000,
415 .end = 0xfe00900b,
416 .flags = IORESOURCE_MEM,
417 },
418 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900419 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000420 .start = evt2irq(0x20c0),
421 .end = evt2irq(0x20c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000422 .flags = IORESOURCE_IRQ,
423 },
424 {
425 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000426 .start = evt2irq(0x2000),
427 .end = evt2irq(0x20a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000428 .flags = IORESOURCE_IRQ,
429 },
430};
431
432/* Resource order important! */
433static struct resource sh7372_dmae1_resources[] = {
434 {
435 /* Channel registers and DMAOR */
436 .start = 0xfe018020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100437 .end = 0xfe01828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000438 .flags = IORESOURCE_MEM,
439 },
440 {
441 /* DMARSx */
442 .start = 0xfe019000,
443 .end = 0xfe01900b,
444 .flags = IORESOURCE_MEM,
445 },
446 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900447 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000448 .start = evt2irq(0x21c0),
449 .end = evt2irq(0x21c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000450 .flags = IORESOURCE_IRQ,
451 },
452 {
453 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000454 .start = evt2irq(0x2100),
455 .end = evt2irq(0x21a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000456 .flags = IORESOURCE_IRQ,
457 },
458};
459
460/* Resource order important! */
461static struct resource sh7372_dmae2_resources[] = {
462 {
463 /* Channel registers and DMAOR */
464 .start = 0xfe028020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100465 .end = 0xfe02828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000466 .flags = IORESOURCE_MEM,
467 },
468 {
469 /* DMARSx */
470 .start = 0xfe029000,
471 .end = 0xfe02900b,
472 .flags = IORESOURCE_MEM,
473 },
474 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900475 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000476 .start = evt2irq(0x22c0),
477 .end = evt2irq(0x22c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000478 .flags = IORESOURCE_IRQ,
479 },
480 {
481 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000482 .start = evt2irq(0x2200),
483 .end = evt2irq(0x22a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000484 .flags = IORESOURCE_IRQ,
485 },
486};
487
488static struct platform_device dma0_device = {
489 .name = "sh-dma-engine",
490 .id = 0,
491 .resource = sh7372_dmae0_resources,
492 .num_resources = ARRAY_SIZE(sh7372_dmae0_resources),
493 .dev = {
494 .platform_data = &dma_platform_data,
495 },
496};
497
498static struct platform_device dma1_device = {
499 .name = "sh-dma-engine",
500 .id = 1,
501 .resource = sh7372_dmae1_resources,
502 .num_resources = ARRAY_SIZE(sh7372_dmae1_resources),
503 .dev = {
504 .platform_data = &dma_platform_data,
505 },
506};
507
508static struct platform_device dma2_device = {
509 .name = "sh-dma-engine",
510 .id = 2,
511 .resource = sh7372_dmae2_resources,
512 .num_resources = ARRAY_SIZE(sh7372_dmae2_resources),
513 .dev = {
514 .platform_data = &dma_platform_data,
515 },
516};
517
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000518/*
519 * USB-DMAC
520 */
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000521static const struct sh_dmae_channel sh7372_usb_dmae_channels[] = {
522 {
523 .offset = 0,
524 }, {
525 .offset = 0x20,
526 },
527};
528
529/* USB DMAC0 */
530static const struct sh_dmae_slave_config sh7372_usb_dmae0_slaves[] = {
531 {
532 .slave_id = SHDMA_SLAVE_USB0_TX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700533 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000534 }, {
535 .slave_id = SHDMA_SLAVE_USB0_RX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700536 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000537 },
538};
539
540static struct sh_dmae_pdata usb_dma0_platform_data = {
541 .slave = sh7372_usb_dmae0_slaves,
542 .slave_num = ARRAY_SIZE(sh7372_usb_dmae0_slaves),
543 .channel = sh7372_usb_dmae_channels,
544 .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700545 .ts_low_shift = USBTS_LOW_SHIFT,
546 .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
547 .ts_high_shift = USBTS_HI_SHIFT,
548 .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
549 .ts_shift = dma_usbts_shift,
550 .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000551 .dmaor_init = DMAOR_DME,
552 .chcr_offset = 0x14,
553 .chcr_ie_bit = 1 << 5,
554 .dmaor_is_32bit = 1,
555 .needs_tend_set = 1,
556 .no_dmars = 1,
Guennadi Liakhovetskic8ddf032012-01-18 10:14:29 +0100557 .slave_only = 1,
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000558};
559
560static struct resource sh7372_usb_dmae0_resources[] = {
561 {
562 /* Channel registers and DMAOR */
563 .start = 0xe68a0020,
564 .end = 0xe68a0064 - 1,
565 .flags = IORESOURCE_MEM,
566 },
567 {
568 /* VCR/SWR/DMICR */
569 .start = 0xe68a0000,
570 .end = 0xe68a0014 - 1,
571 .flags = IORESOURCE_MEM,
572 },
573 {
574 /* IRQ for channels */
575 .start = evt2irq(0x0a00),
576 .end = evt2irq(0x0a00),
577 .flags = IORESOURCE_IRQ,
578 },
579};
580
581static struct platform_device usb_dma0_device = {
582 .name = "sh-dma-engine",
583 .id = 3,
584 .resource = sh7372_usb_dmae0_resources,
585 .num_resources = ARRAY_SIZE(sh7372_usb_dmae0_resources),
586 .dev = {
587 .platform_data = &usb_dma0_platform_data,
588 },
589};
590
591/* USB DMAC1 */
592static const struct sh_dmae_slave_config sh7372_usb_dmae1_slaves[] = {
593 {
594 .slave_id = SHDMA_SLAVE_USB1_TX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700595 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000596 }, {
597 .slave_id = SHDMA_SLAVE_USB1_RX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700598 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000599 },
600};
601
602static struct sh_dmae_pdata usb_dma1_platform_data = {
603 .slave = sh7372_usb_dmae1_slaves,
604 .slave_num = ARRAY_SIZE(sh7372_usb_dmae1_slaves),
605 .channel = sh7372_usb_dmae_channels,
606 .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700607 .ts_low_shift = USBTS_LOW_SHIFT,
608 .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
609 .ts_high_shift = USBTS_HI_SHIFT,
610 .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
611 .ts_shift = dma_usbts_shift,
612 .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000613 .dmaor_init = DMAOR_DME,
614 .chcr_offset = 0x14,
615 .chcr_ie_bit = 1 << 5,
616 .dmaor_is_32bit = 1,
617 .needs_tend_set = 1,
618 .no_dmars = 1,
Guennadi Liakhovetskic8ddf032012-01-18 10:14:29 +0100619 .slave_only = 1,
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000620};
621
622static struct resource sh7372_usb_dmae1_resources[] = {
623 {
624 /* Channel registers and DMAOR */
625 .start = 0xe68c0020,
626 .end = 0xe68c0064 - 1,
627 .flags = IORESOURCE_MEM,
628 },
629 {
630 /* VCR/SWR/DMICR */
631 .start = 0xe68c0000,
632 .end = 0xe68c0014 - 1,
633 .flags = IORESOURCE_MEM,
634 },
635 {
636 /* IRQ for channels */
637 .start = evt2irq(0x1d00),
638 .end = evt2irq(0x1d00),
639 .flags = IORESOURCE_IRQ,
640 },
641};
642
643static struct platform_device usb_dma1_device = {
644 .name = "sh-dma-engine",
645 .id = 4,
646 .resource = sh7372_usb_dmae1_resources,
647 .num_resources = ARRAY_SIZE(sh7372_usb_dmae1_resources),
648 .dev = {
649 .platform_data = &usb_dma1_platform_data,
650 },
651};
652
Magnus Damm68224712011-04-28 03:21:00 +0000653/* VPU */
654static struct uio_info vpu_platform_data = {
655 .name = "VPU5HG",
656 .version = "0",
657 .irq = intcs_evt2irq(0x980),
658};
659
660static struct resource vpu_resources[] = {
661 [0] = {
662 .name = "VPU",
663 .start = 0xfe900000,
664 .end = 0xfe900157,
665 .flags = IORESOURCE_MEM,
666 },
667};
668
669static struct platform_device vpu_device = {
670 .name = "uio_pdrv_genirq",
671 .id = 0,
672 .dev = {
673 .platform_data = &vpu_platform_data,
674 },
675 .resource = vpu_resources,
676 .num_resources = ARRAY_SIZE(vpu_resources),
677};
678
679/* VEU0 */
680static struct uio_info veu0_platform_data = {
681 .name = "VEU0",
682 .version = "0",
683 .irq = intcs_evt2irq(0x700),
684};
685
686static struct resource veu0_resources[] = {
687 [0] = {
688 .name = "VEU0",
689 .start = 0xfe920000,
690 .end = 0xfe9200cb,
691 .flags = IORESOURCE_MEM,
692 },
693};
694
695static struct platform_device veu0_device = {
696 .name = "uio_pdrv_genirq",
697 .id = 1,
698 .dev = {
699 .platform_data = &veu0_platform_data,
700 },
701 .resource = veu0_resources,
702 .num_resources = ARRAY_SIZE(veu0_resources),
703};
704
705/* VEU1 */
706static struct uio_info veu1_platform_data = {
707 .name = "VEU1",
708 .version = "0",
709 .irq = intcs_evt2irq(0x720),
710};
711
712static struct resource veu1_resources[] = {
713 [0] = {
714 .name = "VEU1",
715 .start = 0xfe924000,
716 .end = 0xfe9240cb,
717 .flags = IORESOURCE_MEM,
718 },
719};
720
721static struct platform_device veu1_device = {
722 .name = "uio_pdrv_genirq",
723 .id = 2,
724 .dev = {
725 .platform_data = &veu1_platform_data,
726 },
727 .resource = veu1_resources,
728 .num_resources = ARRAY_SIZE(veu1_resources),
729};
730
731/* VEU2 */
732static struct uio_info veu2_platform_data = {
733 .name = "VEU2",
734 .version = "0",
735 .irq = intcs_evt2irq(0x740),
736};
737
738static struct resource veu2_resources[] = {
739 [0] = {
740 .name = "VEU2",
741 .start = 0xfe928000,
742 .end = 0xfe928307,
743 .flags = IORESOURCE_MEM,
744 },
745};
746
747static struct platform_device veu2_device = {
748 .name = "uio_pdrv_genirq",
749 .id = 3,
750 .dev = {
751 .platform_data = &veu2_platform_data,
752 },
753 .resource = veu2_resources,
754 .num_resources = ARRAY_SIZE(veu2_resources),
755};
756
757/* VEU3 */
758static struct uio_info veu3_platform_data = {
759 .name = "VEU3",
760 .version = "0",
761 .irq = intcs_evt2irq(0x760),
762};
763
764static struct resource veu3_resources[] = {
765 [0] = {
766 .name = "VEU3",
767 .start = 0xfe92c000,
768 .end = 0xfe92c307,
769 .flags = IORESOURCE_MEM,
770 },
771};
772
773static struct platform_device veu3_device = {
774 .name = "uio_pdrv_genirq",
775 .id = 4,
776 .dev = {
777 .platform_data = &veu3_platform_data,
778 },
779 .resource = veu3_resources,
780 .num_resources = ARRAY_SIZE(veu3_resources),
781};
782
783/* JPU */
784static struct uio_info jpu_platform_data = {
785 .name = "JPU",
786 .version = "0",
787 .irq = intcs_evt2irq(0x560),
788};
789
790static struct resource jpu_resources[] = {
791 [0] = {
792 .name = "JPU",
793 .start = 0xfe980000,
794 .end = 0xfe9902d3,
795 .flags = IORESOURCE_MEM,
796 },
797};
798
799static struct platform_device jpu_device = {
800 .name = "uio_pdrv_genirq",
801 .id = 5,
802 .dev = {
803 .platform_data = &jpu_platform_data,
804 },
805 .resource = jpu_resources,
806 .num_resources = ARRAY_SIZE(jpu_resources),
807};
808
809/* SPU2DSP0 */
810static struct uio_info spu0_platform_data = {
811 .name = "SPU2DSP0",
812 .version = "0",
813 .irq = evt2irq(0x1800),
814};
815
816static struct resource spu0_resources[] = {
817 [0] = {
818 .name = "SPU2DSP0",
819 .start = 0xfe200000,
820 .end = 0xfe2fffff,
821 .flags = IORESOURCE_MEM,
822 },
823};
824
825static struct platform_device spu0_device = {
826 .name = "uio_pdrv_genirq",
827 .id = 6,
828 .dev = {
829 .platform_data = &spu0_platform_data,
830 },
831 .resource = spu0_resources,
832 .num_resources = ARRAY_SIZE(spu0_resources),
833};
834
835/* SPU2DSP1 */
836static struct uio_info spu1_platform_data = {
837 .name = "SPU2DSP1",
838 .version = "0",
839 .irq = evt2irq(0x1820),
840};
841
842static struct resource spu1_resources[] = {
843 [0] = {
844 .name = "SPU2DSP1",
845 .start = 0xfe300000,
846 .end = 0xfe3fffff,
847 .flags = IORESOURCE_MEM,
848 },
849};
850
851static struct platform_device spu1_device = {
852 .name = "uio_pdrv_genirq",
853 .id = 7,
854 .dev = {
855 .platform_data = &spu1_platform_data,
856 },
857 .resource = spu1_resources,
858 .num_resources = ARRAY_SIZE(spu1_resources),
859};
860
Hideki EIRAKU3cfb8432013-01-21 19:54:27 +0900861/* IPMMUI (an IPMMU module for ICB/LMB) */
862static struct resource ipmmu_resources[] = {
863 [0] = {
864 .name = "IPMMUI",
865 .start = 0xfe951000,
866 .end = 0xfe9510ff,
867 .flags = IORESOURCE_MEM,
868 },
869};
870
871static const char * const ipmmu_dev_names[] = {
872 "sh_mobile_lcdc_fb.0",
873 "sh_mobile_lcdc_fb.1",
874 "sh_mobile_ceu.0",
875 "uio_pdrv_genirq.0",
876 "uio_pdrv_genirq.1",
877 "uio_pdrv_genirq.2",
878 "uio_pdrv_genirq.3",
879 "uio_pdrv_genirq.4",
880 "uio_pdrv_genirq.5",
881};
882
883static struct shmobile_ipmmu_platform_data ipmmu_platform_data = {
884 .dev_names = ipmmu_dev_names,
885 .num_dev_names = ARRAY_SIZE(ipmmu_dev_names),
886};
887
888static struct platform_device ipmmu_device = {
889 .name = "ipmmu",
890 .id = -1,
891 .dev = {
892 .platform_data = &ipmmu_platform_data,
893 },
894 .resource = ipmmu_resources,
895 .num_resources = ARRAY_SIZE(ipmmu_resources),
896};
897
Magnus Damm2b7eda62010-02-05 11:14:58 +0000898static struct platform_device *sh7372_early_devices[] __initdata = {
899 &scif0_device,
900 &scif1_device,
901 &scif2_device,
902 &scif3_device,
903 &scif4_device,
904 &scif5_device,
905 &scif6_device,
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000906 &cmt2_device,
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200907 &tmu0_device,
Hideki EIRAKU3cfb8432013-01-21 19:54:27 +0900908 &ipmmu_device,
Magnus Damm934e4072010-10-13 07:22:11 +0000909};
910
911static struct platform_device *sh7372_late_devices[] __initdata = {
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000912 &iic0_device,
913 &iic1_device,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000914 &dma0_device,
915 &dma1_device,
916 &dma2_device,
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000917 &usb_dma0_device,
918 &usb_dma1_device,
Magnus Damm68224712011-04-28 03:21:00 +0000919 &vpu_device,
920 &veu0_device,
921 &veu1_device,
922 &veu2_device,
923 &veu3_device,
924 &jpu_device,
925 &spu0_device,
926 &spu1_device,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000927};
928
929void __init sh7372_add_standard_devices(void)
930{
Geert Uytterhoeven9eda01b2014-08-29 15:26:19 +0200931 static struct pm_domain_device domain_devices[] __initdata = {
Rafael J. Wysockiac18e022012-08-15 20:56:26 +0200932 { "A3RV", &vpu_device, },
933 { "A4MP", &spu0_device, },
934 { "A4MP", &spu1_device, },
935 { "A3SP", &scif0_device, },
936 { "A3SP", &scif1_device, },
937 { "A3SP", &scif2_device, },
938 { "A3SP", &scif3_device, },
939 { "A3SP", &scif4_device, },
940 { "A3SP", &scif5_device, },
941 { "A3SP", &scif6_device, },
942 { "A3SP", &iic1_device, },
943 { "A3SP", &dma0_device, },
944 { "A3SP", &dma1_device, },
945 { "A3SP", &dma2_device, },
946 { "A3SP", &usb_dma0_device, },
947 { "A3SP", &usb_dma1_device, },
948 { "A4R", &iic0_device, },
949 { "A4R", &veu0_device, },
950 { "A4R", &veu1_device, },
951 { "A4R", &veu2_device, },
952 { "A4R", &veu3_device, },
953 { "A4R", &jpu_device, },
Laurent Pinchart8e8236a2014-04-23 13:15:16 +0200954 { "A4R", &tmu0_device, },
Rafael J. Wysockic37b7a72012-08-08 00:28:36 +0200955 };
956
Rafael J. Wysockie7e59a42012-08-07 01:12:56 +0200957 sh7372_init_pm_domains();
Magnus Dammf7dadb32011-12-23 01:23:07 +0100958
Magnus Damm2b7eda62010-02-05 11:14:58 +0000959 platform_add_devices(sh7372_early_devices,
960 ARRAY_SIZE(sh7372_early_devices));
Magnus Damm934e4072010-10-13 07:22:11 +0000961
962 platform_add_devices(sh7372_late_devices,
963 ARRAY_SIZE(sh7372_late_devices));
Magnus Damm33afebf2011-07-01 22:14:45 +0200964
Rafael J. Wysockiac18e022012-08-15 20:56:26 +0200965 rmobile_add_devices_to_domains(domain_devices,
966 ARRAY_SIZE(domain_devices));
Magnus Damm2b7eda62010-02-05 11:14:58 +0000967}
968
Stephen Warren6bb27d72012-11-08 12:40:59 -0700969void __init sh7372_earlytimer_init(void)
Magnus Damm17254bf2012-03-06 17:36:37 +0900970{
971 sh7372_clock_init();
972 shmobile_earlytimer_init();
973}
974
Magnus Damm2b7eda62010-02-05 11:14:58 +0000975void __init sh7372_add_early_devices(void)
976{
Magnus Damm2b7eda62010-02-05 11:14:58 +0000977 early_platform_add_devices(sh7372_early_devices,
978 ARRAY_SIZE(sh7372_early_devices));
Magnus Damm5d7220ec2012-02-29 21:37:19 +0900979
980 /* setup early console here as well */
981 shmobile_setup_console();
Magnus Damm2b7eda62010-02-05 11:14:58 +0000982}
Magnus Damm3b7b7052012-03-28 15:53:40 +0900983
984#ifdef CONFIG_USE_OF
985
986void __init sh7372_add_early_devices_dt(void)
987{
Magnus Damm39b22e22014-08-20 22:02:36 +0900988 shmobile_init_delay();
Magnus Damm3b7b7052012-03-28 15:53:40 +0900989
Geert Uytterhoeven1fba31f2014-04-15 14:33:59 +0200990 sh7372_add_early_devices();
Magnus Damm3b7b7052012-03-28 15:53:40 +0900991}
992
Magnus Damm3b7b7052012-03-28 15:53:40 +0900993void __init sh7372_add_standard_devices_dt(void)
994{
995 /* clocks are setup late during boot in the case of DT */
996 sh7372_clock_init();
997
998 platform_add_devices(sh7372_early_devices,
999 ARRAY_SIZE(sh7372_early_devices));
1000
Magnus Damm975e5af2013-07-01 14:41:55 +09001001 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
Magnus Damm3b7b7052012-03-28 15:53:40 +09001002}
1003
1004static const char *sh7372_boards_compat_dt[] __initdata = {
1005 "renesas,sh7372",
1006 NULL,
1007};
1008
1009DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
1010 .map_io = sh7372_map_io,
1011 .init_early = sh7372_add_early_devices_dt,
Magnus Damm3b7b7052012-03-28 15:53:40 +09001012 .init_irq = sh7372_init_irq,
1013 .handle_irq = shmobile_handle_irq_intc,
1014 .init_machine = sh7372_add_standard_devices_dt,
Magnus Damm3b7b7052012-03-28 15:53:40 +09001015 .dt_compat = sh7372_boards_compat_dt,
1016MACHINE_END
1017
1018#endif /* CONFIG_USE_OF */