[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140807151842.1dddaf24@ipc1.ka-ro>
Date: Thu, 7 Aug 2014 15:18:42 +0200
From: Lothar Waßmann <LW@...O-electronics.de>
To: "fugang.duan@...escale.com" <fugang.duan@...escale.com>
Cc: Yao Yuan <yao.yuan@...escale.com>,
"wsa@...-dreams.de" <wsa@...-dreams.de>,
"marex@...x.de" <marex@...x.de>,
"mark.rutland@....com" <mark.rutland@....com>,
"shawn.guo@...aro.org" <shawn.guo@...aro.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"Frank.Li@...escale.com" <Frank.Li@...escale.com>
Subject: Re: [PATCH v6 1/2] i2c: imx: add DMA support for freescale i2c
driver
Hi,
fugang.duan@...escale.com wrote:
> From: Yuan Yao-B46683 Data: Thursday, August 07, 2014 4:05 PM
> >To: Duan Fugang-B38611; wsa@...-dreams.de; marex@...x.de
> >Cc: LW@...O-electronics.de; mark.rutland@....com; shawn.guo@...aro.org;
> >linux-kernel@...r.kernel.org; linux-arm-kernel@...ts.infradead.org; linux-
> >i2c@...r.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@...o-electronics.de
___________________________________________________________
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists