aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
authorMax Filippov <max.filippov@cogentembedded.com>2013-08-25 13:46:23 -0400
committerSimon Horman <horms+renesas@verge.net.au>2013-10-07 20:44:42 -0400
commit441f750236f3d3d435a1e89ad885ec896832b9c6 (patch)
tree75e488d4be8bf3d193ceee3aea4f060cc0a89c93 /arch/arm/mach-shmobile
parent338c4991ed350abd7c5b3cb807fe022cb712a8ba (diff)
ARM: shmobile: r8a7779: add HPB-DMAC support
Add HPB-DMAC platform device on R8A7779 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/r8a7779.h>, removed #include <mach/dma.h> from setup-r8a7779.c, removed SSI-related *enum* values and SSI-related data from hpb_dmae_slaves[] and hpb_dmae_channels[], added ASYNCMDR.ASBTMD{20|24|43} and ASYNCMDR.ASMD{20|24|43} fields/values, fixed comments to ASYNCMDR.ASBTMD2[123] and ASYNCMDR.ASMD2[123] fields/values, renamed all the bit/field/value #define's to include 'HBP_DMAE_' prefix to match the driver, moved 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/r8a7779.h7
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c154
2 files changed, 161 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
index 11c740047e14..31e87b92a9c3 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -6,6 +6,13 @@
6#include <linux/sh_eth.h> 6#include <linux/sh_eth.h>
7#include <linux/platform_data/camera-rcar.h> 7#include <linux/platform_data/camera-rcar.h>
8 8
9/* HPB-DMA slave IDs */
10enum {
11 HPBDMA_SLAVE_DUMMY,
12 HPBDMA_SLAVE_SDHI0_TX,
13 HPBDMA_SLAVE_SDHI0_RX,
14};
15
9struct platform_device; 16struct platform_device;
10 17
11struct r8a7779_pm_ch { 18struct r8a7779_pm_ch {
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index ecd0148ee1e1..eacb2f783693 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -25,6 +25,7 @@
25#include <linux/irqchip.h> 25#include <linux/irqchip.h>
26#include <linux/irqchip/arm-gic.h> 26#include <linux/irqchip/arm-gic.h>
27#include <linux/of_platform.h> 27#include <linux/of_platform.h>
28#include <linux/platform_data/dma-rcar-hpbdma.h>
28#include <linux/platform_data/gpio-rcar.h> 29#include <linux/platform_data/gpio-rcar.h>
29#include <linux/platform_data/irq-renesas-intc-irqpin.h> 30#include <linux/platform_data/irq-renesas-intc-irqpin.h>
30#include <linux/platform_device.h> 31#include <linux/platform_device.h>
@@ -632,6 +633,158 @@ static struct platform_device_info *vin_info_table[] __initdata = {
632 &vin3_info, 633 &vin3_info,
633}; 634};
634 635
636/* HPB-DMA */
637
638/* Asynchronous mode register bits */
639#define HPB_DMAE_ASYNCMDR_ASMD43_MASK BIT(23) /* MMC1 */
640#define HPB_DMAE_ASYNCMDR_ASMD43_SINGLE BIT(23) /* MMC1 */
641#define HPB_DMAE_ASYNCMDR_ASMD43_MULTI 0 /* MMC1 */
642#define HPB_DMAE_ASYNCMDR_ASBTMD43_MASK BIT(22) /* MMC1 */
643#define HPB_DMAE_ASYNCMDR_ASBTMD43_BURST BIT(22) /* MMC1 */
644#define HPB_DMAE_ASYNCMDR_ASBTMD43_NBURST 0 /* MMC1 */
645#define HPB_DMAE_ASYNCMDR_ASMD24_MASK BIT(21) /* MMC0 */
646#define HPB_DMAE_ASYNCMDR_ASMD24_SINGLE BIT(21) /* MMC0 */
647#define HPB_DMAE_ASYNCMDR_ASMD24_MULTI 0 /* MMC0 */
648#define HPB_DMAE_ASYNCMDR_ASBTMD24_MASK BIT(20) /* MMC0 */
649#define HPB_DMAE_ASYNCMDR_ASBTMD24_BURST BIT(20) /* MMC0 */
650#define HPB_DMAE_ASYNCMDR_ASBTMD24_NBURST 0 /* MMC0 */
651#define HPB_DMAE_ASYNCMDR_ASMD41_MASK BIT(19) /* SDHI3 */
652#define HPB_DMAE_ASYNCMDR_ASMD41_SINGLE BIT(19) /* SDHI3 */
653#define HPB_DMAE_ASYNCMDR_ASMD41_MULTI 0 /* SDHI3 */
654#define HPB_DMAE_ASYNCMDR_ASBTMD41_MASK BIT(18) /* SDHI3 */
655#define HPB_DMAE_ASYNCMDR_ASBTMD41_BURST BIT(18) /* SDHI3 */
656#define HPB_DMAE_ASYNCMDR_ASBTMD41_NBURST 0 /* SDHI3 */
657#define HPB_DMAE_ASYNCMDR_ASMD40_MASK BIT(17) /* SDHI3 */
658#define HPB_DMAE_ASYNCMDR_ASMD40_SINGLE BIT(17) /* SDHI3 */
659#define HPB_DMAE_ASYNCMDR_ASMD40_MULTI 0 /* SDHI3 */
660#define HPB_DMAE_ASYNCMDR_ASBTMD40_MASK BIT(16) /* SDHI3 */
661#define HPB_DMAE_ASYNCMDR_ASBTMD40_BURST BIT(16) /* SDHI3 */
662#define HPB_DMAE_ASYNCMDR_ASBTMD40_NBURST 0 /* SDHI3 */
663#define HPB_DMAE_ASYNCMDR_ASMD39_MASK BIT(15) /* SDHI3 */
664#define HPB_DMAE_ASYNCMDR_ASMD39_SINGLE BIT(15) /* SDHI3 */
665#define HPB_DMAE_ASYNCMDR_ASMD39_MULTI 0 /* SDHI3 */
666#define HPB_DMAE_ASYNCMDR_ASBTMD39_MASK BIT(14) /* SDHI3 */
667#define HPB_DMAE_ASYNCMDR_ASBTMD39_BURST BIT(14) /* SDHI3 */
668#define HPB_DMAE_ASYNCMDR_ASBTMD39_NBURST 0 /* SDHI3 */
669#define HPB_DMAE_ASYNCMDR_ASMD27_MASK BIT(13) /* SDHI2 */
670#define HPB_DMAE_ASYNCMDR_ASMD27_SINGLE BIT(13) /* SDHI2 */
671#define HPB_DMAE_ASYNCMDR_ASMD27_MULTI 0 /* SDHI2 */
672#define HPB_DMAE_ASYNCMDR_ASBTMD27_MASK BIT(12) /* SDHI2 */
673#define HPB_DMAE_ASYNCMDR_ASBTMD27_BURST BIT(12) /* SDHI2 */
674#define HPB_DMAE_ASYNCMDR_ASBTMD27_NBURST 0 /* SDHI2 */
675#define HPB_DMAE_ASYNCMDR_ASMD26_MASK BIT(11) /* SDHI2 */
676#define HPB_DMAE_ASYNCMDR_ASMD26_SINGLE BIT(11) /* SDHI2 */
677#define HPB_DMAE_ASYNCMDR_ASMD26_MULTI 0 /* SDHI2 */
678#define HPB_DMAE_ASYNCMDR_ASBTMD26_MASK BIT(10) /* SDHI2 */
679#define HPB_DMAE_ASYNCMDR_ASBTMD26_BURST BIT(10) /* SDHI2 */
680#define HPB_DMAE_ASYNCMDR_ASBTMD26_NBURST 0 /* SDHI2 */
681#define HPB_DMAE_ASYNCMDR_ASMD25_MASK BIT(9) /* SDHI2 */
682#define HPB_DMAE_ASYNCMDR_ASMD25_SINGLE BIT(9) /* SDHI2 */
683#define HPB_DMAE_ASYNCMDR_ASMD25_MULTI 0 /* SDHI2 */
684#define HPB_DMAE_ASYNCMDR_ASBTMD25_MASK BIT(8) /* SDHI2 */
685#define HPB_DMAE_ASYNCMDR_ASBTMD25_BURST BIT(8) /* SDHI2 */
686#define HPB_DMAE_ASYNCMDR_ASBTMD25_NBURST 0 /* SDHI2 */
687#define HPB_DMAE_ASYNCMDR_ASMD23_MASK BIT(7) /* SDHI0 */
688#define HPB_DMAE_ASYNCMDR_ASMD23_SINGLE BIT(7) /* SDHI0 */
689#define HPB_DMAE_ASYNCMDR_ASMD23_MULTI 0 /* SDHI0 */
690#define HPB_DMAE_ASYNCMDR_ASBTMD23_MASK BIT(6) /* SDHI0 */
691#define HPB_DMAE_ASYNCMDR_ASBTMD23_BURST BIT(6) /* SDHI0 */
692#define HPB_DMAE_ASYNCMDR_ASBTMD23_NBURST 0 /* SDHI0 */
693#define HPB_DMAE_ASYNCMDR_ASMD22_MASK BIT(5) /* SDHI0 */
694#define HPB_DMAE_ASYNCMDR_ASMD22_SINGLE BIT(5) /* SDHI0 */
695#define HPB_DMAE_ASYNCMDR_ASMD22_MULTI 0 /* SDHI0 */
696#define HPB_DMAE_ASYNCMDR_ASBTMD22_MASK BIT(4) /* SDHI0 */
697#define HPB_DMAE_ASYNCMDR_ASBTMD22_BURST BIT(4) /* SDHI0 */
698#define HPB_DMAE_ASYNCMDR_ASBTMD22_NBURST 0 /* SDHI0 */
699#define HPB_DMAE_ASYNCMDR_ASMD21_MASK BIT(3) /* SDHI0 */
700#define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE BIT(3) /* SDHI0 */
701#define HPB_DMAE_ASYNCMDR_ASMD21_MULTI 0 /* SDHI0 */
702#define HPB_DMAE_ASYNCMDR_ASBTMD21_MASK BIT(2) /* SDHI0 */
703#define HPB_DMAE_ASYNCMDR_ASBTMD21_BURST BIT(2) /* SDHI0 */
704#define HPB_DMAE_ASYNCMDR_ASBTMD21_NBURST 0 /* SDHI0 */
705#define HPB_DMAE_ASYNCMDR_ASMD20_MASK BIT(1) /* SDHI1 */
706#define HPB_DMAE_ASYNCMDR_ASMD20_SINGLE BIT(1) /* SDHI1 */
707#define HPB_DMAE_ASYNCMDR_ASMD20_MULTI 0 /* SDHI1 */
708#define HPB_DMAE_ASYNCMDR_ASBTMD20_MASK BIT(0) /* SDHI1 */
709#define HPB_DMAE_ASYNCMDR_ASBTMD20_BURST BIT(0) /* SDHI1 */
710#define HPB_DMAE_ASYNCMDR_ASBTMD20_NBURST 0 /* SDHI1 */
711
712static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = {
713 {
714 .id = HPBDMA_SLAVE_SDHI0_TX,
715 .addr = 0xffe4c000 + 0x30,
716 .dcr = HPB_DMAE_DCR_SPDS_16BIT |
717 HPB_DMAE_DCR_DMDL |
718 HPB_DMAE_DCR_DPDS_16BIT,
719 .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
720 HPB_DMAE_ASYNCRSTR_ASRST22 |
721 HPB_DMAE_ASYNCRSTR_ASRST23,
722 .mdr = HPB_DMAE_ASYNCMDR_ASMD21_SINGLE |
723 HPB_DMAE_ASYNCMDR_ASBTMD21_NBURST,
724 .mdm = HPB_DMAE_ASYNCMDR_ASMD21_MASK |
725 HPB_DMAE_ASYNCMDR_ASBTMD21_MASK,
726 .port = 0x0D0C,
727 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
728 .dma_ch = 21,
729 }, {
730 .id = HPBDMA_SLAVE_SDHI0_RX,
731 .addr = 0xffe4c000 + 0x30,
732 .dcr = HPB_DMAE_DCR_SMDL |
733 HPB_DMAE_DCR_SPDS_16BIT |
734 HPB_DMAE_DCR_DPDS_16BIT,
735 .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
736 HPB_DMAE_ASYNCRSTR_ASRST22 |
737 HPB_DMAE_ASYNCRSTR_ASRST23,
738 .mdr = HPB_DMAE_ASYNCMDR_ASMD22_SINGLE |
739 HPB_DMAE_ASYNCMDR_ASBTMD22_NBURST,
740 .mdm = HPB_DMAE_ASYNCMDR_ASMD22_MASK |
741 HPB_DMAE_ASYNCMDR_ASBTMD22_MASK,
742 .port = 0x0D0C,
743 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
744 .dma_ch = 22,
745 },
746};
747
748static const struct hpb_dmae_channel hpb_dmae_channels[] = {
749 HPB_DMAE_CHANNEL(0x93, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */
750 HPB_DMAE_CHANNEL(0x93, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */
751};
752
753static struct hpb_dmae_pdata dma_platform_data __initdata = {
754 .slaves = hpb_dmae_slaves,
755 .num_slaves = ARRAY_SIZE(hpb_dmae_slaves),
756 .channels = hpb_dmae_channels,
757 .num_channels = ARRAY_SIZE(hpb_dmae_channels),
758 .ts_shift = {
759 [XMIT_SZ_8BIT] = 0,
760 [XMIT_SZ_16BIT] = 1,
761 [XMIT_SZ_32BIT] = 2,
762 },
763 .num_hw_channels = 44,
764};
765
766static struct resource hpb_dmae_resources[] __initdata = {
767 /* Channel registers */
768 DEFINE_RES_MEM(0xffc08000, 0x1000),
769 /* Common registers */
770 DEFINE_RES_MEM(0xffc09000, 0x170),
771 /* Asynchronous reset registers */
772 DEFINE_RES_MEM(0xffc00300, 4),
773 /* Asynchronous mode registers */
774 DEFINE_RES_MEM(0xffc00400, 4),
775 /* IRQ for DMA channels */
776 DEFINE_RES_NAMED(gic_iid(0x8e), 12, NULL, IORESOURCE_IRQ),
777};
778
779static void __init r8a7779_register_hpb_dmae(void)
780{
781 platform_device_register_resndata(&platform_bus, "hpb-dma-engine", -1,
782 hpb_dmae_resources,
783 ARRAY_SIZE(hpb_dmae_resources),
784 &dma_platform_data,
785 sizeof(dma_platform_data));
786}
787
635static struct platform_device *r8a7779_devices_dt[] __initdata = { 788static struct platform_device *r8a7779_devices_dt[] __initdata = {
636 &scif0_device, 789 &scif0_device,
637 &scif1_device, 790 &scif1_device,
@@ -665,6 +818,7 @@ void __init r8a7779_add_standard_devices(void)
665 ARRAY_SIZE(r8a7779_devices_dt)); 818 ARRAY_SIZE(r8a7779_devices_dt));
666 platform_add_devices(r8a7779_standard_devices, 819 platform_add_devices(r8a7779_standard_devices,
667 ARRAY_SIZE(r8a7779_standard_devices)); 820 ARRAY_SIZE(r8a7779_standard_devices));
821 r8a7779_register_hpb_dmae();
668} 822}
669 823
670void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata) 824void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata)