diff options
Diffstat (limited to 'arch/arm/mach-shmobile/setup-r8a7779.c')
-rw-r--r-- | arch/arm/mach-shmobile/setup-r8a7779.c | 104 |
1 files changed, 84 insertions, 20 deletions
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c index c54ff9b29fe5..042df35e71a0 100644 --- a/arch/arm/mach-shmobile/setup-r8a7779.c +++ b/arch/arm/mach-shmobile/setup-r8a7779.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/of_platform.h> | ||
24 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
25 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
26 | #include <linux/input.h> | 27 | #include <linux/input.h> |
@@ -28,6 +29,7 @@ | |||
28 | #include <linux/serial_sci.h> | 29 | #include <linux/serial_sci.h> |
29 | #include <linux/sh_intc.h> | 30 | #include <linux/sh_intc.h> |
30 | #include <linux/sh_timer.h> | 31 | #include <linux/sh_timer.h> |
32 | #include <linux/dma-mapping.h> | ||
31 | #include <mach/hardware.h> | 33 | #include <mach/hardware.h> |
32 | #include <mach/irqs.h> | 34 | #include <mach/irqs.h> |
33 | #include <mach/r8a7779.h> | 35 | #include <mach/r8a7779.h> |
@@ -91,7 +93,7 @@ static struct plat_sci_port scif0_platform_data = { | |||
91 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, | 93 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
92 | .scbrr_algo_id = SCBRR_ALGO_2, | 94 | .scbrr_algo_id = SCBRR_ALGO_2, |
93 | .type = PORT_SCIF, | 95 | .type = PORT_SCIF, |
94 | .irqs = SCIx_IRQ_MUXED(gic_spi(88)), | 96 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x78)), |
95 | }; | 97 | }; |
96 | 98 | ||
97 | static struct platform_device scif0_device = { | 99 | static struct platform_device scif0_device = { |
@@ -108,7 +110,7 @@ static struct plat_sci_port scif1_platform_data = { | |||
108 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, | 110 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
109 | .scbrr_algo_id = SCBRR_ALGO_2, | 111 | .scbrr_algo_id = SCBRR_ALGO_2, |
110 | .type = PORT_SCIF, | 112 | .type = PORT_SCIF, |
111 | .irqs = SCIx_IRQ_MUXED(gic_spi(89)), | 113 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x79)), |
112 | }; | 114 | }; |
113 | 115 | ||
114 | static struct platform_device scif1_device = { | 116 | static struct platform_device scif1_device = { |
@@ -125,7 +127,7 @@ static struct plat_sci_port scif2_platform_data = { | |||
125 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, | 127 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
126 | .scbrr_algo_id = SCBRR_ALGO_2, | 128 | .scbrr_algo_id = SCBRR_ALGO_2, |
127 | .type = PORT_SCIF, | 129 | .type = PORT_SCIF, |
128 | .irqs = SCIx_IRQ_MUXED(gic_spi(90)), | 130 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x7a)), |
129 | }; | 131 | }; |
130 | 132 | ||
131 | static struct platform_device scif2_device = { | 133 | static struct platform_device scif2_device = { |
@@ -142,7 +144,7 @@ static struct plat_sci_port scif3_platform_data = { | |||
142 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, | 144 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
143 | .scbrr_algo_id = SCBRR_ALGO_2, | 145 | .scbrr_algo_id = SCBRR_ALGO_2, |
144 | .type = PORT_SCIF, | 146 | .type = PORT_SCIF, |
145 | .irqs = SCIx_IRQ_MUXED(gic_spi(91)), | 147 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x7b)), |
146 | }; | 148 | }; |
147 | 149 | ||
148 | static struct platform_device scif3_device = { | 150 | static struct platform_device scif3_device = { |
@@ -159,7 +161,7 @@ static struct plat_sci_port scif4_platform_data = { | |||
159 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, | 161 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
160 | .scbrr_algo_id = SCBRR_ALGO_2, | 162 | .scbrr_algo_id = SCBRR_ALGO_2, |
161 | .type = PORT_SCIF, | 163 | .type = PORT_SCIF, |
162 | .irqs = SCIx_IRQ_MUXED(gic_spi(92)), | 164 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x7c)), |
163 | }; | 165 | }; |
164 | 166 | ||
165 | static struct platform_device scif4_device = { | 167 | static struct platform_device scif4_device = { |
@@ -176,7 +178,7 @@ static struct plat_sci_port scif5_platform_data = { | |||
176 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, | 178 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
177 | .scbrr_algo_id = SCBRR_ALGO_2, | 179 | .scbrr_algo_id = SCBRR_ALGO_2, |
178 | .type = PORT_SCIF, | 180 | .type = PORT_SCIF, |
179 | .irqs = SCIx_IRQ_MUXED(gic_spi(93)), | 181 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x7d)), |
180 | }; | 182 | }; |
181 | 183 | ||
182 | static struct platform_device scif5_device = { | 184 | static struct platform_device scif5_device = { |
@@ -203,7 +205,7 @@ static struct resource tmu00_resources[] = { | |||
203 | .flags = IORESOURCE_MEM, | 205 | .flags = IORESOURCE_MEM, |
204 | }, | 206 | }, |
205 | [1] = { | 207 | [1] = { |
206 | .start = gic_spi(32), | 208 | .start = gic_iid(0x40), |
207 | .flags = IORESOURCE_IRQ, | 209 | .flags = IORESOURCE_IRQ, |
208 | }, | 210 | }, |
209 | }; | 211 | }; |
@@ -233,7 +235,7 @@ static struct resource tmu01_resources[] = { | |||
233 | .flags = IORESOURCE_MEM, | 235 | .flags = IORESOURCE_MEM, |
234 | }, | 236 | }, |
235 | [1] = { | 237 | [1] = { |
236 | .start = gic_spi(33), | 238 | .start = gic_iid(0x41), |
237 | .flags = IORESOURCE_IRQ, | 239 | .flags = IORESOURCE_IRQ, |
238 | }, | 240 | }, |
239 | }; | 241 | }; |
@@ -255,7 +257,7 @@ static struct resource rcar_i2c0_res[] = { | |||
255 | .end = 0xffc70fff, | 257 | .end = 0xffc70fff, |
256 | .flags = IORESOURCE_MEM, | 258 | .flags = IORESOURCE_MEM, |
257 | }, { | 259 | }, { |
258 | .start = gic_spi(79), | 260 | .start = gic_iid(0x6f), |
259 | .flags = IORESOURCE_IRQ, | 261 | .flags = IORESOURCE_IRQ, |
260 | }, | 262 | }, |
261 | }; | 263 | }; |
@@ -273,7 +275,7 @@ static struct resource rcar_i2c1_res[] = { | |||
273 | .end = 0xffc71fff, | 275 | .end = 0xffc71fff, |
274 | .flags = IORESOURCE_MEM, | 276 | .flags = IORESOURCE_MEM, |
275 | }, { | 277 | }, { |
276 | .start = gic_spi(82), | 278 | .start = gic_iid(0x72), |
277 | .flags = IORESOURCE_IRQ, | 279 | .flags = IORESOURCE_IRQ, |
278 | }, | 280 | }, |
279 | }; | 281 | }; |
@@ -291,7 +293,7 @@ static struct resource rcar_i2c2_res[] = { | |||
291 | .end = 0xffc72fff, | 293 | .end = 0xffc72fff, |
292 | .flags = IORESOURCE_MEM, | 294 | .flags = IORESOURCE_MEM, |
293 | }, { | 295 | }, { |
294 | .start = gic_spi(80), | 296 | .start = gic_iid(0x70), |
295 | .flags = IORESOURCE_IRQ, | 297 | .flags = IORESOURCE_IRQ, |
296 | }, | 298 | }, |
297 | }; | 299 | }; |
@@ -309,7 +311,7 @@ static struct resource rcar_i2c3_res[] = { | |||
309 | .end = 0xffc73fff, | 311 | .end = 0xffc73fff, |
310 | .flags = IORESOURCE_MEM, | 312 | .flags = IORESOURCE_MEM, |
311 | }, { | 313 | }, { |
312 | .start = gic_spi(81), | 314 | .start = gic_iid(0x71), |
313 | .flags = IORESOURCE_IRQ, | 315 | .flags = IORESOURCE_IRQ, |
314 | }, | 316 | }, |
315 | }; | 317 | }; |
@@ -321,7 +323,31 @@ static struct platform_device i2c3_device = { | |||
321 | .num_resources = ARRAY_SIZE(rcar_i2c3_res), | 323 | .num_resources = ARRAY_SIZE(rcar_i2c3_res), |
322 | }; | 324 | }; |
323 | 325 | ||
324 | static struct platform_device *r8a7779_early_devices[] __initdata = { | 326 | static struct resource sata_resources[] = { |
327 | [0] = { | ||
328 | .name = "rcar-sata", | ||
329 | .start = 0xfc600000, | ||
330 | .end = 0xfc601fff, | ||
331 | .flags = IORESOURCE_MEM, | ||
332 | }, | ||
333 | [1] = { | ||
334 | .start = gic_iid(0x84), | ||
335 | .flags = IORESOURCE_IRQ, | ||
336 | }, | ||
337 | }; | ||
338 | |||
339 | static struct platform_device sata_device = { | ||
340 | .name = "sata_rcar", | ||
341 | .id = -1, | ||
342 | .resource = sata_resources, | ||
343 | .num_resources = ARRAY_SIZE(sata_resources), | ||
344 | .dev = { | ||
345 | .dma_mask = &sata_device.dev.coherent_dma_mask, | ||
346 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
347 | }, | ||
348 | }; | ||
349 | |||
350 | static struct platform_device *r8a7779_devices_dt[] __initdata = { | ||
325 | &scif0_device, | 351 | &scif0_device, |
326 | &scif1_device, | 352 | &scif1_device, |
327 | &scif2_device, | 353 | &scif2_device, |
@@ -330,13 +356,14 @@ static struct platform_device *r8a7779_early_devices[] __initdata = { | |||
330 | &scif5_device, | 356 | &scif5_device, |
331 | &tmu00_device, | 357 | &tmu00_device, |
332 | &tmu01_device, | 358 | &tmu01_device, |
359 | }; | ||
360 | |||
361 | static struct platform_device *r8a7779_late_devices[] __initdata = { | ||
333 | &i2c0_device, | 362 | &i2c0_device, |
334 | &i2c1_device, | 363 | &i2c1_device, |
335 | &i2c2_device, | 364 | &i2c2_device, |
336 | &i2c3_device, | 365 | &i2c3_device, |
337 | }; | 366 | &sata_device, |
338 | |||
339 | static struct platform_device *r8a7779_late_devices[] __initdata = { | ||
340 | }; | 367 | }; |
341 | 368 | ||
342 | void __init r8a7779_add_standard_devices(void) | 369 | void __init r8a7779_add_standard_devices(void) |
@@ -349,8 +376,8 @@ void __init r8a7779_add_standard_devices(void) | |||
349 | 376 | ||
350 | r8a7779_init_pm_domains(); | 377 | r8a7779_init_pm_domains(); |
351 | 378 | ||
352 | platform_add_devices(r8a7779_early_devices, | 379 | platform_add_devices(r8a7779_devices_dt, |
353 | ARRAY_SIZE(r8a7779_early_devices)); | 380 | ARRAY_SIZE(r8a7779_devices_dt)); |
354 | platform_add_devices(r8a7779_late_devices, | 381 | platform_add_devices(r8a7779_late_devices, |
355 | ARRAY_SIZE(r8a7779_late_devices)); | 382 | ARRAY_SIZE(r8a7779_late_devices)); |
356 | } | 383 | } |
@@ -367,8 +394,8 @@ void __init r8a7779_earlytimer_init(void) | |||
367 | 394 | ||
368 | void __init r8a7779_add_early_devices(void) | 395 | void __init r8a7779_add_early_devices(void) |
369 | { | 396 | { |
370 | early_platform_add_devices(r8a7779_early_devices, | 397 | early_platform_add_devices(r8a7779_devices_dt, |
371 | ARRAY_SIZE(r8a7779_early_devices)); | 398 | ARRAY_SIZE(r8a7779_devices_dt)); |
372 | 399 | ||
373 | /* Early serial console setup is not included here due to | 400 | /* Early serial console setup is not included here due to |
374 | * memory map collisions. The SCIF serial ports in r8a7779 | 401 | * memory map collisions. The SCIF serial ports in r8a7779 |
@@ -386,3 +413,40 @@ void __init r8a7779_add_early_devices(void) | |||
386 | * command line in case of the marzen board. | 413 | * command line in case of the marzen board. |
387 | */ | 414 | */ |
388 | } | 415 | } |
416 | |||
417 | #ifdef CONFIG_USE_OF | ||
418 | void __init r8a7779_init_delay(void) | ||
419 | { | ||
420 | shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */ | ||
421 | } | ||
422 | |||
423 | static const struct of_dev_auxdata r8a7779_auxdata_lookup[] __initconst = { | ||
424 | {}, | ||
425 | }; | ||
426 | |||
427 | void __init r8a7779_add_standard_devices_dt(void) | ||
428 | { | ||
429 | /* clocks are setup late during boot in the case of DT */ | ||
430 | r8a7779_clock_init(); | ||
431 | |||
432 | platform_add_devices(r8a7779_devices_dt, | ||
433 | ARRAY_SIZE(r8a7779_devices_dt)); | ||
434 | of_platform_populate(NULL, of_default_bus_match_table, | ||
435 | r8a7779_auxdata_lookup, NULL); | ||
436 | } | ||
437 | |||
438 | static const char *r8a7779_compat_dt[] __initdata = { | ||
439 | "renesas,r8a7779", | ||
440 | NULL, | ||
441 | }; | ||
442 | |||
443 | DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)") | ||
444 | .map_io = r8a7779_map_io, | ||
445 | .init_early = r8a7779_init_delay, | ||
446 | .nr_irqs = NR_IRQS_LEGACY, | ||
447 | .init_irq = r8a7779_init_irq_dt, | ||
448 | .init_machine = r8a7779_add_standard_devices_dt, | ||
449 | .init_time = shmobile_timer_init, | ||
450 | .dt_compat = r8a7779_compat_dt, | ||
451 | MACHINE_END | ||
452 | #endif /* CONFIG_USE_OF */ | ||