public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2 00/12] ARM: mxs: move to generic DMA device tree binding
@ 2013-03-05 12:23 Shawn Guo
  2013-03-05 12:23 ` [PATCH v2 07/12] mtd: gpmi: move to use generic DMA helper Shawn Guo
  2013-03-05 19:39 ` [PATCH v2 00/12] ARM: mxs: move to generic DMA device tree binding Arnd Bergmann
  0 siblings, 2 replies; 3+ messages in thread
From: Shawn Guo @ 2013-03-05 12:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fabio Estevam, alsa-devel, Chris Ball, linux-serial,
	Arnd Bergmann, Huang Shijie, Vinod Koul, Greg Kroah-Hartman,
	Mark Brown, linux-mmc, Artem Bityutskiy, Marek Vasut, linux-mtd,
	linux-i2c, Wolfram Sang, Shawn Guo

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

I published a branch below to ease people who is willing to help
testing the series.

 git://git.linaro.org/people/shawnguo/linux-2.6.git devel/mxs-dma-dt

Changes since v1:
 - Remove the use of of_dma_filter_info which should not be needed by
   a customized xlate function
 - Correct dma-names to have it mean the channel function in client
   devices
 - Add a new dmaengine_pcm API snd_dmaengine_generic_pcm_open() for
   users that support generic DMA device tree binding
 - Remove the old fsl,<module>-dma-channel properties from device tree

Subsystem maintainers,

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

Thanks,
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: add snd_dmaengine_generic_pcm_open()
  ASoC: mxs: move to use generic DMA helper
  dma: mxs-dma: remove code left from generic DMA binding conversion
  ARM: dts: remove old DMA binding data 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                       |   57 +++++++--
 arch/arm/boot/dts/imx28.dtsi                       |  104 +++++++++++-----
 arch/arm/boot/dts/imx6qdl.dtsi                     |   12 +-
 drivers/dma/mxs-dma.c                              |  128 +++++++++++---------
 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                      |    2 +
 sound/soc/mxs/mxs-pcm.c                            |   42 +------
 sound/soc/mxs/mxs-pcm.h                            |    5 -
 sound/soc/mxs/mxs-saif.c                           |   28 +----
 sound/soc/mxs/mxs-saif.h                           |    1 -
 sound/soc/soc-dmaengine-pcm.c                      |   39 ++++++
 25 files changed, 368 insertions(+), 464 deletions(-)
 delete mode 100644 include/linux/fsl/mxs-dma.h

-- 
1.7.9.5

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

* [PATCH v2 07/12] mtd: gpmi: move to use generic DMA helper
  2013-03-05 12:23 [PATCH v2 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
@ 2013-03-05 12:23 ` Shawn Guo
  2013-03-05 19:39 ` [PATCH v2 00/12] ARM: mxs: move to generic DMA device tree binding Arnd Bergmann
  1 sibling, 0 replies; 3+ messages in thread
From: Shawn Guo @ 2013-03-05 12:23 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..551b2a1 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 "rx-tx".
 
 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 = "rx-tx";
 
 	partition@0 {
 	...
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 717881a..25ecfa1 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, "rx-tx");
 	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] 3+ messages in thread

* Re: [PATCH v2 00/12] ARM: mxs: move to generic DMA device tree binding
  2013-03-05 12:23 [PATCH v2 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
  2013-03-05 12:23 ` [PATCH v2 07/12] mtd: gpmi: move to use generic DMA helper Shawn Guo
@ 2013-03-05 19:39 ` Arnd Bergmann
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2013-03-05 19:39 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Fabio Estevam, alsa-devel, linux-serial, Huang Shijie, Vinod Koul,
	Greg Kroah-Hartman, Mark Brown, linux-mmc, Artem Bityutskiy,
	Marek Vasut, linux-mtd, linux-i2c, Wolfram Sang, Chris Ball,
	linux-arm-kernel

On Tuesday 05 March 2013, Shawn Guo wrote:
> The series converts mxs-dma and its clients to generic DMA device tree
> binding/helper.
> 
> I published a branch below to ease people who is willing to help
> testing the series.

Looks all good, aside from the bug I found in the first patch.

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

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

end of thread, other threads:[~2013-03-05 19:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-05 12:23 [PATCH v2 00/12] ARM: mxs: move to generic DMA device tree binding Shawn Guo
2013-03-05 12:23 ` [PATCH v2 07/12] mtd: gpmi: move to use generic DMA helper Shawn Guo
2013-03-05 19:39 ` [PATCH v2 00/12] ARM: mxs: move to generic DMA device tree binding Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox