mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: "fugang.duan@freescale.com" <fugang.duan@freescale.com>
Cc: Yao Yuan <yao.yuan@freescale.com>,
	"wsa@the-dreams.de" <wsa@the-dreams.de>,
	"marex@denx.de" <marex@denx.de>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"shawn.guo@linaro.org" <shawn.guo@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"Frank.Li@freescale.com" <Frank.Li@freescale.com>
Subject: Re: [PATCH v6 1/2] i2c: imx: add DMA support for freescale i2c driver
Date: Thu, 7 Aug 2014 15:18:42 +0200	[thread overview]
Message-ID: <20140807151842.1dddaf24@ipc1.ka-ro> (raw)
In-Reply-To: <6537011f698c4c7faaf5b66b870afbd2@BLUPR03MB373.namprd03.prod.outlook.com>

Hi,

fugang.duan@freescale.com wrote:
> From: Yuan Yao-B46683 Data: Thursday, August 07, 2014 4:05 PM
> >To: Duan Fugang-B38611; wsa@the-dreams.de; marex@denx.de
> >Cc: LW@KARO-electronics.de; mark.rutland@arm.com; shawn.guo@linaro.org;
> >linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> >i2c@vger.kernel.org; Li Frank-B20596
> >Subject: RE: [PATCH v6 1/2] i2c: imx: add DMA support for freescale i2c
> >driver
> >
> >Hi Fugang,
> >
> >> >> >+	/* Waiting for Transfer complete. */
> >> >> >+	while (timeout--) {
> >> >> >+		temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2SR);
> >> >> >+		if (temp & I2SR_ICF)
> >> >> >+			break;
> >> >> >+		udelay(10);
> >> >> >+	}
> >> >> Whether there have better method like interrupt to avoid dead wait
> >> >> here until timeout ?
> >> >
> >> >Can you give me more suggestion? We have discussed it with our team,
> >> >It seems the short query wait is necessary.
> >> >
> >> At least, you can use schdule_timeout() instead of udelay() ?
> >
> >In fact, the waiting time normally is less than 10-50us, but the minimum
> >time interval for schdule_timeout() is 1 jiffies.
> >So maybe schdule_timeout() is not very necessary?
> >
> Oh, if the waiting time is 10 ~ 50us, you can use usleep_range(10, 50).
>
The loop is not meant to generate a certain delay, but to wait for some
HW flag to change within a certain time frame. So usleep_range() is
rather inadequate here!


But looking a little closer at the function, the timeout value seems to
be rather bogus to me. The loop counter 'timeout' is initialized from 
the constant IMX_I2C_DMA_TIMEOUT which is also used in
|wait_for_completion_interruptible_timeout(
|                               &i2c_imx->dma->cmd_complete,
|                               msecs_to_jiffies(IMX_I2C_DMA_TIMEOUT));
 				                 ^^^^^^^^^^^^^^^^^^^
as a number of milliseconds to wait for DMA completion.


Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________

  reply	other threads:[~2014-08-07 13:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05  9:56 [PATCH v6 0/2] " Yuan Yao
2014-08-05  9:56 ` [PATCH v6 1/2] " Yuan Yao
2014-08-05 11:48   ` Varka Bhadram
2014-08-06  2:26     ` Yao Yuan
2014-08-06  7:20       ` Wolfram Sang
2014-08-06  2:33   ` fugang.duan
2014-08-06  7:06     ` Yao Yuan
2014-08-07  5:28       ` fugang.duan
2014-08-07  8:04         ` Yao Yuan
2014-08-07 10:01           ` fugang.duan
2014-08-07 13:18             ` Lothar Waßmann [this message]
2014-08-05  9:56 ` [PATCH v6 2/2] Documentation:add " Yuan Yao

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=20140807151842.1dddaf24@ipc1.ka-ro \
    --to=lw@karo-electronics.de \
    --cc=Frank.Li@freescale.com \
    --cc=fugang.duan@freescale.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=mark.rutland@arm.com \
    --cc=shawn.guo@linaro.org \
    --cc=wsa@the-dreams.de \
    --cc=yao.yuan@freescale.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®