All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>,
	Shawn Guo <shawn.guo-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"Detlev Zundel" <dzu-ynQEQJNshbs@public.gmane.org>,
	"Dong Aisheng" <b29396-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	"Fabio Estevam"
	<fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	"Linux ARM kernel"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"Sascha Hauer" <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	"Stefano Babic" <sbabic-ynQEQJNshbs@public.gmane.org>,
	"Uwe Kleine-König"
	<u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	"Wolfgang Denk" <wd-ynQEQJNshbs@public.gmane.org>
Subject: Re: [PATCH 2/2 V3] MXS: Implement DMA support into mxs-i2c
Date: Fri, 13 Jul 2012 10:22:49 +0200	[thread overview]
Message-ID: <20120713082249.GF32184@pengutronix.de> (raw)
In-Reply-To: <1341850974-11977-2-git-send-email-marex-ynQEQJNshbs@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 4009 bytes --]

Hi,

On Mon, Jul 09, 2012 at 06:22:54PM +0200, Marek Vasut wrote:
> This patch implements DMA support into mxs-i2c. DMA transfers are now enabled
> via DT. The DMA operation is enabled by default.
> 
> Signed-off-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
> Cc: Detlev Zundel <dzu-ynQEQJNshbs@public.gmane.org>
> CC: Dong Aisheng <b29396-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> CC: Fabio Estevam <fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> Cc: Linux ARM kernel <linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
> Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> CC: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> CC: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Stefano Babic <sbabic-ynQEQJNshbs@public.gmane.org>
> CC: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Wolfgang Denk <wd-ynQEQJNshbs@public.gmane.org>
> Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/i2c/i2c-mxs.txt |    5 +
>  arch/arm/boot/dts/imx28.dtsi                      |    2 +
>  drivers/i2c/busses/i2c-mxs.c                      |  267 +++++++++++++++++++--
>  3 files changed, 252 insertions(+), 22 deletions(-)
> 
> V2: Fixed return value from mxs_i2c_dma_setup_xfer().
>     Fixed coding style nitpicks
>     Call mxs_i2c_dma_finish() in failpath only if DMA is active
> V3: Align with changes in previous patch
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mxs.txt b/Documentation/devicetree/bindings/i2c/i2c-mxs.txt
> index 30ac3a0..45b6307 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-mxs.txt
> +++ b/Documentation/devicetree/bindings/i2c/i2c-mxs.txt
> @@ -6,6 +6,10 @@ Required properties:
>  - interrupts: Should contain ERROR and DMA interrupts
>  - 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
> +
> +Optional properties:
> +- fsl,use-pio: Use PIO transfers instead of DMA, useful for debug

Having PIOQUEUE (not PIO) as a fallback is good. I'd rather like to see
this as a module parameter, though. For one reason, this is not a
hardware property or board specific, so not a good device tree property.
Also, it is implicitly deprecated somehow since either we want DMA to
fully work or, even better, somewhen be able to automatically switch
between PIOQUEUE and DMA depending on the i2c_msg size. Deprecated
properties are also troublesome. Third, we don't really need this per
instance, if somebody really has problems with DMA, it will apply to all
i2c busses. Makes sense?

>  
>  Examples:
>  
> @@ -16,4 +20,5 @@ i2c0: i2c@80058000 {
>  	reg = <0x80058000 2000>;
>  	interrupts = <111 68>;
>  	clock-frequency = <100000>;
> +	fsl,i2c-dma-channel = <6>;
>  };

> +	/*
> +	 * The MXS I2C DMA mode is prefered and enabled by default.
> +	 * The PIO mode is still supported, but should be used only

PIOQUEUE

> +	 * for debuging purposes etc.
> +	 */
> +	i2c->dma_mode = 1;
> +	if (of_find_property(node, "fsl,use-pio", NULL)) {
> +		i2c->dma_mode = 0;
> +		dev_info(dev, "Using PIO mode for I2C transfers!\n");
> +	}
> +
> +	/*
> +	 * TODO: This is a temporary solution and should be changed
> +	 * to use generic DMA binding later when the helpers get in.
> +	 */

@Shawn: Any idea when this is going to happen? And why do we need this?
AFAICT it will be always channel 6/7 on mx28?

> +	ret = of_property_read_u32(node, "fsl,i2c-dma-channel",
> +				   &i2c->dma_channel);
> +	if (ret) {
> +		dev_warn(dev, "Failed to get DMA channel!\n");
> +		i2c->dma_mode = 0;
> +	}
> +

Rest looks good, thanks!

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: w.sang@pengutronix.de (Wolfram Sang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2 V3] MXS: Implement DMA support into mxs-i2c
Date: Fri, 13 Jul 2012 10:22:49 +0200	[thread overview]
Message-ID: <20120713082249.GF32184@pengutronix.de> (raw)
In-Reply-To: <1341850974-11977-2-git-send-email-marex@denx.de>

Hi,

On Mon, Jul 09, 2012 at 06:22:54PM +0200, Marek Vasut wrote:
> This patch implements DMA support into mxs-i2c. DMA transfers are now enabled
> via DT. The DMA operation is enabled by default.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Detlev Zundel <dzu@denx.de>
> CC: Dong Aisheng <b29396@freescale.com>
> CC: Fabio Estevam <fabio.estevam@freescale.com>
> Cc: Linux ARM kernel <linux-arm-kernel@lists.infradead.org>
> Cc: linux-i2c at vger.kernel.org
> CC: Sascha Hauer <s.hauer@pengutronix.de>
> CC: Shawn Guo <shawn.guo@linaro.org>
> Cc: Stefano Babic <sbabic@denx.de>
> CC: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Wolfram Sang <w.sang@pengutronix.de>
> ---
>  Documentation/devicetree/bindings/i2c/i2c-mxs.txt |    5 +
>  arch/arm/boot/dts/imx28.dtsi                      |    2 +
>  drivers/i2c/busses/i2c-mxs.c                      |  267 +++++++++++++++++++--
>  3 files changed, 252 insertions(+), 22 deletions(-)
> 
> V2: Fixed return value from mxs_i2c_dma_setup_xfer().
>     Fixed coding style nitpicks
>     Call mxs_i2c_dma_finish() in failpath only if DMA is active
> V3: Align with changes in previous patch
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mxs.txt b/Documentation/devicetree/bindings/i2c/i2c-mxs.txt
> index 30ac3a0..45b6307 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-mxs.txt
> +++ b/Documentation/devicetree/bindings/i2c/i2c-mxs.txt
> @@ -6,6 +6,10 @@ Required properties:
>  - interrupts: Should contain ERROR and DMA interrupts
>  - 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
> +
> +Optional properties:
> +- fsl,use-pio: Use PIO transfers instead of DMA, useful for debug

Having PIOQUEUE (not PIO) as a fallback is good. I'd rather like to see
this as a module parameter, though. For one reason, this is not a
hardware property or board specific, so not a good device tree property.
Also, it is implicitly deprecated somehow since either we want DMA to
fully work or, even better, somewhen be able to automatically switch
between PIOQUEUE and DMA depending on the i2c_msg size. Deprecated
properties are also troublesome. Third, we don't really need this per
instance, if somebody really has problems with DMA, it will apply to all
i2c busses. Makes sense?

>  
>  Examples:
>  
> @@ -16,4 +20,5 @@ i2c0: i2c at 80058000 {
>  	reg = <0x80058000 2000>;
>  	interrupts = <111 68>;
>  	clock-frequency = <100000>;
> +	fsl,i2c-dma-channel = <6>;
>  };

> +	/*
> +	 * The MXS I2C DMA mode is prefered and enabled by default.
> +	 * The PIO mode is still supported, but should be used only

PIOQUEUE

> +	 * for debuging purposes etc.
> +	 */
> +	i2c->dma_mode = 1;
> +	if (of_find_property(node, "fsl,use-pio", NULL)) {
> +		i2c->dma_mode = 0;
> +		dev_info(dev, "Using PIO mode for I2C transfers!\n");
> +	}
> +
> +	/*
> +	 * TODO: This is a temporary solution and should be changed
> +	 * to use generic DMA binding later when the helpers get in.
> +	 */

