dmaengine: sf-pdma: Add platform dma driver
Subsystems (5)
v6 cover dmaengine: sf-pdma: Add platform dma driver
Add PDMA driver support for SiFive HiFive Unleashed RevA00 board. Mainly follows DMAengine controller doc[1] to implement and take other DMA drivers as reference. Such as
- drivers/dma/fsl-edma.c
- drivers/dma/dw-edma/
- drivers/dma/pxa-dma.c
Using DMA test client[2] to test. Detailed datasheet is doc[3]. Driver supports:
- 4 physical DMA channels, share same DONE and error interrupt handler.
- Support MEM_TO_MEM
- Tested by DMA test client
- patches include DT Bindgins document and dts for fu450-c000 SoC. Separate dts patch for easier review and apply to different branch or SoC platform.
- retry 1 time if DMA error occurs.
[Changelog]
- v6 patch
. Remove incorrect reviewer and fix commit number
. Revise sf_pdma_desc_residue() to report residue according to cookie. The tx
could be in completed, in-progress state or still in pending list.
. Refer to fsl-edma.c to free irq and kill tasklet before exit. . Minor fixes include left-justisfied, empty line and unnecessary line.
[Reference Doc]
[1] ./Documentation/driver-api/dmaengine/provider.rst
[2] ./Documentation/driver-api/dmaengine/dmatest.rst
[3] https://static.dev.sifive.com/FU540-C000-v1.0.pdf
[Simple steps to test of DMA Test client]
$ echo 1 > /sys/module/dmatest/parameters/iterations $ echo dma0chan0 > /sys/module/dmatest/parameters/channel $ echo dma0chan1 > /sys/module/dmatest/parameters/channel $ echo dma0chan2 > /sys/module/dmatest/parameters/channel $ echo dma0chan3 > /sys/module/dmatest/parameters/channel $ echo 1 > /sys/module/dmatest/parameters/run
[Expected test result]
[ 267.563323] dmatest: dma0chan0-copy0: summary 45629 tests, 0 failures 38769.01 iops 309661 KB/s (0) [ 267.572427] dmatest: dma0chan1-copy0: summary 45863 tests, 0 failures 40286.85 iops 321643 KB/s (0) [ 267.581392] dmatest: dma0chan2-copy0: summary 45975 tests, 0 failures 41178.48 iops 328740 KB/s (0) [ 267.590542] dmatest: dma0chan3-copy0: summary 44768 tests, 0 failures 38560.29 iops 307726 KB/s (0)
Green Wan (4):
dt-bindings: dmaengine: sf-pdma: add bindins for SiFive PDMA
riscv: dts: add support for PDMA device of HiFive Unleashed Rev A00
dmaengine: sf-pdma: add platform DMA support for HiFive Unleashed A00
MAINTAINERS: Add Green as SiFive PDMA driver maintainer
.../bindings/dma/sifive,fu540-c000-pdma.yaml | 55 ++ MAINTAINERS | 6 + arch/riscv/boot/dts/sifive/fu540-c000.dtsi | 7 + 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 | 621 ++++++++++++++++++ drivers/dma/sf-pdma/sf-pdma.h | 122 ++++ 9 files changed, 821 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/sifive,fu540-c000-pdma.yaml 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
base-commit: 4dd58158254c8a027f2bf5060b72ef64cafa3b9d
Signature · 1 line
2.17.1
PATCH v6 1/4 dt-bindings: dmaengine: sf-pdma: add bindins for SiFive PDMA
Add DT bindings document for Platform DMA(PDMA) driver of board, HiFive Unleashed Rev A00.
--- .../bindings/dma/sifive,fu540-c000-pdma.yaml | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/sifive,fu540-c000-pdma.yaml
Documentation/devicetree/bindings/dma/sifive,fu540-c000-pdma.yaml new file +55 -0
@@ -0,0 +1,55 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/dma/sifive,fu540-c000-pdma.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: SiFive Unleashed Rev C000 Platform DMA + +maintainers: + - Green Wan <[email protected]> + - Palmer Debbelt <[email protected]> + - Paul Walmsley <[email protected]> + +description: | + Platform DMA is a DMA engine of SiFive Unleashed. It supports 4 + channels. Each channel has 2 interrupts. One is for DMA done and + the other is for DME error. + + In different SoC, DMA could be attached to different IRQ line. + DT file need to be changed to meet the difference. For technical + doc, + + https://static.dev.sifive.com/FU540-C000-v1.0.pdf + +properties: + compatible: + items: + - const: sifive,fu540-c000-pdma + + reg: + maxItems: 1 + + interrupts: + minItems: 1 + maxItems: 8 + + '#dma-cells': + const: 1 + +required: + - compatible + - reg + - interrupts + - '#dma-cells' + +examples: + - | + dma@3000000 { + compatible = "sifive,fu540-c000-pdma"; + reg = <0x0 0x3000000 0x0 0x8000>; + interrupts = <23 24 25 26 27 28 29 30>; + #dma-cells = <1>; + }; + +...
Signature · 1 line
2.17.1
PATCH v6 2/4 riscv: dts: add support for PDMA device of HiFive Unleashed Rev A00
In reply to Green WanAdd PDMA support to (arch/riscv/boot/dts/sifive/fu540-c000.dtsi)
--- arch/riscv/boot/dts/sifive/fu540-c000.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/riscv/boot/dts/sifive/fu540-c000.dtsi +7 -0
@@ -162,6 +162,13 @@ clocks = <&prci PRCI_CLK_TLCLK>; status = "disabled"; }; + dma: dma@3000000 { + compatible = "sifive,fu540-c000-pdma"; + reg = <0x0 0x3000000 0x0 0x8000>; + interrupt-parent = <&plic0>; + interrupts = <23 24 25 26 27 28 29 30>; + #dma-cells = <1>; + }; uart1: serial@10011000 { compatible = "sifive,fu540-c000-uart", "sifive,uart0"; reg = <0x0 0x10011000 0x0 0x1000>;
Signature · 1 line
2.17.1
Re: [PATCH v6 2/4] riscv: dts: add support for PDMA device of HiFive Unleashed Rev A00
Quoted 3 lines · Green Wan
Add PDMA support to (
arch/riscv/boot/dts/sifive/fu540-c000.dtsi)Signed-off-by Green Wan <[email protected]>
Thanks, queued for v5.5-rc1.
- Paul
PATCH v6 3/4 dmaengine: sf-pdma: add platform DMA support for HiFive Unleashed A00
In reply to Green WanAdd 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
The datasheet is here:
https://static.dev.sifive.com/FU540-C000-v1.0.pdf
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) ------ ------
--- 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 | 621 ++++++++++++++++++++++++++++++++++ drivers/dma/sf-pdma/sf-pdma.h | 122 +++++++ 6 files changed, 753 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
drivers/dma/Kconfig +2 -0
@@ -665,6 +665,8 @@ source "drivers/dma/dw-edma/Kconfig" source "drivers/dma/hsu/Kconfig" +source "drivers/dma/sf-pdma/Kconfig" + source "drivers/dma/sh/Kconfig" source "drivers/dma/ti/Kconfig"
drivers/dma/Makefile +1 -0
@@ -60,6 +60,7 @@ obj-$(CONFIG_PL330_DMA) += pl330.o obj-$(CONFIG_PPC_BESTCOMM) += bestcomm/ obj-$(CONFIG_PXA_DMA) += pxa_dma.o obj-$(CONFIG_RENESAS_DMA) += sh/ +obj-$(CONFIG_SF_PDMA) += sf-pdma/ obj-$(CONFIG_SIRF_DMA) += sirf-dma.o obj-$(CONFIG_STE_DMA40) += ste_dma40.o ste_dma40_ll.o obj-$(CONFIG_STM32_DMA) += stm32-dma.o
drivers/dma/sf-pdma/Kconfig new file +6 -0
@@ -0,0 +1,6 @@ +config SF_PDMA + tristate "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
@@ -0,0 +1 @@ +obj-$(CONFIG_SF_PDMA) += sf-pdma.o
drivers/dma/sf-pdma/sf-pdma.c new file +621 -0
621 lines not on this page · raw message
drivers/dma/sf-pdma/sf-pdma.h new file +122 -0
122 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v6 4/4 MAINTAINERS: Add Green as SiFive PDMA driver maintainer
In reply to Green WanUpdate MAINTAINERS for SiFive PDMA driver.
--- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -14785,6 +14785,12 @@ F: drivers/media/usb/siano/ F: drivers/media/usb/siano/ 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 M: Palmer Dabbelt <[email protected]> M: Paul Walmsley <[email protected]>
Signature · 1 line
2.17.1
Vinod Koul
maintainerQuoted 8 lines · Green Wan
Add PDMA driver support for SiFive HiFive Unleashed RevA00 board. Mainly follows DMAengine controller doc[1] to implement and take other DMA drivers as reference. Such as
-
drivers/dma/fsl-edma.c
-drivers/dma/dw-edma/
-drivers/dma/pxa-dma.c
Quoted 8 lines
Using DMA test client[2] to test. Detailed datasheet is doc[3]. Driver supports:
- 4 physical DMA channels, share same DONE and error interrupt handler.
- SupportMEM_TO_MEM
- Tested by DMA test client
- patches include DT Bindgins document and dts for fu450-c000 SoC. Separate dts patch for easier review and apply to different branch or SoC platform.
- retry 1 time if DMA error occurs.
I have applied this expect dt change. I see some warns due to missing kernel-doc style comments with W=1, please fix that and send update on top of these
Thanks
Signature · 1 line
~Vinod
Thanks, Vinod,
I found there are "/**" in the beginning of files but not for commenting function purpose. Those comments cause kernel-doc W=1 warning. I've fixed them and rebased to latest source. will send the patch after running regression tests soon.
--
Green
Quoted 26 lines · Vinod Koul
Quoted 8 lines · Green Wan
Add PDMA driver support for SiFive HiFive Unleashed RevA00 board. Mainly follows DMAengine controller doc[1] to implement and take other DMA drivers as reference. Such as
-
drivers/dma/fsl-edma.c
-drivers/dma/dw-edma/
-drivers/dma/pxa-dma.cQuoted 8 lines
Using DMA test client[2] to test. Detailed datasheet is doc[3]. Driver supports:
- 4 physical DMA channels, share same DONE and error interrupt handler.
- SupportMEM_TO_MEM
- Tested by DMA test client
- patches include DT Bindgins document and dts for fu450-c000 SoC. Separate dts patch for easier review and apply to different branch or SoC platform.
- retry 1 time if DMA error occurs.I have applied this expect dt change. I see some warns due to missing kernel-doc style comments with W=1, please fix that and send update on top of these
Thanks
--
~Vinod