dma: Add Freescale eDMA engine driver support
Subsystems (3)
v9 cover dma: Add Freescale eDMA engine driver support
This series add Freescale eDMA engine support.
Jingchang Lu (2):
ARM: dts: vf610: Add eDMA node
dma: Add Freescale eDMA engine driver support
Documentation/devicetree/bindings/dma/fsl-edma.txt | 66 ++++ arch/arm/boot/dts/vf610.dtsi | 30 ++ drivers/dma/Kconfig | 10 + drivers/dma/Makefile | 1 + drivers/dma/fsl-edma.c | 957 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 1064 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/fsl-edma.txt create mode 100644 drivers/dma/fsl-edma.c
PATCH v9 1/2 ARM: dts: vf610: Add eDMA node
---
changes in v9:
remove include/dt-bindings/dma/vf610-edma.h, the request source ID is the same as SoC's reference manual.
changes in v8:
describe dmamux info in edma node to avoid confusion. change eDMA requst source macro definitions.
changes in v7:
fix dmamux2 and dmamux3 register number.
no changes in v2 ~ v6.
arch/arm/boot/dts/vf610.dtsi | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
arch/arm/boot/dts/vf610.dtsi +30 -0
@@ -88,6 +88,21 @@ arm,tag-latency = <2 2 2>; }; + edma0: dma-controller at 40018000 { + #dma-cells = <2>; + compatible = "fsl,vf610-edma"; + reg = <0x40018000 0x2000>, + <0x40024000 0x1000>, + <0x40025000 0x1000>; + interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>, + <0 9 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "edma-tx", "edma-err"; + dma-channels = <32>; + clock-names = "dmamux0", "dmamux1"; + clocks = <&clks VF610_CLK_DMAMUX0>, + <&clks VF610_CLK_DMAMUX1>; + }; + uart0: serial at 40027000 { compatible = "fsl,vf610-lpuart"; reg = <0x40027000 0x1000>;
@@ -263,6 +278,21 @@ reg = <0x40080000 0x80000>; ranges; + edma1: dma-controller at 40098000 { + #dma-cells = <2>; + compatible = "fsl,vf610-edma"; + reg = <0x40098000 0x2000>, + <0x400a1000 0x1000>, + <0x400a2000 0x1000>; + interrupts = <0 10 IRQ_TYPE_LEVEL_HIGH>, + <0 11 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "edma-tx", "edma-err"; + dma-channels = <32>; + clock-names = "dmamux0", "dmamux1"; + clocks = <&clks VF610_CLK_DMAMUX2>, + <&clks VF610_CLK_DMAMUX3>; + }; + uart4: serial at 400a9000 { compatible = "fsl,vf610-lpuart"; reg = <0x400a9000 0x1000>;
Signature · 1 line
1.8.0
PATCH v9 2/2 dma: Add Freescale eDMA engine driver support
In reply to Jingchang LuAdd Freescale enhanced direct memory(eDMA) controller support. This module can be found on Vybrid and LS-1 SoCs.
---
changes in v9:
define endian's operating functions instead of macro definition. remove the filter function, using dma_get_slave_channel instead.
changes in v8:
change the edma driver according eDMA dts change. add big-endian and little-endian handling.
no changes in v4 ~ v7.
changes in v3:
add vf610 edma dt-bindings namespace with prefix VF610_*.
changes in v2:
using generic dma-channels property instead of fsl,dma-channels.
Documentation/devicetree/bindings/dma/fsl-edma.txt | 66 ++ drivers/dma/Kconfig | 10 + drivers/dma/Makefile | 1 + drivers/dma/fsl-edma.c | 957 +++++++++++++++++++++ 4 files changed, 1034 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 +66 -0
@@ -0,0 +1,66 @@ +* Freescale enhanced Direct Memory Access(eDMA) Controller + + The eDMA channels have multiplex capability by programmble memory-mapped +registers. channels are split into two groups, called DMAMUX0 and DMAMUX1, +specific DMA request source can only be multiplexed by any channel of certain +group, DMAMUX0 or DMAMUX1, but not both. + +* eDMA Controller +Required properties: +- compatible : + - "fsl,vf610-edma" for eDMA used similar to that on Vybrid vf610 SoC +- reg : Specifies base physical address(s) and size of the eDMA registers. + The 1st region is eDMA control register's address and size. + The 2nd and the 3rd regions are programmable channel multiplexing + control register's address and size. +- interrupts : Should contain eDMA interrupt +- interrupt-names : Should be "edma-tx" for transmission interrupt and + "edma-err" for error interrupt +- #dma-cells : Must be <2>. + The 1st cell specifies the DMAMUX(0 for DMAMUX0 and 1 for DMAMUX1). + Specific request source can only be multiplexed by specific channels + group called DMAMUX. + The 2nd cell specifies the request source(slot) ID. + See the SoC's reference manual for all the supported request sources. +- dma-channels : Number of channels supported by the controller +- clock-names : The channel group block clock names +- clocks : eDMA module clock + + +Examples: + +edma0: dma-controller at 40018000 { + #dma-cells = <2>; + compatible = "fsl,vf610-edma"; + reg = <0x40018000 0x2000>, + <0x40024000 0x1000>, + <0x40025000 0x1000>; + interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>, + <0 9 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "edma-tx", "edma-err"; + dma-channels = <32>; + clock-names = "dmamux0", "dmamux1"; + clocks = <&clks VF610_CLK_DMAMUX0>, + <&clks VF610_CLK_DMAMUX1>; +}; + + +* DMA clients +DMA client drivers that uses the DMA function must use the format described +in the dma.txt file, using a two-cell specifier for each channel: the 1st +specifies the channel group(DMAMUX) in which this request can be multiplexed, +and the 2nd specifies the request source. + +Examples: + +sai2: sai at 40031000 { + compatible = "fsl,vf610-sai"; + reg = <0x40031000 0x1000>; + interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>; + clock-names = "sai"; + clocks = <&clks VF610_CLK_SAI2>; + dma-names = "tx", "rx"; + dmas = <&edma0 0 21>, + <&edma0 0 20>; + status = "disabled"; +};
drivers/dma/Kconfig +10 -0
@@ -342,6 +342,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 programmable channel + multiplexing capability for DMA request sources(slot). + This module can be found on Freescale Vybrid and LS-1 SoCs. + config DMA_ENGINE bool
drivers/dma/Makefile +1 -0
@@ -43,3 +43,4 @@ obj-$(CONFIG_MMP_PDMA) += mmp_pdma.o obj-$(CONFIG_DMA_JZ4740) += dma-jz4740.o obj-$(CONFIG_TI_CPPI41) += cppi41.o obj-$(CONFIG_K3_DMA) += k3dma.o +obj-$(CONFIG_FSL_EDMA) += fsl-edma.o
drivers/dma/fsl-edma.c new file +957 -0
957 lines not on this page · raw message
Signature · 1 line
1.8.0
Quoted 5 lines · Jingchang Lu
Add Freescale enhanced direct memory(eDMA) controller support. This module can be found on Vybrid and LS-1 SoCs.
Signed-off-by Alison Wang <[email protected]>Signed-off-by Jingchang Lu <[email protected]>
Very nice! All my previous comments have been addressed, so
One small comment still:
drivers/dma/fsl-edma.c line 116
Quoted 3 lines
drivers/dma/fsl-edma.c new file +3
-0+ +static DEFINE_MUTEX (fsl_edma_mutex); +
I think this mutex should be part of struct fsl_edma_engine, not global.
Arnd
Quoted 23 lines
-----Original Message-----
From: Arnd Bergmann [mailto:arnd at arndb.de]
Sent: Thursday, January 16, 2014 7:03 PM
To: Lu Jingchang-B35083
Cc: vinod.koul at intel.com; dan.j.williams at intel.com; shawn.guo at linaro.org; pawel.moll at arm.com; mark.rutland at arm.com; swarren at wwwdotorg.org; linux- kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; devicetree at vger.kernel.org; Wang Huan-B18965
Subject: Re: [PATCHv9 2/2] dma: Add Freescale eDMA engine driver supportQuoted 5 lines · Jingchang Lu
Add Freescale enhanced direct memory(eDMA) controller support. This module can be found on Vybrid and LS-1 SoCs.
Signed-off-by Alison Wang <[email protected]>Signed-off-by Jingchang Lu <[email protected]>Very nice! All my previous comments have been addressed, so
Acked-by Arnd Bergmann <[email protected]>
Quoted 7 lines
One small comment still:
drivers/dma/fsl-edma.c line 116
Quoted 3 lines
drivers/dma/fsl-edma.c new file +3
-0+ +static DEFINE_MUTEX (fsl_edma_mutex); +I think this mutex should be part of struct
fsl_edma_engine, not global.
Yes, it should be for each edma controller, I will define it in struct fsl_edma_engine. Thanks.
Best Regards,
Jingchang
Quoted 45 lines · Jingchang Lu
Add Freescale enhanced direct memory(eDMA) controller support. This module can be found on Vybrid and LS-1 SoCs.
Signed-off-by Alison Wang <[email protected]>Signed-off-by Jingchang Lu <[email protected]>---
changes in v9:
define endian's operating functions instead of macro definition. remove the filter function, usingdma_get_slave_channelinstead.changes in v8:
change the edma driver according eDMA dts change. add big-endian and little-endian handling.no changes in v4 ~ v7.
changes in v3:
add vf610 edma dt-bindings namespace with prefix VF610_*.changes in v2:
using generic dma-channels property instead of fsl,dma-channels.Documentation/devicetree/bindings/dma/fsl-edma.txt | 66 ++ drivers/dma/Kconfig | 10 + drivers/dma/Makefile | 1 + drivers/dma/fsl-edma.c | 957 +++++++++++++++++++++ 4 files changed, 1034 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/fsl-edma.txt create mode 100644 drivers/dma/fsl-edma.cDocumentation/devicetree/bindings/dma/fsl-edma.txt new file +8
-0@@ -0,0 +1,66 @@ +* Freescale enhanced Direct Memory Access(eDMA) Controller + + The eDMA channels have multiplex capability by programmble memory-mapped +registers. channels are split into two groups, called DMAMUX0 and DMAMUX1, +specific DMA request source can only be multiplexed by any channel of certain +group, DMAMUX0 or DMAMUX1, but not both. + +* eDMA Controller
Documentation/devicetree/bindings/dma/fsl-edma.txt line 18
Quoted 10 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +10
-0+Required properties: +- compatible : + - "fsl,vf610-edma" for eDMA used similar to that on Vybrid vf610 SoC +- reg : Specifies base physical address(s) and size of the eDMA registers. + The 1st region is eDMA control register's address and size. + The 2nd and the 3rd regions are programmable channel multiplexing + control register's address and size. +- interrupts : Should contain eDMA interrupt +- interrupt-names : Should be "edma-tx" for transmission interrupt and + "edma-err" for error interrupt
The description of interrupts and interrupt-names is a bit odd. How about:
- interrupts: a list of interrupt-specifiers, one for each entry in interrupt-names.
- interrupt names: should contain:
* "edma-tx" - the transmission interrupt.
* "edma-err" - the error interrupt.
Documentation/devicetree/bindings/dma/fsl-edma.txt line 27
Quoted 9 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +9
-0+- #dma-cells : Must be <2>. + The 1st cell specifies the DMAMUX(0 for DMAMUX0 and 1 for DMAMUX1). + Specific request source can only be multiplexed by specific channels + group called DMAMUX. + The 2nd cell specifies the request source(slot) ID. + See the SoC's reference manual for all the supported request sources. +- dma-channels : Number of channels supported by the controller +- clock-names : The channel group block clock names +- clocks : eDMA module clock
The set of expected clock-names should be well defined, and the example has more than one clock..
This should be something like:
- clocks: a list of phandle + clock-specifier pairs, one for each entry in clock-names.
- clock-names: a list of clock names. Should contain:
* "dmamux0" - <insert description here>
* "dmamux1" - <insert description here>
Quoted 18 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +18
-0+ + +Examples: + +edma0: dma-controller at 40018000 { + #dma-cells = <2>; + compatible = "fsl,vf610-edma"; + reg = <0x40018000 0x2000>, + <0x40024000 0x1000>, + <0x40025000 0x1000>; + interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>, + <0 9 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "edma-tx", "edma-err"; + dma-channels = <32>; + clock-names = "dmamux0", "dmamux1"; + clocks = <&clks VF610_CLK_DMAMUX0>, + <&clks VF610_CLK_DMAMUX1>; +};
[...]
Documentation/devicetree/bindings/dma/fsl-edma.txt
Quoted 11 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +11
-0+ for (i = 0; i < DMAMUX_NR; i++) { + char clkname[32]; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 1 + i); + fsl_edma->muxbase[i] = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(fsl_edma->muxbase[i])) + return PTR_ERR(fsl_edma->muxbase[i]); + + sprintf(clkname, "dmamux%d", i); + fsl_edma->muxclk[i] = of_clk_get(np, i); + fsl_edma->muxclk[i] = devm_clk_get(&pdev->dev, clkname);
The of_clk_get should disappear. It's always overwritten and devm_clk_get will do what you want.
Quoted 8 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +8
-0+ if (IS_ERR(fsl_edma->muxclk[i])) { + dev_err(&pdev->dev, "Missing DMAMUX block clock.\n"); + return PTR_ERR(fsl_edma->muxclk[i]); + } + + ret = clk_prepare_enable(fsl_edma->muxclk[i]); + if (ret) { + dev_err(&pdev->dev, "DMAMUX clk block failed.\n");
Documentation/devicetree/bindings/dma/fsl-edma.txt
Quoted 10 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +10
-0+ return ret; + } + + } + + ret = fsl_edma_irq_init(pdev, fsl_edma); + if (ret) + return ret; + + fsl_edma->big_endian = of_property_read_bool(np, "big-endian");
This isn't in the binding.
Thanks,
Mark.
Quoted 103 lines
-----Original Message-----
From: Mark Rutland [mailto:mark.rutland at arm.com]
Sent: Thursday, January 16, 2014 7:12 PM
To: Lu Jingchang-B35083
Cc: vinod.koul at intel.com; dan.j.williams at intel.com; arnd at arndb.de; shawn.guo at linaro.org; Pawel Moll; swarren at wwwdotorg.org; linux- kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; devicetree at vger.kernel.org; Wang Huan-B18965
Subject: Re: [PATCHv9 2/2] dma: Add Freescale eDMA engine driver supportQuoted 19 lines · Jingchang Lu
Add Freescale enhanced direct memory(eDMA) controller support. This module can be found on Vybrid and LS-1 SoCs.
Signed-off-by Alison Wang <[email protected]>Signed-off-by Jingchang Lu <[email protected]>---
changes in v9:
define endian's operating functions instead of macro definition. remove the filter function, usingdma_get_slave_channelinstead.changes in v8:
change the edma driver according eDMA dts change. add big-endian and little-endian handling.no changes in v4 ~ v7.
changes in v3:
add vf610 edma dt-bindings namespace with prefix VF610_*.Quoted 8 lines
changes in v2:
using generic dma-channels property instead of fsl,dma-channels.Documentation/devicetree/bindings/dma/fsl-edma.txt | 66 ++ drivers/dma/Kconfig | 10 + drivers/dma/Makefile | 1 + drivers/dma/fsl-edma.c | 957+++++++++++++++++++++
Review
Quoted 5 lines
4 files changed, 1034 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/fsl-edma.txt create mode 100644 drivers/dma/fsl-edma.c(quoted diff) +0
-0
b/Documentation/devicetree/bindings/dma/fsl-edma.txtDocumentation/devicetree/bindings/dma/fsl-edma.txt line 3
Quoted 8 lines
new file mode 100644
index 0000000..5a5fb61Documentation/devicetree/bindings/dma/fsl-edma.txt new file +3
-0@@ -0,0 +1,66 @@ +* Freescale enhanced Direct Memory Access(eDMA) Controller + + The eDMA channels have multiplex capability by programmble memory-mapped
Documentation/devicetree/bindings/dma/fsl-edma.txt line 4
Quoted 1 line
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +1
-0+registers. channels are split into two groups, called DMAMUX0 andDMAMUX1,
Documentation/devicetree/bindings/dma/fsl-edma.txt line 5
Quoted 1 line
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +1
-0+specific DMA request source can only be multiplexed by any channel ofcertain
Documentation/devicetree/bindings/dma/fsl-edma.txt
Quoted 6 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +6
-0+group, DMAMUX0 or DMAMUX1, but not both. + +* eDMA Controller +Required properties: +- compatible : + - "fsl,vf610-edma" for eDMA used similar to that on Vybridvf610 SoC
Documentation/devicetree/bindings/dma/fsl-edma.txt line 12
Quoted 1 line
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +1
-0+- reg : Specifies base physical address(s) and size of the eDMAregisters.
Documentation/devicetree/bindings/dma/fsl-edma.txt line 14
Quoted 2 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +2
-0+ The 1st region is eDMA control register's address and size. + The 2nd and the 3rd regions are programmable channelmultiplexing
Documentation/devicetree/bindings/dma/fsl-edma.txt line 18
Quoted 4 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +4
-0+ control register's address and size. +- interrupts : Should contain eDMA interrupt +- interrupt-names : Should be "edma-tx" for transmission interrupt and + "edma-err" for error interruptThe description of interrupts and interrupt-names is a bit odd. How about:
- interrupts: a list of interrupt-specifiers, one for each entry in interrupt-names.
- interrupt names: should contain:
* "edma-tx" - the transmission interrupt.
* "edma-err" - the error interrupt.Documentation/devicetree/bindings/dma/fsl-edma.txt line 20
Quoted 2 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +2
-0+- #dma-cells : Must be <2>. + The 1st cell specifies the DMAMUX(0 for DMAMUX0 and 1 forDMAMUX1).
Documentation/devicetree/bindings/dma/fsl-edma.txt line 21
Quoted 1 line
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +1
-0+ Specific request source can only be multiplexed by specificchannels
Documentation/devicetree/bindings/dma/fsl-edma.txt
Quoted 3 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +3
-0+ group called DMAMUX. + The 2nd cell specifies the request source(slot) ID. + See the SoC's reference manual for all the supported requestsources.
Documentation/devicetree/bindings/dma/fsl-edma.txt line 27
Quoted 3 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +3
-0+- dma-channels : Number of channels supported by the controller +- clock-names : The channel group block clock names +- clocks : eDMA module clockThe set of expected clock-names should be well defined, and the example has more than one clock..
Quoted 8 lines
This should be something like:
- clocks: a list of phandle + clock-specifier pairs, one for each entry in clock-names.
- clock-names: a list of clock names. Should contain:
* "dmamux0" - <insert description here>
* "dmamux1" - <insert description here>
Your suggestion for the interrupt and clock binding is much clearer, I will take this, thanks.
Quoted 36 lines
Quoted 19 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +18
-0+ + +Examples: + +edma0: dma-controller at 40018000 { + #dma-cells = <2>; + compatible = "fsl,vf610-edma"; + reg = <0x40018000 0x2000>, + <0x40024000 0x1000>, + <0x40025000 0x1000>; + interrupts = <0 8 IRQ_TYPE_LEVEL_HIGH>, + <0 9 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "edma-tx", "edma-err"; + dma-channels = <32>; + clock-names = "dmamux0", "dmamux1"; + clocks = <&clks VF610_CLK_DMAMUX0>, + <&clks VF610_CLK_DMAMUX1>; +};[...]
Documentation/devicetree/bindings/dma/fsl-edma.txt
Quoted 4 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +4
-0+ for (i = 0; i < DMAMUX_NR; i++) { + char clkname[32]; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 1 +i);
Quoted 1 line
+ fsl_edma->muxbase[i] = devm_ioremap_resource(&pdev->dev,
res);
Documentation/devicetree/bindings/dma/fsl-edma.txt
Quoted 6 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +6
-0+ if (IS_ERR(fsl_edma->muxbase[i])) + return PTR_ERR(fsl_edma->muxbase[i]); + + sprintf(clkname, "dmamux%d", i); + fsl_edma->muxclk[i] = of_clk_get(np, i); + fsl_edma->muxclk[i] = devm_clk_get(&pdev->dev, clkname);
Quoted 2 lines
The
of_clk_getshould disappear. It's always overwritten anddevm_clk_getwill do what you want.
It's my mistake in substituting devm_clk_get() for of_clk_get(), I will remove it, thanks.
Quoted 11 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt
Quoted 3 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +2
-0+ if (IS_ERR(fsl_edma->muxclk[i])) { + dev_err(&pdev->dev, "Missing DMAMUX blockclock.\n");
Documentation/devicetree/bindings/dma/fsl-edma.txt
Quoted 6 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +6
-0+ return PTR_ERR(fsl_edma->muxclk[i]); + } + + ret = clk_prepare_enable(fsl_edma->muxclk[i]); + if (ret) { + dev_err(&pdev->dev, "DMAMUX clk blockfailed.\n");
Quoted 12 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt
Quoted 10 lines
Documentation/devicetree/bindings/dma/fsl-edma.txt new file +10
-0+ return ret; + } + + } + + ret = fsl_edma_irq_init(pdev, fsl_edma); + if (ret) + return ret; + + fsl_edma->big_endian = of_property_read_bool(np, "big-endian");This isn't in the binding.
I will add its binding, thanks.
Best Regards,
Jingchang