blob: 4c0e9435af21d59150a602aafe9dc8d1b4f9607a [file] [log] [blame]
Magnus Damm2b7eda62010-02-05 11:14:58 +00001/*
2 * sh7372 processor support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/platform_device.h>
Magnus Damm3b7b7052012-03-28 15:53:40 +090025#include <linux/of_platform.h>
Magnus Damm68224712011-04-28 03:21:00 +000026#include <linux/uio_driver.h>
Magnus Damm2b7eda62010-02-05 11:14:58 +000027#include <linux/delay.h>
28#include <linux/input.h>
29#include <linux/io.h>
30#include <linux/serial_sci.h>
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +000031#include <linux/sh_dma.h>
Magnus Damm2b7eda62010-02-05 11:14:58 +000032#include <linux/sh_intc.h>
33#include <linux/sh_timer.h>
Rafael J. Wysocki111058c2011-08-14 13:35:39 +020034#include <linux/pm_domain.h>
Arnd Bergmann426f1af2012-03-22 22:02:16 +000035#include <linux/dma-mapping.h>
Hideki EIRAKU3cfb8432013-01-21 19:54:27 +090036#include <linux/platform_data/sh_ipmmu.h>
Kuninori Morimotoc317fc52012-06-25 03:43:19 -070037#include <mach/dma-register.h>
Rob Herring250a2722012-01-03 16:57:33 -060038#include <mach/irqs.h>
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +000039#include <mach/sh7372.h>
Magnus Damm5d7220ec2012-02-29 21:37:19 +090040#include <mach/common.h>
41#include <asm/mach/map.h>
Magnus Damm2b7eda62010-02-05 11:14:58 +000042#include <asm/mach-types.h>
43#include <asm/mach/arch.h>
Magnus Damm17254bf2012-03-06 17:36:37 +090044#include <asm/mach/time.h>
Magnus Damm2b7eda62010-02-05 11:14:58 +000045
Magnus Damm5d7220ec2012-02-29 21:37:19 +090046static struct map_desc sh7372_io_desc[] __initdata = {
47 /* create a 1:1 entity map for 0xe6xxxxxx
48 * used by CPGA, INTC and PFC.
49 */
50 {
51 .virtual = 0xe6000000,
52 .pfn = __phys_to_pfn(0xe6000000),
53 .length = 256 << 20,
54 .type = MT_DEVICE_NONSHARED
55 },
56};
57
58void __init sh7372_map_io(void)
59{
60 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc));
61}
Magnus Damm2b7eda62010-02-05 11:14:58 +000062
Laurent Pinchart5967fe02012-12-15 23:51:27 +010063/* PFC */
64static struct resource sh7372_pfc_resources[] = {
65 [0] = {
66 .start = 0xe6050000,
67 .end = 0xe6057fff,
68 .flags = IORESOURCE_MEM,
69 },
70 [1] = {
71 .start = 0xe605800c,
72 .end = 0xe6058027,
73 .flags = IORESOURCE_MEM,
74 }
75};
76
77static struct platform_device sh7372_pfc_device = {
78 .name = "pfc-sh7372",
79 .id = -1,
80 .resource = sh7372_pfc_resources,
81 .num_resources = ARRAY_SIZE(sh7372_pfc_resources),
82};
83
84void __init sh7372_pinmux_init(void)
85{
86 platform_device_register(&sh7372_pfc_device);
87}
88
Laurent Pinchartc6a0d862013-12-06 10:59:21 +010089/* SCIF */
90#define SH7372_SCIF(scif_type, index, baseaddr, irq) \
91static struct plat_sci_port scif##index##_platform_data = { \
92 .type = scif_type, \
Laurent Pinchartc6a0d862013-12-06 10:59:21 +010093 .flags = UPF_BOOT_AUTOCONF, \
Laurent Pinchartc6a0d862013-12-06 10:59:21 +010094 .scscr = SCSCR_RE | SCSCR_TE, \
95}; \
96 \
Laurent Pinchartd39f98b2013-12-06 10:59:30 +010097static struct resource scif##index##_resources[] = { \
98 DEFINE_RES_MEM(baseaddr, 0x100), \
99 DEFINE_RES_IRQ(irq), \
100}; \
101 \
Laurent Pinchartc6a0d862013-12-06 10:59:21 +0100102static struct platform_device scif##index##_device = { \
103 .name = "sh-sci", \
104 .id = index, \
Laurent Pinchartd39f98b2013-12-06 10:59:30 +0100105 .resource = scif##index##_resources, \
106 .num_resources = ARRAY_SIZE(scif##index##_resources), \
Laurent Pinchartc6a0d862013-12-06 10:59:21 +0100107 .dev = { \
108 .platform_data = &scif##index##_platform_data, \
109 }, \
110}
Magnus Damm2b7eda62010-02-05 11:14:58 +0000111
Laurent Pinchartc6a0d862013-12-06 10:59:21 +0100112SH7372_SCIF(PORT_SCIFA, 0, 0xe6c40000, evt2irq(0x0c00));
113SH7372_SCIF(PORT_SCIFA, 1, 0xe6c50000, evt2irq(0x0c20));
114SH7372_SCIF(PORT_SCIFA, 2, 0xe6c60000, evt2irq(0x0c40));
115SH7372_SCIF(PORT_SCIFA, 3, 0xe6c70000, evt2irq(0x0c60));
116SH7372_SCIF(PORT_SCIFA, 4, 0xe6c80000, evt2irq(0x0d20));
117SH7372_SCIF(PORT_SCIFA, 5, 0xe6cb0000, evt2irq(0x0d40));
118SH7372_SCIF(PORT_SCIFB, 6, 0xe6c30000, evt2irq(0x0d60));
Magnus Damm2b7eda62010-02-05 11:14:58 +0000119
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000120/* CMT */
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000121static struct sh_timer_config cmt2_platform_data = {
Laurent Pinchart386f60a2014-04-23 13:15:09 +0200122 .channels_mask = 0x20,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000123};
124
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000125static struct resource cmt2_resources[] = {
Laurent Pinchart386f60a2014-04-23 13:15:09 +0200126 DEFINE_RES_MEM(0xe6130000, 0x50),
127 DEFINE_RES_IRQ(evt2irq(0x0b80)),
Magnus Damm2b7eda62010-02-05 11:14:58 +0000128};
129
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000130static struct platform_device cmt2_device = {
Laurent Pinchart386f60a2014-04-23 13:15:09 +0200131 .name = "sh-cmt-32-fast",
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000132 .id = 2,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000133 .dev = {
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000134 .platform_data = &cmt2_platform_data,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000135 },
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000136 .resource = cmt2_resources,
137 .num_resources = ARRAY_SIZE(cmt2_resources),
Magnus Damm2b7eda62010-02-05 11:14:58 +0000138};
139
Magnus Dammc6c049e2010-10-14 06:57:25 +0000140/* TMU */
141static struct sh_timer_config tmu00_platform_data = {
142 .name = "TMU00",
143 .channel_offset = 0x4,
144 .timer_bit = 0,
145 .clockevent_rating = 200,
146};
147
148static struct resource tmu00_resources[] = {
149 [0] = {
150 .name = "TMU00",
151 .start = 0xfff60008,
152 .end = 0xfff60013,
153 .flags = IORESOURCE_MEM,
154 },
155 [1] = {
156 .start = intcs_evt2irq(0xe80), /* TMU_TUNI0 */
157 .flags = IORESOURCE_IRQ,
158 },
159};
160
161static struct platform_device tmu00_device = {
162 .name = "sh_tmu",
163 .id = 0,
164 .dev = {
165 .platform_data = &tmu00_platform_data,
166 },
167 .resource = tmu00_resources,
168 .num_resources = ARRAY_SIZE(tmu00_resources),
169};
170
171static struct sh_timer_config tmu01_platform_data = {
172 .name = "TMU01",
173 .channel_offset = 0x10,
174 .timer_bit = 1,
175 .clocksource_rating = 200,
176};
177
178static struct resource tmu01_resources[] = {
179 [0] = {
180 .name = "TMU01",
181 .start = 0xfff60014,
182 .end = 0xfff6001f,
183 .flags = IORESOURCE_MEM,
184 },
185 [1] = {
186 .start = intcs_evt2irq(0xea0), /* TMU_TUNI1 */
187 .flags = IORESOURCE_IRQ,
188 },
189};
190
191static struct platform_device tmu01_device = {
192 .name = "sh_tmu",
193 .id = 1,
194 .dev = {
195 .platform_data = &tmu01_platform_data,
196 },
197 .resource = tmu01_resources,
198 .num_resources = ARRAY_SIZE(tmu01_resources),
199};
200
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000201/* I2C */
202static struct resource iic0_resources[] = {
203 [0] = {
204 .name = "IIC0",
205 .start = 0xFFF20000,
206 .end = 0xFFF20425 - 1,
207 .flags = IORESOURCE_MEM,
208 },
209 [1] = {
Magnus Damm33c96072010-05-20 14:41:00 +0000210 .start = intcs_evt2irq(0xe00), /* IIC0_ALI0 */
211 .end = intcs_evt2irq(0xe60), /* IIC0_DTEI0 */
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000212 .flags = IORESOURCE_IRQ,
213 },
214};
215
216static struct platform_device iic0_device = {
217 .name = "i2c-sh_mobile",
218 .id = 0, /* "i2c0" clock */
219 .num_resources = ARRAY_SIZE(iic0_resources),
220 .resource = iic0_resources,
221};
222
223static struct resource iic1_resources[] = {
224 [0] = {
225 .name = "IIC1",
226 .start = 0xE6C20000,
227 .end = 0xE6C20425 - 1,
228 .flags = IORESOURCE_MEM,
229 },
230 [1] = {
Magnus Damm33c96072010-05-20 14:41:00 +0000231 .start = evt2irq(0x780), /* IIC1_ALI1 */
232 .end = evt2irq(0x7e0), /* IIC1_DTEI1 */
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000233 .flags = IORESOURCE_IRQ,
234 },
235};
236
237static struct platform_device iic1_device = {
238 .name = "i2c-sh_mobile",
239 .id = 1, /* "i2c1" clock */
240 .num_resources = ARRAY_SIZE(iic1_resources),
241 .resource = iic1_resources,
242};
243
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000244/* DMA */
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000245static const struct sh_dmae_slave_config sh7372_dmae_slaves[] = {
246 {
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000247 .slave_id = SHDMA_SLAVE_SCIF0_TX,
248 .addr = 0xe6c40020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700249 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000250 .mid_rid = 0x21,
251 }, {
252 .slave_id = SHDMA_SLAVE_SCIF0_RX,
253 .addr = 0xe6c40024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700254 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000255 .mid_rid = 0x22,
256 }, {
257 .slave_id = SHDMA_SLAVE_SCIF1_TX,
258 .addr = 0xe6c50020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700259 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000260 .mid_rid = 0x25,
261 }, {
262 .slave_id = SHDMA_SLAVE_SCIF1_RX,
263 .addr = 0xe6c50024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700264 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000265 .mid_rid = 0x26,
266 }, {
267 .slave_id = SHDMA_SLAVE_SCIF2_TX,
268 .addr = 0xe6c60020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700269 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000270 .mid_rid = 0x29,
271 }, {
272 .slave_id = SHDMA_SLAVE_SCIF2_RX,
273 .addr = 0xe6c60024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700274 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000275 .mid_rid = 0x2a,
276 }, {
277 .slave_id = SHDMA_SLAVE_SCIF3_TX,
278 .addr = 0xe6c70020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700279 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000280 .mid_rid = 0x2d,
281 }, {
282 .slave_id = SHDMA_SLAVE_SCIF3_RX,
283 .addr = 0xe6c70024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700284 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000285 .mid_rid = 0x2e,
286 }, {
287 .slave_id = SHDMA_SLAVE_SCIF4_TX,
288 .addr = 0xe6c80020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700289 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000290 .mid_rid = 0x39,
291 }, {
292 .slave_id = SHDMA_SLAVE_SCIF4_RX,
293 .addr = 0xe6c80024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700294 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000295 .mid_rid = 0x3a,
296 }, {
297 .slave_id = SHDMA_SLAVE_SCIF5_TX,
298 .addr = 0xe6cb0020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700299 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000300 .mid_rid = 0x35,
301 }, {
302 .slave_id = SHDMA_SLAVE_SCIF5_RX,
303 .addr = 0xe6cb0024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700304 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000305 .mid_rid = 0x36,
306 }, {
307 .slave_id = SHDMA_SLAVE_SCIF6_TX,
308 .addr = 0xe6c30040,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700309 .chcr = CHCR_TX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000310 .mid_rid = 0x3d,
311 }, {
312 .slave_id = SHDMA_SLAVE_SCIF6_RX,
313 .addr = 0xe6c30060,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700314 .chcr = CHCR_RX(XMIT_SZ_8BIT),
Guennadi Liakhovetski8d3e17b2010-05-23 16:39:24 +0000315 .mid_rid = 0x3e,
316 }, {
Bastian Hecht40eaed72012-09-22 14:06:38 +0200317 .slave_id = SHDMA_SLAVE_FLCTL0_TX,
318 .addr = 0xe6a30050,
319 .chcr = CHCR_TX(XMIT_SZ_32BIT),
320 .mid_rid = 0x83,
321 }, {
322 .slave_id = SHDMA_SLAVE_FLCTL0_RX,
323 .addr = 0xe6a30050,
324 .chcr = CHCR_RX(XMIT_SZ_32BIT),
325 .mid_rid = 0x83,
326 }, {
327 .slave_id = SHDMA_SLAVE_FLCTL1_TX,
328 .addr = 0xe6a30060,
329 .chcr = CHCR_TX(XMIT_SZ_32BIT),
330 .mid_rid = 0x87,
331 }, {
332 .slave_id = SHDMA_SLAVE_FLCTL1_RX,
333 .addr = 0xe6a30060,
334 .chcr = CHCR_RX(XMIT_SZ_32BIT),
335 .mid_rid = 0x87,
336 }, {
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000337 .slave_id = SHDMA_SLAVE_SDHI0_TX,
338 .addr = 0xe6850030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700339 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000340 .mid_rid = 0xc1,
341 }, {
342 .slave_id = SHDMA_SLAVE_SDHI0_RX,
343 .addr = 0xe6850030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700344 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000345 .mid_rid = 0xc2,
346 }, {
347 .slave_id = SHDMA_SLAVE_SDHI1_TX,
348 .addr = 0xe6860030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700349 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000350 .mid_rid = 0xc9,
351 }, {
352 .slave_id = SHDMA_SLAVE_SDHI1_RX,
353 .addr = 0xe6860030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700354 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000355 .mid_rid = 0xca,
356 }, {
357 .slave_id = SHDMA_SLAVE_SDHI2_TX,
358 .addr = 0xe6870030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700359 .chcr = CHCR_TX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000360 .mid_rid = 0xcd,
361 }, {
362 .slave_id = SHDMA_SLAVE_SDHI2_RX,
363 .addr = 0xe6870030,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700364 .chcr = CHCR_RX(XMIT_SZ_16BIT),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000365 .mid_rid = 0xce,
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000366 }, {
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700367 .slave_id = SHDMA_SLAVE_FSIA_TX,
368 .addr = 0xfe1f0024,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700369 .chcr = CHCR_TX(XMIT_SZ_32BIT),
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700370 .mid_rid = 0xb1,
371 }, {
372 .slave_id = SHDMA_SLAVE_FSIA_RX,
373 .addr = 0xfe1f0020,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700374 .chcr = CHCR_RX(XMIT_SZ_32BIT),
Kuninori Morimoto880452b2012-04-01 18:40:01 -0700375 .mid_rid = 0xb2,
376 }, {
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000377 .slave_id = SHDMA_SLAVE_MMCIF_TX,
378 .addr = 0xe6bd0034,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700379 .chcr = CHCR_TX(XMIT_SZ_32BIT),
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000380 .mid_rid = 0xd1,
381 }, {
382 .slave_id = SHDMA_SLAVE_MMCIF_RX,
383 .addr = 0xe6bd0034,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700384 .chcr = CHCR_RX(XMIT_SZ_32BIT),
Guennadi Liakhovetski6d11dc12010-11-24 10:05:15 +0000385 .mid_rid = 0xd2,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000386 },
387};
388
Kuninori Morimoto4d6344f2012-06-20 11:30:32 +0200389#define SH7372_CHCLR (0x220 - 0x20)
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100390
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000391static const struct sh_dmae_channel sh7372_dmae_channels[] = {
392 {
393 .offset = 0,
394 .dmars = 0,
395 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100396 .chclr_offset = SH7372_CHCLR + 0,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000397 }, {
398 .offset = 0x10,
399 .dmars = 0,
400 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100401 .chclr_offset = SH7372_CHCLR + 0x10,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000402 }, {
403 .offset = 0x20,
404 .dmars = 4,
405 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100406 .chclr_offset = SH7372_CHCLR + 0x20,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000407 }, {
408 .offset = 0x30,
409 .dmars = 4,
410 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100411 .chclr_offset = SH7372_CHCLR + 0x30,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000412 }, {
413 .offset = 0x50,
414 .dmars = 8,
415 .dmars_bit = 0,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100416 .chclr_offset = SH7372_CHCLR + 0x50,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000417 }, {
418 .offset = 0x60,
419 .dmars = 8,
420 .dmars_bit = 8,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100421 .chclr_offset = SH7372_CHCLR + 0x60,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000422 }
423};
424
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000425static struct sh_dmae_pdata dma_platform_data = {
426 .slave = sh7372_dmae_slaves,
427 .slave_num = ARRAY_SIZE(sh7372_dmae_slaves),
428 .channel = sh7372_dmae_channels,
429 .channel_num = ARRAY_SIZE(sh7372_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700430 .ts_low_shift = TS_LOW_SHIFT,
431 .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
432 .ts_high_shift = TS_HI_SHIFT,
433 .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
434 .ts_shift = dma_ts_shift,
435 .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000436 .dmaor_init = DMAOR_DME,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100437 .chclr_present = 1,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000438};
439
440/* Resource order important! */
441static struct resource sh7372_dmae0_resources[] = {
442 {
443 /* Channel registers and DMAOR */
444 .start = 0xfe008020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100445 .end = 0xfe00828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000446 .flags = IORESOURCE_MEM,
447 },
448 {
449 /* DMARSx */
450 .start = 0xfe009000,
451 .end = 0xfe00900b,
452 .flags = IORESOURCE_MEM,
453 },
454 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900455 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000456 .start = evt2irq(0x20c0),
457 .end = evt2irq(0x20c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000458 .flags = IORESOURCE_IRQ,
459 },
460 {
461 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000462 .start = evt2irq(0x2000),
463 .end = evt2irq(0x20a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000464 .flags = IORESOURCE_IRQ,
465 },
466};
467
468/* Resource order important! */
469static struct resource sh7372_dmae1_resources[] = {
470 {
471 /* Channel registers and DMAOR */
472 .start = 0xfe018020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100473 .end = 0xfe01828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000474 .flags = IORESOURCE_MEM,
475 },
476 {
477 /* DMARSx */
478 .start = 0xfe019000,
479 .end = 0xfe01900b,
480 .flags = IORESOURCE_MEM,
481 },
482 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900483 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000484 .start = evt2irq(0x21c0),
485 .end = evt2irq(0x21c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000486 .flags = IORESOURCE_IRQ,
487 },
488 {
489 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000490 .start = evt2irq(0x2100),
491 .end = evt2irq(0x21a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000492 .flags = IORESOURCE_IRQ,
493 },
494};
495
496/* Resource order important! */
497static struct resource sh7372_dmae2_resources[] = {
498 {
499 /* Channel registers and DMAOR */
500 .start = 0xfe028020,
Guennadi Liakhovetskie08b8812012-01-04 15:34:21 +0100501 .end = 0xfe02828f,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000502 .flags = IORESOURCE_MEM,
503 },
504 {
505 /* DMARSx */
506 .start = 0xfe029000,
507 .end = 0xfe02900b,
508 .flags = IORESOURCE_MEM,
509 },
510 {
Shimoda, Yoshihiro20052462012-01-10 14:21:31 +0900511 .name = "error_irq",
Magnus Dammf989ae52010-08-31 09:27:53 +0000512 .start = evt2irq(0x22c0),
513 .end = evt2irq(0x22c0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000514 .flags = IORESOURCE_IRQ,
515 },
516 {
517 /* IRQ for channels 0-5 */
Magnus Dammf989ae52010-08-31 09:27:53 +0000518 .start = evt2irq(0x2200),
519 .end = evt2irq(0x22a0),
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000520 .flags = IORESOURCE_IRQ,
521 },
522};
523
524static struct platform_device dma0_device = {
525 .name = "sh-dma-engine",
526 .id = 0,
527 .resource = sh7372_dmae0_resources,
528 .num_resources = ARRAY_SIZE(sh7372_dmae0_resources),
529 .dev = {
530 .platform_data = &dma_platform_data,
531 },
532};
533
534static struct platform_device dma1_device = {
535 .name = "sh-dma-engine",
536 .id = 1,
537 .resource = sh7372_dmae1_resources,
538 .num_resources = ARRAY_SIZE(sh7372_dmae1_resources),
539 .dev = {
540 .platform_data = &dma_platform_data,
541 },
542};
543
544static struct platform_device dma2_device = {
545 .name = "sh-dma-engine",
546 .id = 2,
547 .resource = sh7372_dmae2_resources,
548 .num_resources = ARRAY_SIZE(sh7372_dmae2_resources),
549 .dev = {
550 .platform_data = &dma_platform_data,
551 },
552};
553
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000554/*
555 * USB-DMAC
556 */
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000557static const struct sh_dmae_channel sh7372_usb_dmae_channels[] = {
558 {
559 .offset = 0,
560 }, {
561 .offset = 0x20,
562 },
563};
564
565/* USB DMAC0 */
566static const struct sh_dmae_slave_config sh7372_usb_dmae0_slaves[] = {
567 {
568 .slave_id = SHDMA_SLAVE_USB0_TX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700569 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000570 }, {
571 .slave_id = SHDMA_SLAVE_USB0_RX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700572 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000573 },
574};
575
576static struct sh_dmae_pdata usb_dma0_platform_data = {
577 .slave = sh7372_usb_dmae0_slaves,
578 .slave_num = ARRAY_SIZE(sh7372_usb_dmae0_slaves),
579 .channel = sh7372_usb_dmae_channels,
580 .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700581 .ts_low_shift = USBTS_LOW_SHIFT,
582 .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
583 .ts_high_shift = USBTS_HI_SHIFT,
584 .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
585 .ts_shift = dma_usbts_shift,
586 .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000587 .dmaor_init = DMAOR_DME,
588 .chcr_offset = 0x14,
589 .chcr_ie_bit = 1 << 5,
590 .dmaor_is_32bit = 1,
591 .needs_tend_set = 1,
592 .no_dmars = 1,
Guennadi Liakhovetskic8ddf032012-01-18 10:14:29 +0100593 .slave_only = 1,
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000594};
595
596static struct resource sh7372_usb_dmae0_resources[] = {
597 {
598 /* Channel registers and DMAOR */
599 .start = 0xe68a0020,
600 .end = 0xe68a0064 - 1,
601 .flags = IORESOURCE_MEM,
602 },
603 {
604 /* VCR/SWR/DMICR */
605 .start = 0xe68a0000,
606 .end = 0xe68a0014 - 1,
607 .flags = IORESOURCE_MEM,
608 },
609 {
610 /* IRQ for channels */
611 .start = evt2irq(0x0a00),
612 .end = evt2irq(0x0a00),
613 .flags = IORESOURCE_IRQ,
614 },
615};
616
617static struct platform_device usb_dma0_device = {
618 .name = "sh-dma-engine",
619 .id = 3,
620 .resource = sh7372_usb_dmae0_resources,
621 .num_resources = ARRAY_SIZE(sh7372_usb_dmae0_resources),
622 .dev = {
623 .platform_data = &usb_dma0_platform_data,
624 },
625};
626
627/* USB DMAC1 */
628static const struct sh_dmae_slave_config sh7372_usb_dmae1_slaves[] = {
629 {
630 .slave_id = SHDMA_SLAVE_USB1_TX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700631 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000632 }, {
633 .slave_id = SHDMA_SLAVE_USB1_RX,
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700634 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000635 },
636};
637
638static struct sh_dmae_pdata usb_dma1_platform_data = {
639 .slave = sh7372_usb_dmae1_slaves,
640 .slave_num = ARRAY_SIZE(sh7372_usb_dmae1_slaves),
641 .channel = sh7372_usb_dmae_channels,
642 .channel_num = ARRAY_SIZE(sh7372_usb_dmae_channels),
Kuninori Morimotoc317fc52012-06-25 03:43:19 -0700643 .ts_low_shift = USBTS_LOW_SHIFT,
644 .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
645 .ts_high_shift = USBTS_HI_SHIFT,
646 .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
647 .ts_shift = dma_usbts_shift,
648 .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000649 .dmaor_init = DMAOR_DME,
650 .chcr_offset = 0x14,
651 .chcr_ie_bit = 1 << 5,
652 .dmaor_is_32bit = 1,
653 .needs_tend_set = 1,
654 .no_dmars = 1,
Guennadi Liakhovetskic8ddf032012-01-18 10:14:29 +0100655 .slave_only = 1,
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000656};
657
658static struct resource sh7372_usb_dmae1_resources[] = {
659 {
660 /* Channel registers and DMAOR */
661 .start = 0xe68c0020,
662 .end = 0xe68c0064 - 1,
663 .flags = IORESOURCE_MEM,
664 },
665 {
666 /* VCR/SWR/DMICR */
667 .start = 0xe68c0000,
668 .end = 0xe68c0014 - 1,
669 .flags = IORESOURCE_MEM,
670 },
671 {
672 /* IRQ for channels */
673 .start = evt2irq(0x1d00),
674 .end = evt2irq(0x1d00),
675 .flags = IORESOURCE_IRQ,
676 },
677};
678
679static struct platform_device usb_dma1_device = {
680 .name = "sh-dma-engine",
681 .id = 4,
682 .resource = sh7372_usb_dmae1_resources,
683 .num_resources = ARRAY_SIZE(sh7372_usb_dmae1_resources),
684 .dev = {
685 .platform_data = &usb_dma1_platform_data,
686 },
687};
688
Magnus Damm68224712011-04-28 03:21:00 +0000689/* VPU */
690static struct uio_info vpu_platform_data = {
691 .name = "VPU5HG",
692 .version = "0",
693 .irq = intcs_evt2irq(0x980),
694};
695
696static struct resource vpu_resources[] = {
697 [0] = {
698 .name = "VPU",
699 .start = 0xfe900000,
700 .end = 0xfe900157,
701 .flags = IORESOURCE_MEM,
702 },
703};
704
705static struct platform_device vpu_device = {
706 .name = "uio_pdrv_genirq",
707 .id = 0,
708 .dev = {
709 .platform_data = &vpu_platform_data,
710 },
711 .resource = vpu_resources,
712 .num_resources = ARRAY_SIZE(vpu_resources),
713};
714
715/* VEU0 */
716static struct uio_info veu0_platform_data = {
717 .name = "VEU0",
718 .version = "0",
719 .irq = intcs_evt2irq(0x700),
720};
721
722static struct resource veu0_resources[] = {
723 [0] = {
724 .name = "VEU0",
725 .start = 0xfe920000,
726 .end = 0xfe9200cb,
727 .flags = IORESOURCE_MEM,
728 },
729};
730
731static struct platform_device veu0_device = {
732 .name = "uio_pdrv_genirq",
733 .id = 1,
734 .dev = {
735 .platform_data = &veu0_platform_data,
736 },
737 .resource = veu0_resources,
738 .num_resources = ARRAY_SIZE(veu0_resources),
739};
740
741/* VEU1 */
742static struct uio_info veu1_platform_data = {
743 .name = "VEU1",
744 .version = "0",
745 .irq = intcs_evt2irq(0x720),
746};
747
748static struct resource veu1_resources[] = {
749 [0] = {
750 .name = "VEU1",
751 .start = 0xfe924000,
752 .end = 0xfe9240cb,
753 .flags = IORESOURCE_MEM,
754 },
755};
756
757static struct platform_device veu1_device = {
758 .name = "uio_pdrv_genirq",
759 .id = 2,
760 .dev = {
761 .platform_data = &veu1_platform_data,
762 },
763 .resource = veu1_resources,
764 .num_resources = ARRAY_SIZE(veu1_resources),
765};
766
767/* VEU2 */
768static struct uio_info veu2_platform_data = {
769 .name = "VEU2",
770 .version = "0",
771 .irq = intcs_evt2irq(0x740),
772};
773
774static struct resource veu2_resources[] = {
775 [0] = {
776 .name = "VEU2",
777 .start = 0xfe928000,
778 .end = 0xfe928307,
779 .flags = IORESOURCE_MEM,
780 },
781};
782
783static struct platform_device veu2_device = {
784 .name = "uio_pdrv_genirq",
785 .id = 3,
786 .dev = {
787 .platform_data = &veu2_platform_data,
788 },
789 .resource = veu2_resources,
790 .num_resources = ARRAY_SIZE(veu2_resources),
791};
792
793/* VEU3 */
794static struct uio_info veu3_platform_data = {
795 .name = "VEU3",
796 .version = "0",
797 .irq = intcs_evt2irq(0x760),
798};
799
800static struct resource veu3_resources[] = {
801 [0] = {
802 .name = "VEU3",
803 .start = 0xfe92c000,
804 .end = 0xfe92c307,
805 .flags = IORESOURCE_MEM,
806 },
807};
808
809static struct platform_device veu3_device = {
810 .name = "uio_pdrv_genirq",
811 .id = 4,
812 .dev = {
813 .platform_data = &veu3_platform_data,
814 },
815 .resource = veu3_resources,
816 .num_resources = ARRAY_SIZE(veu3_resources),
817};
818
819/* JPU */
820static struct uio_info jpu_platform_data = {
821 .name = "JPU",
822 .version = "0",
823 .irq = intcs_evt2irq(0x560),
824};
825
826static struct resource jpu_resources[] = {
827 [0] = {
828 .name = "JPU",
829 .start = 0xfe980000,
830 .end = 0xfe9902d3,
831 .flags = IORESOURCE_MEM,
832 },
833};
834
835static struct platform_device jpu_device = {
836 .name = "uio_pdrv_genirq",
837 .id = 5,
838 .dev = {
839 .platform_data = &jpu_platform_data,
840 },
841 .resource = jpu_resources,
842 .num_resources = ARRAY_SIZE(jpu_resources),
843};
844
845/* SPU2DSP0 */
846static struct uio_info spu0_platform_data = {
847 .name = "SPU2DSP0",
848 .version = "0",
849 .irq = evt2irq(0x1800),
850};
851
852static struct resource spu0_resources[] = {
853 [0] = {
854 .name = "SPU2DSP0",
855 .start = 0xfe200000,
856 .end = 0xfe2fffff,
857 .flags = IORESOURCE_MEM,
858 },
859};
860
861static struct platform_device spu0_device = {
862 .name = "uio_pdrv_genirq",
863 .id = 6,
864 .dev = {
865 .platform_data = &spu0_platform_data,
866 },
867 .resource = spu0_resources,
868 .num_resources = ARRAY_SIZE(spu0_resources),
869};
870
871/* SPU2DSP1 */
872static struct uio_info spu1_platform_data = {
873 .name = "SPU2DSP1",
874 .version = "0",
875 .irq = evt2irq(0x1820),
876};
877
878static struct resource spu1_resources[] = {
879 [0] = {
880 .name = "SPU2DSP1",
881 .start = 0xfe300000,
882 .end = 0xfe3fffff,
883 .flags = IORESOURCE_MEM,
884 },
885};
886
887static struct platform_device spu1_device = {
888 .name = "uio_pdrv_genirq",
889 .id = 7,
890 .dev = {
891 .platform_data = &spu1_platform_data,
892 },
893 .resource = spu1_resources,
894 .num_resources = ARRAY_SIZE(spu1_resources),
895};
896
Hideki EIRAKU3cfb8432013-01-21 19:54:27 +0900897/* IPMMUI (an IPMMU module for ICB/LMB) */
898static struct resource ipmmu_resources[] = {
899 [0] = {
900 .name = "IPMMUI",
901 .start = 0xfe951000,
902 .end = 0xfe9510ff,
903 .flags = IORESOURCE_MEM,
904 },
905};
906
907static const char * const ipmmu_dev_names[] = {
908 "sh_mobile_lcdc_fb.0",
909 "sh_mobile_lcdc_fb.1",
910 "sh_mobile_ceu.0",
911 "uio_pdrv_genirq.0",
912 "uio_pdrv_genirq.1",
913 "uio_pdrv_genirq.2",
914 "uio_pdrv_genirq.3",
915 "uio_pdrv_genirq.4",
916 "uio_pdrv_genirq.5",
917};
918
919static struct shmobile_ipmmu_platform_data ipmmu_platform_data = {
920 .dev_names = ipmmu_dev_names,
921 .num_dev_names = ARRAY_SIZE(ipmmu_dev_names),
922};
923
924static struct platform_device ipmmu_device = {
925 .name = "ipmmu",
926 .id = -1,
927 .dev = {
928 .platform_data = &ipmmu_platform_data,
929 },
930 .resource = ipmmu_resources,
931 .num_resources = ARRAY_SIZE(ipmmu_resources),
932};
933
Magnus Damm2b7eda62010-02-05 11:14:58 +0000934static struct platform_device *sh7372_early_devices[] __initdata = {
935 &scif0_device,
936 &scif1_device,
937 &scif2_device,
938 &scif3_device,
939 &scif4_device,
940 &scif5_device,
941 &scif6_device,
Magnus Damm0ed61fc2011-06-30 09:22:50 +0000942 &cmt2_device,
Magnus Dammc6c049e2010-10-14 06:57:25 +0000943 &tmu00_device,
944 &tmu01_device,
Hideki EIRAKU3cfb8432013-01-21 19:54:27 +0900945 &ipmmu_device,
Magnus Damm934e4072010-10-13 07:22:11 +0000946};
947
948static struct platform_device *sh7372_late_devices[] __initdata = {
Kuninori Morimotoc1909cc2010-03-11 10:42:47 +0000949 &iic0_device,
950 &iic1_device,
Guennadi Liakhovetski69bf6f42010-05-04 14:07:15 +0000951 &dma0_device,
952 &dma1_device,
953 &dma2_device,
Kuninori Morimotoafe48042011-06-17 08:21:10 +0000954 &usb_dma0_device,
955 &usb_dma1_device,
Magnus Damm68224712011-04-28 03:21:00 +0000956 &vpu_device,
957 &veu0_device,
958 &veu1_device,
959 &veu2_device,
960 &veu3_device,
961 &jpu_device,
962 &spu0_device,
963 &spu1_device,
Magnus Damm2b7eda62010-02-05 11:14:58 +0000964};
965
966void __init sh7372_add_standard_devices(void)
967{
Rafael J. Wysockiac18e022012-08-15 20:56:26 +0200968 struct pm_domain_device domain_devices[] = {
969 { "A3RV", &vpu_device, },
970 { "A4MP", &spu0_device, },
971 { "A4MP", &spu1_device, },
972 { "A3SP", &scif0_device, },
973 { "A3SP", &scif1_device, },
974 { "A3SP", &scif2_device, },
975 { "A3SP", &scif3_device, },
976 { "A3SP", &scif4_device, },
977 { "A3SP", &scif5_device, },
978 { "A3SP", &scif6_device, },
979 { "A3SP", &iic1_device, },
980 { "A3SP", &dma0_device, },
981 { "A3SP", &dma1_device, },
982 { "A3SP", &dma2_device, },
983 { "A3SP", &usb_dma0_device, },
984 { "A3SP", &usb_dma1_device, },
985 { "A4R", &iic0_device, },
986 { "A4R", &veu0_device, },
987 { "A4R", &veu1_device, },
988 { "A4R", &veu2_device, },
989 { "A4R", &veu3_device, },
990 { "A4R", &jpu_device, },
991 { "A4R", &tmu00_device, },
992 { "A4R", &tmu01_device, },
Rafael J. Wysockic37b7a72012-08-08 00:28:36 +0200993 };
994
Rafael J. Wysockie7e59a42012-08-07 01:12:56 +0200995 sh7372_init_pm_domains();
Magnus Dammf7dadb32011-12-23 01:23:07 +0100996
Magnus Damm2b7eda62010-02-05 11:14:58 +0000997 platform_add_devices(sh7372_early_devices,
998 ARRAY_SIZE(sh7372_early_devices));
Magnus Damm934e4072010-10-13 07:22:11 +0000999
1000 platform_add_devices(sh7372_late_devices,
1001 ARRAY_SIZE(sh7372_late_devices));
Magnus Damm33afebf2011-07-01 22:14:45 +02001002
Rafael J. Wysockiac18e022012-08-15 20:56:26 +02001003 rmobile_add_devices_to_domains(domain_devices,
1004 ARRAY_SIZE(domain_devices));
Magnus Damm2b7eda62010-02-05 11:14:58 +00001005}
1006
Stephen Warren6bb27d72012-11-08 12:40:59 -07001007void __init sh7372_earlytimer_init(void)
Magnus Damm17254bf2012-03-06 17:36:37 +09001008{
1009 sh7372_clock_init();
1010 shmobile_earlytimer_init();
1011}
1012
Magnus Damm2b7eda62010-02-05 11:14:58 +00001013void __init sh7372_add_early_devices(void)
1014{
Magnus Damm2b7eda62010-02-05 11:14:58 +00001015 early_platform_add_devices(sh7372_early_devices,
1016 ARRAY_SIZE(sh7372_early_devices));
Magnus Damm5d7220ec2012-02-29 21:37:19 +09001017
1018 /* setup early console here as well */
1019 shmobile_setup_console();
Magnus Damm2b7eda62010-02-05 11:14:58 +00001020}
Magnus Damm3b7b7052012-03-28 15:53:40 +09001021
1022#ifdef CONFIG_USE_OF
1023
1024void __init sh7372_add_early_devices_dt(void)
1025{
1026 shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */
1027
1028 early_platform_add_devices(sh7372_early_devices,
1029 ARRAY_SIZE(sh7372_early_devices));
1030
1031 /* setup early console here as well */
1032 shmobile_setup_console();
1033}
1034
Magnus Damm3b7b7052012-03-28 15:53:40 +09001035void __init sh7372_add_standard_devices_dt(void)
1036{
1037 /* clocks are setup late during boot in the case of DT */
1038 sh7372_clock_init();
1039
1040 platform_add_devices(sh7372_early_devices,
1041 ARRAY_SIZE(sh7372_early_devices));
1042
Magnus Damm975e5af2013-07-01 14:41:55 +09001043 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
Magnus Damm3b7b7052012-03-28 15:53:40 +09001044}
1045
1046static const char *sh7372_boards_compat_dt[] __initdata = {
1047 "renesas,sh7372",
1048 NULL,
1049};
1050
1051DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
1052 .map_io = sh7372_map_io,
1053 .init_early = sh7372_add_early_devices_dt,
1054 .nr_irqs = NR_IRQS_LEGACY,
1055 .init_irq = sh7372_init_irq,
1056 .handle_irq = shmobile_handle_irq_intc,
1057 .init_machine = sh7372_add_standard_devices_dt,
Magnus Damm3b7b7052012-03-28 15:53:40 +09001058 .dt_compat = sh7372_boards_compat_dt,
1059MACHINE_END
1060
1061#endif /* CONFIG_USE_OF */