diff options
author | Max Filippov <max.filippov@cogentembedded.com> | 2013-08-24 17:35:13 -0400 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2013-10-07 20:27:21 -0400 |
commit | 1eb6b5a0e55bfcfb0852b7d0f9442841ff807345 (patch) | |
tree | 46623a0082a19c2b3004cbb214b8124768b4dcb3 /arch/arm/mach-shmobile | |
parent | 3794c1663491012b10b41699b5ee5175bd75a3f1 (diff) |
ARM: shmobile: r8a7778: add HPB-DMAC support
Add HPB-DMAC platform device on R8A7778 SoC along with its slave and channel
configurations (only for SDHI0 so far).
Signed-off-by: Max Filippov <max.filippov@cogentembedded.com>
[Sergei: moved *enum* declaring HPB-DMAC slave IDs from now removed <mach/dma.h>
to <mach/r8a7778.h>, removed #include <mach/dma.h> from setup-r8a7778.c, removed
SSI-related *enum* values and SSI-related data from hpb_dmae_slaves[] and
hpb_dmae_channels[], moved the comments after the element initializers of
hpb_dmae_channels[].]
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/r8a7778.h | 8 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/setup-r8a7778.c | 85 |
2 files changed, 93 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/include/mach/r8a7778.h index ea1dca6880f4..1d6fe973e8b4 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7778.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7778.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2013 Renesas Solutions Corp. | 2 | * Copyright (C) 2013 Renesas Solutions Corp. |
3 | * Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 3 | * Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
4 | * Copyright (C) 2013 Cogent Embedded, Inc. | ||
4 | * | 5 | * |
5 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -21,6 +22,13 @@ | |||
21 | #include <linux/sh_eth.h> | 22 | #include <linux/sh_eth.h> |
22 | #include <linux/platform_data/camera-rcar.h> | 23 | #include <linux/platform_data/camera-rcar.h> |
23 | 24 | ||
25 | /* HPB-DMA slave IDs */ | ||
26 | enum { | ||
27 | HPBDMA_SLAVE_DUMMY, | ||
28 | HPBDMA_SLAVE_SDHI0_TX, | ||
29 | HPBDMA_SLAVE_SDHI0_RX, | ||
30 | }; | ||
31 | |||
24 | extern void r8a7778_add_standard_devices(void); | 32 | extern void r8a7778_add_standard_devices(void); |
25 | extern void r8a7778_add_standard_devices_dt(void); | 33 | extern void r8a7778_add_standard_devices_dt(void); |
26 | extern void r8a7778_add_ether_device(struct sh_eth_plat_data *pdata); | 34 | extern void r8a7778_add_ether_device(struct sh_eth_plat_data *pdata); |
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c index e484d1420a01..fa1b7e44a973 100644 --- a/arch/arm/mach-shmobile/setup-r8a7778.c +++ b/arch/arm/mach-shmobile/setup-r8a7778.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/irqchip/arm-gic.h> | 24 | #include <linux/irqchip/arm-gic.h> |
25 | #include <linux/of.h> | 25 | #include <linux/of.h> |
26 | #include <linux/of_platform.h> | 26 | #include <linux/of_platform.h> |
27 | #include <linux/platform_data/dma-rcar-hpbdma.h> | ||
27 | #include <linux/platform_data/gpio-rcar.h> | 28 | #include <linux/platform_data/gpio-rcar.h> |
28 | #include <linux/platform_data/irq-renesas-intc-irqpin.h> | 29 | #include <linux/platform_data/irq-renesas-intc-irqpin.h> |
29 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
@@ -356,6 +357,88 @@ void __init r8a7778_add_dt_devices(void) | |||
356 | r8a7778_register_tmu(1); | 357 | r8a7778_register_tmu(1); |
357 | } | 358 | } |
358 | 359 | ||
360 | /* HPB-DMA */ | ||
361 | |||
362 | /* Asynchronous mode register (ASYNCMDR) bits */ | ||
363 | #define HPB_DMAE_ASYNCMDR_ASMD22_MASK BIT(2) /* SDHI0 */ | ||
364 | #define HPB_DMAE_ASYNCMDR_ASMD22_SINGLE BIT(2) /* SDHI0 */ | ||
365 | #define HPB_DMAE_ASYNCMDR_ASMD22_MULTI 0 /* SDHI0 */ | ||
366 | #define HPB_DMAE_ASYNCMDR_ASMD21_MASK BIT(1) /* SDHI0 */ | ||
367 | #define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE BIT(1) /* SDHI0 */ | ||
368 | #define HPB_DMAE_ASYNCMDR_ASMD21_MULTI 0 /* SDHI0 */ | ||
369 | |||
370 | static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = { | ||
371 | { | ||
372 | .id = HPBDMA_SLAVE_SDHI0_TX, | ||
373 | .addr = 0xffe4c000 + 0x30, | ||
374 | .dcr = HPB_DMAE_DCR_SPDS_16BIT | | ||
375 | HPB_DMAE_DCR_DMDL | | ||
376 | HPB_DMAE_DCR_DPDS_16BIT, | ||
377 | .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 | | ||
378 | HPB_DMAE_ASYNCRSTR_ASRST22 | | ||
379 | HPB_DMAE_ASYNCRSTR_ASRST23, | ||
380 | .mdr = HPB_DMAE_ASYNCMDR_ASMD21_MULTI, | ||
381 | .mdm = HPB_DMAE_ASYNCMDR_ASMD21_MASK, | ||
382 | .port = 0x0D0C, | ||
383 | .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE, | ||
384 | .dma_ch = 21, | ||
385 | }, { | ||
386 | .id = HPBDMA_SLAVE_SDHI0_RX, | ||
387 | .addr = 0xffe4c000 + 0x30, | ||
388 | .dcr = HPB_DMAE_DCR_SMDL | | ||
389 | HPB_DMAE_DCR_SPDS_16BIT | | ||
390 | HPB_DMAE_DCR_DPDS_16BIT, | ||
391 | .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 | | ||
392 | HPB_DMAE_ASYNCRSTR_ASRST22 | | ||
393 | HPB_DMAE_ASYNCRSTR_ASRST23, | ||
394 | .mdr = HPB_DMAE_ASYNCMDR_ASMD22_MULTI, | ||
395 | .mdm = HPB_DMAE_ASYNCMDR_ASMD22_MASK, | ||
396 | .port = 0x0D0C, | ||
397 | .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE, | ||
398 | .dma_ch = 22, | ||
399 | }, | ||
400 | }; | ||
401 | |||
402 | static const struct hpb_dmae_channel hpb_dmae_channels[] = { | ||
403 | HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */ | ||
404 | HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */ | ||
405 | }; | ||
406 | |||
407 | static struct hpb_dmae_pdata dma_platform_data __initdata = { | ||
408 | .slaves = hpb_dmae_slaves, | ||
409 | .num_slaves = ARRAY_SIZE(hpb_dmae_slaves), | ||
410 | .channels = hpb_dmae_channels, | ||
411 | .num_channels = ARRAY_SIZE(hpb_dmae_channels), | ||
412 | .ts_shift = { | ||
413 | [XMIT_SZ_8BIT] = 0, | ||
414 | [XMIT_SZ_16BIT] = 1, | ||
415 | [XMIT_SZ_32BIT] = 2, | ||
416 | }, | ||
417 | .num_hw_channels = 39, | ||
418 | }; | ||
419 | |||
420 | static struct resource hpb_dmae_resources[] __initdata = { | ||
421 | /* Channel registers */ | ||
422 | DEFINE_RES_MEM(0xffc08000, 0x1000), | ||
423 | /* Common registers */ | ||
424 | DEFINE_RES_MEM(0xffc09000, 0x170), | ||
425 | /* Asynchronous reset registers */ | ||
426 | DEFINE_RES_MEM(0xffc00300, 4), | ||
427 | /* Asynchronous mode registers */ | ||
428 | DEFINE_RES_MEM(0xffc00400, 4), | ||
429 | /* IRQ for DMA channels */ | ||
430 | DEFINE_RES_NAMED(gic_iid(0x7b), 5, NULL, IORESOURCE_IRQ), | ||
431 | }; | ||
432 | |||
433 | static void __init r8a7778_register_hpb_dmae(void) | ||
434 | { | ||
435 | platform_device_register_resndata(&platform_bus, "hpb-dma-engine", -1, | ||
436 | hpb_dmae_resources, | ||
437 | ARRAY_SIZE(hpb_dmae_resources), | ||
438 | &dma_platform_data, | ||
439 | sizeof(dma_platform_data)); | ||
440 | } | ||
441 | |||
359 | void __init r8a7778_add_standard_devices(void) | 442 | void __init r8a7778_add_standard_devices(void) |
360 | { | 443 | { |
361 | r8a7778_add_dt_devices(); | 444 | r8a7778_add_dt_devices(); |
@@ -366,6 +449,8 @@ void __init r8a7778_add_standard_devices(void) | |||
366 | r8a7778_register_hspi(0); | 449 | r8a7778_register_hspi(0); |
367 | r8a7778_register_hspi(1); | 450 | r8a7778_register_hspi(1); |
368 | r8a7778_register_hspi(2); | 451 | r8a7778_register_hspi(2); |
452 | |||
453 | r8a7778_register_hpb_dmae(); | ||
369 | } | 454 | } |
370 | 455 | ||
371 | void __init r8a7778_init_late(void) | 456 | void __init r8a7778_init_late(void) |