All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding
@ 2013-02-27 15:25 Shawn Guo
  2013-02-27 15:25 ` [PATCH 01/12] ARM: dts: add generic DMA device tree binding for mxs-dma Shawn Guo
                   ` (12 more replies)
  0 siblings, 13 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

The series converts mxs-dma and its clients to generic DMA device tree
binding/helper.

Subsystem maintainers,

I need your ACKs to have the series go via arm-soc as a whole if the
patches look good to you.

Mark,

Patch "ASoC: dmaengine_pcm: support use of generic DMA helper" is not
mxs specific.  It makes more sense for you to maintain a topic branch
for that patch.  It should be useful for any dmaengine_pcm users that
want to move to generic DMA helper.

Regards,
Shawn

Shawn Guo (12):
  ARM: dts: add generic DMA device tree binding for mxs-dma
  dma: mxs-dma: use devm_* managed functions
  dma: mxs-dma: move to generic device tree binding
  mmc: mxs-mmc: move to use generic DMA helper
  spi: mxs-spi: move to use generic DMA helper
  i2c: i2c-mxs: move to use generic DMA helper
  mtd: gpmi: move to use generic DMA helper
  serial: mxs-auart: move to use generic DMA helper
  ASoC: dmaengine_pcm: support use of generic DMA helper
  ASoC: mxs: move to use generic DMA helper
  dma: mxs-dma: remove code left from generic DMA binding conversion
  ARM: dts: remove mxs-dma channel interrupt number from client nodes

 .../devicetree/bindings/dma/fsl-mxs-dma.txt        |   49 ++++++-
 Documentation/devicetree/bindings/i2c/i2c-mxs.txt  |   12 +-
 Documentation/devicetree/bindings/mmc/mxs-mmc.txt  |   12 +-
 .../devicetree/bindings/mtd/gpmi-nand.txt          |   17 ++-
 .../devicetree/bindings/sound/mxs-saif.txt         |   18 ++-
 Documentation/devicetree/bindings/spi/mxs-spi.txt  |   12 +-
 .../bindings/tty/serial/fsl-mxs-auart.txt          |   16 +--
 arch/arm/boot/dts/imx23.dtsi                       |   54 ++++++--
 arch/arm/boot/dts/imx28.dtsi                       |   94 +++++++++++---
 arch/arm/boot/dts/imx6qdl.dtsi                     |   12 +-
 drivers/dma/mxs-dma.c                              |  135 ++++++++++++--------
 drivers/i2c/busses/i2c-mxs.c                       |   40 +-----
 drivers/mmc/host/mxs-mmc.c                         |   48 +------
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c             |   51 +-------
 drivers/mtd/nand/gpmi-nand/gpmi-nand.h             |    3 +-
 drivers/spi/spi-mxs.c                              |   60 ++-------
 drivers/tty/serial/mxs-auart.c                     |   52 +-------
 include/linux/fsl/mxs-dma.h                        |   20 ---
 include/linux/spi/mxs-spi.h                        |    4 +-
 include/sound/dmaengine_pcm.h                      |    5 +
 sound/soc/mxs/mxs-pcm.c                            |   43 +------
 sound/soc/mxs/mxs-pcm.h                            |    5 -
 sound/soc/mxs/mxs-saif.c                           |   28 +---
 sound/soc/mxs/mxs-saif.h                           |    3 +-
 sound/soc/soc-dmaengine-pcm.c                      |   19 ++-
 25 files changed, 357 insertions(+), 455 deletions(-)
 delete mode 100644 include/linux/fsl/mxs-dma.h

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 01/12] ARM: dts: add generic DMA device tree binding for mxs-dma
  2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
@ 2013-02-27 15:25 ` Shawn Guo
  2013-02-27 20:36   ` Arnd Bergmann
  2013-02-27 15:25 ` [PATCH 02/12] dma: mxs-dma: use devm_* managed functions Shawn Guo
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

Add generic DMA device tree binding for mxs-dma.  The changes include:

 * Add channel interrupts into DMA controller nodes
 * Add properties '#dma-cells' and 'dma-channels' for DMA controller nodes
 * And properties 'dmas' and 'dma-names' for DMA client nodes
 * Update mxs-dma device tree binding doc

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 .../devicetree/bindings/dma/fsl-mxs-dma.txt        |   49 +++++++++++++++--
 arch/arm/boot/dts/imx23.dtsi                       |   42 +++++++++++++-
 arch/arm/boot/dts/imx28.dtsi                       |   58 +++++++++++++++++++-
 arch/arm/boot/dts/imx6qdl.dtsi                     |    8 ++-
 4 files changed, 148 insertions(+), 9 deletions(-)

diff --git a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
index ded0398..a4873e5 100644
--- a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
+++ b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
@@ -3,17 +3,58 @@
 Required properties:
 - compatible : Should be "fsl,<chip>-dma-apbh" or "fsl,<chip>-dma-apbx"
 - reg : Should contain registers location and length
+- interrupts : Should contain the interrupt numbers of DMA channels.
+  If a channel is empty/reserved, 0 should be filled in place.
+- #dma-cells : Must be <1>.  The number cell specifies the channel ID.
+- dma-channels : Number of channels supported by the DMA controller
+
+Optional properties:
+- interrupt-names : Name of DMA channel interrupts
 
 Supported chips:
 imx23, imx28.
 
 Examples:
-dma-apbh at 80004000 {
+
+dma_apbh: dma-apbh at 80004000 {
 	compatible = "fsl,imx28-dma-apbh";
-	reg = <0x80004000 2000>;
+	reg = <0x80004000 0x2000>;
+	interrupts = <82 83 84 85
+		      88 88 88 88
+		      88 88 88 88
+		      87 86 0 0>;
+	interrupt-names = "ssp0", "ssp1", "ssp2", "ssp3",
+			  "gpmi0", "gmpi1", "gpmi2", "gmpi3",
+			  "gpmi4", "gmpi5", "gpmi6", "gmpi7",
+			  "hsadc", "lcdif", "empty", "empty";
+	#dma-cells = <1>;
+	dma-channels = <16>;
 };
 
-dma-apbx at 80024000 {
+dma_apbx: dma-apbx at 80024000 {
 	compatible = "fsl,imx28-dma-apbx";
-	reg = <0x80024000 2000>;
+	reg = <0x80024000 0x2000>;
+	interrupts = <78 79 66 0
+		      80 81 68 69
+		      70 71 72 73
+		      74 75 76 77>;
+	interrupt-names = "auart4-rx", "aurat4-tx", "spdif-tx", "empty",
+			  "saif0", "saif1", "i2c0", "i2c1",
+			  "auart0-rx", "auart0-tx", "auart1-rx", "auart1-tx",
+			  "auart2-rx", "auart2-tx", "auart3-rx", "auart3-tx";
+	#dma-cells = <1>;
+	dma-channels = <16>;
+};
+
+DMA clients connected to the MXS DMA controller must use the format
+described in the dma.txt file.
+
+Examples:
+
+auart0: serial at 8006a000 {
+	compatible = "fsl,imx28-auart", "fsl,imx23-auart";
+	reg = <0x8006a000 0x2000>;
+	interrupts = <112>;
+	dmas = <&dma_apbx 8>, <&dma_apbx 9>;
+	dma-names = "rx", "tx";
 };
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 56afcf4..889a89a 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -49,9 +49,15 @@
 				reg = <0x80000000 0x2000>;
 			};
 
-			dma-apbh at 80004000 {
+			dma_apbh: dma-apbh at 80004000 {
 				compatible = "fsl,imx23-dma-apbh";
 				reg = <0x80004000 0x2000>;
+				interrupts = <0 14 20 0
+					      13 13 13 13>;
+				interrupt-names = "empty", "ssp0", "ssp1", "empty",
+						  "gpmi0", "gpmi1", "gpmi2", "gpmi3";
+				#dma-cells = <1>;
+				dma-channels = <8>;
 				clocks = <&clks 15>;
 			};
 
@@ -70,6 +76,8 @@
 				interrupt-names = "gpmi-dma", "bch";
 				clocks = <&clks 34>;
 				clock-names = "gpmi_io";
+				dmas = <&dma_apbh 4>;
+				dma-names = "ssp";
 				fsl,gpmi-dma-channel = <4>;
 				status = "disabled";
 			};
@@ -78,6 +86,8 @@
 				reg = <0x80010000 0x2000>;
 				interrupts = <15 14>;
 				clocks = <&clks 33>;
+				dmas = <&dma_apbh 1>;
+				dma-names = "ssp";
 				fsl,ssp-dma-channel = <1>;
 				status = "disabled";
 			};
@@ -304,9 +314,19 @@
 				status = "disabled";
 			};
 
-			dma-apbx at 80024000 {
+			dma_apbx: dma-apbx at 80024000 {
 				compatible = "fsl,imx23-dma-apbx";
 				reg = <0x80024000 0x2000>;
+				interrupts = <7 5 9 26
+					      19 0 25 23
+					      60 58 9 0
+					      0 0 0 0>;
+				interrupt-names = "audio-adc", "audio-dac", "spdif-tx", "i2c",
+						  "saif0", "empty", "auart0-rx", "auart0-tx",
+						  "auart1-rx", "auart1-tx", "saif1", "empty",
+						  "empty", "empty", "empty", "empty";
+				#dma-cells = <1>;
+				dma-channels = <16>;
 				clocks = <&clks 16>;
 			};
 
@@ -342,6 +362,8 @@
 				reg = <0x80034000 0x2000>;
 				interrupts = <2 20>;
 				clocks = <&clks 33>;
+				dmas = <&dma_apbh 2>;
+				dma-names = "ssp";
 				fsl,ssp-dma-channel = <2>;
 				status = "disabled";
 			};
@@ -367,6 +389,8 @@
 
 			saif0: saif at 80042000 {
 				reg = <0x80042000 0x2000>;
+				dmas = <&dma_apbx 4>;
+				dma-names = "saif";
 				status = "disabled";
 			};
 
@@ -377,16 +401,22 @@
 
 			saif1: saif at 80046000 {
 				reg = <0x80046000 0x2000>;
+				dmas = <&dma_apbx 10>;
+				dma-names = "saif";
 				status = "disabled";
 			};
 
 			audio-out at 80048000 {
 				reg = <0x80048000 0x2000>;
+				dmas = <&dma_apbx 1>;
+				dma-names = "dac";
 				status = "disabled";
 			};
 
 			audio-in at 8004c000 {
 				reg = <0x8004c000 0x2000>;
+				dmas = <&dma_apbx 0>;
+				dma-names = "adc";
 				status = "disabled";
 			};
 
@@ -399,11 +429,15 @@
 
 			spdif at 80054000 {
 				reg = <0x80054000 2000>;
+				dmas = <&dma_apbx 2>;
+				dma-names = "spdif";
 				status = "disabled";
 			};
 
 			i2c at 80058000 {
 				reg = <0x80058000 0x2000>;
+				dmas = <&dma_apbx 3>;
+				dma-names = "i2c";
 				status = "disabled";
 			};
 
@@ -433,6 +467,8 @@
 				reg = <0x8006c000 0x2000>;
 				interrupts = <24 25 23>;
 				clocks = <&clks 32>;
+				dmas = <&dma_apbx 6>, <&dma_apbx 7>;
+				dma-names = "rx", "tx";
 				status = "disabled";
 			};
 
@@ -441,6 +477,8 @@
 				reg = <0x8006e000 0x2000>;
 				interrupts = <59 60 58>;
 				clocks = <&clks 32>;
+				dmas = <&dma_apbx 8>, <&dma_apbx 9>;
+				dma-names = "rx", "tx";
 				status = "disabled";
 			};
 
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index 7ba4966..bb63d4e 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -61,12 +61,24 @@
 			hsadc at 80002000 {
 				reg = <0x80002000 0x2000>;
 				interrupts = <13 87>;
+				dmas = <&dma_apbh 12>;
+				dma-names = "hsadc";
 				status = "disabled";
 			};
 
-			dma-apbh at 80004000 {
+			dma_apbh: dma-apbh at 80004000 {
 				compatible = "fsl,imx28-dma-apbh";
 				reg = <0x80004000 0x2000>;
+				interrupts = <82 83 84 85
+					      88 88 88 88
+					      88 88 88 88
+					      87 86 0 0>;
+				interrupt-names = "ssp0", "ssp1", "ssp2", "ssp3",
+						  "gpmi0", "gmpi1", "gpmi2", "gmpi3",
+						  "gpmi4", "gmpi5", "gpmi6", "gmpi7",
+						  "hsadc", "lcdif", "empty", "empty";
+				#dma-cells = <1>;
+				dma-channels = <16>;
 				clocks = <&clks 25>;
 			};
 
@@ -86,6 +98,8 @@
 				interrupt-names = "gpmi-dma", "bch";
 				clocks = <&clks 50>;
 				clock-names = "gpmi_io";
+				dmas = <&dma_apbh 4>;
+				dma-names = "gpmi";
 				fsl,gpmi-dma-channel = <4>;
 				status = "disabled";
 			};
@@ -96,6 +110,8 @@
 				reg = <0x80010000 0x2000>;
 				interrupts = <96 82>;
 				clocks = <&clks 46>;
+				dmas = <&dma_apbh 0>;
+				dma-names = "ssp";
 				fsl,ssp-dma-channel = <0>;
 				status = "disabled";
 			};
@@ -106,6 +122,8 @@
 				reg = <0x80012000 0x2000>;
 				interrupts = <97 83>;
 				clocks = <&clks 47>;
+				dmas = <&dma_apbh 1>;
+				dma-names = "ssp";
 				fsl,ssp-dma-channel = <1>;
 				status = "disabled";
 			};
@@ -116,6 +134,8 @@
 				reg = <0x80014000 0x2000>;
 				interrupts = <98 84>;
 				clocks = <&clks 48>;
+				dmas = <&dma_apbh 2>;
+				dma-names = "ssp";
 				fsl,ssp-dma-channel = <2>;
 				status = "disabled";
 			};
@@ -126,6 +146,8 @@
 				reg = <0x80016000 0x2000>;
 				interrupts = <99 85>;
 				clocks = <&clks 49>;
+				dmas = <&dma_apbh 3>;
+				dma-names = "ssp";
 				fsl,ssp-dma-channel = <3>;
 				status = "disabled";
 			};
@@ -657,9 +679,19 @@
 				status = "disabled";
 			};
 
-			dma-apbx at 80024000 {
+			dma_apbx: dma-apbx at 80024000 {
 				compatible = "fsl,imx28-dma-apbx";
 				reg = <0x80024000 0x2000>;
+				interrupts = <78 79 66 0
+					      80 81 68 69
+					      70 71 72 73
+					      74 75 76 77>;
+				interrupt-names = "auart4-rx", "aurat4-tx", "spdif-tx", "empty",
+						  "saif0", "saif1", "i2c0", "i2c1",
+						  "auart0-rx", "auart0-tx", "auart1-rx", "auart1-tx",
+						  "auart2-rx", "auart2-tx", "auart3-rx", "auart3-tx";
+				#dma-cells = <1>;
+				dma-channels = <16>;
 				clocks = <&clks 26>;
 			};
 
@@ -690,6 +722,8 @@
 				reg = <0x80030000 0x2000>;
 				interrupts = <38 86>;
 				clocks = <&clks 55>;
+				dmas = <&dma_apbh 13>;
+				dma-names = "lcdif";
 				status = "disabled";
 			};
 
@@ -765,6 +799,8 @@
 				reg = <0x80042000 0x2000>;
 				interrupts = <59 80>;
 				clocks = <&clks 53>;
+				dmas = <&dma_apbx 4>;
+				dma-names = "saif";
 				fsl,saif-dma-channel = <4>;
 				status = "disabled";
 			};
@@ -779,6 +815,8 @@
 				reg = <0x80046000 0x2000>;
 				interrupts = <58 81>;
 				clocks = <&clks 54>;
+				dmas = <&dma_apbx 5>;
+				dma-names = "saif";
 				fsl,saif-dma-channel = <5>;
 				status = "disabled";
 			};
@@ -794,6 +832,8 @@
 			spdif at 80054000 {
 				reg = <0x80054000 0x2000>;
 				interrupts = <45 66>;
+				dmas = <&dma_apbx 2>;
+				dma-names = "spdif";
 				status = "disabled";
 			};
 
@@ -810,6 +850,8 @@
 				reg = <0x80058000 0x2000>;
 				interrupts = <111 68>;
 				clock-frequency = <100000>;
+				dmas = <&dma_apbx 6>;
+				dma-names = "i2c";
 				fsl,i2c-dma-channel = <6>;
 				status = "disabled";
 			};
@@ -821,6 +863,8 @@
 				reg = <0x8005a000 0x2000>;
 				interrupts = <110 69>;
 				clock-frequency = <100000>;
+				dmas = <&dma_apbx 7>;
+				dma-names = "i2c";
 				fsl,i2c-dma-channel = <7>;
 				status = "disabled";
 			};
@@ -844,6 +888,8 @@
 				compatible = "fsl,imx28-auart", "fsl,imx23-auart";
 				reg = <0x8006a000 0x2000>;
 				interrupts = <112 70 71>;
+				dmas = <&dma_apbx 8>, <&dma_apbx 9>;
+				dma-names = "rx", "tx";
 				fsl,auart-dma-channel = <8 9>;
 				clocks = <&clks 45>;
 				status = "disabled";
@@ -853,6 +899,8 @@
 				compatible = "fsl,imx28-auart", "fsl,imx23-auart";
 				reg = <0x8006c000 0x2000>;
 				interrupts = <113 72 73>;
+				dmas = <&dma_apbx 10>, <&dma_apbx 11>;
+				dma-names = "rx", "tx";
 				clocks = <&clks 45>;
 				status = "disabled";
 			};
@@ -861,6 +909,8 @@
 				compatible = "fsl,imx28-auart", "fsl,imx23-auart";
 				reg = <0x8006e000 0x2000>;
 				interrupts = <114 74 75>;
+				dmas = <&dma_apbx 12>, <&dma_apbx 13>;
+				dma-names = "rx", "tx";
 				clocks = <&clks 45>;
 				status = "disabled";
 			};
@@ -869,6 +919,8 @@
 				compatible = "fsl,imx28-auart", "fsl,imx23-auart";
 				reg = <0x80070000 0x2000>;
 				interrupts = <115 76 77>;
+				dmas = <&dma_apbx 14>, <&dma_apbx 15>;
+				dma-names = "rx", "tx";
 				clocks = <&clks 45>;
 				status = "disabled";
 			};
@@ -877,6 +929,8 @@
 				compatible = "fsl,imx28-auart", "fsl,imx23-auart";
 				reg = <0x80072000 0x2000>;
 				interrupts = <116 78 79>;
+				dmas = <&dma_apbx 0>, <&dma_apbx 1>;
+				dma-names = "rx", "tx";
 				clocks = <&clks 45>;
 				status = "disabled";
 			};
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 8f34a3cd..ccdcb06 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -65,9 +65,13 @@
 		interrupt-parent = <&intc>;
 		ranges;
 
-		dma-apbh at 00110000 {
+		dma_apbh: dma-apbh at 00110000 {
 			compatible = "fsl,imx6q-dma-apbh", "fsl,imx28-dma-apbh";
 			reg = <0x00110000 0x2000>;
+			interrupts = <0 13 0x04>, <0 13 0x04>, <0 13 0x04>, <0 13 0x04>;
+			interrupt-names = "gpmi0", "gpmi1", "gpmi2", "gpmi3";
+			#dma-cells = <1>;
+			dma-channels = <4>;
 			clocks = <&clks 106>;
 		};
 
@@ -83,6 +87,8 @@
 				 <&clks 150>, <&clks 149>;
 			clock-names = "gpmi_io", "gpmi_apb", "gpmi_bch",
 				      "gpmi_bch_apb", "per1_bch";
+			dmas = <&dma_apbh 0>;
+			dma-names = "gpmi";
 			fsl,gpmi-dma-channel = <0>;
 			status = "disabled";
 		};
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 02/12] dma: mxs-dma: use devm_* managed functions
  2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
  2013-02-27 15:25 ` [PATCH 01/12] ARM: dts: add generic DMA device tree binding for mxs-dma Shawn Guo
@ 2013-02-27 15:25 ` Shawn Guo
  2013-02-27 15:25 ` [PATCH 03/12] dma: mxs-dma: move to generic device tree binding Shawn Guo
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

Use devm_* managed functions to simplify probe() error handling.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/dma/mxs-dma.c |   39 +++++++++------------------------------
 1 file changed, 9 insertions(+), 30 deletions(-)

diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index 8f6d30d..bb86f7f 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -674,7 +674,7 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
 	struct resource *iores;
 	int ret, i;
 
-	mxs_dma = kzalloc(sizeof(*mxs_dma), GFP_KERNEL);
+	mxs_dma = devm_kzalloc(&pdev->dev, sizeof(*mxs_dma), GFP_KERNEL);
 	if (!mxs_dma)
 		return -ENOMEM;
 
@@ -689,24 +689,13 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
 	mxs_dma->dev_id = dma_type->id;
 
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	mxs_dma->base = devm_ioremap_resource(&pdev->dev, iores);
+	if (IS_ERR(mxs_dma->base))
+		return PTR_ERR(mxs_dma->base);
 
-	if (!request_mem_region(iores->start, resource_size(iores),
-				pdev->name)) {
-		ret = -EBUSY;
-		goto err_request_region;
-	}
-
-	mxs_dma->base = ioremap(iores->start, resource_size(iores));
-	if (!mxs_dma->base) {
-		ret = -ENOMEM;
-		goto err_ioremap;
-	}
-
-	mxs_dma->clk = clk_get(&pdev->dev, NULL);
-	if (IS_ERR(mxs_dma->clk)) {
-		ret = PTR_ERR(mxs_dma->clk);
-		goto err_clk;
-	}
+	mxs_dma->clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(mxs_dma->clk))
+		return PTR_ERR(mxs_dma->clk);
 
 	dma_cap_set(DMA_SLAVE, mxs_dma->dma_device.cap_mask);
 	dma_cap_set(DMA_CYCLIC, mxs_dma->dma_device.cap_mask);
@@ -732,7 +721,7 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
 
 	ret = mxs_dma_init(mxs_dma);
 	if (ret)
-		goto err_init;
+		return ret;
 
 	mxs_dma->dma_device.dev = &pdev->dev;
 
@@ -751,22 +740,12 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
 	ret = dma_async_device_register(&mxs_dma->dma_device);
 	if (ret) {
 		dev_err(mxs_dma->dma_device.dev, "unable to register\n");
-		goto err_init;
+		return ret;
 	}
 
 	dev_info(mxs_dma->dma_device.dev, "initialized\n");
 
 	return 0;
-
-err_init:
-	clk_put(mxs_dma->clk);
-err_clk:
-	iounmap(mxs_dma->base);
-err_ioremap:
-	release_mem_region(iores->start, resource_size(iores));
-err_request_region:
-	kfree(mxs_dma);
-	return ret;
 }
 
 static struct platform_driver mxs_dma_driver = {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 03/12] dma: mxs-dma: move to generic device tree binding
  2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
  2013-02-27 15:25 ` [PATCH 01/12] ARM: dts: add generic DMA device tree binding for mxs-dma Shawn Guo
  2013-02-27 15:25 ` [PATCH 02/12] dma: mxs-dma: use devm_* managed functions Shawn Guo
@ 2013-02-27 15:25 ` Shawn Guo
  2013-02-27 20:50   ` Arnd Bergmann
  2013-02-27 15:25   ` Shawn Guo
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

Update mxs-dma driver to adopt generic DMA device tree binding.  It
calls of_dma_controller_register() with mxs specific of_dma_xlate to
get the generic DMA device tree helper support.  Then DMA clients only
need to call dma_request_slave_channel() for requesting a DMA channel
from dmaengine.

The existing way of requesting channel, clients directly call
dma_request_channel(), still work there, and will be removed after
all mxs-dma clients get converted to generic DMA device tree helper.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/dma/mxs-dma.c |   77 ++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 73 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index bb86f7f..4edf8e9 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -27,6 +27,7 @@
 #include <linux/stmp_device.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/of_dma.h>
 
 #include <asm/irq.h>
 
@@ -139,6 +140,9 @@ struct mxs_dma_engine {
 	struct dma_device		dma_device;
 	struct device_dma_parameters	dma_parms;
 	struct mxs_dma_chan		mxs_chans[MXS_DMA_CHANNELS];
+	struct platform_device		*pdev;
+	struct of_dma_filter_info	filter_info;
+	unsigned int			nr_channels;
 };
 
 struct mxs_dma_type {
@@ -350,10 +354,8 @@ static int mxs_dma_alloc_chan_resources(struct dma_chan *chan)
 	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
 	int ret;
 
-	if (!data)
-		return -EINVAL;
-
-	mxs_chan->chan_irq = data->chan_irq;
+	if (data)
+		mxs_chan->chan_irq = data->chan_irq;
 
 	mxs_chan->ccw = dma_alloc_coherent(mxs_dma->dma_device.dev,
 				CCW_BLOCK_SIZE, &mxs_chan->ccw_phys,
@@ -665,8 +667,59 @@ err_out:
 	return ret;
 }
 
+struct mxs_dma_filter_param {
+	struct device_node *of_node;
+	unsigned int chan_id;
+};
+
+struct dma_chan *mxs_dma_xlate(struct of_phandle_args *dma_spec,
+			       struct of_dma *ofdma)
+{
+	struct mxs_dma_engine *mxs_dma = ofdma->of_dma_data;
+	struct of_dma_filter_info *info = &mxs_dma->filter_info;
+	struct mxs_dma_filter_param param;
+	int count = dma_spec->args_count;
+
+	if (!info || !info->filter_fn)
+		return NULL;
+
+	if (count != 1)
+		return NULL;
+
+	param.of_node = ofdma->of_node;
+	param.chan_id = dma_spec->args[0];
+
+	if (param.chan_id >= mxs_dma->nr_channels)
+		return NULL;
+
+	return dma_request_channel(info->dma_cap, info->filter_fn, &param);
+}
+
+static bool mxs_dma_filter_fn(struct dma_chan *chan, void *fn_param)
+{
+	struct mxs_dma_filter_param *param = fn_param;
+	struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
+	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
+	int chan_irq;
+
+	if (mxs_dma->dma_device.dev->of_node != param->of_node)
+		return false;
+
+	if (chan->chan_id != param->chan_id)
+		return false;
+
+	chan_irq = platform_get_irq(mxs_dma->pdev, param->chan_id);
+	if (chan_irq < 0)
+		return false;
+
+	mxs_chan->chan_irq = chan_irq;
+
+	return true;
+}
+
 static int __init mxs_dma_probe(struct platform_device *pdev)
 {
+	struct device_node *np = pdev->dev.of_node;
 	const struct platform_device_id *id_entry;
 	const struct of_device_id *of_id;
 	const struct mxs_dma_type *dma_type;
@@ -678,6 +731,12 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
 	if (!mxs_dma)
 		return -ENOMEM;
 
+	ret = of_property_read_u32(np, "dma-channels", &mxs_dma->nr_channels);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to read dma-channels\n");
+		return ret;
+	}
+
 	of_id = of_match_device(mxs_dma_dt_ids, &pdev->dev);
 	if (of_id)
 		id_entry = of_id->data;
@@ -723,6 +782,7 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
+	mxs_dma->pdev = pdev;
 	mxs_dma->dma_device.dev = &pdev->dev;
 
 	/* mxs_dma gets 65535 bytes maximum sg size */
@@ -743,6 +803,15 @@ static int __init mxs_dma_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	mxs_dma->filter_info.dma_cap = mxs_dma->dma_device.cap_mask;
+	mxs_dma->filter_info.filter_fn = mxs_dma_filter_fn;
+	ret = of_dma_controller_register(np, mxs_dma_xlate, mxs_dma);
+	if (ret) {
+		dev_err(mxs_dma->dma_device.dev,
+			"failed to register controller\n");
+		dma_async_device_unregister(&mxs_dma->dma_device);
+	}
+
 	dev_info(mxs_dma->dma_device.dev, "initialized\n");
 
 	return 0;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 04/12] mmc: mxs-mmc: move to use generic DMA helper
  2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
@ 2013-02-27 15:25   ` Shawn Guo
  2013-02-27 15:25 ` [PATCH 02/12] dma: mxs-dma: use devm_* managed functions Shawn Guo
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Vinod Koul, Arnd Bergmann, Marek Vasut, Fabio Estevam,
	Huang Shijie, Shawn Guo, Chris Ball, linux-mmc

With the generic DMA device tree helper supported by mxs-dma driver,
client devices only need to call dma_request_slave_channel() for
requesting a DMA channel from dmaengine.

Since mxs is a DT only platform now, along with the changes, the non-DT
case checking in probe function also gets cleaned up.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Chris Ball <cjb@laptop.org>
Cc: linux-mmc@vger.kernel.org
---
 Documentation/devicetree/bindings/mmc/mxs-mmc.txt |   12 ++++--
 drivers/mmc/host/mxs-mmc.c                        |   48 +++------------------
 2 files changed, 13 insertions(+), 47 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/mxs-mmc.txt b/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
index 54949f6..9f55d85 100644
--- a/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
+++ b/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
@@ -9,15 +9,19 @@ and the properties used by the mxsmmc driver.
 Required properties:
 - compatible: Should be "fsl,<chip>-mmc".  The supported chips include
   imx23 and imx28.
-- interrupts: Should contain ERROR and DMA interrupts
-- fsl,ssp-dma-channel: APBH DMA channel for the SSP
+- interrupts: Should contain ERROR interrupt number
+- dmas: DMA specifier, consisting of a phandle to DMA controller node
+  and SSP DMA channel ID.
+  Refer to dma.txt and fsl-mxs-dma.txt for details.
+- dma-names: Must be "ssp".
 
 Examples:
 
 ssp0: ssp@80010000 {
 	compatible = "fsl,imx28-mmc";
 	reg = <0x80010000 2000>;
-	interrupts = <96 82>;
-	fsl,ssp-dma-channel = <0>;
+	interrupts = <96>;
+	dmas = <&dma_apbh 0>;
+	dma-names = "ssp";
 	bus-width = <8>;
 };
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 4efe302..83fe0ad 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -548,22 +548,6 @@ static const struct mmc_host_ops mxs_mmc_ops = {
 	.enable_sdio_irq = mxs_mmc_enable_sdio_irq,
 };
 
-static bool mxs_mmc_dma_filter(struct dma_chan *chan, void *param)
-{
-	struct mxs_mmc_host *host = param;
-	struct mxs_ssp *ssp = &host->ssp;
-
-	if (!mxs_dma_is_apbh(chan))
-		return false;
-
-	if (chan->chan_id != ssp->dma_channel)
-		return false;
-
-	chan->private = &ssp->dma_data;
-
-	return true;
-}
-
 static struct platform_device_id mxs_ssp_ids[] = {
 	{
 		.name = "imx23-mmc",
@@ -591,20 +575,17 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 	struct device_node *np = pdev->dev.of_node;
 	struct mxs_mmc_host *host;
 	struct mmc_host *mmc;
-	struct resource *iores, *dmares;
+	struct resource *iores;
 	struct pinctrl *pinctrl;
-	int ret = 0, irq_err, irq_dma;
-	dma_cap_mask_t mask;
+	int ret = 0, irq_err;
 	struct regulator *reg_vmmc;
 	enum of_gpio_flags flags;
 	struct mxs_ssp *ssp;
 	u32 bus_width = 0;
 
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
 	irq_err = platform_get_irq(pdev, 0);
-	irq_dma = platform_get_irq(pdev, 1);
-	if (!iores || irq_err < 0 || irq_dma < 0)
+	if (!iores || irq_err < 0)
 		return -EINVAL;
 
 	mmc = mmc_alloc_host(sizeof(struct mxs_mmc_host), &pdev->dev);
@@ -620,23 +601,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 		goto out_mmc_free;
 	}
 
-	if (np) {
-		ssp->devid = (enum mxs_ssp_id) of_id->data;
-		/*
-		 * TODO: This is a temporary solution and should be changed
-		 * to use generic DMA binding later when the helpers get in.
-		 */
-		ret = of_property_read_u32(np, "fsl,ssp-dma-channel",
-					   &ssp->dma_channel);
-		if (ret) {
-			dev_err(mmc_dev(host->mmc),
-				"failed to get dma channel\n");
-			goto out_mmc_free;
-		}
-	} else {
-		ssp->devid = pdev->id_entry->driver_data;
-		ssp->dma_channel = dmares->start;
-	}
+	ssp->devid = (enum mxs_ssp_id) of_id->data;
 
 	host->mmc = mmc;
 	host->sdio_irq_en = 0;
@@ -666,10 +631,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 
 	mxs_mmc_reset(host);
 
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-	ssp->dma_data.chan_irq = irq_dma;
-	ssp->dmach = dma_request_channel(mask, mxs_mmc_dma_filter, host);
+	ssp->dmach = dma_request_slave_channel(&pdev->dev, "ssp");
 	if (!ssp->dmach) {
 		dev_err(mmc_dev(host->mmc),
 			"%s: failed to request dma\n", __func__);
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 04/12] mmc: mxs-mmc: move to use generic DMA helper
@ 2013-02-27 15:25   ` Shawn Guo
  0 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

With the generic DMA device tree helper supported by mxs-dma driver,
client devices only need to call dma_request_slave_channel() for
requesting a DMA channel from dmaengine.

Since mxs is a DT only platform now, along with the changes, the non-DT
case checking in probe function also gets cleaned up.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Chris Ball <cjb@laptop.org>
Cc: linux-mmc at vger.kernel.org
---
 Documentation/devicetree/bindings/mmc/mxs-mmc.txt |   12 ++++--
 drivers/mmc/host/mxs-mmc.c                        |   48 +++------------------
 2 files changed, 13 insertions(+), 47 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/mxs-mmc.txt b/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
index 54949f6..9f55d85 100644
--- a/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
+++ b/Documentation/devicetree/bindings/mmc/mxs-mmc.txt
@@ -9,15 +9,19 @@ and the properties used by the mxsmmc driver.
 Required properties:
 - compatible: Should be "fsl,<chip>-mmc".  The supported chips include
   imx23 and imx28.
-- interrupts: Should contain ERROR and DMA interrupts
-- fsl,ssp-dma-channel: APBH DMA channel for the SSP
+- interrupts: Should contain ERROR interrupt number
+- dmas: DMA specifier, consisting of a phandle to DMA controller node
+  and SSP DMA channel ID.
+  Refer to dma.txt and fsl-mxs-dma.txt for details.
+- dma-names: Must be "ssp".
 
 Examples:
 
 ssp0: ssp at 80010000 {
 	compatible = "fsl,imx28-mmc";
 	reg = <0x80010000 2000>;
-	interrupts = <96 82>;
-	fsl,ssp-dma-channel = <0>;
+	interrupts = <96>;
+	dmas = <&dma_apbh 0>;
+	dma-names = "ssp";
 	bus-width = <8>;
 };
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 4efe302..83fe0ad 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -548,22 +548,6 @@ static const struct mmc_host_ops mxs_mmc_ops = {
 	.enable_sdio_irq = mxs_mmc_enable_sdio_irq,
 };
 
