Skip to contentSkip to conversation

dma: Add Freescale eDMA engine driver support

PATCH Superseded Jingchang Lu 1 participant 2 messages Sep 5, 2013 – Sep 13, 2013

Subsystems (3)

v5 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 3/3 dma: Add Freescale eDMA engine driver support

Add Freescale enhanced direct memory(eDMA) controller support. The eDMA controller deploys DMAMUXs routing DMA request sources(slot) to eDMA channels.
This module can be found on Vybrid and LS-1 SoCs.

---
changes in v5:
config slave_id when dmaengine_slave_config intead of channel request. adding residue calculation and dma pause/resume device control.

changes in v4:
using exact compatible string in binding document.

changes in v3:
handle all pending interrupt one time.
add protect lock on dma transfer complete handling. change desc and tcd alloc flag to GFP_NOWAIT. add sanity check and error messages.

changes in v2:
using generic dma-channels property instead of fsl,dma-channel. rename the binding document to fsl-edma.txt.

 Documentation/devicetree/bindings/dma/fsl-edma.txt |  84 ++
 drivers/dma/Kconfig                                |  10 +
 drivers/dma/Makefile                               |   1 +
 drivers/dma/fsl-edma.c                             | 925 +++++++++++++++++++++
 4 files changed, 1020 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/fsl-edma.txt
 create mode 100644 drivers/dma/fsl-edma.c
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +84 -0
new file mode 100644
index 0000000..60a8cb2
@@ -0,0 +1,84 @@
+* Freescale enhanced Direct Memory Access(eDMA) Controller
+
+The eDMA engine deploys DMAMUXs routing request sources(slot) to
+eDMA controller channels.
+
+* eDMA Controller
+Required properties:
+- compatible :
+  - "fsl,vf610-edma" for eDMA used similar to that on Vybrid vf610 SoC
+- reg : Should contain eDMA registers location and length
+- interrupts : Should contain eDMA interrupt
+- interrupt-names : Should be "edma-tx" for tx interrupt and
+  "edma-err" for err interrupt
+- #dma-cells : Must be <2>.
+  The first cell specifies the DMAMUX ID. Specific request source
+  can only be routed by specific DMAMUXs.
+  the second cell specifies the request source(slot) ID.
+  See include/dt-bindings/dma/<soc>-edma.h for all the supported
+  request source IDs.
+- dma-channels : Number of channels supported by the controller
+- fsl,dma-mux : Phandle of the DMAMUXs deployed by the controller
+
+
+* DMAMUX
+Required properties:
+- reg : Should contain DMAMUX registers location and length
+- fsl,dmamux-id : DMAMUX ID. DMAMUX IDs are unique in each eDMA controller.
+  inside one eDMA controller, specific request source can only be routed by
+  one of its DMAMUXs.
+  However Specific request source may be routed to different eDMA controller,
+  thus all the DMAMUXs sharing a the same request sources have the same ID.
+- clocks : Phandle of the clock used by the DMAMUX
+- clock-names : The clock names
+
+Below is the eDMA controller and DMAMUX association, and DMAMUX IDs assignment
+On Vybrid vf610 SoC, DMAMUX0 and DMAMU3 share the same request source group,
+and DMAMUX1 and DMAMU2 share the same request source group.
+
+eDMA controller		DMAMUXs		DMAMUX ID
+-------------------------------------------------
+eDMA0			DMAMUX0		0
+			DMAMUX1		1
+
+eDMA1			DMAMUX2		1
+			DMAMUX3		0
+
+Examples:
+
+edma0: dma-controller at 40018000 {
+	#dma-cells = <2>;
+	compatible = "fsl,vf610-edma";
+	reg = <0x40018000 0x2000>;
+	interrupts = <0 8 0x04>, <0 9 0x04>;
+	interrupt-names = "edma-tx", "edma-err";
+	dma-channels = <32>;
+	fsl,edma-mux = <&dmamux0>, <&dmamux1>;
+};
+
+dmamux0: dmamux at 40024000 {
+	reg = <0x40024000 0x1000>;
+	fsl,dmamux-id = <0>;
+	clocks = <&clks VF610_CLK_DMAMUX0>;
+	clock-names = "dmamux";
+};
+
+
+* DMA clients
+DMA client drivers that uses the DMA function must use the format described
+in the dma.txt file, using a three-cell specifier for each channel: a phandle
+plus two integer cells as described above.
+
+Examples:
+
+sai2: sai at 40031000 {
+	compatible = "fsl,vf610-sai";
+	reg = <0x40031000 0x1000>;
+	interrupts = <0 86 0x04>;
+	clocks = <&clks VF610_CLK_SAI2>;
+	clock-names = "sai";
+	dma-names = "tx", "rx";
+	dmas = <&edma0 0 VF610_EDMA_MUXID0_SAI2_TX>,
+		<&edma0 0 VF610_EDMA_MUXID0_SAI2_RX>;
+	status = "disabled";
+};
drivers/dma/Kconfig +10 -0
index 526ec77..7d7604d 100644
@@ -317,6 +317,16 @@ config K3_DMA
 	  Support the DMA engine for Hisilicon K3 platform
 	  devices.
 
+config FSL_EDMA
+	tristate "Freescale eDMA engine support"
+	depends on OF
+	select DMA_ENGINE
+	select DMA_VIRTUAL_CHANNELS
+	help
+	  Support the Freescale eDMA engine with DMAMUXs managing route
+	  between request sources(slot) and eDMA engine channels.
+	  This module can be found on Freescale Vybrid and LS-1 SoCs.
+
 config DMA_ENGINE
 	bool
 
drivers/dma/Makefile +1 -0
index cb5a77a..bb50311 100644
@@ -41,3 +41,4 @@ obj-$(CONFIG_MMP_PDMA) += mmp_pdma.o
 obj-$(CONFIG_DMA_JZ4740) += dma-jz4740.o
 obj-$(CONFIG_K3_DMA) += k3dma.o
 obj-$(CONFIG_TI_CPPI41) += cppi41.o
+obj-$(CONFIG_FSL_EDMA) += fsl-edma.o
drivers/dma/fsl-edma.c new file +925 -0

925 lines not on this page · raw message

Signature · 1 line
1.8.0
#1 lore raw

Hi, Vinod,

Could you please help review this patch?
Thanks!

Best Regards,
Jingchang

Quoted 43 lines

-----Original Message-----
From: Lu Jingchang-B35083
Sent: Thursday, September 05, 2013 5:55 PM
To: vinod.koul at intel.com
Cc: djbw at fb.com; shawn.guo at linaro.org; linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; devicetree at vger.kernel.org; Lu Jingchang-B35083; Wang Huan-B18965
Subject: [PATCH v5 3/3] dma: Add Freescale eDMA engine driver support

Add Freescale enhanced direct memory(eDMA) controller support. The eDMA controller deploys DMAMUXs routing DMA request sources(slot) to eDMA channels.
This module can be found on Vybrid and LS-1 SoCs.

---
changes in v5:
config slave_id when dmaengine_slave_config intead of channel request. adding residue calculation and dma pause/resume device control.

changes in v4:
using exact compatible string in binding document.

changes in v3:
handle all pending interrupt one time.
add protect lock on dma transfer complete handling. change desc and tcd alloc flag to GFP_NOWAIT. add sanity check and error messages.

changes in v2:
using generic dma-channels property instead of fsl,dma-channel. rename the binding document to fsl-edma.txt.

 Documentation/devicetree/bindings/dma/fsl-edma.txt |  84 ++
 drivers/dma/Kconfig                                |  10 +
 drivers/dma/Makefile                               |   1 +
 drivers/dma/fsl-edma.c                             | 925
+++++++++++++++++++++
 4 files changed, 1020 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/fsl-edma.txt
 create mode 100644 drivers/dma/fsl-edma.c