dmaengine: sirf: enable generic dt binding for dma channels
Subsystems (2)
PATCH v4 1/1 dmaengine: sirf: enable generic dt binding for dma channels
From: Barry Song <[email protected]>
move to support of_dma_request_slave_channel() and dma_request_slave_channel. we add a xlate() to let dma clients be able to find right dma_chan by generic "dmas" properties in dts.
---
-v4: clear dt-binding document according to Mark's feedback
.../devicetree/bindings/dma/sirfsoc-dma.txt | 43 ++++++++++++++++++++ arch/arm/boot/dts/atlas6.dtsi | 2 + arch/arm/boot/dts/prima2.dtsi | 2 + drivers/dma/sirf-dma.c | 23 ++++++++++ 4 files changed, 70 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/dma/sirfsoc-dma.txt
Documentation/devicetree/bindings/dma/sirfsoc-dma.txt new file +43 -0
@@ -0,0 +1,43 @@ +* CSR SiRFSoC DMA controller + +See dma.txt first + +Required properties: +- compatible: Should be "sirf,prima2-dmac" or "sirf,marco-dmac" +- reg: Should contain DMA registers location and length. +- interrupts: Should contain one interrupt shared by all channel +- #dma-cells: must be <1>. used to represent the number of integer + cells in the dmas property of client device. +- clocks: clock required + +Example: + +Controller: +dmac0: dma-controller at b00b0000 { + compatible = "sirf,prima2-dmac"; + reg = <0xb00b0000 0x10000>; + interrupts = <12>; + clocks = <&clks 24>; + #dma-cells = <1>; +}; + + +Client: +Fill the specific dma request line in dmas. In the below example, spi0 read +channel request line is 9 of the 2nd dma controller, while write channel uses +4 of the 2nd dma controller; spi1 read channel request line is 12 of the 1st +dma controller, while write channel uses 13 of the 1st dma controller: + +spi0: spi at b00d0000 { + compatible = "sirf,prima2-spi"; + dmas = <&dmac1 9>, + <&dmac1 4>; + dma-names = "rx", "tx"; +}; + +spi1: spi at b0170000 { + compatible = "sirf,prima2-spi"; + dmas = <&dmac0 12>, + <&dmac0 13>; + dma-names = "rx", "tx"; +};
arch/arm/boot/dts/atlas6.dtsi +2 -0
@@ -260,6 +260,7 @@ reg = <0xb00b0000 0x10000>; interrupts = <12>; clocks = <&clks 24>; + #dma-cells = <1>; }; dmac1: dma-controller at b0160000 {
@@ -268,6 +269,7 @@ reg = <0xb0160000 0x10000>; interrupts = <13>; clocks = <&clks 25>; + #dma-cells = <1>; }; vip at b00C0000 {
arch/arm/boot/dts/prima2.dtsi +2 -0
@@ -277,6 +277,7 @@ reg = <0xb00b0000 0x10000>; interrupts = <12>; clocks = <&clks 24>; + #dma-cells = <1>; }; dmac1: dma-controller at b0160000 {
@@ -285,6 +286,7 @@ reg = <0xb0160000 0x10000>; interrupts = <13>; clocks = <&clks 25>; + #dma-cells = <1>; }; vip at b00C0000 {
drivers/dma/sirf-dma.c +23 -0
@@ -18,6 +18,7 @@#include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/clk.h> +#include <linux/of_dma.h> #include <linux/sirfsoc_dma.h> #include "dmaengine.h"
@@ -640,6 +641,18 @@ bool sirfsoc_dma_filter_id(struct dma_chan *chan, void *chan_id) }EXPORT_SYMBOL (sirfsoc_dma_filter_id); +static struct dma_chan *of_dma_sirfsoc_xlate (struct of_phandle_args *dma_spec, +struct of_dma *ofdma) +{ +struct sirfsoc_dma *sdma = ofdma->of_dma_data; +unsigned int request = dma_spec->args[0 ]; + +if (request >SIRFSOC_DMA_CHANNELS ) +return NULL ; + +return dma_get_slave_channel (&sdma->channels[request].chan); +} +static int sirfsoc_dma_probe (struct platform_device *op) {struct device_node *dn = op->dev.of_node;
@@ -744,11 +757,20 @@ static int sirfsoc_dma_probe(struct platform_device *op)if (ret) goto free_irq; +/* Device-tree DMA controller registration */ + ret =of_dma_controller_register (dn, of_dma_sirfsoc_xlate, sdma); +if (ret) { +dev_err (dev,"failed to register DMA controller\n" ); + goto unreg_dma_dev; + } +pm_runtime_enable (&op->dev);dev_info (dev,"initialized SIRFSOC DMAC driver\n" );return 0 ; +unreg_dma_dev: +dma_async_device_unregister (dma); free_irq:free_irq (sdma->irq, sdma); irq_dispose:
@@ -761,6 +783,7 @@ static int sirfsoc_dma_remove(struct platform_device *op)struct device *dev = &op->dev;struct sirfsoc_dma *sdma =dev_get_drvdata (dev); +of_dma_controller_free (op->dev.of_node);dma_async_device_unregister (&sdma->dma);free_irq (sdma->irq, sdma);irq_dispose_mapping (sdma->irq);
Signature · 1 line
1.7.5.4
PATCH v4 1/1 dmaengine: sirf: enable generic dt binding for dma channels
Quoted 9 lines · Barry Song
From: Barry Song <[email protected]>
move to support
of_dma_request_slave_channel()anddma_request_slave_channel. we add axlate()to let dma clients be able to find rightdma_chanby generic "dmas" properties in dts.Cc Mark Rutland <[email protected]>Cc Lars-Peter Clausen <[email protected]>Signed-off-by Barry Song <[email protected]>
Look okay, need an ACk from DT maintainers before I can apply...
--
~Vinod
Quoted 162 lines
---
-v4: clear dt-binding document according to Mark's feedback.../devicetree/bindings/dma/sirfsoc-dma.txt | 43 ++++++++++++++++++++ arch/arm/boot/dts/atlas6.dtsi | 2 + arch/arm/boot/dts/prima2.dtsi | 2 + drivers/dma/sirf-dma.c | 23 ++++++++++ 4 files changed, 70 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/dma/sirfsoc-dma.txtDocumentation/devicetree/bindings/dma/sirfsoc-dma.txt new file +43
-0@@ -0,0 +1,43 @@ +* CSR SiRFSoC DMA controller + +See dma.txt first + +Required properties: +- compatible: Should be "sirf,prima2-dmac" or "sirf,marco-dmac" +- reg: Should contain DMA registers location and length. +- interrupts: Should contain one interrupt shared by all channel +- #dma-cells: must be <1>. used to represent the number of integer + cells in the dmas property of client device. +- clocks: clock required + +Example: + +Controller: +dmac0: dma-controller at b00b0000 { + compatible = "sirf,prima2-dmac"; + reg = <0xb00b0000 0x10000>; + interrupts = <12>; + clocks = <&clks 24>; + #dma-cells = <1>; +}; + + +Client: +Fill the specific dma request line in dmas. In the below example, spi0 read +channel request line is 9 of the 2nd dma controller, while write channel uses +4 of the 2nd dma controller; spi1 read channel request line is 12 of the 1st +dma controller, while write channel uses 13 of the 1st dma controller: + +spi0: spi at b00d0000 { + compatible = "sirf,prima2-spi"; + dmas = <&dmac1 9>, + <&dmac1 4>; + dma-names = "rx", "tx"; +}; + +spi1: spi at b0170000 { + compatible = "sirf,prima2-spi"; + dmas = <&dmac0 12>, + <&dmac0 13>; + dma-names = "rx", "tx"; +};arch/arm/boot/dts/atlas6.dtsi +2
-0@@ -260,6 +260,7 @@ reg = <0xb00b0000 0x10000>; interrupts = <12>; clocks = <&clks 24>; + #dma-cells = <1>; }; dmac1: dma-controller at b0160000 {@@ -268,6 +269,7 @@ reg = <0xb0160000 0x10000>; interrupts = <13>; clocks = <&clks 25>; + #dma-cells = <1>; }; vip at b00C0000 {arch/arm/boot/dts/prima2.dtsi +2
-0@@ -277,6 +277,7 @@ reg = <0xb00b0000 0x10000>; interrupts = <12>; clocks = <&clks 24>; + #dma-cells = <1>; }; dmac1: dma-controller at b0160000 {@@ -285,6 +286,7 @@ reg = <0xb0160000 0x10000>; interrupts = <13>; clocks = <&clks 25>; + #dma-cells = <1>; }; vip at b00C0000 {drivers/dma/sirf-dma.c +23
-0@@ -18,6 +18,7 @@#include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/clk.h> +#include <linux/of_dma.h> #include <linux/sirfsoc_dma.h> #include "dmaengine.h" @@ -640,6 +641,18 @@ bool sirfsoc_dma_filter_id(struct dma_chan *chan, void *chan_id) }EXPORT_SYMBOL (sirfsoc_dma_filter_id); +static struct dma_chan *of_dma_sirfsoc_xlate (struct of_phandle_args *dma_spec, +struct of_dma *ofdma) +{ +struct sirfsoc_dma *sdma = ofdma->of_dma_data; +unsigned int request = dma_spec->args[0 ]; + +if (request >SIRFSOC_DMA_CHANNELS ) +return NULL ; + +return dma_get_slave_channel (&sdma->channels[request].chan); +} +static int sirfsoc_dma_probe (struct platform_device *op) {struct device_node *dn = op->dev.of_node;@@ -744,11 +757,20 @@ static int sirfsoc_dma_probe(struct platform_device *op)if (ret) goto free_irq; +/* Device-tree DMA controller registration */ + ret =of_dma_controller_register (dn, of_dma_sirfsoc_xlate, sdma); +if (ret) { +dev_err (dev,"failed to register DMA controller\n" ); + goto unreg_dma_dev; + } +pm_runtime_enable (&op->dev);dev_info (dev,"initialized SIRFSOC DMAC driver\n" );return 0 ; +unreg_dma_dev: +dma_async_device_unregister (dma); free_irq:free_irq (sdma->irq, sdma); irq_dispose:@@ -761,6 +783,7 @@ static int sirfsoc_dma_remove(struct platform_device *op)struct device *dev = &op->dev;struct sirfsoc_dma *sdma =dev_get_drvdata (dev); +of_dma_controller_free (op->dev.of_node);dma_async_device_unregister (&sdma->dma);free_irq (sdma->irq, sdma);irq_dispose_mapping (sdma->irq);Signature · 1 line
1.7.5.4
PATCH v4 1/1 dmaengine: sirf: enable generic dt binding for dma channels
2014/1/20 Vinod Koul <[email protected]>:
Quoted 11 lines · Barry Song
Quoted 9 lines
From: Barry Song <[email protected]>
move to support
of_dma_request_slave_channel()anddma_request_slave_channel. we add axlate()to let dma clients be able to find rightdma_chanby generic "dmas" properties in dts.Cc Mark Rutland <[email protected]>Cc Lars-Peter Clausen <[email protected]>Signed-off-by Barry Song <[email protected]>Look okay, need an ACk from DT maintainers before I can apply...
Vinod, will i send v5 with your ack to devicetree-discuss at lists.ozlabs.org, and CC Grant & Rob?
Hi Rob, will you Ack this one if you have noticed this thread?
Quoted 5 lines
--
~VinodQuoted 2 lines
---
-v4: clear dt-binding document according to Mark's feedback
-barry
PATCH v4 1/1 dmaengine: sirf: enable generic dt binding for dma channels
Quoted 8 lines · Barry Song
2014/1/20 Vinod Koul <[email protected]>:
Quoted 7 lines · Barry Song
Quoted 6 lines
From: Barry Song <[email protected]>
move to support
of_dma_request_slave_channel()anddma_request_slave_channel. we add axlate()to let dma clients be able to find rightdma_chanby generic "dmas" properties in dts.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Cc Mark Rutland <[email protected]>Cc Lars-Peter Clausen <[email protected]>Signed-off-by Barry Song <[email protected]>Look okay, need an ACk from DT maintainers before I can apply...
Vinod, will i send v5 with your ack to devicetree-discuss at lists.ozlabs.org, and CC Grant & Rob?
Which tree are you tragetting this, if dmaengine then my ack make no sense :)
Quoted 2 lines
Hi Rob, will you Ack this one if you have noticed this thread?
I dont think Robs email is avlid anymore, I think he moved to Linaro, if I am not mistaken.
~Vinod
Quoted 9 lines
Quoted 3 lines
~Vinod
Quoted 2 lines
---
-v4: clear dt-binding document according to Mark's feedback-barry
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 1/1 dmaengine: sirf: enable generic dt binding for dma channels
2014/1/20 Vinod Koul <[email protected]>:
Quoted 16 lines · Barry Song
Quoted 8 lines
2014/1/20 Vinod Koul <[email protected]>:
Quoted 7 lines · Barry Song
Quoted 6 lines
From: Barry Song <[email protected]>
move to support
of_dma_request_slave_channel()anddma_request_slave_channel. we add axlate()to let dma clients be able to find rightdma_chanby generic "dmas" properties in dts.Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Cc Mark Rutland <[email protected]>Cc Lars-Peter Clausen <[email protected]>Signed-off-by Barry Song <[email protected]>Look okay, need an ACk from DT maintainers before I can apply...
Vinod, will i send v5 with your ack to devicetree-discuss at lists.ozlabs.org, and CC Grant & Rob?
Quoted 8 lines
Which tree are you tragetting this, if dmaengine then my ack make no sense :)
Quoted 2 lines
Hi Rob, will you Ack this one if you have noticed this thread?
I dont think Robs email is avlid anymore, I think he moved to Linaro, if I am not mistaken.
~Vinod
ok. i will resend the patch with dts guys.
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
~Vinod
Quoted 2 lines
---
-v4: clear dt-binding document according to Mark's feedback-barry
-barry
PATCH v4 1/1 dmaengine: sirf: enable generic dt binding for dma channels
In reply to Barry Song2014-01-20 17:35 GMT+08:00 Barry Song <[email protected]>:
Quoted 12 lines
2014/1/20 Vinod Koul <[email protected]>:
Quoted 11 lines · Barry Song
Quoted 9 lines
From: Barry Song <[email protected]>
move to support
of_dma_request_slave_channel()anddma_request_slave_channel. we add axlate()to let dma clients be able to find rightdma_chanby generic "dmas" properties in dts.Cc Mark Rutland <[email protected]>Cc Lars-Peter Clausen <[email protected]>Signed-off-by Barry Song <[email protected]>Look okay, need an ACk from DT maintainers before I can apply...
Hi Vinod,
v5 is sent to devicetree list and there is no object.
http://www.spinics.net/lists/devicetree/msg19677.html
this patch is using general dt-binding for dma completely same with other dma drivers, there is no special binding here.
so i think there is no reason to wait for merging since now updates for its clients e.g. SPI, UART have been in 3.14-rc.
-barry
PATCH v4 1/1 dmaengine: sirf: enable generic dt binding for dma channels
Quoted 14 lines · Barry Song
2014-01-20 17:35 GMT+08:00 Barry Song <[email protected]>:
Quoted 12 lines
2014/1/20 Vinod Koul <[email protected]>:
Quoted 11 lines · Barry Song
Quoted 9 lines
From: Barry Song <[email protected]>
move to support
of_dma_request_slave_channel()anddma_request_slave_channel. we add axlate()to let dma clients be able to find rightdma_chanby generic "dmas" properties in dts.Cc Mark Rutland <[email protected]>Cc Lars-Peter Clausen <[email protected]>Signed-off-by Barry Song <[email protected]>Look okay, need an ACk from DT maintainers before I can apply...
Quoted 7 lines
Hi Vinod,
v5 is sent to devicetree list and there is no object.
http://www.spinics.net/lists/devicetree/msg19677.html
this patch is using general dt-binding for dma completely same with other dma drivers, there is no special binding here.
so i think there is no reason to wait for merging since now updates for its clients e.g. SPI, UART have been in 3.14-rc.
I still need the ack for DT folks... Seems still missing :(
Signature · 1 line
~Vinod
PATCH v4 1/1 dmaengine: sirf: enable generic dt binding for dma channels
2014-03-17 12:51 GMT+08:00 Vinod Koul <[email protected]>:
Quoted 15 lines · Barry Song
Quoted 14 lines
2014-01-20 17:35 GMT+08:00 Barry Song <[email protected]>:
Quoted 12 lines
2014/1/20 Vinod Koul <[email protected]>:
Quoted 11 lines · Barry Song
Quoted 9 lines
From: Barry Song <[email protected]>
move to support
of_dma_request_slave_channel()anddma_request_slave_channel. we add axlate()to let dma clients be able to find rightdma_chanby generic "dmas" properties in dts.Cc Mark Rutland <[email protected]>Cc Lars-Peter Clausen <[email protected]>Signed-off-by Barry Song <[email protected]>Look okay, need an ACk from DT maintainers before I can apply...
Quoted 8 lines
Quoted 7 lines
Hi Vinod,
v5 is sent to devicetree list and there is no object.
http://www.spinics.net/lists/devicetree/msg19677.html
this patch is using general dt-binding for dma completely same with other dma drivers, there is no special binding here.
so i think there is no reason to wait for merging since now updates for its clients e.g. SPI, UART have been in 3.14-rc.I still need the ack for DT folks... Seems still missing :(
Vinod, it seems nobody in dt has noticed this change since there is not a real change for DT binding. if we need an ack for every normal change in dt, the maintain chain might be easily broken.it seems it is not always a good practice?
Quoted 3 lines
--
~Vinod
-barry
PATCH v4 1/1 dmaengine: sirf: enable generic dt binding for dma channels
In reply to Vinod KoulQuoted 15 lines · Vinod Koul
Quoted 14 lines · Barry Song
2014-01-20 17:35 GMT+08:00 Barry Song <[email protected]>:
Quoted 12 lines
2014/1/20 Vinod Koul <[email protected]>:
Quoted 11 lines · Barry Song
Quoted 9 lines
From: Barry Song <[email protected]>
move to support
of_dma_request_slave_channel()anddma_request_slave_channel. we add axlate()to let dma clients be able to find rightdma_chanby generic "dmas" properties in dts.Cc Mark Rutland <[email protected]>Cc Lars-Peter Clausen <[email protected]>Signed-off-by Barry Song <[email protected]>Look okay, need an ACk from DT maintainers before I can apply...
Quoted 8 lines
Quoted 7 lines
Hi Vinod,
v5 is sent to devicetree list and there is no object.
http://www.spinics.net/lists/devicetree/msg19677.html
this patch is using general dt-binding for dma completely same with other dma drivers, there is no special binding here.
so i think there is no reason to wait for merging since now updates for its clients e.g. SPI, UART have been in 3.14-rc.I still need the ack for DT folks... Seems still missing :(
I thought I'd looked at it before. The wording of the binding document could be clarified a little, but the binding itself is absolutely reasonable and the implementation looks correct. I would suggest you merge it as is.
Arnd
PATCH v4 1/1 dmaengine: sirf: enable generic dt binding for dma channels
In reply to Vinod Koul2014/1/20 Vinod Koul <[email protected]>:
Quoted 11 lines · Barry Song
Quoted 9 lines
From: Barry Song <[email protected]>
move to support
of_dma_request_slave_channel()anddma_request_slave_channel. we add axlate()to let dma clients be able to find rightdma_chanby generic "dmas" properties in dts.Cc Mark Rutland <[email protected]>Cc Lars-Peter Clausen <[email protected]>Signed-off-by Barry Song <[email protected]>Look okay, need an ACk from DT maintainers before I can apply...
sorry. i just realized Mark has followed this thread and given comments from the beginning.
Hi Mark,
will you ack this?
Quoted 6 lines
--
~VinodQuoted 3 lines
---
-v4: clear dt-binding document according to Mark's feedback
-barry
A message that is not in the archive (sent off-list or not yet received): 1389190369-2012-1-git-send-email-21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 9 lines · Barry Song
From: Barry Song <[email protected]>
move to support
of_dma_request_slave_channel()anddma_request_slave_channel. we add axlate()to let dma clients be able to find rightdma_chanby generic "dmas" properties in dts.Cc Mark Rutland <[email protected]>Cc Lars-Peter Clausen <lars-Qo5EllUWu/[email protected]>Signed-off-by Barry Song <[email protected]>
I tried applying this but it failed to apply.
Can you pls rebase quickly and resend. While at it pls add the Acks recived!
Signature · 1 line
~Vinod
Quoted 165 lines
---
-v5:
add Acked-by: [email protected]; cc devicetree guys as Acked from dt was required.../devicetree/bindings/dma/sirfsoc-dma.txt | 43 ++++++++++++++++++++ arch/arm/boot/dts/atlas6.dtsi | 2 + arch/arm/boot/dts/prima2.dtsi | 2 + drivers/dma/sirf-dma.c | 23 ++++++++++ 4 files changed, 70 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/dma/sirfsoc-dma.txtDocumentation/devicetree/bindings/dma/sirfsoc-dma.txt new file +43
-0@@ -0,0 +1,43 @@ +* CSR SiRFSoC DMA controller + +See dma.txt first + +Required properties: +- compatible: Should be "sirf,prima2-dmac" or "sirf,marco-dmac" +- reg: Should contain DMA registers location and length. +- interrupts: Should contain one interrupt shared by all channel +- #dma-cells: must be <1>. used to represent the number of integer + cells in the dmas property of client device. +- clocks: clock required + +Example: + +Controller: +dmac0: dma-controller@b00b0000 { + compatible = "sirf,prima2-dmac"; + reg = <0xb00b0000 0x10000>; + interrupts = <12>; + clocks = <&clks 24>; + #dma-cells = <1>; +}; + + +Client: +Fill the specific dma request line in dmas. In the below example, spi0 read +channel request line is 9 of the 2nd dma controller, while write channel uses +4 of the 2nd dma controller; spi1 read channel request line is 12 of the 1st +dma controller, while write channel uses 13 of the 1st dma controller: + +spi0: spi@b00d0000 { + compatible = "sirf,prima2-spi"; + dmas = <&dmac1 9>, + <&dmac1 4>; + dma-names = "rx", "tx"; +}; + +spi1: spi@b0170000 { + compatible = "sirf,prima2-spi"; + dmas = <&dmac0 12>, + <&dmac0 13>; + dma-names = "rx", "tx"; +};arch/arm/boot/dts/atlas6.dtsi +2
-0@@ -260,6 +260,7 @@ reg = <0xb00b0000 0x10000>; interrupts = <12>; clocks = <&clks 24>; + #dma-cells = <1>; }; dmac1: dma-controller@b0160000 {@@ -268,6 +269,7 @@ reg = <0xb0160000 0x10000>; interrupts = <13>; clocks = <&clks 25>; + #dma-cells = <1>; }; vip@b00C0000 {arch/arm/boot/dts/prima2.dtsi +2
-0@@ -277,6 +277,7 @@ reg = <0xb00b0000 0x10000>; interrupts = <12>; clocks = <&clks 24>; + #dma-cells = <1>; }; dmac1: dma-controller@b0160000 {@@ -285,6 +286,7 @@ reg = <0xb0160000 0x10000>; interrupts = <13>; clocks = <&clks 25>; + #dma-cells = <1>; }; vip@b00C0000 {drivers/dma/sirf-dma.c +23
-0@@ -18,6 +18,7 @@#include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/clk.h> +#include <linux/of_dma.h> #include <linux/sirfsoc_dma.h> #include "dmaengine.h" @@ -640,6 +641,18 @@ bool sirfsoc_dma_filter_id(struct dma_chan *chan, void *chan_id) }EXPORT_SYMBOL (sirfsoc_dma_filter_id); +static struct dma_chan *of_dma_sirfsoc_xlate (struct of_phandle_args *dma_spec, +struct of_dma *ofdma) +{ +struct sirfsoc_dma *sdma = ofdma->of_dma_data; +unsigned int request = dma_spec->args[0 ]; + +if (request >SIRFSOC_DMA_CHANNELS ) +return NULL ; + +return dma_get_slave_channel (&sdma->channels[request].chan); +} +static int sirfsoc_dma_probe (struct platform_device *op) {struct device_node *dn = op->dev.of_node;@@ -744,11 +757,20 @@ static int sirfsoc_dma_probe(struct platform_device *op)if (ret) goto free_irq; +/* Device-tree DMA controller registration */ + ret =of_dma_controller_register (dn, of_dma_sirfsoc_xlate, sdma); +if (ret) { +dev_err (dev,"failed to register DMA controller\n" ); + goto unreg_dma_dev; + } +pm_runtime_enable (&op->dev);dev_info (dev,"initialized SIRFSOC DMAC driver\n" );return 0 ; +unreg_dma_dev: +dma_async_device_unregister (dma); free_irq:free_irq (sdma->irq, sdma); irq_dispose:@@ -761,6 +783,7 @@ static int sirfsoc_dma_remove(struct platform_device *op)struct device *dev = &op->dev;struct sirfsoc_dma *sdma =dev_get_drvdata (dev); +of_dma_controller_free (op->dev.of_node);dma_async_device_unregister (&sdma->dma);free_irq (sdma->irq, sdma);irq_dispose_mapping (sdma->irq);Signature · 1 line
1.7.5.4
Signature · 4 lines
-- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Barry Song
Acked-by Arnd Bergmann2014-03-19 22:43 GMT+08:00 Vinod Koul <[email protected]>:
Quoted 7 lines · Barry Song
Quoted 6 lines
From: Barry Song <[email protected]>
move to support
of_dma_request_slave_channel()anddma_request_slave_channel. we add axlate()to let dma clients be able to find rightdma_chanby generic "dmas" properties in dts.
Quoted 7 lines
Quoted 3 lines
Cc Mark Rutland <[email protected]>Cc Lars-Peter Clausen <lars-Qo5EllUWu/[email protected]>Signed-off-by Barry Song <[email protected]>I tried applying this but it failed to apply.
Can you pls rebase quickly and resend. While at it pls add the Acks recived!
Hi Vinod,
attached see the rebased version for master.
-barry
From 3b720f21783f1df32ceaed35aa01ee2da1d2d26a Mon Sep 17 00:00:00 2001
From: Barry Song <[email protected]>
Date: Thu, 27 Mar 2014 15:49:31 +0800
Subject: [PATCH] dmaengine: sirf: enable generic dt binding for dma channels
move to support of_dma_request_slave_channel() and dma_request_slave_channel. we add a xlate() to let dma clients be able to find right dma_chan by generic "dmas" properties in dts.
--- .../devicetree/bindings/dma/sirfsoc-dma.txt | 43 ++++++++++++++++++++ arch/arm/boot/dts/atlas6.dtsi | 2 + arch/arm/boot/dts/prima2.dtsi | 2 + drivers/dma/sirf-dma.c | 23 ++++++++++ 4 files changed, 70 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/dma/sirfsoc-dma.txt
Documentation/devicetree/bindings/dma/sirfsoc-dma.txt new file +43 -0
@@ -0,0 +1,43 @@ +* CSR SiRFSoC DMA controller + +See dma.txt first + +Required properties: +- compatible: Should be "sirf,prima2-dmac" or "sirf,marco-dmac" +- reg: Should contain DMA registers location and length. +- interrupts: Should contain one interrupt shared by all channel +- #dma-cells: must be <1>. used to represent the number of integer + cells in the dmas property of client device. +- clocks: clock required + +Example: + +Controller: +dmac0: dma-controller@b00b0000 { + compatible = "sirf,prima2-dmac"; + reg = <0xb00b0000 0x10000>; + interrupts = <12>; + clocks = <&clks 24>; + #dma-cells = <1>; +}; + + +Client: +Fill the specific dma request line in dmas. In the below example, spi0 read +channel request line is 9 of the 2nd dma controller, while write channel uses +4 of the 2nd dma controller; spi1 read channel request line is 12 of the 1st +dma controller, while write channel uses 13 of the 1st dma controller: + +spi0: spi@b00d0000 { + compatible = "sirf,prima2-spi"; + dmas = <&dmac1 9>, + <&dmac1 4>; + dma-names = "rx", "tx"; +}; + +spi1: spi@b0170000 { + compatible = "sirf,prima2-spi"; + dmas = <&dmac0 12>, + <&dmac0 13>; + dma-names = "rx", "tx"; +};
arch/arm/boot/dts/atlas6.dtsi +2 -0
@@ -269,6 +269,7 @@ reg = <0xb00b0000 0x10000>; interrupts = <12>; clocks = <&clks 24>; + #dma-cells = <1>; }; dmac1: dma-controller@b0160000 {
@@ -277,6 +278,7 @@ reg = <0xb0160000 0x10000>; interrupts = <13>; clocks = <&clks 25>; + #dma-cells = <1>; }; vip@b00C0000 {
arch/arm/boot/dts/prima2.dtsi +2 -0
@@ -286,6 +286,7 @@ reg = <0xb00b0000 0x10000>; interrupts = <12>; clocks = <&clks 24>; + #dma-cells = <1>; }; dmac1: dma-controller@b0160000 {
@@ -294,6 +295,7 @@ reg = <0xb0160000 0x10000>; interrupts = <13>; clocks = <&clks 25>; + #dma-cells = <1>; }; vip@b00C0000 {
drivers/dma/sirf-dma.c +23 -0
@@ -18,6 +18,7 @@#include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/clk.h> +#include <linux/of_dma.h> #include <linux/sirfsoc_dma.h> #include "dmaengine.h"
@@ -659,6 +660,18 @@ static int sirfsoc_dma_device_slave_caps(struct dma_chan *dchan,return 0 ; } +static struct dma_chan *of_dma_sirfsoc_xlate (struct of_phandle_args *dma_spec, +struct of_dma *ofdma) +{ +struct sirfsoc_dma *sdma = ofdma->of_dma_data; +unsigned int request = dma_spec->args[0 ]; + +if (request >SIRFSOC_DMA_CHANNELS ) +return NULL ; + +return dma_get_slave_channel (&sdma->channels[request].chan); +} +static int sirfsoc_dma_probe (struct platform_device *op) {struct device_node *dn = op->dev.of_node;
@@ -764,11 +777,20 @@ static int sirfsoc_dma_probe(struct platform_device *op)if (ret) goto free_irq; +/* Device-tree DMA controller registration */ + ret =of_dma_controller_register (dn, of_dma_sirfsoc_xlate, sdma); +if (ret) { +dev_err (dev,"failed to register DMA controller\n" ); + goto unreg_dma_dev; + } +pm_runtime_enable (&op->dev);dev_info (dev,"initialized SIRFSOC DMAC driver\n" );return 0 ; +unreg_dma_dev: +dma_async_device_unregister (dma); free_irq:free_irq (sdma->irq, sdma); irq_dispose:
@@ -781,6 +803,7 @@ static int sirfsoc_dma_remove(struct platform_device *op)struct device *dev = &op->dev;struct sirfsoc_dma *sdma =dev_get_drvdata (dev); +of_dma_controller_free (op->dev.of_node);dma_async_device_unregister (&sdma->dma);free_irq (sdma->irq, sdma);irq_dispose_mapping (sdma->irq);
Signature · 1 line
1.7.5.4
A message that is not in the archive (sent off-list or not yet received): CAGsJ_4yVXN2pT-QCjWLx7bCM7rau=UAnkCY8k9QqEPOkMAcrXA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Vinod Koul
AppliedQuoted 12 lines · Barry Song
2014-03-19 22:43 GMT+08:00 Vinod Koul <[email protected]>:
Quoted 11 lines · Barry Song
Quoted 9 lines
From: Barry Song <[email protected]>
move to support
of_dma_request_slave_channel()anddma_request_slave_channel. we add axlate()to let dma clients be able to find rightdma_chanby generic "dmas" properties in dts.Cc Mark Rutland <[email protected]>Cc Lars-Peter Clausen <lars-Qo5EllUWu/[email protected]>Signed-off-by Barry Song <[email protected]>
Quoted 6 lines
Quoted 3 lines
I tried applying this but it failed to apply.
Can you pls rebase quickly and resend. While at it pls add the Acks recived!
Hi Vinod,
attached see the rebased version for master.
Applied, thanks
Signature · 5 lines
~Vinod -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html