-static bool mxs_mmc_dma_filter(struct dma_chan *chan, void *param)
-{
-	struct mxs_mmc_host *host = param;
-	struct mxs_ssp *ssp = &host->ssp;
-
-	if (!mxs_dma_is_apbh(chan))
-		return false;
-
-	if (chan->chan_id != ssp->dma_channel)
-		return false;
-
-	chan->private = &ssp->dma_data;
-
-	return true;
-}
-
 static struct platform_device_id mxs_ssp_ids[] = {
 	{
 		.name = "imx23-mmc",
@@ -591,20 +575,17 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 	struct device_node *np = pdev->dev.of_node;
 	struct mxs_mmc_host *host;
 	struct mmc_host *mmc;
-	struct resource *iores, *dmares;
+	struct resource *iores;
 	struct pinctrl *pinctrl;
-	int ret = 0, irq_err, irq_dma;
-	dma_cap_mask_t mask;
+	int ret = 0, irq_err;
 	struct regulator *reg_vmmc;
 	enum of_gpio_flags flags;
 	struct mxs_ssp *ssp;
 	u32 bus_width = 0;
 
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
 	irq_err = platform_get_irq(pdev, 0);
-	irq_dma = platform_get_irq(pdev, 1);
-	if (!iores || irq_err < 0 || irq_dma < 0)
+	if (!iores || irq_err < 0)
 		return -EINVAL;
 
 	mmc = mmc_alloc_host(sizeof(struct mxs_mmc_host), &pdev->dev);
@@ -620,23 +601,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 		goto out_mmc_free;
 	}
 
-	if (np) {
-		ssp->devid = (enum mxs_ssp_id) of_id->data;
-		/*
-		 * TODO: This is a temporary solution and should be changed
-		 * to use generic DMA binding later when the helpers get in.
-		 */
-		ret = of_property_read_u32(np, "fsl,ssp-dma-channel",
-					   &ssp->dma_channel);
-		if (ret) {
-			dev_err(mmc_dev(host->mmc),
-				"failed to get dma channel\n");
-			goto out_mmc_free;
-		}
-	} else {
-		ssp->devid = pdev->id_entry->driver_data;
-		ssp->dma_channel = dmares->start;
-	}
+	ssp->devid = (enum mxs_ssp_id) of_id->data;
 
 	host->mmc = mmc;
 	host->sdio_irq_en = 0;
@@ -666,10 +631,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 
 	mxs_mmc_reset(host);
 
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-	ssp->dma_data.chan_irq = irq_dma;
-	ssp->dmach = dma_request_channel(mask, mxs_mmc_dma_filter, host);
+	ssp->dmach = dma_request_slave_channel(&pdev->dev, "ssp");
 	if (!ssp->dmach) {
 		dev_err(mmc_dev(host->mmc),
 			"%s: failed to request dma\n", __func__);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 05/12] spi: mxs-spi: move to use generic DMA helper
  2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
@ 2013-02-27 15:25   ` Shawn Guo
  2013-02-27 15:25 ` [PATCH 02/12] dma: mxs-dma: use devm_* managed functions Shawn Guo
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fabio Estevam, Arnd Bergmann, Huang Shijie, Vinod Koul,
	Grant Likely, Marek Vasut, spi-devel-general, Shawn Guo

With the generic DMA device tree helper supported by mxs-dma driver,
client devices only need to call dma_request_slave_channel() for
requesting a DMA channel from dmaengine.

Since mxs is a DT only platform now, along with the changes, the non-DT
case handling in probe function also gets removed.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: spi-devel-general@lists.sourceforge.net
---
 Documentation/devicetree/bindings/spi/mxs-spi.txt |   12 +++--
 drivers/spi/spi-mxs.c                             |   60 ++++-----------------
 include/linux/spi/mxs-spi.h                       |    4 +-
 3 files changed, 18 insertions(+), 58 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/mxs-spi.txt b/Documentation/devicetree/bindings/spi/mxs-spi.txt
index e2e1395..166d33b 100644
--- a/Documentation/devicetree/bindings/spi/mxs-spi.txt
+++ b/Documentation/devicetree/bindings/spi/mxs-spi.txt
@@ -3,8 +3,11 @@
 Required properties:
 - compatible: Should be "fsl,<soc>-spi", where soc is "imx23" or "imx28"
 - reg: Offset and length of the register set for the device
-- interrupts: Should contain SSP interrupts (error irq first, dma irq second)
-- fsl,ssp-dma-channel: APBX DMA channel for the SSP
+- interrupts: Should contain SSP ERROR interrupt
+- dmas: DMA specifier, consisting of a phandle to DMA controller node
+  and SSP DMA channel ID.
+  Refer to dma.txt and fsl-mxs-dma.txt for details.
+- dma-names: Must be "ssp".
 
 Optional properties:
 - clock-frequency : Input clock frequency to the SPI block in Hz.
@@ -17,6 +20,7 @@ ssp0: ssp@80010000 {
 	#size-cells = <0>;
 	compatible = "fsl,imx28-spi";
 	reg = <0x80010000 0x2000>;
-	interrupts = <96 82>;
-	fsl,ssp-dma-channel = <0>;
+	interrupts = <96>;
+	dmas = <&dma_apbh 0>;
+	dma-names = "ssp";
 };
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index 22a0af0..5481b1a 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -490,21 +490,6 @@ static int mxs_spi_transfer_one(struct spi_master *master,
 	return status;
 }
 
-static bool mxs_ssp_dma_filter(struct dma_chan *chan, void *param)
-{
-	struct mxs_ssp *ssp = param;
-
-	if (!mxs_dma_is_apbh(chan))
-		return false;
-
-	if (chan->chan_id != ssp->dma_channel)
-		return false;
-
-	chan->private = &ssp->dma_data;
-
-	return true;
-}
-
 static const struct of_device_id mxs_spi_dt_ids[] = {
 	{ .compatible = "fsl,imx23-spi", .data = (void *) IMX23_SSP, },
 	{ .compatible = "fsl,imx28-spi", .data = (void *) IMX28_SSP, },
@@ -520,13 +505,12 @@ static int mxs_spi_probe(struct platform_device *pdev)
 	struct spi_master *master;
 	struct mxs_spi *spi;
 	struct mxs_ssp *ssp;
-	struct resource *iores, *dmares;
+	struct resource *iores;
 	struct pinctrl *pinctrl;
 	struct clk *clk;
 	void __iomem *base;
-	int devid, dma_channel, clk_freq;
-	int ret = 0, irq_err, irq_dma;
-	dma_cap_mask_t mask;
+	int devid, clk_freq;
+	int ret = 0, irq_err;
 
 	/*
 	 * Default clock speed for the SPI core. 160MHz seems to
@@ -537,8 +521,7 @@ static int mxs_spi_probe(struct platform_device *pdev)
 
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq_err = platform_get_irq(pdev, 0);
-	irq_dma = platform_get_irq(pdev, 1);
-	if (!iores || irq_err < 0 || irq_dma < 0)
+	if (!iores || irq_err < 0)
 		return -EINVAL;
 
 	base = devm_ioremap_resource(&pdev->dev, iores);
@@ -553,32 +536,11 @@ static int mxs_spi_probe(struct platform_device *pdev)
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
 
-	if (np) {
-		devid = (enum mxs_ssp_id) of_id->data;
-		/*
-		 * TODO: This is a temporary solution and should be changed
-		 * to use generic DMA binding later when the helpers get in.
-		 */
-		ret = of_property_read_u32(np, "fsl,ssp-dma-channel",
-					   &dma_channel);
-		if (ret) {
-			dev_err(&pdev->dev,
-				"Failed to get DMA channel\n");
-			return -EINVAL;
-		}
-
-		ret = of_property_read_u32(np, "clock-frequency",
-					   &clk_freq);
-		if (ret)
-			clk_freq = clk_freq_default;
-	} else {
-		dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
-		if (!dmares)
-			return -EINVAL;
-		devid = pdev->id_entry->driver_data;
-		dma_channel = dmares->start;
+	devid = (enum mxs_ssp_id) of_id->data;
+	ret = of_property_read_u32(np, "clock-frequency",
+				   &clk_freq);
+	if (ret)
 		clk_freq = clk_freq_default;
-	}
 
 	master = spi_alloc_master(&pdev->dev, sizeof(*spi));
 	if (!master)
@@ -597,7 +559,6 @@ static int mxs_spi_probe(struct platform_device *pdev)
 	ssp->clk = clk;
 	ssp->base = base;
 	ssp->devid = devid;
-	ssp->dma_channel = dma_channel;
 
 	init_completion(&spi->c);
 
@@ -606,10 +567,7 @@ static int mxs_spi_probe(struct platform_device *pdev)
 	if (ret)
 		goto out_master_free;
 
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-	ssp->dma_data.chan_irq = irq_dma;
-	ssp->dmach = dma_request_channel(mask, mxs_ssp_dma_filter, ssp);
+	ssp->dmach = dma_request_slave_channel(&pdev->dev, "ssp");
 	if (!ssp->dmach) {
 		dev_err(ssp->dev, "Failed to request DMA\n");
 		goto out_master_free;
diff --git a/include/linux/spi/mxs-spi.h b/include/linux/spi/mxs-spi.h
index 61ae130..4835486 100644
--- a/include/linux/spi/mxs-spi.h
+++ b/include/linux/spi/mxs-spi.h
@@ -24,7 +24,7 @@
 #ifndef __LINUX_SPI_MXS_SPI_H__
 #define __LINUX_SPI_MXS_SPI_H__
 
-#include <linux/fsl/mxs-dma.h>
+#include <linux/dmaengine.h>
 
 #define ssp_is_old(host)	((host)->devid == IMX23_SSP)
 
@@ -137,9 +137,7 @@ struct mxs_ssp {
 	unsigned int			clk_rate;
 	enum mxs_ssp_id			devid;
 
-	int				dma_channel;
 	struct dma_chan			*dmach;
-	struct mxs_dma_data		dma_data;
 	unsigned int			dma_dir;
 	enum dma_transfer_direction	slave_dirn;
 	u32				ssp_pio_words[SSP_PIO_NUM];
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 05/12] spi: mxs-spi: move to use generic DMA helper
@ 2013-02-27 15:25   ` Shawn Guo
  0 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

With the generic DMA device tree helper supported by mxs-dma driver,
client devices only need to call dma_request_slave_channel() for
requesting a DMA channel from dmaengine.

Since mxs is a DT only platform now, along with the changes, the non-DT
case handling in probe function also gets removed.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: spi-devel-general at lists.sourceforge.net
---
 Documentation/devicetree/bindings/spi/mxs-spi.txt |   12 +++--
 drivers/spi/spi-mxs.c                             |   60 ++++-----------------
 include/linux/spi/mxs-spi.h                       |    4 +-
 3 files changed, 18 insertions(+), 58 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/mxs-spi.txt b/Documentation/devicetree/bindings/spi/mxs-spi.txt
index e2e1395..166d33b 100644
--- a/Documentation/devicetree/bindings/spi/mxs-spi.txt
+++ b/Documentation/devicetree/bindings/spi/mxs-spi.txt
@@ -3,8 +3,11 @@
 Required properties:
 - compatible: Should be "fsl,<soc>-spi", where soc is "imx23" or "imx28"
 - reg: Offset and length of the register set for the device
-- interrupts: Should contain SSP interrupts (error irq first, dma irq second)
-- fsl,ssp-dma-channel: APBX DMA channel for the SSP
+- interrupts: Should contain SSP ERROR interrupt
+- dmas: DMA specifier, consisting of a phandle to DMA controller node
+  and SSP DMA channel ID.
+  Refer to dma.txt and fsl-mxs-dma.txt for details.
+- dma-names: Must be "ssp".
 
 Optional properties:
 - clock-frequency : Input clock frequency to the SPI block in Hz.
@@ -17,6 +20,7 @@ ssp0: ssp at 80010000 {
 	#size-cells = <0>;
 	compatible = "fsl,imx28-spi";
 	reg = <0x80010000 0x2000>;
-	interrupts = <96 82>;
-	fsl,ssp-dma-channel = <0>;
+	interrupts = <96>;
+	dmas = <&dma_apbh 0>;
+	dma-names = "ssp";
 };
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index 22a0af0..5481b1a 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -490,21 +490,6 @@ static int mxs_spi_transfer_one(struct spi_master *master,
 	return status;
 }
 
-static bool mxs_ssp_dma_filter(struct dma_chan *chan, void *param)
-{
-	struct mxs_ssp *ssp = param;
-
-	if (!mxs_dma_is_apbh(chan))
-		return false;
-
-	if (chan->chan_id != ssp->dma_channel)
-		return false;
-
-	chan->private = &ssp->dma_data;
-
-	return true;
-}
-
 static const struct of_device_id mxs_spi_dt_ids[] = {
 	{ .compatible = "fsl,imx23-spi", .data = (void *) IMX23_SSP, },
 	{ .compatible = "fsl,imx28-spi", .data = (void *) IMX28_SSP, },
@@ -520,13 +505,12 @@ static int mxs_spi_probe(struct platform_device *pdev)
 	struct spi_master *master;
 	struct mxs_spi *spi;
 	struct mxs_ssp *ssp;
-	struct resource *iores, *dmares;
+	struct resource *iores;
 	struct pinctrl *pinctrl;
 	struct clk *clk;
 	void __iomem *base;
-	int devid, dma_channel, clk_freq;
-	int ret = 0, irq_err, irq_dma;
-	dma_cap_mask_t mask;
+	int devid, clk_freq;
+	int ret = 0, irq_err;
 
 	/*
 	 * Default clock speed for the SPI core. 160MHz seems to
@@ -537,8 +521,7 @@ static int mxs_spi_probe(struct platform_device *pdev)
 
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq_err = platform_get_irq(pdev, 0);
-	irq_dma = platform_get_irq(pdev, 1);
-	if (!iores || irq_err < 0 || irq_dma < 0)
+	if (!iores || irq_err < 0)
 		return -EINVAL;
 
 	base = devm_ioremap_resource(&pdev->dev, iores);
@@ -553,32 +536,11 @@ static int mxs_spi_probe(struct platform_device *pdev)
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
 
-	if (np) {
-		devid = (enum mxs_ssp_id) of_id->data;
-		/*
-		 * TODO: This is a temporary solution and should be changed
-		 * to use generic DMA binding later when the helpers get in.
-		 */
-		ret = of_property_read_u32(np, "fsl,ssp-dma-channel",
-					   &dma_channel);
-		if (ret) {
-			dev_err(&pdev->dev,
-				"Failed to get DMA channel\n");
-			return -EINVAL;
-		}
-
-		ret = of_property_read_u32(np, "clock-frequency",
-					   &clk_freq);
-		if (ret)
-			clk_freq = clk_freq_default;
-	} else {
-		dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
-		if (!dmares)
-			return -EINVAL;
-		devid = pdev->id_entry->driver_data;
-		dma_channel = dmares->start;
+	devid = (enum mxs_ssp_id) of_id->data;
+	ret = of_property_read_u32(np, "clock-frequency",
+				   &clk_freq);
+	if (ret)
 		clk_freq = clk_freq_default;
-	}
 
 	master = spi_alloc_master(&pdev->dev, sizeof(*spi));
 	if (!master)
@@ -597,7 +559,6 @@ static int mxs_spi_probe(struct platform_device *pdev)
 	ssp->clk = clk;
 	ssp->base = base;
 	ssp->devid = devid;
-	ssp->dma_channel = dma_channel;
 
 	init_completion(&spi->c);
 
@@ -606,10 +567,7 @@ static int mxs_spi_probe(struct platform_device *pdev)
 	if (ret)
 		goto out_master_free;
 
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-	ssp->dma_data.chan_irq = irq_dma;
-	ssp->dmach = dma_request_channel(mask, mxs_ssp_dma_filter, ssp);
+	ssp->dmach = dma_request_slave_channel(&pdev->dev, "ssp");
 	if (!ssp->dmach) {
 		dev_err(ssp->dev, "Failed to request DMA\n");
 		goto out_master_free;
diff --git a/include/linux/spi/mxs-spi.h b/include/linux/spi/mxs-spi.h
index 61ae130..4835486 100644
--- a/include/linux/spi/mxs-spi.h
+++ b/include/linux/spi/mxs-spi.h
@@ -24,7 +24,7 @@
 #ifndef __LINUX_SPI_MXS_SPI_H__
 #define __LINUX_SPI_MXS_SPI_H__
 
-#include <linux/fsl/mxs-dma.h>
+#include <linux/dmaengine.h>
 
 #define ssp_is_old(host)	((host)->devid == IMX23_SSP)
 
@@ -137,9 +137,7 @@ struct mxs_ssp {
 	unsigned int			clk_rate;
 	enum mxs_ssp_id			devid;
 
-	int				dma_channel;
 	struct dma_chan			*dmach;
-	struct mxs_dma_data		dma_data;
 	unsigned int			dma_dir;
 	enum dma_transfer_direction	slave_dirn;
 	u32				ssp_pio_words[SSP_PIO_NUM];
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 06/12] i2c: i2c-mxs: move to use generic DMA helper
  2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
@ 2013-02-27 15:25     ` Shawn Guo
  2013-02-27 15:25 ` [PATCH 02/12] dma: mxs-dma: use devm_* managed functions Shawn Guo
                       ` (11 subsequent siblings)
  12 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Vinod Koul, Arnd Bergmann, Marek Vasut, Fabio Estevam,
	Huang Shijie, Shawn Guo, Wolfram Sang,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

With the generic DMA device tree helper supported by mxs-dma driver,
client devices only need to call dma_request_slave_channel() for
requesting a DMA channel from dmaengine.

Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 Documentation/devicetree/bindings/i2c/i2c-mxs.txt |   12 ++++---
 drivers/i2c/busses/i2c-mxs.c                      |   40 ++-------------------
 2 files changed, 11 insertions(+), 41 deletions(-)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mxs.txt b/Documentation/devicetree/bindings/i2c/i2c-mxs.txt
index 7a3fe9e..c32f4e9 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-mxs.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-mxs.txt
@@ -3,10 +3,13 @@
 Required properties:
 - compatible: Should be "fsl,<chip>-i2c"
 - reg: Should contain registers location and length
-- interrupts: Should contain ERROR and DMA interrupts
+- interrupts: Should contain ERROR interrupt number
 - clock-frequency: Desired I2C bus clock frequency in Hz.
                    Only 100000Hz and 400000Hz modes are supported.
-- fsl,i2c-dma-channel: APBX DMA channel for the I2C
+- dmas: DMA specifier, consisting of a phandle to DMA controller node
+  and I2C DMA channel ID.
+  Refer to dma.txt and fsl-mxs-dma.txt for details.
+- dma-names: Must be "i2c".
 
 Examples:
 
@@ -15,7 +18,8 @@ i2c0: i2c@80058000 {
 	#size-cells = <0>;
 	compatible = "fsl,imx28-i2c";
 	reg = <0x80058000 2000>;
-	interrupts = <111 68>;
+	interrupts = <111>;
 	clock-frequency = <100000>;
-	fsl,i2c-dma-channel = <6>;
+	dmas = <&dma_apbx 6>;
+	dma-names = "i2c";
 };
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 22d8ad3..1f282df 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -31,7 +31,6 @@
 #include <linux/of_i2c.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
-#include <linux/fsl/mxs-dma.h>
 
 #define DRIVER_NAME "mxs-i2c"
 
@@ -113,9 +112,7 @@ struct mxs_i2c_dev {
 	uint32_t timing1;
 
 	/* DMA support components */
-	int				dma_channel;
 	struct dma_chan         	*dmach;
-	struct mxs_dma_data		dma_data;
 	uint32_t			pio_data[2];
 	uint32_t			addr_data;
 	struct scatterlist		sg_io[2];
@@ -518,21 +515,6 @@ static const struct i2c_algorithm mxs_i2c_algo = {
 	.functionality = mxs_i2c_func,
 };
 
-static bool mxs_i2c_dma_filter(struct dma_chan *chan, void *param)
-{
-	struct mxs_i2c_dev *i2c = param;
-
-	if (!mxs_dma_is_apbx(chan))
-		return false;
-
-	if (chan->chan_id != i2c->dma_channel)
-		return false;
-
-	chan->private = &i2c->dma_data;
-
-	return true;
-}
-
 static void mxs_i2c_derive_timing(struct mxs_i2c_dev *i2c, int speed)
 {
 	/* The I2C block clock run at 24MHz */
@@ -577,17 +559,6 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c)
 	struct device_node *node = dev->of_node;
 	int ret;
 
-	/*
-	 * TODO: This is a temporary solution and should be changed
-	 * to use generic DMA binding later when the helpers get in.
-	 */
-	ret = of_property_read_u32(node, "fsl,i2c-dma-channel",
-				   &i2c->dma_channel);
-	if (ret) {
-		dev_err(dev, "Failed to get DMA channel!\n");
-		return -ENODEV;
-	}
-
 	ret = of_property_read_u32(node, "clock-frequency", &speed);
 	if (ret) {
 		dev_warn(dev, "No I2C speed selected, using 100kHz\n");
@@ -607,8 +578,7 @@ static int mxs_i2c_probe(struct platform_device *pdev)
 	struct pinctrl *pinctrl;
 	struct resource *res;
 	resource_size_t res_size;
-	int err, irq, dmairq;
-	dma_cap_mask_t mask;
+	int err, irq;
 
 	pinctrl = devm_pinctrl_get_select_default(dev);
 	if (IS_ERR(pinctrl))
@@ -620,9 +590,8 @@ static int mxs_i2c_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(pdev, 0);
-	dmairq = platform_get_irq(pdev, 1);
 
-	if (!res || irq < 0 || dmairq < 0)
+	if (!res || irq < 0)
 		return -ENOENT;
 
 	res_size = resource_size(res);
@@ -648,10 +617,7 @@ static int mxs_i2c_probe(struct platform_device *pdev)
 	}
 
 	/* Setup the DMA */
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-	i2c->dma_data.chan_irq = dmairq;
-	i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c);
+	i2c->dmach = dma_request_slave_channel(dev, "i2c");
 	if (!i2c->dmach) {
 		dev_err(dev, "Failed to request dma\n");
 		return -ENODEV;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 06/12] i2c: i2c-mxs: move to use generic DMA helper
@ 2013-02-27 15:25     ` Shawn Guo
  0 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

With the generic DMA device tree helper supported by mxs-dma driver,
client devices only need to call dma_request_slave_channel() for
requesting a DMA channel from dmaengine.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: linux-i2c at vger.kernel.org
---
 Documentation/devicetree/bindings/i2c/i2c-mxs.txt |   12 ++++---
 drivers/i2c/busses/i2c-mxs.c                      |   40 ++-------------------
 2 files changed, 11 insertions(+), 41 deletions(-)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mxs.txt b/Documentation/devicetree/bindings/i2c/i2c-mxs.txt
index 7a3fe9e..c32f4e9 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-mxs.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-mxs.txt
@@ -3,10 +3,13 @@
 Required properties:
 - compatible: Should be "fsl,<chip>-i2c"
 - reg: Should contain registers location and length
-- interrupts: Should contain ERROR and DMA interrupts
+- interrupts: Should contain ERROR interrupt number
 - clock-frequency: Desired I2C bus clock frequency in Hz.
                    Only 100000Hz and 400000Hz modes are supported.
-- fsl,i2c-dma-channel: APBX DMA channel for the I2C
+- dmas: DMA specifier, consisting of a phandle to DMA controller node
+  and I2C DMA channel ID.
+  Refer to dma.txt and fsl-mxs-dma.txt for details.
+- dma-names: Must be "i2c".
 
 Examples:
 
@@ -15,7 +18,8 @@ i2c0: i2c at 80058000 {
 	#size-cells = <0>;
 	compatible = "fsl,imx28-i2c";
 	reg = <0x80058000 2000>;
-	interrupts = <111 68>;
+	interrupts = <111>;
 	clock-frequency = <100000>;
-	fsl,i2c-dma-channel = <6>;
+	dmas = <&dma_apbx 6>;
+	dma-names = "i2c";
 };
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 22d8ad3..1f282df 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -31,7 +31,6 @@
 #include <linux/of_i2c.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
-#include <linux/fsl/mxs-dma.h>
 
 #define DRIVER_NAME "mxs-i2c"
 
@@ -113,9 +112,7 @@ struct mxs_i2c_dev {
 	uint32_t timing1;
 
 	/* DMA support components */
-	int				dma_channel;
 	struct dma_chan         	*dmach;
-	struct mxs_dma_data		dma_data;
 	uint32_t			pio_data[2];
 	uint32_t			addr_data;
 	struct scatterlist		sg_io[2];
@@ -518,21 +515,6 @@ static const struct i2c_algorithm mxs_i2c_algo = {
 	.functionality = mxs_i2c_func,
 };
 
-static bool mxs_i2c_dma_filter(struct dma_chan *chan, void *param)
-{
-	struct mxs_i2c_dev *i2c = param;
-
-	if (!mxs_dma_is_apbx(chan))
-		return false;
-
-	if (chan->chan_id != i2c->dma_channel)
-		return false;
-
-	chan->private = &i2c->dma_data;
-
-	return true;
-}
-
 static void mxs_i2c_derive_timing(struct mxs_i2c_dev *i2c, int speed)
 {
 	/* The I2C block clock run at 24MHz */
@@ -577,17 +559,6 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c)
 	struct device_node *node = dev->of_node;
 	int ret;
 
-	/*
-	 * TODO: This is a temporary solution and should be changed
-	 * to use generic DMA binding later when the helpers get in.
-	 */
-	ret = of_property_read_u32(node, "fsl,i2c-dma-channel",
-				   &i2c->dma_channel);
-	if (ret) {
-		dev_err(dev, "Failed to get DMA channel!\n");
-		return -ENODEV;
-	}
-
 	ret = of_property_read_u32(node, "clock-frequency", &speed);
 	if (ret) {
 		dev_warn(dev, "No I2C speed selected, using 100kHz\n");
@@ -607,8 +578,7 @@ static int mxs_i2c_probe(struct platform_device *pdev)
 	struct pinctrl *pinctrl;
 	struct resource *res;
 	resource_size_t res_size;
-	int err, irq, dmairq;
-	dma_cap_mask_t mask;
+	int err, irq;
 
 	pinctrl = devm_pinctrl_get_select_default(dev);
 	if (IS_ERR(pinctrl))
@@ -620,9 +590,8 @@ static int mxs_i2c_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(pdev, 0);
-	dmairq = platform_get_irq(pdev, 1);
 
-	if (!res || irq < 0 || dmairq < 0)
+	if (!res || irq < 0)
 		return -ENOENT;
 
 	res_size = resource_size(res);
@@ -648,10 +617,7 @@ static int mxs_i2c_probe(struct platform_device *pdev)
 	}
 
 	/* Setup the DMA */
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-	i2c->dma_data.chan_irq = dmairq;
-	i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c);
+	i2c->dmach = dma_request_slave_channel(dev, "i2c");
 	if (!i2c->dmach) {
 		dev_err(dev, "Failed to request dma\n");
 		return -ENODEV;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
  2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
@ 2013-02-27 15:25   ` Shawn Guo
  2013-02-27 15:25 ` [PATCH 02/12] dma: mxs-dma: use devm_* managed functions Shawn Guo
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fabio Estevam, Arnd Bergmann, Huang Shijie, Vinod Koul,
	Artem Bityutskiy, Marek Vasut, linux-mtd, Shawn Guo

With the generic DMA device tree helper supported by mxs-dma driver,
client devices only need to call dma_request_slave_channel() for
requesting a DMA channel from dmaengine.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: linux-mtd@lists.infradead.org
---
 .../devicetree/bindings/mtd/gpmi-nand.txt          |   17 ++++---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c             |   51 +-------------------
 drivers/mtd/nand/gpmi-nand/gpmi-nand.h             |    3 +-
 3 files changed, 12 insertions(+), 59 deletions(-)

diff --git a/Documentation/devicetree/bindings/mtd/gpmi-nand.txt b/Documentation/devicetree/bindings/mtd/gpmi-nand.txt
index 3fb3f901..6f74e23 100644
--- a/Documentation/devicetree/bindings/mtd/gpmi-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/gpmi-nand.txt
@@ -7,10 +7,12 @@ Required properties:
   - compatible : should be "fsl,<chip>-gpmi-nand"
   - reg : should contain registers location and length for gpmi and bch.
   - reg-names: Should contain the reg names "gpmi-nand" and "bch"
-  - interrupts : The first is the DMA interrupt number for GPMI.
-                 The second is the BCH interrupt number.
-  - interrupt-names : The interrupt names "gpmi-dma", "bch";
-  - fsl,gpmi-dma-channel : Should contain the dma channel it uses.
+  - interrupts : BCH interrupt number.
+  - interrupt-names : Should be "bch".
+  - dmas: DMA specifier, consisting of a phandle to DMA controller node
+    and GPMI DMA channel ID.
+    Refer to dma.txt and fsl-mxs-dma.txt for details.
+  - dma-names: Must be "gpmi".
 
 Optional properties:
   - nand-on-flash-bbt: boolean to enable on flash bbt option if not
@@ -27,9 +29,10 @@ gpmi-nand@8000c000 {
 	#size-cells = <1>;
 	reg = <0x8000c000 2000>, <0x8000a000 2000>;
 	reg-names = "gpmi-nand", "bch";
-	interrupts = <88>, <41>;
-	interrupt-names = "gpmi-dma", "bch";
-	fsl,gpmi-dma-channel = <4>;
+	interrupts = <41>;
+	interrupt-names = "bch";
+	dmas = <&dma_apbh 4>;
+	dma-names = "gpmi";
 
 	partition@0 {
 	...
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 717881a..64d4d61 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -36,7 +36,6 @@
 #define GPMI_NAND_GPMI_REGS_ADDR_RES_NAME  "gpmi-nand"
 #define GPMI_NAND_BCH_REGS_ADDR_RES_NAME   "bch"
 #define GPMI_NAND_BCH_INTERRUPT_RES_NAME   "bch"
-#define GPMI_NAND_DMA_INTERRUPT_RES_NAME   "gpmi-dma"
 
 /* add our owner bbt descriptor */
 static uint8_t scan_ff_pattern[] = { 0xff };
@@ -420,28 +419,6 @@ static void release_bch_irq(struct gpmi_nand_data *this)
 		free_irq(i, this);
 }
 
-static bool gpmi_dma_filter(struct dma_chan *chan, void *param)
-{
-	struct gpmi_nand_data *this = param;
-	int dma_channel = (int)this->private;
-
-	if (!mxs_dma_is_apbh(chan))
-		return false;
-	/*
-	 * only catch the GPMI dma channels :
-	 *	for mx23 :	MX23_DMA_GPMI0 ~ MX23_DMA_GPMI3
-	 *		(These four channels share the same IRQ!)
-	 *
-	 *	for mx28 :	MX28_DMA_GPMI0 ~ MX28_DMA_GPMI7
-	 *		(These eight channels share the same IRQ!)
-	 */
-	if (dma_channel == chan->chan_id) {
-		chan->private = &this->dma_data;
-		return true;
-	}
-	return false;
-}
-
 static void release_dma_channels(struct gpmi_nand_data *this)
 {
 	unsigned int i;
@@ -455,36 +432,10 @@ static void release_dma_channels(struct gpmi_nand_data *this)
 static int acquire_dma_channels(struct gpmi_nand_data *this)
 {
 	struct platform_device *pdev = this->pdev;
-	struct resource *r_dma;
-	struct device_node *dn;
-	u32 dma_channel;
-	int ret;
 	struct dma_chan *dma_chan;
-	dma_cap_mask_t mask;
-
-	/* dma channel, we only use the first one. */
-	dn = pdev->dev.of_node;
-	ret = of_property_read_u32(dn, "fsl,gpmi-dma-channel", &dma_channel);
-	if (ret) {
-		pr_err("unable to get DMA channel from dt.\n");
-		goto acquire_err;
-	}
-	this->private = (void *)dma_channel;
-
-	/* gpmi dma interrupt */
-	r_dma = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
-					GPMI_NAND_DMA_INTERRUPT_RES_NAME);
-	if (!r_dma) {
-		pr_err("Can't get resource for DMA\n");
-		goto acquire_err;
-	}
-	this->dma_data.chan_irq = r_dma->start;
 
 	/* request dma channel */
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-
-	dma_chan = dma_request_channel(mask, gpmi_dma_filter, this);
+	dma_chan = dma_request_slave_channel(&pdev->dev, "gpmi");
 	if (!dma_chan) {
 		pr_err("Failed to request DMA channel.\n");
 		goto acquire_err;
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.h b/drivers/mtd/nand/gpmi-nand/gpmi-nand.h
index 0729477..a7685e3 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.h
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.h
@@ -20,7 +20,7 @@
 #include <linux/mtd/nand.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
-#include <linux/fsl/mxs-dma.h>
+#include <linux/dmaengine.h>
 
 #define GPMI_CLK_MAX 5 /* MX6Q needs five clocks */
 struct resources {
@@ -180,7 +180,6 @@ struct gpmi_nand_data {
 	/* DMA channels */
 #define DMA_CHANS		8
 	struct dma_chan		*dma_chans[DMA_CHANS];
-	struct mxs_dma_data	dma_data;
 	enum dma_ops_type	last_dma_type;
 	enum dma_ops_type	dma_type;
 	struct completion	dma_done;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
@ 2013-02-27 15:25   ` Shawn Guo
  0 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

With the generic DMA device tree helper supported by mxs-dma driver,
client devices only need to call dma_request_slave_channel() for
requesting a DMA channel from dmaengine.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: linux-mtd at lists.infradead.org
---
 .../devicetree/bindings/mtd/gpmi-nand.txt          |   17 ++++---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c             |   51 +-------------------
 drivers/mtd/nand/gpmi-nand/gpmi-nand.h             |    3 +-
 3 files changed, 12 insertions(+), 59 deletions(-)

diff --git a/Documentation/devicetree/bindings/mtd/gpmi-nand.txt b/Documentation/devicetree/bindings/mtd/gpmi-nand.txt
index 3fb3f901..6f74e23 100644
--- a/Documentation/devicetree/bindings/mtd/gpmi-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/gpmi-nand.txt
@@ -7,10 +7,12 @@ Required properties:
   - compatible : should be "fsl,<chip>-gpmi-nand"
   - reg : should contain registers location and length for gpmi and bch.
   - reg-names: Should contain the reg names "gpmi-nand" and "bch"
-  - interrupts : The first is the DMA interrupt number for GPMI.
-                 The second is the BCH interrupt number.
-  - interrupt-names : The interrupt names "gpmi-dma", "bch";
-  - fsl,gpmi-dma-channel : Should contain the dma channel it uses.
+  - interrupts : BCH interrupt number.
+  - interrupt-names : Should be "bch".
+  - dmas: DMA specifier, consisting of a phandle to DMA controller node
+    and GPMI DMA channel ID.
+    Refer to dma.txt and fsl-mxs-dma.txt for details.
+  - dma-names: Must be "gpmi".
 
 Optional properties:
   - nand-on-flash-bbt: boolean to enable on flash bbt option if not
@@ -27,9 +29,10 @@ gpmi-nand at 8000c000 {
 	#size-cells = <1>;
 	reg = <0x8000c000 2000>, <0x8000a000 2000>;
 	reg-names = "gpmi-nand", "bch";
-	interrupts = <88>, <41>;
-	interrupt-names = "gpmi-dma", "bch";
-	fsl,gpmi-dma-channel = <4>;
+	interrupts = <41>;
+	interrupt-names = "bch";
+	dmas = <&dma_apbh 4>;
+	dma-names = "gpmi";
 
 	partition at 0 {
 	...
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 717881a..64d4d61 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -36,7 +36,6 @@
 #define GPMI_NAND_GPMI_REGS_ADDR_RES_NAME  "gpmi-nand"
 #define GPMI_NAND_BCH_REGS_ADDR_RES_NAME   "bch"
 #define GPMI_NAND_BCH_INTERRUPT_RES_NAME   "bch"
-#define GPMI_NAND_DMA_INTERRUPT_RES_NAME   "gpmi-dma"
 
 /* add our owner bbt descriptor */
 static uint8_t scan_ff_pattern[] = { 0xff };
@@ -420,28 +419,6 @@ static void release_bch_irq(struct gpmi_nand_data *this)
 		free_irq(i, this);
 }
 
-static bool gpmi_dma_filter(struct dma_chan *chan, void *param)
-{
-	struct gpmi_nand_data *this = param;
-	int dma_channel = (int)this->private;
-
-	if (!mxs_dma_is_apbh(chan))
-		return false;
-	/*
-	 * only catch the GPMI dma channels :
-	 *	for mx23 :	MX23_DMA_GPMI0 ~ MX23_DMA_GPMI3
-	 *		(These four channels share the same IRQ!)
-	 *
-	 *	for mx28 :	MX28_DMA_GPMI0 ~ MX28_DMA_GPMI7
-	 *		(These eight channels share the same IRQ!)
-	 */
-	if (dma_channel == chan->chan_id) {
-		chan->private = &this->dma_data;
-		return true;
-	}
-	return false;
-}
-
 static void release_dma_channels(struct gpmi_nand_data *this)
 {
 	unsigned int i;
@@ -455,36 +432,10 @@ static void release_dma_channels(struct gpmi_nand_data *this)
 static int acquire_dma_channels(struct gpmi_nand_data *this)
 {
 	struct platform_device *pdev = this->pdev;
-	struct resource *r_dma;
-	struct device_node *dn;
-	u32 dma_channel;
-	int ret;
 	struct dma_chan *dma_chan;
-	dma_cap_mask_t mask;
-
-	/* dma channel, we only use the first one. */
-	dn = pdev->dev.of_node;
-	ret = of_property_read_u32(dn, "fsl,gpmi-dma-channel", &dma_channel);
-	if (ret) {
-		pr_err("unable to get DMA channel from dt.\n");
-		goto acquire_err;
-	}
-	this->private = (void *)dma_channel;
-
-	/* gpmi dma interrupt */
-	r_dma = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
-					GPMI_NAND_DMA_INTERRUPT_RES_NAME);
-	if (!r_dma) {
-		pr_err("Can't get resource for DMA\n");
-		goto acquire_err;
-	}
-	this->dma_data.chan_irq = r_dma->start;
 
 	/* request dma channel */
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-
-	dma_chan = dma_request_channel(mask, gpmi_dma_filter, this);
+	dma_chan = dma_request_slave_channel(&pdev->dev, "gpmi");
 	if (!dma_chan) {
 		pr_err("Failed to request DMA channel.\n");
 		goto acquire_err;
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.h b/drivers/mtd/nand/gpmi-nand/gpmi-nand.h
index 0729477..a7685e3 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.h
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.h
@@ -20,7 +20,7 @@
 #include <linux/mtd/nand.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
-#include <linux/fsl/mxs-dma.h>
+#include <linux/dmaengine.h>
 
 #define GPMI_CLK_MAX 5 /* MX6Q needs five clocks */
 struct resources {
@@ -180,7 +180,6 @@ struct gpmi_nand_data {
 	/* DMA channels */
 #define DMA_CHANS		8
 	struct dma_chan		*dma_chans[DMA_CHANS];
-	struct mxs_dma_data	dma_data;
 	enum dma_ops_type	last_dma_type;
 	enum dma_ops_type	dma_type;
 	struct completion	dma_done;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 08/12] serial: mxs-auart: move to use generic DMA helper
  2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
@ 2013-02-27 15:25   ` Shawn Guo
  2013-02-27 15:25 ` [PATCH 02/12] dma: mxs-dma: use devm_* managed functions Shawn Guo
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Vinod Koul, Arnd Bergmann, Marek Vasut, Fabio Estevam,
	Huang Shijie, Shawn Guo, Greg Kroah-Hartman, linux-serial

With the generic DMA device tree helper supported by mxs-dma driver,
client devices only need to call dma_request_slave_channel() for
requesting a DMA channel from dmaengine.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-serial@vger.kernel.org
---
 .../bindings/tty/serial/fsl-mxs-auart.txt          |   16 +++---
 drivers/tty/serial/mxs-auart.c                     |   52 ++------------------
 2 files changed, 11 insertions(+), 57 deletions(-)

diff --git a/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt
index 273a8d5..2c00ec6 100644
--- a/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt
+++ b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt
@@ -5,20 +5,18 @@ Required properties:
   imx23 and imx28.
 - reg : Address and length of the register set for the device
 - interrupts : Should contain the auart interrupt numbers
-
-Optional properties:
-- fsl,auart-dma-channel : The DMA channels, the first is for RX, the other
-		is for TX. If you add this property, it also means that you
-		will enable the DMA support for the auart.
-		Note: due to the hardware bug in imx23(see errata : 2836),
-		only the imx28 can enable the DMA support for the auart.
+- dmas: DMA specifier, consisting of a phandle to DMA controller node
+  and AUART DMA channel ID.
+  Refer to dma.txt and fsl-mxs-dma.txt for details.
+- dma-names: "rx" for RX channel, "tx" for TX channel.
 
 Example:
 auart0: serial@8006a000 {
 	compatible = "fsl,imx28-auart", "fsl,imx23-auart";
 	reg = <0x8006a000 0x2000>;
-	interrupts = <112 70 71>;
-	fsl,auart-dma-channel = <8 9>;
+	interrupts = <112>;
+	dmas = <&dma_apbx 8>, <&dma_apbx 9>;
+	dma-names = "rx", "tx";
 };
 
 Note: Each auart port should have an alias correctly numbered in "aliases"
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index d549fe1..269a27c 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -35,7 +35,7 @@
 #include <linux/pinctrl/consumer.h>
 #include <linux/of_device.h>
 #include <linux/dma-mapping.h>
-#include <linux/fsl/mxs-dma.h>
+#include <linux/dmaengine.h>
 
 #include <asm/cacheflush.h>
 
@@ -148,11 +148,6 @@ struct mxs_auart_port {
 	struct device *dev;
 
 	/* for DMA */
-	struct mxs_dma_data dma_data;
-	int dma_channel_rx, dma_channel_tx;
-	int dma_irq_rx, dma_irq_tx;
-	int dma_channel;
-
 	struct scatterlist tx_sgl;
 	struct dma_chan	*tx_dma_chan;
 	void *tx_dma_buf;
@@ -440,20 +435,6 @@ static u32 mxs_auart_get_mctrl(struct uart_port *u)
 	return mctrl;
 }
 
-static bool mxs_auart_dma_filter(struct dma_chan *chan, void *param)
-{
-	struct mxs_auart_port *s = param;
-
-	if (!mxs_dma_is_apbx(chan))
-		return false;
-
-	if (s->dma_channel == chan->chan_id) {
-		chan->private = &s->dma_data;
-		return true;
-	}
-	return false;
-}
-
 static int mxs_auart_dma_prep_rx(struct mxs_auart_port *s);
 static void dma_rx_callback(void *arg)
 {
@@ -545,21 +526,11 @@ static void mxs_auart_dma_exit(struct mxs_auart_port *s)
 
 static int mxs_auart_dma_init(struct mxs_auart_port *s)
 {
-	dma_cap_mask_t mask;
-
 	if (auart_dma_enabled(s))
 		return 0;
 
-	/* We do not get the right DMA channels. */
-	if (s->dma_channel_rx == -1 || s->dma_channel_tx == -1)
-		return -EINVAL;
-
 	/* init for RX */
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-	s->dma_channel = s->dma_channel_rx;
-	s->dma_data.chan_irq = s->dma_irq_rx;
-	s->rx_dma_chan = dma_request_channel(mask, mxs_auart_dma_filter, s);
+	s->rx_dma_chan = dma_request_slave_channel(s->dev, "rx");
 	if (!s->rx_dma_chan)
 		goto err_out;
 	s->rx_dma_buf = kzalloc(UART_XMIT_SIZE, GFP_KERNEL | GFP_DMA);
@@ -567,9 +538,7 @@ static int mxs_auart_dma_init(struct mxs_auart_port *s)
 		goto err_out;
 
 	/* init for TX */
-	s->dma_channel = s->dma_channel_tx;
-	s->dma_data.chan_irq = s->dma_irq_tx;
-	s->tx_dma_chan = dma_request_channel(mask, mxs_auart_dma_filter, s);
+	s->tx_dma_chan = dma_request_slave_channel(s->dev, "tx");
 	if (!s->tx_dma_chan)
 		goto err_out;
 	s->tx_dma_buf = kzalloc(UART_XMIT_SIZE, GFP_KERNEL | GFP_DMA);
@@ -1020,7 +989,6 @@ static int serial_mxs_probe_dt(struct mxs_auart_port *s,
 		struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
-	u32 dma_channel[2];
 	int ret;
 
 	if (!np)
@@ -1034,20 +1002,8 @@ static int serial_mxs_probe_dt(struct mxs_auart_port *s,
 	}
 	s->port.line = ret;
 
-	s->dma_irq_rx = platform_get_irq(pdev, 1);
-	s->dma_irq_tx = platform_get_irq(pdev, 2);
+	s->flags |= MXS_AUART_DMA_CONFIG;
 
-	ret = of_property_read_u32_array(np, "fsl,auart-dma-channel",
-					dma_channel, 2);
-	if (ret == 0) {
-		s->dma_channel_rx = dma_channel[0];
-		s->dma_channel_tx = dma_channel[1];
-
-		s->flags |= MXS_AUART_DMA_CONFIG;
-	} else {
-		s->dma_channel_rx = -1;
-		s->dma_channel_tx = -1;
-	}
 	return 0;
 }
 
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 08/12] serial: mxs-auart: move to use generic DMA helper
@ 2013-02-27 15:25   ` Shawn Guo
  0 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

With the generic DMA device tree helper supported by mxs-dma driver,
client devices only need to call dma_request_slave_channel() for
requesting a DMA channel from dmaengine.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-serial at vger.kernel.org
---
 .../bindings/tty/serial/fsl-mxs-auart.txt          |   16 +++---
 drivers/tty/serial/mxs-auart.c                     |   52 ++------------------
 2 files changed, 11 insertions(+), 57 deletions(-)

diff --git a/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt
index 273a8d5..2c00ec6 100644
--- a/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt
+++ b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt
@@ -5,20 +5,18 @@ Required properties:
   imx23 and imx28.
 - reg : Address and length of the register set for the device
 - interrupts : Should contain the auart interrupt numbers
-
-Optional properties:
-- fsl,auart-dma-channel : The DMA channels, the first is for RX, the other
-		is for TX. If you add this property, it also means that you
-		will enable the DMA support for the auart.
-		Note: due to the hardware bug in imx23(see errata : 2836),
-		only the imx28 can enable the DMA support for the auart.
+- dmas: DMA specifier, consisting of a phandle to DMA controller node
+  and AUART DMA channel ID.
+  Refer to dma.txt and fsl-mxs-dma.txt for details.
+- dma-names: "rx" for RX channel, "tx" for TX channel.
 
 Example:
 auart0: serial at 8006a000 {
 	compatible = "fsl,imx28-auart", "fsl,imx23-auart";
 	reg = <0x8006a000 0x2000>;
-	interrupts = <112 70 71>;
-	fsl,auart-dma-channel = <8 9>;
+	interrupts = <112>;
+	dmas = <&dma_apbx 8>, <&dma_apbx 9>;
+	dma-names = "rx", "tx";
 };
 
 Note: Each auart port should have an alias correctly numbered in "aliases"
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index d549fe1..269a27c 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -35,7 +35,7 @@
 #include <linux/pinctrl/consumer.h>
 #include <linux/of_device.h>
 #include <linux/dma-mapping.h>
-#include <linux/fsl/mxs-dma.h>
+#include <linux/dmaengine.h>
 
 #include <asm/cacheflush.h>
 
@@ -148,11 +148,6 @@ struct mxs_auart_port {
 	struct device *dev;
 
 	/* for DMA */
-	struct mxs_dma_data dma_data;
-	int dma_channel_rx, dma_channel_tx;
-	int dma_irq_rx, dma_irq_tx;
-	int dma_channel;
-
 	struct scatterlist tx_sgl;
 	struct dma_chan	*tx_dma_chan;
 	void *tx_dma_buf;
@@ -440,20 +435,6 @@ static u32 mxs_auart_get_mctrl(struct uart_port *u)
 	return mctrl;
 }
 
-static bool mxs_auart_dma_filter(struct dma_chan *chan, void *param)
-{
-	struct mxs_auart_port *s = param;
-
-	if (!mxs_dma_is_apbx(chan))
-		return false;
-
-	if (s->dma_channel == chan->chan_id) {
-		chan->private = &s->dma_data;
-		return true;
-	}
-	return false;
-}
-
 static int mxs_auart_dma_prep_rx(struct mxs_auart_port *s);
 static void dma_rx_callback(void *arg)
 {
@@ -545,21 +526,11 @@ static void mxs_auart_dma_exit(struct mxs_auart_port *s)
 
 static int mxs_auart_dma_init(struct mxs_auart_port *s)
 {
-	dma_cap_mask_t mask;
-
 	if (auart_dma_enabled(s))
 		return 0;
 
-	/* We do not get the right DMA channels. */
-	if (s->dma_channel_rx == -1 || s->dma_channel_tx == -1)
-		return -EINVAL;
-
 	/* init for RX */
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-	s->dma_channel = s->dma_channel_rx;
-	s->dma_data.chan_irq = s->dma_irq_rx;
-	s->rx_dma_chan = dma_request_channel(mask, mxs_auart_dma_filter, s);
+	s->rx_dma_chan = dma_request_slave_channel(s->dev, "rx");
 	if (!s->rx_dma_chan)
 		goto err_out;
 	s->rx_dma_buf = kzalloc(UART_XMIT_SIZE, GFP_KERNEL | GFP_DMA);
@@ -567,9 +538,7 @@ static int mxs_auart_dma_init(struct mxs_auart_port *s)
 		goto err_out;
 
 	/* init for TX */
-	s->dma_channel = s->dma_channel_tx;
-	s->dma_data.chan_irq = s->dma_irq_tx;
-	s->tx_dma_chan = dma_request_channel(mask, mxs_auart_dma_filter, s);
+	s->tx_dma_chan = dma_request_slave_channel(s->dev, "tx");
 	if (!s->tx_dma_chan)
 		goto err_out;
 	s->tx_dma_buf = kzalloc(UART_XMIT_SIZE, GFP_KERNEL | GFP_DMA);
@@ -1020,7 +989,6 @@ static int serial_mxs_probe_dt(struct mxs_auart_port *s,
 		struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
-	u32 dma_channel[2];
 	int ret;
 
 	if (!np)
@@ -1034,20 +1002,8 @@ static int serial_mxs_probe_dt(struct mxs_auart_port *s,
 	}
 	s->port.line = ret;
 
-	s->dma_irq_rx = platform_get_irq(pdev, 1);
-	s->dma_irq_tx = platform_get_irq(pdev, 2);
+	s->flags |= MXS_AUART_DMA_CONFIG;
 
-	ret = of_property_read_u32_array(np, "fsl,auart-dma-channel",
-					dma_channel, 2);
-	if (ret == 0) {
-		s->dma_channel_rx = dma_channel[0];
-		s->dma_channel_tx = dma_channel[1];
-
-		s->flags |= MXS_AUART_DMA_CONFIG;
-	} else {
-		s->dma_channel_rx = -1;
-		s->dma_channel_tx = -1;
-	}
 	return 0;
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 09/12] ASoC: dmaengine_pcm: support use of generic DMA helper
  2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
@ 2013-02-27 15:25   ` Shawn Guo
  2013-02-27 15:25 ` [PATCH 02/12] dma: mxs-dma: use devm_* managed functions Shawn Guo
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fabio Estevam, alsa-devel, Arnd Bergmann, Huang Shijie,
	Vinod Koul, Mark Brown, Marek Vasut, Shawn Guo

With generic DMA device tree binding and helper function
dma_request_slave_channel() in place, dmaengine_pcm should support
that in requesting DMA channel for users that support generic DMA
device tree binding.

Instead of inventing a new API, it defines the parameters needed by
dma_request_slave_channel() into struct snd_dma_channel_params,
interprets filter_data into snd_dma_channel_params, and calls the
helper in case that dmaengine_pcm users pass in a NULL filter_fn.

Then, dmaengine_pcm users can call snd_dmaengine_pcm_open() with NULL
filter_fn and snd_dma_channel_params being filter_data to direct the
API to request DMA channel using generic DMA helper.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org
---
 include/sound/dmaengine_pcm.h |    5 +++++
 sound/soc/soc-dmaengine-pcm.c |   19 +++++++++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
index b877334..6c0f795 100644
--- a/include/sound/dmaengine_pcm.h
+++ b/include/sound/dmaengine_pcm.h
@@ -18,6 +18,11 @@
 #include <sound/pcm.h>
 #include <linux/dmaengine.h>
 
+struct snd_dma_channel_params {
+	struct device *dev;
+	char *name;
+};
+
 /**
  * snd_pcm_substream_to_dma_direction - Get dma_transfer_direction for a PCM
  *   substream
diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c
index 111b7d92..7ef8034 100644
--- a/sound/soc/soc-dmaengine-pcm.c
+++ b/sound/soc/soc-dmaengine-pcm.c
@@ -247,12 +247,19 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_pointer);
 static int dmaengine_pcm_request_channel(struct dmaengine_pcm_runtime_data *prtd,
 	dma_filter_fn filter_fn, void *filter_data)
 {
-	dma_cap_mask_t mask;
-
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-	dma_cap_set(DMA_CYCLIC, mask);
-	prtd->dma_chan = dma_request_channel(mask, filter_fn, filter_data);
+	if (filter_fn) {
+		dma_cap_mask_t mask;
+
+		dma_cap_zero(mask);
+		dma_cap_set(DMA_SLAVE, mask);
+		dma_cap_set(DMA_CYCLIC, mask);
+		prtd->dma_chan = dma_request_channel(mask, filter_fn,
+						     filter_data);
+	} else {
+		struct snd_dma_channel_params *params = filter_data;
+		prtd->dma_chan = dma_request_slave_channel(params->dev,
+							   params->name);
+	}
 
 	if (!prtd->dma_chan)
 		return -ENXIO;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 09/12] ASoC: dmaengine_pcm: support use of generic DMA helper
@ 2013-02-27 15:25   ` Shawn Guo
  0 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

With generic DMA device tree binding and helper function
dma_request_slave_channel() in place, dmaengine_pcm should support
that in requesting DMA channel for users that support generic DMA
device tree binding.

Instead of inventing a new API, it defines the parameters needed by
dma_request_slave_channel() into struct snd_dma_channel_params,
interprets filter_data into snd_dma_channel_params, and calls the
helper in case that dmaengine_pcm users pass in a NULL filter_fn.

Then, dmaengine_pcm users can call snd_dmaengine_pcm_open() with NULL
filter_fn and snd_dma_channel_params being filter_data to direct the
API to request DMA channel using generic DMA helper.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel at alsa-project.org
---
 include/sound/dmaengine_pcm.h |    5 +++++
 sound/soc/soc-dmaengine-pcm.c |   19 +++++++++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
index b877334..6c0f795 100644
--- a/include/sound/dmaengine_pcm.h
+++ b/include/sound/dmaengine_pcm.h
@@ -18,6 +18,11 @@
 #include <sound/pcm.h>
 #include <linux/dmaengine.h>
 
+struct snd_dma_channel_params {
+	struct device *dev;
+	char *name;
+};
+
 /**
  * snd_pcm_substream_to_dma_direction - Get dma_transfer_direction for a PCM
  *   substream
diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c
index 111b7d92..7ef8034 100644
--- a/sound/soc/soc-dmaengine-pcm.c
+++ b/sound/soc/soc-dmaengine-pcm.c
@@ -247,12 +247,19 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_pointer);
 static int dmaengine_pcm_request_channel(struct dmaengine_pcm_runtime_data *prtd,
 	dma_filter_fn filter_fn, void *filter_data)
 {
-	dma_cap_mask_t mask;
-
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-	dma_cap_set(DMA_CYCLIC, mask);
-	prtd->dma_chan = dma_request_channel(mask, filter_fn, filter_data);
+	if (filter_fn) {
+		dma_cap_mask_t mask;
+
+		dma_cap_zero(mask);
+		dma_cap_set(DMA_SLAVE, mask);
+		dma_cap_set(DMA_CYCLIC, mask);
+		prtd->dma_chan = dma_request_channel(mask, filter_fn,
+						     filter_data);
+	} else {
+		struct snd_dma_channel_params *params = filter_data;
+		prtd->dma_chan = dma_request_slave_channel(params->dev,
+							   params->name);
+	}
 
 	if (!prtd->dma_chan)
 		return -ENXIO;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 10/12] ASoC: mxs: move to use generic DMA helper
  2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
@ 2013-02-27 15:25   ` Shawn Guo
  2013-02-27 15:25 ` [PATCH 02/12] dma: mxs-dma: use devm_* managed functions Shawn Guo
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fabio Estevam, alsa-devel, Arnd Bergmann, Huang Shijie,
	Vinod Koul, Mark Brown, Marek Vasut, Shawn Guo

With the generic DMA device tree helper supported by mxs-dma driver,
client devices only need to call dma_request_slave_channel() for
requesting a DMA channel from dmaengine.

Call snd_dmaengine_pcm_open() with NULL filter_fn, and having
parameters needed by dma_request_slave_channel() wrap into
snd_dma_channel_params and pass it in as filter_data, so that
dmaengine_pcm will call the helper rather than dma_request_channel()
to request DMA channel.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org
---
 .../devicetree/bindings/sound/mxs-saif.txt         |   18 ++++----
 sound/soc/mxs/mxs-pcm.c                            |   43 ++------------------
 sound/soc/mxs/mxs-pcm.h                            |    5 ---
 sound/soc/mxs/mxs-saif.c                           |   28 ++-----------
 sound/soc/mxs/mxs-saif.h                           |    3 +-
 5 files changed, 20 insertions(+), 77 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mxs-saif.txt b/Documentation/devicetree/bindings/sound/mxs-saif.txt
index c37ba61..da221b4 100644
--- a/Documentation/devicetree/bindings/sound/mxs-saif.txt
+++ b/Documentation/devicetree/bindings/sound/mxs-saif.txt
@@ -3,8 +3,11 @@
 Required properties:
 - compatible: Should be "fsl,<chip>-saif"
 - reg: Should contain registers location and length
-- interrupts: Should contain ERROR and DMA interrupts
-- fsl,saif-dma-channel: APBX DMA channel for the SAIF
+- interrupts: Should contain ERROR interrupt number
+- dmas: DMA specifier, consisting of a phandle to DMA controller node
+  and SAIF DMA channel ID.
+  Refer to dma.txt and fsl-mxs-dma.txt for details.
+- dma-names: Must be "saif".
 
 Optional properties:
 - fsl,saif-master: phandle to the master SAIF.  It's only required for
@@ -23,14 +26,15 @@ aliases {
 saif0: saif@80042000 {
 	compatible = "fsl,imx28-saif";
 	reg = <0x80042000 2000>;
-	interrupts = <59 80>;
-	fsl,saif-dma-channel = <4>;
+	interrupts = <59>;
+	dmas = <&dma_apbx 4>;
+	dma-names = "saif";
 };
 
 saif1: saif@80046000 {
 	compatible = "fsl,imx28-saif";
 	reg = <0x80046000 2000>;
-	interrupts = <58 81>;
-	fsl,saif-dma-channel = <5>;
-	fsl,saif-master = <&saif0>;
+	interrupts = <58>;
+	dmas = <&dma_apbx 5>;
+	dma-names = "saif";
 };
diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c
index 564b5b6..74cb4b5 100644
--- a/sound/soc/mxs/mxs-pcm.c
+++ b/sound/soc/mxs/mxs-pcm.c
@@ -28,7 +28,6 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/dmaengine.h>
-#include <linux/fsl/mxs-dma.h>
 
 #include <sound/core.h>
 #include <sound/initval.h>
@@ -39,11 +38,6 @@
 
 #include "mxs-pcm.h"
 
-struct mxs_pcm_dma_data {
-	struct mxs_dma_data dma_data;
-	struct mxs_pcm_dma_params *dma_params;
-};
-
 static struct snd_pcm_hardware snd_mxs_hardware = {
 	.info			= SNDRV_PCM_INFO_MMAP |
 				  SNDRV_PCM_INFO_MMAP_VALID |
@@ -64,22 +58,6 @@ static struct snd_pcm_hardware snd_mxs_hardware = {
 
 };
 
-static bool filter(struct dma_chan *chan, void *param)
-{
-	struct mxs_pcm_dma_data *pcm_dma_data = param;
-	struct mxs_pcm_dma_params *dma_params = pcm_dma_data->dma_params;
-
-	if (!mxs_dma_is_apbx(chan))
-		return false;
-
-	if (chan->chan_id != dma_params->chan_num)
-		return false;
-
-	chan->private = &pcm_dma_data->dma_data;
-
-	return true;
-}
-
 static int snd_mxs_pcm_hw_params(struct snd_pcm_substream *substream,
 				struct snd_pcm_hw_params *params)
 {
@@ -91,35 +69,22 @@ static int snd_mxs_pcm_hw_params(struct snd_pcm_substream *substream,
 static int snd_mxs_open(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct mxs_pcm_dma_data *pcm_dma_data;
+	struct snd_dma_channel_params *params;
 	int ret;
 
-	pcm_dma_data = kzalloc(sizeof(*pcm_dma_data), GFP_KERNEL);
-	if (pcm_dma_data == NULL)
-		return -ENOMEM;
-
-	pcm_dma_data->dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
-	pcm_dma_data->dma_data.chan_irq = pcm_dma_data->dma_params->chan_irq;
-
-	ret = snd_dmaengine_pcm_open(substream, filter, pcm_dma_data);
-	if (ret) {
-		kfree(pcm_dma_data);
+	params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
+	ret = snd_dmaengine_pcm_open(substream, NULL, params);
+	if (ret)
 		return ret;
-	}
 
 	snd_soc_set_runtime_hwparams(substream, &snd_mxs_hardware);
 
-	snd_dmaengine_pcm_set_data(substream, pcm_dma_data);
-
 	return 0;
 }
 
 static int snd_mxs_close(struct snd_pcm_substream *substream)
 {
-	struct mxs_pcm_dma_data *pcm_dma_data = snd_dmaengine_pcm_get_data(substream);
-
 	snd_dmaengine_pcm_close(substream);
-	kfree(pcm_dma_data);
 
 	return 0;
 }
diff --git a/sound/soc/mxs/mxs-pcm.h b/sound/soc/mxs/mxs-pcm.h
index 35ba2ca..bc685b6 100644
--- a/sound/soc/mxs/mxs-pcm.h
+++ b/sound/soc/mxs/mxs-pcm.h
@@ -19,11 +19,6 @@
 #ifndef _MXS_PCM_H
 #define _MXS_PCM_H
 
-struct mxs_pcm_dma_params {
-	int chan_irq;
-	int chan_num;
-};
-
 int mxs_pcm_platform_register(struct device *dev);
 void mxs_pcm_platform_unregister(struct device *dev);
 
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 3a2aa1d..9f6abb8 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -26,7 +26,6 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/time.h>
-#include <linux/fsl/mxs-dma.h>
 #include <linux/pinctrl/consumer.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -659,7 +658,7 @@ static irqreturn_t mxs_saif_irq(int irq, void *dev_id)
 static int mxs_saif_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
-	struct resource *iores, *dmares;
+	struct resource *iores;
 	struct mxs_saif *saif;
 	struct pinctrl *pinctrl;
 	int ret = 0;
@@ -721,22 +720,6 @@ static int mxs_saif_probe(struct platform_device *pdev)
 	if (IS_ERR(saif->base))
 		return PTR_ERR(saif->base);
 
-	dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
-	if (!dmares) {
-		/*
-		 * TODO: This is a temporary solution and should be changed
-		 * to use generic DMA binding later when the helplers get in.
-		 */
-		ret = of_property_read_u32(np, "fsl,saif-dma-channel",
-					   &saif->dma_param.chan_num);
-		if (ret) {
-			dev_err(&pdev->dev, "failed to get dma channel\n");
-			return ret;
-		}
-	} else {
-		saif->dma_param.chan_num = dmares->start;
-	}
-
 	saif->irq = platform_get_irq(pdev, 0);
 	if (saif->irq < 0) {
 		ret = saif->irq;
@@ -753,13 +736,8 @@ static int mxs_saif_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	saif->dma_param.chan_irq = platform_get_irq(pdev, 1);
-	if (saif->dma_param.chan_irq < 0) {
-		ret = saif->dma_param.chan_irq;
-		dev_err(&pdev->dev, "failed to get dma irq resource: %d\n",
-			ret);
-		return ret;
-	}
+	saif->dma_param.dev = saif->dev;
+	saif->dma_param.name = "saif";
 
 	platform_set_drvdata(pdev, saif);
 
diff --git a/sound/soc/mxs/mxs-saif.h b/sound/soc/mxs/mxs-saif.h
index 3cb342e..32b4310 100644
--- a/sound/soc/mxs/mxs-saif.h
+++ b/sound/soc/mxs/mxs-saif.h
@@ -108,6 +108,7 @@
 
 #define MXS_SAIF_MCLK		0
 
+#include <sound/dmaengine_pcm.h>
 #include "mxs-pcm.h"
 
 struct mxs_saif {
@@ -117,7 +118,7 @@ struct mxs_saif {
 	unsigned int mclk_in_use;
 	void __iomem *base;
 	int irq;
-	struct mxs_pcm_dma_params dma_param;
+	struct snd_dma_channel_params dma_param;
 	unsigned int id;
 	unsigned int master_id;
 	unsigned int cur_rate;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 10/12] ASoC: mxs: move to use generic DMA helper
@ 2013-02-27 15:25   ` Shawn Guo
  0 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

With the generic DMA device tree helper supported by mxs-dma driver,
client devices only need to call dma_request_slave_channel() for
requesting a DMA channel from dmaengine.

Call snd_dmaengine_pcm_open() with NULL filter_fn, and having
parameters needed by dma_request_slave_channel() wrap into
snd_dma_channel_params and pass it in as filter_data, so that
dmaengine_pcm will call the helper rather than dma_request_channel()
to request DMA channel.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel at alsa-project.org
---
 .../devicetree/bindings/sound/mxs-saif.txt         |   18 ++++----
 sound/soc/mxs/mxs-pcm.c                            |   43 ++------------------
 sound/soc/mxs/mxs-pcm.h                            |    5 ---
 sound/soc/mxs/mxs-saif.c                           |   28 ++-----------
 sound/soc/mxs/mxs-saif.h                           |    3 +-
 5 files changed, 20 insertions(+), 77 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/mxs-saif.txt b/Documentation/devicetree/bindings/sound/mxs-saif.txt
index c37ba61..da221b4 100644
--- a/Documentation/devicetree/bindings/sound/mxs-saif.txt
+++ b/Documentation/devicetree/bindings/sound/mxs-saif.txt
@@ -3,8 +3,11 @@
 Required properties:
 - compatible: Should be "fsl,<chip>-saif"
 - reg: Should contain registers location and length
-- interrupts: Should contain ERROR and DMA interrupts
-- fsl,saif-dma-channel: APBX DMA channel for the SAIF
+- interrupts: Should contain ERROR interrupt number
+- dmas: DMA specifier, consisting of a phandle to DMA controller node
+  and SAIF DMA channel ID.
+  Refer to dma.txt and fsl-mxs-dma.txt for details.
+- dma-names: Must be "saif".
 
 Optional properties:
 - fsl,saif-master: phandle to the master SAIF.  It's only required for
@@ -23,14 +26,15 @@ aliases {
 saif0: saif at 80042000 {
 	compatible = "fsl,imx28-saif";
 	reg = <0x80042000 2000>;
-	interrupts = <59 80>;
-	fsl,saif-dma-channel = <4>;
+	interrupts = <59>;
+	dmas = <&dma_apbx 4>;
+	dma-names = "saif";
 };
 
 saif1: saif at 80046000 {
 	compatible = "fsl,imx28-saif";
 	reg = <0x80046000 2000>;
-	interrupts = <58 81>;
-	fsl,saif-dma-channel = <5>;
-	fsl,saif-master = <&saif0>;
+	interrupts = <58>;
+	dmas = <&dma_apbx 5>;
+	dma-names = "saif";
 };
diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c
index 564b5b6..74cb4b5 100644
--- a/sound/soc/mxs/mxs-pcm.c
+++ b/sound/soc/mxs/mxs-pcm.c
@@ -28,7 +28,6 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/dmaengine.h>
-#include <linux/fsl/mxs-dma.h>
 
 #include <sound/core.h>
 #include <sound/initval.h>
@@ -39,11 +38,6 @@
 
 #include "mxs-pcm.h"
 
-struct mxs_pcm_dma_data {
-	struct mxs_dma_data dma_data;
-	struct mxs_pcm_dma_params *dma_params;
-};
-
 static struct snd_pcm_hardware snd_mxs_hardware = {
 	.info			= SNDRV_PCM_INFO_MMAP |
 				  SNDRV_PCM_INFO_MMAP_VALID |
@@ -64,22 +58,6 @@ static struct snd_pcm_hardware snd_mxs_hardware = {
 
 };
 
-static bool filter(struct dma_chan *chan, void *param)
-{
-	struct mxs_pcm_dma_data *pcm_dma_data = param;
-	struct mxs_pcm_dma_params *dma_params = pcm_dma_data->dma_params;
-
-	if (!mxs_dma_is_apbx(chan))
-		return false;
-
-	if (chan->chan_id != dma_params->chan_num)
-		return false;
-
-	chan->private = &pcm_dma_data->dma_data;
-
-	return true;
-}
-
 static int snd_mxs_pcm_hw_params(struct snd_pcm_substream *substream,
 				struct snd_pcm_hw_params *params)
 {
@@ -91,35 +69,22 @@ static int snd_mxs_pcm_hw_params(struct snd_pcm_substream *substream,
 static int snd_mxs_open(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct mxs_pcm_dma_data *pcm_dma_data;
+	struct snd_dma_channel_params *params;
 	int ret;
 
-	pcm_dma_data = kzalloc(sizeof(*pcm_dma_data), GFP_KERNEL);
-	if (pcm_dma_data == NULL)
-		return -ENOMEM;
-
-	pcm_dma_data->dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
-	pcm_dma_data->dma_data.chan_irq = pcm_dma_data->dma_params->chan_irq;
-
-	ret = snd_dmaengine_pcm_open(substream, filter, pcm_dma_data);
-	if (ret) {
-		kfree(pcm_dma_data);
+	params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
+	ret = snd_dmaengine_pcm_open(substream, NULL, params);
+	if (ret)
 		return ret;
-	}
 
 	snd_soc_set_runtime_hwparams(substream, &snd_mxs_hardware);
 
-	snd_dmaengine_pcm_set_data(substream, pcm_dma_data);
-
 	return 0;
 }
 
 static int snd_mxs_close(struct snd_pcm_substream *substream)
 {
-	struct mxs_pcm_dma_data *pcm_dma_data = snd_dmaengine_pcm_get_data(substream);
-
 	snd_dmaengine_pcm_close(substream);
-	kfree(pcm_dma_data);
 
 	return 0;
 }
diff --git a/sound/soc/mxs/mxs-pcm.h b/sound/soc/mxs/mxs-pcm.h
index 35ba2ca..bc685b6 100644
--- a/sound/soc/mxs/mxs-pcm.h
+++ b/sound/soc/mxs/mxs-pcm.h
@@ -19,11 +19,6 @@
 #ifndef _MXS_PCM_H
 #define _MXS_PCM_H
 
-struct mxs_pcm_dma_params {
-	int chan_irq;
-	int chan_num;
-};
-
 int mxs_pcm_platform_register(struct device *dev);
 void mxs_pcm_platform_unregister(struct device *dev);
 
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 3a2aa1d..9f6abb8 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -26,7 +26,6 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/time.h>
-#include <linux/fsl/mxs-dma.h>
 #include <linux/pinctrl/consumer.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -659,7 +658,7 @@ static irqreturn_t mxs_saif_irq(int irq, void *dev_id)
 static int mxs_saif_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
-	struct resource *iores, *dmares;
+	struct resource *iores;
 	struct mxs_saif *saif;
 	struct pinctrl *pinctrl;
 	int ret = 0;
@@ -721,22 +720,6 @@ static int mxs_saif_probe(struct platform_device *pdev)
 	if (IS_ERR(saif->base))
 		return PTR_ERR(saif->base);
 
-	dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
-	if (!dmares) {
-		/*
-		 * TODO: This is a temporary solution and should be changed
-		 * to use generic DMA binding later when the helplers get in.
-		 */
-		ret = of_property_read_u32(np, "fsl,saif-dma-channel",
-					   &saif->dma_param.chan_num);
-		if (ret) {
-			dev_err(&pdev->dev, "failed to get dma channel\n");
-			return ret;
-		}
-	} else {
-		saif->dma_param.chan_num = dmares->start;
-	}
-
 	saif->irq = platform_get_irq(pdev, 0);
 	if (saif->irq < 0) {
 		ret = saif->irq;
@@ -753,13 +736,8 @@ static int mxs_saif_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	saif->dma_param.chan_irq = platform_get_irq(pdev, 1);
-	if (saif->dma_param.chan_irq < 0) {
-		ret = saif->dma_param.chan_irq;
-		dev_err(&pdev->dev, "failed to get dma irq resource: %d\n",
-			ret);
-		return ret;
-	}
+	saif->dma_param.dev = saif->dev;
+	saif->dma_param.name = "saif";
 
 	platform_set_drvdata(pdev, saif);
 
diff --git a/sound/soc/mxs/mxs-saif.h b/sound/soc/mxs/mxs-saif.h
index 3cb342e..32b4310 100644
--- a/sound/soc/mxs/mxs-saif.h
+++ b/sound/soc/mxs/mxs-saif.h
@@ -108,6 +108,7 @@
 
 #define MXS_SAIF_MCLK		0
 
+#include <sound/dmaengine_pcm.h>
 #include "mxs-pcm.h"
 
 struct mxs_saif {
@@ -117,7 +118,7 @@ struct mxs_saif {
 	unsigned int mclk_in_use;
 	void __iomem *base;
 	int irq;
-	struct mxs_pcm_dma_params dma_param;
+	struct snd_dma_channel_params dma_param;
 	unsigned int id;
 	unsigned int master_id;
 	unsigned int cur_rate;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 11/12] dma: mxs-dma: remove code left from generic DMA binding conversion
  2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
                   ` (9 preceding siblings ...)
  2013-02-27 15:25   ` Shawn Guo
@ 2013-02-27 15:25 ` Shawn Guo
  2013-02-27 15:25 ` [PATCH 12/12] ARM: dts: remove mxs-dma channel interrupt number from client nodes Shawn Guo
  2013-02-27 21:05 ` [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Arnd Bergmann
  12 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

With all mxs-dma clients moved to use generic DMA helper, the code
left from generic DMA binding conversion can be removed now.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/dma/mxs-dma.c       |   23 -----------------------
 include/linux/fsl/mxs-dma.h |   20 --------------------
 2 files changed, 43 deletions(-)
 delete mode 100644 include/linux/fsl/mxs-dma.h

diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index 4edf8e9..62b4ba1 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -23,7 +23,6 @@
 #include <linux/dmaengine.h>
 #include <linux/delay.h>
 #include <linux/module.h>
-#include <linux/fsl/mxs-dma.h>
 #include <linux/stmp_device.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -198,24 +197,6 @@ static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
 	return container_of(chan, struct mxs_dma_chan, chan);
 }
 
-int mxs_dma_is_apbh(struct dma_chan *chan)
-{
-	struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
-	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
-
-	return dma_is_apbh(mxs_dma);
-}
-EXPORT_SYMBOL_GPL(mxs_dma_is_apbh);
-
-int mxs_dma_is_apbx(struct dma_chan *chan)
-{
-	struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
-	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
-
-	return !dma_is_apbh(mxs_dma);
-}
-EXPORT_SYMBOL_GPL(mxs_dma_is_apbx);
-
 static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
 {
 	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
@@ -350,13 +331,9 @@ static irqreturn_t mxs_dma_int_handler(int irq, void *dev_id)
 static int mxs_dma_alloc_chan_resources(struct dma_chan *chan)
 {
 	struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
-	struct mxs_dma_data *data = chan->private;
 	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
 	int ret;
 
-	if (data)
-		mxs_chan->chan_irq = data->chan_irq;
-
 	mxs_chan->ccw = dma_alloc_coherent(mxs_dma->dma_device.dev,
 				CCW_BLOCK_SIZE, &mxs_chan->ccw_phys,
 				GFP_KERNEL);
diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
deleted file mode 100644
index 55d8702..0000000
--- a/include/linux/fsl/mxs-dma.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef __MACH_MXS_DMA_H__
-#define __MACH_MXS_DMA_H__
-
-#include <linux/dmaengine.h>
-
-struct mxs_dma_data {
-	int chan_irq;
-};
-
-extern int mxs_dma_is_apbh(struct dma_chan *chan);
-extern int mxs_dma_is_apbx(struct dma_chan *chan);
-#endif /* __MACH_MXS_DMA_H__ */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 12/12] ARM: dts: remove mxs-dma channel interrupt number from client nodes
  2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
                   ` (10 preceding siblings ...)
  2013-02-27 15:25 ` [PATCH 11/12] dma: mxs-dma: remove code left from generic DMA binding conversion Shawn Guo
@ 2013-02-27 15:25 ` Shawn Guo
  2013-02-27 21:05 ` [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Arnd Bergmann
  12 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-27 15:25 UTC (permalink / raw)
  To: linux-arm-kernel

With adopting generic DMA device tree binding, all mxs-dma channel
interrupt numbers are defined in DMA controller nodes, so they can be
removed from client nodes.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 arch/arm/boot/dts/imx23.dtsi   |   12 ++++++------
 arch/arm/boot/dts/imx28.dtsi   |   36 ++++++++++++++++++------------------
 arch/arm/boot/dts/imx6qdl.dtsi |    4 ++--
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 889a89a..1d5b0ac 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -72,8 +72,8 @@
 				#size-cells = <1>;
 				reg = <0x8000c000 0x2000>, <0x8000a000 0x2000>;
 				reg-names = "gpmi-nand", "bch";
-				interrupts = <13>, <56>;
-				interrupt-names = "gpmi-dma", "bch";
+				interrupts = <56>;
+				interrupt-names = "bch";
 				clocks = <&clks 34>;
 				clock-names = "gpmi_io";
 				dmas = <&dma_apbh 4>;
@@ -84,7 +84,7 @@
 
 			ssp0: ssp at 80010000 {
 				reg = <0x80010000 0x2000>;
-				interrupts = <15 14>;
+				interrupts = <15>;
 				clocks = <&clks 33>;
 				dmas = <&dma_apbh 1>;
 				dma-names = "ssp";
@@ -360,7 +360,7 @@
 
 			ssp1: ssp at 80034000 {
 				reg = <0x80034000 0x2000>;
-				interrupts = <2 20>;
+				interrupts = <2>;
 				clocks = <&clks 33>;
 				dmas = <&dma_apbh 2>;
 				dma-names = "ssp";
@@ -465,7 +465,7 @@
 			auart0: serial at 8006c000 {
 				compatible = "fsl,imx23-auart";
 				reg = <0x8006c000 0x2000>;
-				interrupts = <24 25 23>;
+				interrupts = <24>;
 				clocks = <&clks 32>;
 				dmas = <&dma_apbx 6>, <&dma_apbx 7>;
 				dma-names = "rx", "tx";
@@ -475,7 +475,7 @@
 			auart1: serial at 8006e000 {
 				compatible = "fsl,imx23-auart";
 				reg = <0x8006e000 0x2000>;
-				interrupts = <59 60 58>;
+				interrupts = <59>;
 				clocks = <&clks 32>;
 				dmas = <&dma_apbx 8>, <&dma_apbx 9>;
 				dma-names = "rx", "tx";
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index bb63d4e..79af54e 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -60,7 +60,7 @@
 
 			hsadc at 80002000 {
 				reg = <0x80002000 0x2000>;
-				interrupts = <13 87>;
+				interrupts = <13>;
 				dmas = <&dma_apbh 12>;
 				dma-names = "hsadc";
 				status = "disabled";
@@ -94,8 +94,8 @@
 				#size-cells = <1>;
 				reg = <0x8000c000 0x2000>, <0x8000a000 0x2000>;
 				reg-names = "gpmi-nand", "bch";
-				interrupts = <88>, <41>;
-				interrupt-names = "gpmi-dma", "bch";
+				interrupts = <41>;
+				interrupt-names = "bch";
 				clocks = <&clks 50>;
 				clock-names = "gpmi_io";
 				dmas = <&dma_apbh 4>;
@@ -108,7 +108,7 @@
 				#address-cells = <1>;
 				#size-cells = <0>;
 				reg = <0x80010000 0x2000>;
-				interrupts = <96 82>;
+				interrupts = <96>;
 				clocks = <&clks 46>;
 				dmas = <&dma_apbh 0>;
 				dma-names = "ssp";
@@ -120,7 +120,7 @@
 				#address-cells = <1>;
 				#size-cells = <0>;
 				reg = <0x80012000 0x2000>;
-				interrupts = <97 83>;
+				interrupts = <97>;
 				clocks = <&clks 47>;
 				dmas = <&dma_apbh 1>;
 				dma-names = "ssp";
@@ -132,7 +132,7 @@
 				#address-cells = <1>;
 				#size-cells = <0>;
 				reg = <0x80014000 0x2000>;
-				interrupts = <98 84>;
+				interrupts = <98>;
 				clocks = <&clks 48>;
 				dmas = <&dma_apbh 2>;
 				dma-names = "ssp";
@@ -144,7 +144,7 @@
 				#address-cells = <1>;
 				#size-cells = <0>;
 				reg = <0x80016000 0x2000>;
-				interrupts = <99 85>;
+				interrupts = <99>;
 				clocks = <&clks 49>;
 				dmas = <&dma_apbh 3>;
 				dma-names = "ssp";
@@ -720,7 +720,7 @@
 			lcdif at 80030000 {
 				compatible = "fsl,imx28-lcdif";
 				reg = <0x80030000 0x2000>;
-				interrupts = <38 86>;
+				interrupts = <38>;
 				clocks = <&clks 55>;
 				dmas = <&dma_apbh 13>;
 				dma-names = "lcdif";
@@ -797,7 +797,7 @@
 			saif0: saif at 80042000 {
 				compatible = "fsl,imx28-saif";
 				reg = <0x80042000 0x2000>;
-				interrupts = <59 80>;
+				interrupts = <59>;
 				clocks = <&clks 53>;
 				dmas = <&dma_apbx 4>;
 				dma-names = "saif";
@@ -813,7 +813,7 @@
 			saif1: saif at 80046000 {
 				compatible = "fsl,imx28-saif";
 				reg = <0x80046000 0x2000>;
-				interrupts = <58 81>;
+				interrupts = <58>;
 				clocks = <&clks 54>;
 				dmas = <&dma_apbx 5>;
 				dma-names = "saif";
@@ -831,7 +831,7 @@
 
 			spdif at 80054000 {
 				reg = <0x80054000 0x2000>;
-				interrupts = <45 66>;
+				interrupts = <45>;
 				dmas = <&dma_apbx 2>;
 				dma-names = "spdif";
 				status = "disabled";
@@ -848,7 +848,7 @@
 				#size-cells = <0>;
 				compatible = "fsl,imx28-i2c";
 				reg = <0x80058000 0x2000>;
-				interrupts = <111 68>;
+				interrupts = <111>;
 				clock-frequency = <100000>;
 				dmas = <&dma_apbx 6>;
 				dma-names = "i2c";
@@ -861,7 +861,7 @@
 				#size-cells = <0>;
 				compatible = "fsl,imx28-i2c";
 				reg = <0x8005a000 0x2000>;
-				interrupts = <110 69>;
+				interrupts = <110>;
 				clock-frequency = <100000>;
 				dmas = <&dma_apbx 7>;
 				dma-names = "i2c";
@@ -887,7 +887,7 @@
 			auart0: serial at 8006a000 {
 				compatible = "fsl,imx28-auart", "fsl,imx23-auart";
 				reg = <0x8006a000 0x2000>;
-				interrupts = <112 70 71>;
+				interrupts = <112>;
 				dmas = <&dma_apbx 8>, <&dma_apbx 9>;
 				dma-names = "rx", "tx";
 				fsl,auart-dma-channel = <8 9>;
@@ -898,7 +898,7 @@
 			auart1: serial at 8006c000 {
 				compatible = "fsl,imx28-auart", "fsl,imx23-auart";
 				reg = <0x8006c000 0x2000>;
-				interrupts = <113 72 73>;
+				interrupts = <113>;
 				dmas = <&dma_apbx 10>, <&dma_apbx 11>;
 				dma-names = "rx", "tx";
 				clocks = <&clks 45>;
@@ -908,7 +908,7 @@
 			auart2: serial at 8006e000 {
 				compatible = "fsl,imx28-auart", "fsl,imx23-auart";
 				reg = <0x8006e000 0x2000>;
-				interrupts = <114 74 75>;
+				interrupts = <114>;
 				dmas = <&dma_apbx 12>, <&dma_apbx 13>;
 				dma-names = "rx", "tx";
 				clocks = <&clks 45>;
@@ -918,7 +918,7 @@
 			auart3: serial at 80070000 {
 				compatible = "fsl,imx28-auart", "fsl,imx23-auart";
 				reg = <0x80070000 0x2000>;
-				interrupts = <115 76 77>;
+				interrupts = <115>;
 				dmas = <&dma_apbx 14>, <&dma_apbx 15>;
 				dma-names = "rx", "tx";
 				clocks = <&clks 45>;
@@ -928,7 +928,7 @@
 			auart4: serial at 80072000 {
 				compatible = "fsl,imx28-auart", "fsl,imx23-auart";
 				reg = <0x80072000 0x2000>;
-				interrupts = <116 78 79>;
+				interrupts = <116>;
 				dmas = <&dma_apbx 0>, <&dma_apbx 1>;
 				dma-names = "rx", "tx";
 				clocks = <&clks 45>;
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index ccdcb06..8abf2dc 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -81,8 +81,8 @@
 			#size-cells = <1>;
 			reg = <0x00112000 0x2000>, <0x00114000 0x2000>;
 			reg-names = "gpmi-nand", "bch";
-			interrupts = <0 13 0x04>, <0 15 0x04>;
-			interrupt-names = "gpmi-dma", "bch";
+			interrupts = <0 15 0x04>;
+			interrupt-names = "bch";
 			clocks = <&clks 152>, <&clks 153>, <&clks 151>,
 				 <&clks 150>, <&clks 149>;
 			clock-names = "gpmi_io", "gpmi_apb", "gpmi_bch",
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 01/12] ARM: dts: add generic DMA device tree binding for mxs-dma
  2013-02-27 15:25 ` [PATCH 01/12] ARM: dts: add generic DMA device tree binding for mxs-dma Shawn Guo
@ 2013-02-27 20:36   ` Arnd Bergmann
  2013-02-28  6:39     ` Shawn Guo
  0 siblings, 1 reply; 57+ messages in thread
From: Arnd Bergmann @ 2013-02-27 20:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 27 February 2013, Shawn Guo wrote:
> Add generic DMA device tree binding for mxs-dma.  The changes include:
> 
>  * Add channel interrupts into DMA controller nodes
>  * Add properties '#dma-cells' and 'dma-channels' for DMA controller nodes
>  * And properties 'dmas' and 'dma-names' for DMA client nodes
>  * Update mxs-dma device tree binding doc
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
>  .../devicetree/bindings/dma/fsl-mxs-dma.txt        |   49 +++++++++++++++--
>  arch/arm/boot/dts/imx23.dtsi                       |   42 +++++++++++++-
>  arch/arm/boot/dts/imx28.dtsi                       |   58 +++++++++++++++++++-
>  arch/arm/boot/dts/imx6qdl.dtsi                     |    8 ++-
>  4 files changed, 148 insertions(+), 9 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> index ded0398..a4873e5 100644
> --- a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> +++ b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt
> @@ -3,17 +3,58 @@
>  Required properties:
>  - compatible : Should be "fsl,<chip>-dma-apbh" or "fsl,<chip>-dma-apbx"
>  - reg : Should contain registers location and length
> +- interrupts : Should contain the interrupt numbers of DMA channels.
> +  If a channel is empty/reserved, 0 should be filled in place.
> +- #dma-cells : Must be <1>.  The number cell specifies the channel ID.
> +- dma-channels : Number of channels supported by the DMA controller
> +
> +Optional properties:
> +- interrupt-names : Name of DMA channel interrupts
>  


Looks good overall, just one small comment: The generic binding requires both
"dma-channels" and "dma-requests" to be listed here. My understanding of this
driver is that each channel is hardwired to one request, so you can mandate here
that the two values must be the same.

	Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 03/12] dma: mxs-dma: move to generic device tree binding
  2013-02-27 15:25 ` [PATCH 03/12] dma: mxs-dma: move to generic device tree binding Shawn Guo
@ 2013-02-27 20:50   ` Arnd Bergmann
  2013-02-28  7:24     ` Shawn Guo
  0 siblings, 1 reply; 57+ messages in thread
From: Arnd Bergmann @ 2013-02-27 20:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 27 February 2013, Shawn Guo wrote:
> @@ -139,6 +140,9 @@ struct mxs_dma_engine {
>  	struct dma_device		dma_device;
>  	struct device_dma_parameters	dma_parms;
>  	struct mxs_dma_chan		mxs_chans[MXS_DMA_CHANNELS];
> +	struct platform_device		*pdev;
> +	struct of_dma_filter_info	filter_info;
> +	unsigned int			nr_channels;
>  };

I don't think using of_dma_filter_info makes sense when we are not
using the generic xlate function:

> @@ -665,8 +667,59 @@ err_out:
>  	return ret;
>  }
>  
> +struct mxs_dma_filter_param {
> +	struct device_node *of_node;
> +	unsigned int chan_id;
> +};
> +
> +struct dma_chan *mxs_dma_xlate(struct of_phandle_args *dma_spec,
> +			       struct of_dma *ofdma)
> +{
> +	struct mxs_dma_engine *mxs_dma = ofdma->of_dma_data;
> +	struct of_dma_filter_info *info = &mxs_dma->filter_info;
> +	struct mxs_dma_filter_param param;
> +	int count = dma_spec->args_count;
> +
> +	if (!info || !info->filter_fn)
> +		return NULL;
> +
> +	if (count != 1)
> +		return NULL;
> +
> +	param.of_node = ofdma->of_node;
> +	param.chan_id = dma_spec->args[0];
> +
> +	if (param.chan_id >= mxs_dma->nr_channels)
> +		return NULL;
> +
> +	return dma_request_channel(info->dma_cap, info->filter_fn, &param);
> +}
> +
> +static bool mxs_dma_filter_fn(struct dma_chan *chan, void *fn_param)

You already know the value of info->filter_fn, it's always &mxs_dma_filter_fn,
so if you reorder these two functions, you can pass it directly into
dma_request_channel.

> +	struct mxs_dma_filter_param *param = fn_param;
> +	struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> +	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> +	int chan_irq;
> +
> +	if (mxs_dma->dma_device.dev->of_node != param->of_node)
> +		return false;
> +
> +	if (chan->chan_id != param->chan_id)
> +		return false;

It would be nice if we could just get a pointer to the right channel
structure from the xlate() function, rather than having to walk the
list of channels and trying each one. Your method is what everyone
else is doing as well, so we can stick with it for now, but at some
point I'd like to open up this discussion again.

	Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 04/12] mmc: mxs-mmc: move to use generic DMA helper
  2013-02-27 15:25   ` Shawn Guo
@ 2013-02-27 20:54     ` Arnd Bergmann
  -1 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2013-02-27 20:54 UTC (permalink / raw)
  To: Shawn Guo
  Cc: linux-arm-kernel, Vinod Koul, Marek Vasut, Fabio Estevam,
	Huang Shijie, Chris Ball, linux-mmc

On Wednesday 27 February 2013, Shawn Guo wrote:
>  Required properties:
>  - compatible: Should be "fsl,<chip>-mmc".  The supported chips include
>    imx23 and imx28.
> -- interrupts: Should contain ERROR and DMA interrupts
> -- fsl,ssp-dma-channel: APBH DMA channel for the SSP
> +- interrupts: Should contain ERROR interrupt number
> +- dmas: DMA specifier, consisting of a phandle to DMA controller node
> +  and SSP DMA channel ID.
> +  Refer to dma.txt and fsl-mxs-dma.txt for details.

I wonder if we should leave support for old device trees files around,
at least for a while. Your patch removes a lot of unnecessary code if
we decide not to worry about backwards compatibility here, but I could
imagine that we see a few surprises here.

> +- dma-names: Must be "ssp".

I would prefer calling this "data" rather than "ssp". The name only
has local significance in the ssp device, so calling the channel
"ssp" seems wrong.

	Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 04/12] mmc: mxs-mmc: move to use generic DMA helper
@ 2013-02-27 20:54     ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2013-02-27 20:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 27 February 2013, Shawn Guo wrote:
>  Required properties:
>  - compatible: Should be "fsl,<chip>-mmc".  The supported chips include
>    imx23 and imx28.
> -- interrupts: Should contain ERROR and DMA interrupts
> -- fsl,ssp-dma-channel: APBH DMA channel for the SSP
> +- interrupts: Should contain ERROR interrupt number
> +- dmas: DMA specifier, consisting of a phandle to DMA controller node
> +  and SSP DMA channel ID.
> +  Refer to dma.txt and fsl-mxs-dma.txt for details.

I wonder if we should leave support for old device trees files around,
at least for a while. Your patch removes a lot of unnecessary code if
we decide not to worry about backwards compatibility here, but I could
imagine that we see a few surprises here.

> +- dma-names: Must be "ssp".

I would prefer calling this "data" rather than "ssp". The name only
has local significance in the ssp device, so calling the channel
"ssp" seems wrong.

	Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 09/12] ASoC: dmaengine_pcm: support use of generic DMA helper
  2013-02-27 15:25   ` Shawn Guo
@ 2013-02-27 21:02     ` Arnd Bergmann
  -1 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2013-02-27 21:02 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Fabio Estevam, alsa-devel, Huang Shijie, Vinod Koul, Mark Brown,
	Marek Vasut, linux-arm-kernel

On Wednesday 27 February 2013, Shawn Guo wrote:
> With generic DMA device tree binding and helper function
> dma_request_slave_channel() in place, dmaengine_pcm should support
> that in requesting DMA channel for users that support generic DMA
> device tree binding.
> 
> Instead of inventing a new API, it defines the parameters needed by
> dma_request_slave_channel() into struct snd_dma_channel_params,
> interprets filter_data into snd_dma_channel_params, and calls the
> helper in case that dmaengine_pcm users pass in a NULL filter_fn.
> 
> Then, dmaengine_pcm users can call snd_dmaengine_pcm_open() with NULL
> filter_fn and snd_dma_channel_params being filter_data to direct the
> API to request DMA channel using generic DMA helper.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> Cc: alsa-devel@alsa-project.org

I would actually prefer having a new API in the soc-dmaengine-pcm
module, like

static int dmaengine_pcm_request_slave_channel(struct dmaengine_pcm_runtime_data *prtd,
						struct device *dev, const char *id);

For sound drivers that are fully converted to using DT, it would be
a more natural interface to use IMHO.

Your patch looks technically correct though, so it's up to Mark to decide
what he prefers.

	Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 09/12] ASoC: dmaengine_pcm: support use of generic DMA helper
@ 2013-02-27 21:02     ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2013-02-27 21:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 27 February 2013, Shawn Guo wrote:
> With generic DMA device tree binding and helper function
> dma_request_slave_channel() in place, dmaengine_pcm should support
> that in requesting DMA channel for users that support generic DMA
> device tree binding.
> 
> Instead of inventing a new API, it defines the parameters needed by
> dma_request_slave_channel() into struct snd_dma_channel_params,
> interprets filter_data into snd_dma_channel_params, and calls the
> helper in case that dmaengine_pcm users pass in a NULL filter_fn.
> 
> Then, dmaengine_pcm users can call snd_dmaengine_pcm_open() with NULL
> filter_fn and snd_dma_channel_params being filter_data to direct the
> API to request DMA channel using generic DMA helper.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> Cc: alsa-devel at alsa-project.org

I would actually prefer having a new API in the soc-dmaengine-pcm
module, like

static int dmaengine_pcm_request_slave_channel(struct dmaengine_pcm_runtime_data *prtd,
						struct device *dev, const char *id);

For sound drivers that are fully converted to using DT, it would be
a more natural interface to use IMHO.

Your patch looks technically correct though, so it's up to Mark to decide
what he prefers.

	Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding
  2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
                   ` (11 preceding siblings ...)
  2013-02-27 15:25 ` [PATCH 12/12] ARM: dts: remove mxs-dma channel interrupt number from client nodes Shawn Guo
@ 2013-02-27 21:05 ` Arnd Bergmann
  2013-02-28 19:20   ` Marek Vasut
  12 siblings, 1 reply; 57+ messages in thread
From: Arnd Bergmann @ 2013-02-27 21:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 27 February 2013, Shawn Guo wrote:
> The series converts mxs-dma and its clients to generic DMA device tree
> binding/helper.
> 
> Subsystem maintainers,
> 
> I need your ACKs to have the series go via arm-soc as a whole if the
> patches look good to you.

Great stuff!

I have a few smaller comments (my comments on patch 4 also apply to
a lot of the other ones), but I'm very happy with the conversion
overall.

	Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 01/12] ARM: dts: add generic DMA device tree binding for mxs-dma
  2013-02-27 20:36   ` Arnd Bergmann
@ 2013-02-28  6:39     ` Shawn Guo
  2013-02-28 10:48       ` Arnd Bergmann
  0 siblings, 1 reply; 57+ messages in thread
From: Shawn Guo @ 2013-02-28  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 08:36:04PM +0000, Arnd Bergmann wrote:
> Looks good overall, just one small comment: The generic binding requires both
> "dma-channels" and "dma-requests" to be listed here.

Hmm, what I read from Documentation/devicetree/bindings/dma/dma.txt is
that both dma-channels and dma-requests are optional properties.

Shawn

> My understanding of this
> driver is that each channel is hardwired to one request, so you can mandate here
> that the two values must be the same.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 03/12] dma: mxs-dma: move to generic device tree binding
  2013-02-27 20:50   ` Arnd Bergmann
@ 2013-02-28  7:24     ` Shawn Guo
  0 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-28  7:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 08:50:14PM +0000, Arnd Bergmann wrote:
> On Wednesday 27 February 2013, Shawn Guo wrote:
> > @@ -139,6 +140,9 @@ struct mxs_dma_engine {
> >  	struct dma_device		dma_device;
> >  	struct device_dma_parameters	dma_parms;
> >  	struct mxs_dma_chan		mxs_chans[MXS_DMA_CHANNELS];
> > +	struct platform_device		*pdev;
> > +	struct of_dma_filter_info	filter_info;
> > +	unsigned int			nr_channels;
> >  };
> 
> I don't think using of_dma_filter_info makes sense when we are not
> using the generic xlate function:
...
> > +static bool mxs_dma_filter_fn(struct dma_chan *chan, void *fn_param)
> 
> You already know the value of info->filter_fn, it's always &mxs_dma_filter_fn,
> so if you reorder these two functions, you can pass it directly into
> dma_request_channel.

Yeah, you're right.  I was blindly following the generic xlate example.
Thanks for spotting this.  Will fix it.

Shawn

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 09/12] ASoC: dmaengine_pcm: support use of generic DMA helper
  2013-02-27 21:02     ` Arnd Bergmann
@ 2013-02-28  8:09       ` Shawn Guo
  -1 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-28  8:09 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Fabio Estevam, alsa-devel, Huang Shijie, Vinod Koul, Mark Brown,
	Marek Vasut, linux-arm-kernel

On Wed, Feb 27, 2013 at 09:02:40PM +0000, Arnd Bergmann wrote:
> On Wednesday 27 February 2013, Shawn Guo wrote:
> > With generic DMA device tree binding and helper function
> > dma_request_slave_channel() in place, dmaengine_pcm should support
> > that in requesting DMA channel for users that support generic DMA
> > device tree binding.
> > 
> > Instead of inventing a new API, it defines the parameters needed by
> > dma_request_slave_channel() into struct snd_dma_channel_params,
> > interprets filter_data into snd_dma_channel_params, and calls the
> > helper in case that dmaengine_pcm users pass in a NULL filter_fn.
> > 
> > Then, dmaengine_pcm users can call snd_dmaengine_pcm_open() with NULL
> > filter_fn and snd_dma_channel_params being filter_data to direct the
> > API to request DMA channel using generic DMA helper.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> > Cc: alsa-devel@alsa-project.org
> 
> I would actually prefer having a new API in the soc-dmaengine-pcm
> module, like
> 
> static int dmaengine_pcm_request_slave_channel(struct dmaengine_pcm_runtime_data *prtd,
> 						struct device *dev, const char *id);
> 
> For sound drivers that are fully converted to using DT, it would be
> a more natural interface to use IMHO.
> 
Ok, let's do this.  While my patch saves a new API, it adds a new
struct anyway, which I'm not happy with.

Shawn

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 09/12] ASoC: dmaengine_pcm: support use of generic DMA helper
@ 2013-02-28  8:09       ` Shawn Guo
  0 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-28  8:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 09:02:40PM +0000, Arnd Bergmann wrote:
> On Wednesday 27 February 2013, Shawn Guo wrote:
> > With generic DMA device tree binding and helper function
> > dma_request_slave_channel() in place, dmaengine_pcm should support
> > that in requesting DMA channel for users that support generic DMA
> > device tree binding.
> > 
> > Instead of inventing a new API, it defines the parameters needed by
> > dma_request_slave_channel() into struct snd_dma_channel_params,
> > interprets filter_data into snd_dma_channel_params, and calls the
> > helper in case that dmaengine_pcm users pass in a NULL filter_fn.
> > 
> > Then, dmaengine_pcm users can call snd_dmaengine_pcm_open() with NULL
> > filter_fn and snd_dma_channel_params being filter_data to direct the
> > API to request DMA channel using generic DMA helper.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> > Cc: alsa-devel at alsa-project.org
> 
> I would actually prefer having a new API in the soc-dmaengine-pcm
> module, like
> 
> static int dmaengine_pcm_request_slave_channel(struct dmaengine_pcm_runtime_data *prtd,
> 						struct device *dev, const char *id);
> 
> For sound drivers that are fully converted to using DT, it would be
> a more natural interface to use IMHO.
> 
Ok, let's do this.  While my patch saves a new API, it adds a new
struct anyway, which I'm not happy with.

Shawn

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 04/12] mmc: mxs-mmc: move to use generic DMA helper
  2013-02-27 20:54     ` Arnd Bergmann
@ 2013-02-28  8:28       ` Shawn Guo
  -1 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-28  8:28 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Vinod Koul, Marek Vasut, Fabio Estevam,
	Huang Shijie, Chris Ball, linux-mmc

On Wed, Feb 27, 2013 at 08:54:18PM +0000, Arnd Bergmann wrote:
> On Wednesday 27 February 2013, Shawn Guo wrote:
> >  Required properties:
> >  - compatible: Should be "fsl,<chip>-mmc".  The supported chips include
> >    imx23 and imx28.
> > -- interrupts: Should contain ERROR and DMA interrupts
> > -- fsl,ssp-dma-channel: APBH DMA channel for the SSP
> > +- interrupts: Should contain ERROR interrupt number
> > +- dmas: DMA specifier, consisting of a phandle to DMA controller node
> > +  and SSP DMA channel ID.
> > +  Refer to dma.txt and fsl-mxs-dma.txt for details.
> 
> I wonder if we should leave support for old device trees files around,
> at least for a while. Your patch removes a lot of unnecessary code if
> we decide not to worry about backwards compatibility here, but I could
> imagine that we see a few surprises here.
> 
I'm less concerned by that at this point.  Though platform mxs has been
fully converted to device tree, device tree is still quite new for the
platform.  The incompatible device tree should be acceptable,
considering we have noticed that when adding the temporary DMA binding
for client devices.

/*
 * TODO: This is a temporary solution and should be changed
 * to use generic DMA binding later when the helper get in.
 */

Unless we have these TODO remarks leave in the tree forever, we will
break old device tree sooner or later anyway.  And I would have it
happen sooner than later.

And I would start thinking about maintaining the device tree
compatibility for mxs after generic DMA binding adoption.

> > +- dma-names: Must be "ssp".
> 
> I would prefer calling this "data" rather than "ssp". The name only
> has local significance in the ssp device, so calling the channel
> "ssp" seems wrong.
> 
Ok, will rename it per the use of the channel in the controller.

Shawn


^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 04/12] mmc: mxs-mmc: move to use generic DMA helper
@ 2013-02-28  8:28       ` Shawn Guo
  0 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-02-28  8:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 08:54:18PM +0000, Arnd Bergmann wrote:
> On Wednesday 27 February 2013, Shawn Guo wrote:
> >  Required properties:
> >  - compatible: Should be "fsl,<chip>-mmc".  The supported chips include
> >    imx23 and imx28.
> > -- interrupts: Should contain ERROR and DMA interrupts
> > -- fsl,ssp-dma-channel: APBH DMA channel for the SSP
> > +- interrupts: Should contain ERROR interrupt number
> > +- dmas: DMA specifier, consisting of a phandle to DMA controller node
> > +  and SSP DMA channel ID.
> > +  Refer to dma.txt and fsl-mxs-dma.txt for details.
> 
> I wonder if we should leave support for old device trees files around,
> at least for a while. Your patch removes a lot of unnecessary code if
> we decide not to worry about backwards compatibility here, but I could
> imagine that we see a few surprises here.
> 
I'm less concerned by that at this point.  Though platform mxs has been
fully converted to device tree, device tree is still quite new for the
platform.  The incompatible device tree should be acceptable,
considering we have noticed that when adding the temporary DMA binding
for client devices.

/*
 * TODO: This is a temporary solution and should be changed
 * to use generic DMA binding later when the helper get in.
 */

Unless we have these TODO remarks leave in the tree forever, we will
break old device tree sooner or later anyway.  And I would have it
happen sooner than later.

And I would start thinking about maintaining the device tree
compatibility for mxs after generic DMA binding adoption.

> > +- dma-names: Must be "ssp".
> 
> I would prefer calling this "data" rather than "ssp". The name only
> has local significance in the ssp device, so calling the channel
> "ssp" seems wrong.
> 
Ok, will rename it per the use of the channel in the controller.

Shawn

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
  2013-02-27 15:25   ` Shawn Guo
@ 2013-02-28  8:39     ` Huang Shijie
  -1 siblings, 0 replies; 57+ messages in thread
From: Huang Shijie @ 2013-02-28  8:39 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Fabio Estevam, Arnd Bergmann, Artem Bityutskiy, Vinod Koul,
	Marek Vasut, linux-mtd, linux-arm-kernel

于 2013年02月27日 23:25, Shawn Guo 写道:
> +++ b/Documentation/devicetree/bindings/mtd/gpmi-nand.txt
> @@ -7,10 +7,12 @@ Required properties:
>    - compatible : should be "fsl,<chip>-gpmi-nand"
>    - reg : should contain registers location and length for gpmi and bch.
>    - reg-names: Should contain the reg names "gpmi-nand" and "bch"
> -  - interrupts : The first is the DMA interrupt number for GPMI.
> -                 The second is the BCH interrupt number.
> -  - interrupt-names : The interrupt names "gpmi-dma", "bch";
> -  - fsl,gpmi-dma-channel : Should contain the dma channel it uses.
> +  - interrupts : BCH interrupt number.
> +  - interrupt-names : Should be "bch".
why split out the bch interrupt? It seems no use to do it.

thanks
Huang Shijie

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
@ 2013-02-28  8:39     ` Huang Shijie
  0 siblings, 0 replies; 57+ messages in thread
From: Huang Shijie @ 2013-02-28  8:39 UTC (permalink / raw)
  To: linux-arm-kernel

? 2013?02?27? 23:25, Shawn Guo ??:
> +++ b/Documentation/devicetree/bindings/mtd/gpmi-nand.txt
> @@ -7,10 +7,12 @@ Required properties:
>    - compatible : should be "fsl,<chip>-gpmi-nand"
>    - reg : should contain registers location and length for gpmi and bch.
>    - reg-names: Should contain the reg names "gpmi-nand" and "bch"
> -  - interrupts : The first is the DMA interrupt number for GPMI.
> -                 The second is the BCH interrupt number.
> -  - interrupt-names : The interrupt names "gpmi-dma", "bch";
> -  - fsl,gpmi-dma-channel : Should contain the dma channel it uses.
> +  - interrupts : BCH interrupt number.
> +  - interrupt-names : Should be "bch".
why split out the bch interrupt? It seems no use to do it.

thanks
Huang Shijie

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 01/12] ARM: dts: add generic DMA device tree binding for mxs-dma
  2013-02-28  6:39     ` Shawn Guo
@ 2013-02-28 10:48       ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2013-02-28 10:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 28 February 2013, Shawn Guo wrote:
> On Wed, Feb 27, 2013 at 08:36:04PM +0000, Arnd Bergmann wrote:
> > Looks good overall, just one small comment: The generic binding requires both
> > "dma-channels" and "dma-requests" to be listed here.
> 
> Hmm, what I read from Documentation/devicetree/bindings/dma/dma.txt is
> that both dma-channels and dma-requests are optional properties.
> 

Ah, you are right. Nevermind then.

	Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 04/12] mmc: mxs-mmc: move to use generic DMA helper
  2013-02-28  8:28       ` Shawn Guo
@ 2013-02-28 10:50         ` Arnd Bergmann
  -1 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2013-02-28 10:50 UTC (permalink / raw)
  To: Shawn Guo
  Cc: linux-arm-kernel, Vinod Koul, Marek Vasut, Fabio Estevam,
	Huang Shijie, Chris Ball, linux-mmc

On Thursday 28 February 2013, Shawn Guo wrote:
> On Wed, Feb 27, 2013 at 08:54:18PM +0000, Arnd Bergmann wrote:
> > On Wednesday 27 February 2013, Shawn Guo wrote:
> >
> > I wonder if we should leave support for old device trees files around,
> > at least for a while. Your patch removes a lot of unnecessary code if
> > we decide not to worry about backwards compatibility here, but I could
> > imagine that we see a few surprises here.
> > 
> I'm less concerned by that at this point.  Though platform mxs has been
> fully converted to device tree, device tree is still quite new for the
> platform.  The incompatible device tree should be acceptable,
> considering we have noticed that when adding the temporary DMA binding
> for client devices.
> 
> /*
>  * TODO: This is a temporary solution and should be changed
>  * to use generic DMA binding later when the helper get in.
>  */
> 
> Unless we have these TODO remarks leave in the tree forever, we will
> break old device tree sooner or later anyway.  And I would have it
> happen sooner than later.
> 
> And I would start thinking about maintaining the device tree
> compatibility for mxs after generic DMA binding adoption.

Right. It's your decision anyway, and removing the code as early
as possible has some advantages as well.

	Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 04/12] mmc: mxs-mmc: move to use generic DMA helper
@ 2013-02-28 10:50         ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2013-02-28 10:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 28 February 2013, Shawn Guo wrote:
> On Wed, Feb 27, 2013 at 08:54:18PM +0000, Arnd Bergmann wrote:
> > On Wednesday 27 February 2013, Shawn Guo wrote:
> >
> > I wonder if we should leave support for old device trees files around,
> > at least for a while. Your patch removes a lot of unnecessary code if
> > we decide not to worry about backwards compatibility here, but I could
> > imagine that we see a few surprises here.
> > 
> I'm less concerned by that at this point.  Though platform mxs has been
> fully converted to device tree, device tree is still quite new for the
> platform.  The incompatible device tree should be acceptable,
> considering we have noticed that when adding the temporary DMA binding
> for client devices.
> 
> /*
>  * TODO: This is a temporary solution and should be changed
>  * to use generic DMA binding later when the helper get in.
>  */
> 
> Unless we have these TODO remarks leave in the tree forever, we will
> break old device tree sooner or later anyway.  And I would have it
> happen sooner than later.
> 
> And I would start thinking about maintaining the device tree
> compatibility for mxs after generic DMA binding adoption.

Right. It's your decision anyway, and removing the code as early
as possible has some advantages as well.

	Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding
  2013-02-27 21:05 ` [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Arnd Bergmann
@ 2013-02-28 19:20   ` Marek Vasut
  0 siblings, 0 replies; 57+ messages in thread
From: Marek Vasut @ 2013-02-28 19:20 UTC (permalink / raw)
  To: linux-arm-kernel

Dear Arnd Bergmann,

> On Wednesday 27 February 2013, Shawn Guo wrote:
> > The series converts mxs-dma and its clients to generic DMA device tree
> > binding/helper.
> > 
> > Subsystem maintainers,
> > 
> > I need your ACKs to have the series go via arm-soc as a whole if the
> > patches look good to you.
> 
> Great stuff!
> 
> I have a few smaller comments (my comments on patch 4 also apply to
> a lot of the other ones), but I'm very happy with the conversion
> overall.
> 
> 	Arnd

So true, amazing stuff. I'm currently snowed by email, so I'll try reviewing 
only from version 2 on.

Thanks!

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
  2013-02-28  8:39     ` Huang Shijie
@ 2013-03-01  1:14       ` Shawn Guo
  -1 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-03-01  1:14 UTC (permalink / raw)
  To: Huang Shijie
  Cc: Fabio Estevam, Arnd Bergmann, Artem Bityutskiy, Vinod Koul,
	Marek Vasut, linux-mtd, linux-arm-kernel

On Thu, Feb 28, 2013 at 04:39:12PM +0800, Huang Shijie wrote:
> 于 2013年02月27日 23:25, Shawn Guo 写道:
> > +++ b/Documentation/devicetree/bindings/mtd/gpmi-nand.txt
> > @@ -7,10 +7,12 @@ Required properties:
> >    - compatible : should be "fsl,<chip>-gpmi-nand"
> >    - reg : should contain registers location and length for gpmi and bch.
> >    - reg-names: Should contain the reg names "gpmi-nand" and "bch"
> > -  - interrupts : The first is the DMA interrupt number for GPMI.
> > -                 The second is the BCH interrupt number.
> > -  - interrupt-names : The interrupt names "gpmi-dma", "bch";
> > -  - fsl,gpmi-dma-channel : Should contain the dma channel it uses.
> > +  - interrupts : BCH interrupt number.
> > +  - interrupt-names : Should be "bch".
> why split out the bch interrupt? It seems no use to do it.
> 
The real change here is to remove gpmi-dma interrupt, since we have all
dma interrupts defined in dma controller node.

Shawn

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
@ 2013-03-01  1:14       ` Shawn Guo
  0 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-03-01  1:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Feb 28, 2013 at 04:39:12PM +0800, Huang Shijie wrote:
> ? 2013?02?27? 23:25, Shawn Guo ??:
> > +++ b/Documentation/devicetree/bindings/mtd/gpmi-nand.txt
> > @@ -7,10 +7,12 @@ Required properties:
> >    - compatible : should be "fsl,<chip>-gpmi-nand"
> >    - reg : should contain registers location and length for gpmi and bch.
> >    - reg-names: Should contain the reg names "gpmi-nand" and "bch"
> > -  - interrupts : The first is the DMA interrupt number for GPMI.
> > -                 The second is the BCH interrupt number.
> > -  - interrupt-names : The interrupt names "gpmi-dma", "bch";
> > -  - fsl,gpmi-dma-channel : Should contain the dma channel it uses.
> > +  - interrupts : BCH interrupt number.
> > +  - interrupt-names : Should be "bch".
> why split out the bch interrupt? It seems no use to do it.
> 
The real change here is to remove gpmi-dma interrupt, since we have all
dma interrupts defined in dma controller node.

Shawn

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 09/12] ASoC: dmaengine_pcm: support use of generic DMA helper
  2013-02-27 21:02     ` Arnd Bergmann
@ 2013-03-01 10:23       ` Mark Brown
  -1 siblings, 0 replies; 57+ messages in thread
From: Mark Brown @ 2013-03-01 10:23 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Fabio Estevam, alsa-devel, Huang Shijie, Vinod Koul, Marek Vasut,
	Shawn Guo, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 408 bytes --]

On Wed, Feb 27, 2013 at 09:02:40PM +0000, Arnd Bergmann wrote:

> I would actually prefer having a new API in the soc-dmaengine-pcm
> module, like

> static int dmaengine_pcm_request_slave_channel(struct dmaengine_pcm_runtime_data *prtd,
> 						struct device *dev, const char *id);

> For sound drivers that are fully converted to using DT, it would be
> a more natural interface to use IMHO.

Yes, please.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 09/12] ASoC: dmaengine_pcm: support use of generic DMA helper
@ 2013-03-01 10:23       ` Mark Brown
  0 siblings, 0 replies; 57+ messages in thread
From: Mark Brown @ 2013-03-01 10:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 09:02:40PM +0000, Arnd Bergmann wrote:

> I would actually prefer having a new API in the soc-dmaengine-pcm
> module, like

> static int dmaengine_pcm_request_slave_channel(struct dmaengine_pcm_runtime_data *prtd,
> 						struct device *dev, const char *id);

> For sound drivers that are fully converted to using DT, it would be
> a more natural interface to use IMHO.

Yes, please.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130301/ddab8998/attachment.sig>

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 05/12] spi: mxs-spi: move to use generic DMA helper
  2013-02-27 15:25   ` Shawn Guo
@ 2013-03-02 23:17     ` Grant Likely
  -1 siblings, 0 replies; 57+ messages in thread
From: Grant Likely @ 2013-03-02 23:17 UTC (permalink / raw)
  To: Shawn Guo, linux-arm-kernel
  Cc: Fabio Estevam, Arnd Bergmann, Huang Shijie, Vinod Koul,
	Marek Vasut, spi-devel-general, Shawn Guo

On Wed, 27 Feb 2013 23:25:41 +0800, Shawn Guo <shawn.guo@linaro.org> wrote:
> With the generic DMA device tree helper supported by mxs-dma driver,
> client devices only need to call dma_request_slave_channel() for
> requesting a DMA channel from dmaengine.
> 
> Since mxs is a DT only platform now, along with the changes, the non-DT
> case handling in probe function also gets removed.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: spi-devel-general@lists.sourceforge.net

Acked-by: Grant Likely <grant.likely@secretlab.ca>

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 05/12] spi: mxs-spi: move to use generic DMA helper
@ 2013-03-02 23:17     ` Grant Likely
  0 siblings, 0 replies; 57+ messages in thread
From: Grant Likely @ 2013-03-02 23:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 27 Feb 2013 23:25:41 +0800, Shawn Guo <shawn.guo@linaro.org> wrote:
> With the generic DMA device tree helper supported by mxs-dma driver,
> client devices only need to call dma_request_slave_channel() for
> requesting a DMA channel from dmaengine.
> 
> Since mxs is a DT only platform now, along with the changes, the non-DT
> case handling in probe function also gets removed.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: spi-devel-general at lists.sourceforge.net

Acked-by: Grant Likely <grant.likely@secretlab.ca>

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 09/12] ASoC: dmaengine_pcm: support use of generic DMA helper
  2013-02-27 21:02     ` Arnd Bergmann
@ 2013-03-04  8:37       ` Shawn Guo
  -1 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-03-04  8:37 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Fabio Estevam, alsa-devel, Huang Shijie, Vinod Koul, Mark Brown,
	Marek Vasut, linux-arm-kernel

On Wed, Feb 27, 2013 at 09:02:40PM +0000, Arnd Bergmann wrote:
> On Wednesday 27 February 2013, Shawn Guo wrote:
> > With generic DMA device tree binding and helper function
> > dma_request_slave_channel() in place, dmaengine_pcm should support
> > that in requesting DMA channel for users that support generic DMA
> > device tree binding.
> > 
> > Instead of inventing a new API, it defines the parameters needed by
> > dma_request_slave_channel() into struct snd_dma_channel_params,
> > interprets filter_data into snd_dma_channel_params, and calls the
> > helper in case that dmaengine_pcm users pass in a NULL filter_fn.
> > 
> > Then, dmaengine_pcm users can call snd_dmaengine_pcm_open() with NULL
> > filter_fn and snd_dma_channel_params being filter_data to direct the
> > API to request DMA channel using generic DMA helper.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> > Cc: alsa-devel@alsa-project.org
> 
> I would actually prefer having a new API in the soc-dmaengine-pcm
> module, like
> 
> static int dmaengine_pcm_request_slave_channel(struct dmaengine_pcm_runtime_data *prtd,
> 						struct device *dev, const char *id);
> 
> For sound drivers that are fully converted to using DT, it would be
> a more natural interface to use IMHO.

Just to be clear, if we choose to have a new API, it's not the above
one but something like 

int snd_dmaengine_generic_pcm_open(struct snd_pcm_substream *substream,
                                   struct device *dev, const char *id)

as snd_dmaengine_pcm_open() is the interface to soc-dmaengine-pcm
clients, not dmaengine_pcm_request_channel().

Shawn

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 09/12] ASoC: dmaengine_pcm: support use of generic DMA helper
@ 2013-03-04  8:37       ` Shawn Guo
  0 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-03-04  8:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 09:02:40PM +0000, Arnd Bergmann wrote:
> On Wednesday 27 February 2013, Shawn Guo wrote:
> > With generic DMA device tree binding and helper function
> > dma_request_slave_channel() in place, dmaengine_pcm should support
> > that in requesting DMA channel for users that support generic DMA
> > device tree binding.
> > 
> > Instead of inventing a new API, it defines the parameters needed by
> > dma_request_slave_channel() into struct snd_dma_channel_params,
> > interprets filter_data into snd_dma_channel_params, and calls the
> > helper in case that dmaengine_pcm users pass in a NULL filter_fn.
> > 
> > Then, dmaengine_pcm users can call snd_dmaengine_pcm_open() with NULL
> > filter_fn and snd_dma_channel_params being filter_data to direct the
> > API to request DMA channel using generic DMA helper.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> > Cc: alsa-devel at alsa-project.org
> 
> I would actually prefer having a new API in the soc-dmaengine-pcm
> module, like
> 
> static int dmaengine_pcm_request_slave_channel(struct dmaengine_pcm_runtime_data *prtd,
> 						struct device *dev, const char *id);
> 
> For sound drivers that are fully converted to using DT, it would be
> a more natural interface to use IMHO.

Just to be clear, if we choose to have a new API, it's not the above
one but something like 

int snd_dmaengine_generic_pcm_open(struct snd_pcm_substream *substream,
                                   struct device *dev, const char *id)

as snd_dmaengine_pcm_open() is the interface to soc-dmaengine-pcm
clients, not dmaengine_pcm_request_channel().

Shawn

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
  2013-02-27 15:25   ` Shawn Guo
@ 2013-03-08 13:19     ` Artem Bityutskiy
  -1 siblings, 0 replies; 57+ messages in thread
From: Artem Bityutskiy @ 2013-03-08 13:19 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Fabio Estevam, Arnd Bergmann, Huang Shijie, Vinod Koul,
	Marek Vasut, linux-mtd, linux-arm-kernel

On Wed, 2013-02-27 at 23:25 +0800, Shawn Guo wrote:
> With the generic DMA device tree helper supported by mxs-dma driver,
> client devices only need to call dma_request_slave_channel() for
> requesting a DMA channel from dmaengine.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Artem Bityutskiy <dedekind1@gmail.com>
> Cc: linux-mtd@lists.infradead.org

It looks like this ne is rather independent and can go via the MTD tree.
So pushed this one to l2-mtd.git - let me know if I am confused. Thanks!

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
@ 2013-03-08 13:19     ` Artem Bityutskiy
  0 siblings, 0 replies; 57+ messages in thread
From: Artem Bityutskiy @ 2013-03-08 13:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2013-02-27 at 23:25 +0800, Shawn Guo wrote:
> With the generic DMA device tree helper supported by mxs-dma driver,
> client devices only need to call dma_request_slave_channel() for
> requesting a DMA channel from dmaengine.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Artem Bityutskiy <dedekind1@gmail.com>
> Cc: linux-mtd at lists.infradead.org

It looks like this ne is rather independent and can go via the MTD tree.
So pushed this one to l2-mtd.git - let me know if I am confused. Thanks!

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
  2013-03-08 13:19     ` Artem Bityutskiy
@ 2013-03-08 14:06       ` Arnd Bergmann
  -1 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2013-03-08 14:06 UTC (permalink / raw)
  To: dedekind1
  Cc: Fabio Estevam, Huang Shijie, Vinod Koul, Marek Vasut, linux-mtd,
	Shawn Guo, linux-arm-kernel

On Friday 08 March 2013, Artem Bityutskiy wrote:
> On Wed, 2013-02-27 at 23:25 +0800, Shawn Guo wrote:
> > With the generic DMA device tree helper supported by mxs-dma driver,
> > client devices only need to call dma_request_slave_channel() for
> > requesting a DMA channel from dmaengine.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Artem Bityutskiy <dedekind1@gmail.com>
> > Cc: linux-mtd@lists.infradead.org
> 
> It looks like this ne is rather independent and can go via the MTD tree.
> So pushed this one to l2-mtd.git - let me know if I am confused. Thanks!

I think you should not apply this patch on a tree that does not already
have the first three patches in the series. The easiest way would be
to keep the series together. As an alternative, Shawn could create a
git branch with those three patches and let you (and the other subsystem
maintainers) pull that branch in before applying the subsystem specific
patch.

	Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
@ 2013-03-08 14:06       ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2013-03-08 14:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 08 March 2013, Artem Bityutskiy wrote:
> On Wed, 2013-02-27 at 23:25 +0800, Shawn Guo wrote:
> > With the generic DMA device tree helper supported by mxs-dma driver,
> > client devices only need to call dma_request_slave_channel() for
> > requesting a DMA channel from dmaengine.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Artem Bityutskiy <dedekind1@gmail.com>
> > Cc: linux-mtd at lists.infradead.org
> 
> It looks like this ne is rather independent and can go via the MTD tree.
> So pushed this one to l2-mtd.git - let me know if I am confused. Thanks!

I think you should not apply this patch on a tree that does not already
have the first three patches in the series. The easiest way would be
to keep the series together. As an alternative, Shawn could create a
git branch with those three patches and let you (and the other subsystem
maintainers) pull that branch in before applying the subsystem specific
patch.

	Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
  2013-03-08 13:19     ` Artem Bityutskiy
@ 2013-03-08 16:26       ` Huang Shijie
  -1 siblings, 0 replies; 57+ messages in thread
From: Huang Shijie @ 2013-03-08 16:26 UTC (permalink / raw)
  To: dedekind1
  Cc: Fabio Estevam, Arnd Bergmann, Marek Vasut, Vinod Koul,
	Huang Shijie, linux-mtd, Shawn Guo, linux-arm-kernel

On Fri, Mar 8, 2013 at 8:19 AM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> On Wed, 2013-02-27 at 23:25 +0800, Shawn Guo wrote:
>> With the generic DMA device tree helper supported by mxs-dma driver,
>> client devices only need to call dma_request_slave_channel() for
>> requesting a DMA channel from dmaengine.
>>
>> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
>> Cc: Artem Bityutskiy <dedekind1@gmail.com>
>> Cc: linux-mtd@lists.infradead.org
>
> It looks like this ne is rather independent and can go via the MTD tree.
> So pushed this one to l2-mtd.git - let me know if I am confused. Thanks!
I suggest do not apply this patch. the whole patch set is still under
review now.

Best Regards
Huang Shijie

>
> --
> Best Regards,
> Artem Bityutskiy
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
@ 2013-03-08 16:26       ` Huang Shijie
  0 siblings, 0 replies; 57+ messages in thread
From: Huang Shijie @ 2013-03-08 16:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 8, 2013 at 8:19 AM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> On Wed, 2013-02-27 at 23:25 +0800, Shawn Guo wrote:
>> With the generic DMA device tree helper supported by mxs-dma driver,
>> client devices only need to call dma_request_slave_channel() for
>> requesting a DMA channel from dmaengine.
>>
>> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
>> Cc: Artem Bityutskiy <dedekind1@gmail.com>
>> Cc: linux-mtd at lists.infradead.org
>
> It looks like this ne is rather independent and can go via the MTD tree.
> So pushed this one to l2-mtd.git - let me know if I am confused. Thanks!
I suggest do not apply this patch. the whole patch set is still under
review now.

Best Regards
Huang Shijie

>
> --
> Best Regards,
> Artem Bityutskiy
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
  2013-03-08 13:19     ` Artem Bityutskiy
@ 2013-03-11  3:03       ` Shawn Guo
  -1 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-03-11  3:03 UTC (permalink / raw)
  To: Artem Bityutskiy
  Cc: Fabio Estevam, Arnd Bergmann, Huang Shijie, Vinod Koul,
	Marek Vasut, linux-mtd, linux-arm-kernel

Artem,

On Fri, Mar 08, 2013 at 03:19:45PM +0200, Artem Bityutskiy wrote:
> On Wed, 2013-02-27 at 23:25 +0800, Shawn Guo wrote:
> > With the generic DMA device tree helper supported by mxs-dma driver,
> > client devices only need to call dma_request_slave_channel() for
> > requesting a DMA channel from dmaengine.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Artem Bityutskiy <dedekind1@gmail.com>
> > Cc: linux-mtd@lists.infradead.org
> 
> It looks like this ne is rather independent and can go via the MTD tree.
> So pushed this one to l2-mtd.git - let me know if I am confused. Thanks!

First of all, there is a new version (v2) of the patch (series) to
address review comments.

Secondly, as Arnd pointed it out, you shouldn't apply this single
patch, because it depends on the first 3 patches in the series to
work.  Applying this single patch will result in a non-functional
gpmi driver.

As I mentioned in the cover letter, I prefer to have your ACK on
the patch to merge the series through arm-soc tree as a whole.  If
you insist that you merge the patch through your tree, I can also
create a topic branch containing the first 3 patches, as Arnd suggests.
Please just let me know.

Shawn

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
@ 2013-03-11  3:03       ` Shawn Guo
  0 siblings, 0 replies; 57+ messages in thread
From: Shawn Guo @ 2013-03-11  3:03 UTC (permalink / raw)
  To: linux-arm-kernel

Artem,

On Fri, Mar 08, 2013 at 03:19:45PM +0200, Artem Bityutskiy wrote:
> On Wed, 2013-02-27 at 23:25 +0800, Shawn Guo wrote:
> > With the generic DMA device tree helper supported by mxs-dma driver,
> > client devices only need to call dma_request_slave_channel() for
> > requesting a DMA channel from dmaengine.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Artem Bityutskiy <dedekind1@gmail.com>
> > Cc: linux-mtd at lists.infradead.org
> 
> It looks like this ne is rather independent and can go via the MTD tree.
> So pushed this one to l2-mtd.git - let me know if I am confused. Thanks!

First of all, there is a new version (v2) of the patch (series) to
address review comments.

Secondly, as Arnd pointed it out, you shouldn't apply this single
patch, because it depends on the first 3 patches in the series to
work.  Applying this single patch will result in a non-functional
gpmi driver.

As I mentioned in the cover letter, I prefer to have your ACK on
the patch to merge the series through arm-soc tree as a whole.  If
you insist that you merge the patch through your tree, I can also
create a topic branch containing the first 3 patches, as Arnd suggests.
Please just let me know.

Shawn

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
  2013-03-08 14:06       ` Arnd Bergmann
@ 2013-03-11  7:32         ` Artem Bityutskiy
  -1 siblings, 0 replies; 57+ messages in thread
From: Artem Bityutskiy @ 2013-03-11  7:32 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Fabio Estevam, Huang Shijie, Vinod Koul, Marek Vasut, linux-mtd,
	Shawn Guo, linux-arm-kernel

On Fri, 2013-03-08 at 14:06 +0000, Arnd Bergmann wrote:
> On Friday 08 March 2013, Artem Bityutskiy wrote:
> > On Wed, 2013-02-27 at 23:25 +0800, Shawn Guo wrote:
> > > With the generic DMA device tree helper supported by mxs-dma driver,
> > > client devices only need to call dma_request_slave_channel() for
> > > requesting a DMA channel from dmaengine.
> > > 
> > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > > Cc: Artem Bityutskiy <dedekind1@gmail.com>
> > > Cc: linux-mtd@lists.infradead.org
> > 
> > It looks like this ne is rather independent and can go via the MTD tree.
> > So pushed this one to l2-mtd.git - let me know if I am confused. Thanks!
> 
> I think you should not apply this patch on a tree that does not already
> have the first three patches in the series. The easiest way would be
> to keep the series together. As an alternative, Shawn could create a
> git branch with those three patches and let you (and the other subsystem
> maintainers) pull that branch in before applying the subsystem specific
> patch.

OK, this one looked independent to me. Anyway, dropped it and for this
one:

Acked-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 07/12] mtd: gpmi: move to use generic DMA helper
@ 2013-03-11  7:32         ` Artem Bityutskiy
  0 siblings, 0 replies; 57+ messages in thread
From: Artem Bityutskiy @ 2013-03-11  7:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 2013-03-08 at 14:06 +0000, Arnd Bergmann wrote:
> On Friday 08 March 2013, Artem Bityutskiy wrote:
> > On Wed, 2013-02-27 at 23:25 +0800, Shawn Guo wrote:
> > > With the generic DMA device tree helper supported by mxs-dma driver,
> > > client devices only need to call dma_request_slave_channel() for
> > > requesting a DMA channel from dmaengine.
> > > 
> > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > > Cc: Artem Bityutskiy <dedekind1@gmail.com>
> > > Cc: linux-mtd at lists.infradead.org
> > 
> > It looks like this ne is rather independent and can go via the MTD tree.
> > So pushed this one to l2-mtd.git - let me know if I am confused. Thanks!
> 
> I think you should not apply this patch on a tree that does not already
> have the first three patches in the series. The easiest way would be
> to keep the series together. As an alternative, Shawn could create a
> git branch with those three patches and let you (and the other subsystem
> maintainers) pull that branch in before applying the subsystem specific
> patch.

OK, this one looked independent to me. Anyway, dropped it and for this
one:

Acked-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2013-03-11  7:32 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-27 15:25 [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
2013-02-27 15:25 ` [PATCH 01/12] ARM: dts: add generic DMA device tree binding for mxs-dma Shawn Guo
2013-02-27 20:36   ` Arnd Bergmann
2013-02-28  6:39     ` Shawn Guo
2013-02-28 10:48       ` Arnd Bergmann
2013-02-27 15:25 ` [PATCH 02/12] dma: mxs-dma: use devm_* managed functions Shawn Guo
2013-02-27 15:25 ` [PATCH 03/12] dma: mxs-dma: move to generic device tree binding Shawn Guo
2013-02-27 20:50   ` Arnd Bergmann
2013-02-28  7:24     ` Shawn Guo
2013-02-27 15:25 ` [PATCH 04/12] mmc: mxs-mmc: move to use generic DMA helper Shawn Guo
2013-02-27 15:25   ` Shawn Guo
2013-02-27 20:54   ` Arnd Bergmann
2013-02-27 20:54     ` Arnd Bergmann
2013-02-28  8:28     ` Shawn Guo
2013-02-28  8:28       ` Shawn Guo
2013-02-28 10:50       ` Arnd Bergmann
2013-02-28 10:50         ` Arnd Bergmann
2013-02-27 15:25 ` [PATCH 05/12] spi: mxs-spi: " Shawn Guo
2013-02-27 15:25   ` Shawn Guo
2013-03-02 23:17   ` Grant Likely
2013-03-02 23:17     ` Grant Likely
     [not found] ` <1361978748-25281-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-02-27 15:25   ` [PATCH 06/12] i2c: i2c-mxs: " Shawn Guo
2013-02-27 15:25     ` Shawn Guo
2013-02-27 15:25 ` [PATCH 07/12] mtd: gpmi: " Shawn Guo
2013-02-27 15:25   ` Shawn Guo
2013-02-28  8:39   ` Huang Shijie
2013-02-28  8:39     ` Huang Shijie
2013-03-01  1:14     ` Shawn Guo
2013-03-01  1:14       ` Shawn Guo
2013-03-08 13:19   ` Artem Bityutskiy
2013-03-08 13:19     ` Artem Bityutskiy
2013-03-08 14:06     ` Arnd Bergmann
2013-03-08 14:06       ` Arnd Bergmann
2013-03-11  7:32       ` Artem Bityutskiy
2013-03-11  7:32         ` Artem Bityutskiy
2013-03-08 16:26     ` Huang Shijie
2013-03-08 16:26       ` Huang Shijie
2013-03-11  3:03     ` Shawn Guo
2013-03-11  3:03       ` Shawn Guo
2013-02-27 15:25 ` [PATCH 08/12] serial: mxs-auart: " Shawn Guo
2013-02-27 15:25   ` Shawn Guo
2013-02-27 15:25 ` [PATCH 09/12] ASoC: dmaengine_pcm: support use of " Shawn Guo
2013-02-27 15:25   ` Shawn Guo
2013-02-27 21:02   ` Arnd Bergmann
2013-02-27 21:02     ` Arnd Bergmann
2013-02-28  8:09     ` Shawn Guo
2013-02-28  8:09       ` Shawn Guo
2013-03-01 10:23     ` Mark Brown
2013-03-01 10:23       ` Mark Brown
2013-03-04  8:37     ` Shawn Guo
2013-03-04  8:37       ` Shawn Guo
2013-02-27 15:25 ` [PATCH 10/12] ASoC: mxs: move to use " Shawn Guo
2013-02-27 15:25   ` Shawn Guo
2013-02-27 15:25 ` [PATCH 11/12] dma: mxs-dma: remove code left from generic DMA binding conversion Shawn Guo
2013-02-27 15:25 ` [PATCH 12/12] ARM: dts: remove mxs-dma channel interrupt number from client nodes Shawn Guo
2013-02-27 21:05 ` [PATCH 00/12] ARM: mxs: move to generic DMA device tree binding Arnd Bergmann
2013-02-28 19:20   ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.