aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/dma/sun6i-dma.txt2
-rw-r--r--drivers/dma/Kconfig4
-rw-r--r--drivers/dma/sun6i-dma.c27
3 files changed, 30 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/dma/sun6i-dma.txt b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
index 3e145c1675b1..9cdcba24d7c3 100644
--- a/Documentation/devicetree/bindings/dma/sun6i-dma.txt
+++ b/Documentation/devicetree/bindings/dma/sun6i-dma.txt
@@ -4,7 +4,7 @@ This driver follows the generic DMA bindings defined in dma.txt.
4 4
5Required properties: 5Required properties:
6 6
7- compatible: Must be "allwinner,sun6i-a31-dma" 7- compatible: Must be "allwinner,sun6i-a31-dma" or "allwinner,sun8i-a23-dma"
8- reg: Should contain the registers base address and length 8- reg: Should contain the registers base address and length
9- interrupts: Should contain a reference to the interrupt used by this device 9- interrupts: Should contain a reference to the interrupt used by this device
10- clocks: Should contain a reference to the parent AHB clock 10- clocks: Should contain a reference to the parent AHB clock
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 607271a999a9..aef8b9dd4db6 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -402,12 +402,12 @@ config XILINX_VDMA
402 402
403config DMA_SUN6I 403config DMA_SUN6I
404 tristate "Allwinner A31 SoCs DMA support" 404 tristate "Allwinner A31 SoCs DMA support"
405 depends on MACH_SUN6I || COMPILE_TEST 405 depends on MACH_SUN6I || MACH_SUN8I || COMPILE_TEST
406 depends on RESET_CONTROLLER 406 depends on RESET_CONTROLLER
407 select DMA_ENGINE 407 select DMA_ENGINE
408 select DMA_VIRTUAL_CHANNELS 408 select DMA_VIRTUAL_CHANNELS
409 help 409 help
410 Support for the DMA engine for Allwinner A31 SoCs. 410 Support for the DMA engine first found in Allwinner A31 SoCs.
411 411
412config NBPFAXI_DMA 412config NBPFAXI_DMA
413 tristate "Renesas Type-AXI NBPF DMA support" 413 tristate "Renesas Type-AXI NBPF DMA support"
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index 531abbf68a9d..f9f8f4d9915f 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -43,6 +43,12 @@
43#define DMA_STAT 0x30 43#define DMA_STAT 0x30
44 44
45/* 45/*
46 * sun8i specific registers
47 */
48#define SUN8I_DMA_GATE 0x20
49#define SUN8I_DMA_GATE_ENABLE 0x4
50
51/*
46 * Channels specific registers 52 * Channels specific registers
47 */ 53 */
48#define DMA_CHAN_ENABLE 0x00 54#define DMA_CHAN_ENABLE 0x00
@@ -878,8 +884,20 @@ static struct sun6i_dma_config sun6i_a31_dma_cfg = {
878 .nr_max_vchans = 53, 884 .nr_max_vchans = 53,
879}; 885};
880 886
887/*
888 * The A23 only has 8 physical channels, a maximum DRQ port id of 24,
889 * and a total of 37 usable source and destination endpoints.
890 */
891
892static struct sun6i_dma_config sun8i_a23_dma_cfg = {
893 .nr_max_channels = 8,
894 .nr_max_requests = 24,
895 .nr_max_vchans = 37,
896};
897
881static struct of_device_id sun6i_dma_match[] = { 898static struct of_device_id sun6i_dma_match[] = {
882 { .compatible = "allwinner,sun6i-a31-dma", .data = &sun6i_a31_dma_cfg }, 899 { .compatible = "allwinner,sun6i-a31-dma", .data = &sun6i_a31_dma_cfg },
900 { .compatible = "allwinner,sun8i-a23-dma", .data = &sun8i_a23_dma_cfg },
883 { /* sentinel */ } 901 { /* sentinel */ }
884}; 902};
885 903
@@ -1007,6 +1025,15 @@ static int sun6i_dma_probe(struct platform_device *pdev)
1007 goto err_dma_unregister; 1025 goto err_dma_unregister;
1008 } 1026 }
1009 1027
1028 /*
1029 * sun8i variant requires us to toggle a dma gating register,
1030 * as seen in Allwinner's SDK. This register is not documented
1031 * in the A23 user manual.
1032 */
1033 if (of_device_is_compatible(pdev->dev.of_node,
1034 "allwinner,sun8i-a23-dma"))
1035 writel(SUN8I_DMA_GATE_ENABLE, sdc->base + SUN8I_DMA_GATE);
1036
1010 return 0; 1037 return 0;
1011 1038
1012err_dma_unregister: 1039err_dma_unregister: