linux-i2c.vger.kernel.org archive mirror
 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
       [not found] ` <1362486244-24593-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  2013-03-05 19:39 ` [PATCH v2 00/12] ARM: mxs: move to generic DMA device tree binding Arnd Bergmann
  0 siblings, 2 replies; 4+ 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] 4+ messages in thread

* [PATCH v2 06/12] i2c: i2c-mxs: move to use generic DMA helper
       [not found] ` <1362486244-24593-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2013-03-05 12:23   ` Shawn Guo
       [not found]     ` <1362486244-24593-7-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Shawn Guo @ 2013-03-05 12:23 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 <wsa-z923LK4zBo2bacvFa/9K2g@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..4e1c8ac 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 "rx-tx".
 
 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 = "rx-tx";
 };
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 120f246..d1ba6b4 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, "rx-tx");
 	if (!i2c->dmach) {
 		dev_err(dev, "Failed to request dma\n");
 		return -ENODEV;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ 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
       [not found] ` <1362486244-24593-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2013-03-05 19:39 ` Arnd Bergmann
  1 sibling, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2013-03-05 19:39 UTC (permalink / raw)
  To: Shawn Guo
  Cc: linux-arm-kernel, Vinod Koul, Marek Vasut, Fabio Estevam,
	Huang Shijie, Mark Brown, Greg Kroah-Hartman, Artem Bityutskiy,
	Wolfram Sang, Chris Ball, alsa-devel, linux-serial, linux-mtd,
	linux-i2c, linux-mmc

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] 4+ messages in thread

* Re: [PATCH v2 06/12] i2c: i2c-mxs: move to use generic DMA helper
       [not found]     ` <1362486244-24593-7-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2013-03-21 11:07       ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2013-03-21 11:07 UTC (permalink / raw)
  To: Shawn Guo
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Vinod Koul,
	Arnd Bergmann, Marek Vasut, Fabio Estevam, Huang Shijie,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Tue, Mar 05, 2013 at 08:23:58PM +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-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
> Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Yay, DMA helpers \o/ Assuming the helpers work, for the i2c driver:

Acked-by: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>

Thanks for doing this!

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

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

Thread overview: 4+ 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
     [not found] ` <1362486244-24593-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-03-05 12:23   ` [PATCH v2 06/12] i2c: i2c-mxs: move to use generic DMA helper Shawn Guo
     [not found]     ` <1362486244-24593-7-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-03-21 11:07       ` Wolfram Sang
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;
as well as URLs for NNTP newsgroup(s).