@Shawn: Any idea when this is going to happen? And why do we need this?
AFAICT it will be always channel 6/7 on mx28?

> +	ret = of_property_read_u32(node, "fsl,i2c-dma-channel",
> +				   &i2c->dma_channel);
> +	if (ret) {
> +		dev_warn(dev, "Failed to get DMA channel!\n");
> +		i2c->dma_mode = 0;
> +	}
> +

Rest looks good, thanks!

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120713/622a36fd/attachment-0001.sig>

  parent reply	other threads:[~2012-07-13  8:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-09 16:22 [PATCH 1/2 V3] MXS: Set I2C timing registers for mxs-i2c Marek Vasut
2012-07-09 16:22 ` Marek Vasut
     [not found] ` <1341850974-11977-1-git-send-email-marex-ynQEQJNshbs@public.gmane.org>
2012-07-09 16:22   ` [PATCH 2/2 V3] MXS: Implement DMA support into mxs-i2c Marek Vasut
2012-07-09 16:22     ` Marek Vasut
     [not found]     ` <1341850974-11977-2-git-send-email-marex-ynQEQJNshbs@public.gmane.org>
2012-07-13  8:22       ` Wolfram Sang [this message]
2012-07-13  8:22         ` Wolfram Sang
     [not found]         ` <20120713082249.GF32184-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-07-13 12:10           ` Marek Vasut
2012-07-13 12:10             ` Marek Vasut
     [not found]             ` <201207131410.29469.marex-ynQEQJNshbs@public.gmane.org>
2012-07-14 11:29               ` Wolfram Sang
2012-07-14 11:29                 ` Wolfram Sang
     [not found]                 ` <20120714112929.GB29529-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-07-14 12:09                   ` Marek Vasut
2012-07-14 12:09                     ` Marek Vasut
     [not found]                     ` <201207141409.38554.marex-ynQEQJNshbs@public.gmane.org>
2012-07-16 10:21                       ` Wolfram Sang
2012-07-16 10:21                         ` Wolfram Sang
     [not found]                         ` <20120716102151.GC17435-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-07-16 13:06                           ` Marek Vasut
2012-07-16 13:06                             ` Marek Vasut
     [not found]                             ` <201207161506.08147.marex-ynQEQJNshbs@public.gmane.org>
2012-07-16 13:25                               ` Wolfram Sang
2012-07-16 13:25                                 ` Wolfram Sang
2012-07-15  8:17           ` Shawn Guo
2012-07-15  8:17             ` Shawn Guo
     [not found]             ` <20120715081715.GA2429-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2012-07-21 12:44               ` Wolfram Sang
2012-07-21 12:44                 ` Wolfram Sang
     [not found]                 ` <20120721124406.GA9946-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-07-21 14:11                   ` Marek Vasut
2012-07-21 14:11                     ` Marek Vasut
     [not found]                     ` <201207211611.58956.marex-ynQEQJNshbs@public.gmane.org>
2012-07-21 15:41                       ` Wolfram Sang
2012-07-21 15:41                         ` Wolfram Sang
     [not found]                         ` <20120721154153.GA25874-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-07-21 15:54                           ` Marek Vasut
2012-07-21 15:54                             ` Marek Vasut
     [not found]                             ` <201207211754.29372.marex-ynQEQJNshbs@public.gmane.org>
2012-07-22  8:33                               ` Wolfram Sang
2012-07-22  8:33                                 ` Wolfram Sang
2012-07-28  8:02                   ` Shawn Guo
2012-07-28  8:02                     ` Shawn Guo
2012-07-13  8:07   ` [PATCH 1/2 V3] MXS: Set I2C timing registers for mxs-i2c Wolfram Sang
2012-07-13  8:07     ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120713082249.GF32184@pengutronix.de \
    --to=w.sang-bicnvbalz9megne8c9+irq@public.gmane.org \
    --cc=b29396-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=dzu-ynQEQJNshbs@public.gmane.org \
    --cc=fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=marex-ynQEQJNshbs@public.gmane.org \
    --cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=sbabic-ynQEQJNshbs@public.gmane.org \
    --cc=shawn.guo-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=wd-ynQEQJNshbs@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.