Skip to contentSkip to conversation

dmaengine: sf-pdma: add platform DMA support for HiFive Unleashed A00

PATCH Superseded Green Wan 1 participant 1 message Sep 19, 2019

Subsystems (3)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Green Wan

author
#0 lore raw

PATCH v2 3/3 dmaengine: sf-pdma: add platform DMA support for HiFive Unleashed A00

Add PDMA driver, sf-pdma, to enable DMA engine on HiFive Unleashed Rev A00 board.

- Implement dmaengine APIs, support MEM_TO_MEM async copy.
- Tested by DMA Test client
- Supports 4 channels DMA, each channel has 1 done and 1 err interrupt connected to platform-level interrupt controller (PLIC).
- Depends on DMA_ENGINE and DMA_VIRTUAL_CHANNELS

Follow the DMAengine controller doc, "./Documentation/driver-api/dmaengine/provider.rst" to implement DMA engine. And use the dma test client in doc, "./Documentation/driver-api/dmaengine/dmatest.rst", to test.

Each DMA channel has separate HW regs and support done and error ISRs. 4 channels share 1 done and 1 err ISRs. There's no expander/arbitrator in DMA HW.

   ------               ------
   |    |--< done 23 >--|ch 0|
   |    |--< err  24 >--|    |     (dma0chan0)
   |    |               ------
   |    |               ------
   |    |--< done 25 >--|ch 1|
   |    |--< err  26 >--|    |     (dma0chan1)
   |PLIC|               ------
   |    |               ------
   |    |--< done 27 >--|ch 2|
   |    |--< err  28 >--|    |     (dma0chan2)
   |    |               ------
   |    |               ------
   |    |--< done 29 >--|ch 3|
   |    |--< err  30 >--|    |     (dma0chan3)
   ------               ------
---
 MAINTAINERS                   |   1 +
 drivers/dma/Kconfig           |   2 +
 drivers/dma/Makefile          |   1 +
 drivers/dma/sf-pdma/Kconfig   |   6 +
 drivers/dma/sf-pdma/Makefile  |   1 +
 drivers/dma/sf-pdma/sf-pdma.c | 623 ++++++++++++++++++++++++++++++++++
 drivers/dma/sf-pdma/sf-pdma.h | 124 +++++++
 7 files changed, 758 insertions(+)
 create mode 100644 drivers/dma/sf-pdma/Kconfig
 create mode 100644 drivers/dma/sf-pdma/Makefile
 create mode 100644 drivers/dma/sf-pdma/sf-pdma.c
 create mode 100644 drivers/dma/sf-pdma/sf-pdma.h
MAINTAINERS +1 -0
index d0caa09a479e..c5f0662c9106 100644
@@ -14594,6 +14594,7 @@ F:	drivers/media/mmc/siano/
 SIFIVE PDMA DRIVER
 M:	Green Wan <[email protected]>
 S:	Maintained
+F:	drivers/dma/sf-pdma/
 F:	Documentation/devicetree/bindings/dma/sifive,fu540-c000-pdma.yaml
 
 SIFIVE DRIVERS
drivers/dma/Kconfig +2 -0
index 413efef5fbb6..f05a928f5a3d 100644
@@ -667,6 +667,8 @@ source "drivers/dma/qcom/Kconfig"
 
 source "drivers/dma/dw/Kconfig"
 
+source "drivers/dma/sf-pdma/Kconfig"
+
 source "drivers/dma/dw-edma/Kconfig"
 
 source "drivers/dma/hsu/Kconfig"
drivers/dma/Makefile +1 -0
index 5bddf6f8790f..77a552d970ae 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_DMA_SUN4I) += sun4i-dma.o
 obj-$(CONFIG_DMA_SUN6I) += sun6i-dma.o
 obj-$(CONFIG_DW_AXI_DMAC) += dw-axi-dmac/
 obj-$(CONFIG_DW_DMAC_CORE) += dw/
+obj-$(CONFIG_SF_PDMA) += sf-pdma/
 obj-$(CONFIG_DW_EDMA) += dw-edma/
 obj-$(CONFIG_EP93XX_DMA) += ep93xx_dma.o
 obj-$(CONFIG_FSL_DMA) += fsldma.o
drivers/dma/sf-pdma/Kconfig new file +6 -0
new file mode 100644
index 000000000000..0e01a5728a79
@@ -0,0 +1,6 @@
+config SF_PDMA
+	bool "Sifive PDMA controller driver"
+	select DMA_ENGINE
+	select DMA_VIRTUAL_CHANNELS
+	help
+	  Support the SiFive PDMA controller.
drivers/dma/sf-pdma/Makefile new file +1 -0
new file mode 100644
index 000000000000..764552ab8d0a
@@ -0,0 +1 @@
+obj-$(CONFIG_SF_PDMA)   += sf-pdma.o
drivers/dma/sf-pdma/sf-pdma.c new file +623 -0

623 lines not on this page · raw message

drivers/dma/sf-pdma/sf-pdma.h new file +124 -0

124 lines not on this page · raw message

Signature · 1 line
2.17.1