[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130409092836.GG21818@intel.com>
Date: Tue, 9 Apr 2013 12:28:36 +0300
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: Wolfram Sang <wsa@...-dreams.de>
Cc: linux-kernel@...r.kernel.org, linux-i2c@...r.kernel.org,
ben-linux@...ff.org, Jean Delvare <khali@...ux-fr.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Christian Ruppert <christian.ruppert@...lis.com>
Subject: Re: [5/7] i2c-designware: enable/disable the controller properly
On Tue, Apr 09, 2013 at 11:09:14AM +0200, Wolfram Sang wrote:
>
> > +static void __i2c_dw_enable(struct dw_i2c_dev *dev, bool enable)
> > +{
> > + int timeout = 100;
> > +
> > + do {
> > + dw_writel(dev, enable, DW_IC_ENABLE);
> > + if ((dw_readl(dev, DW_IC_ENABLE_STATUS) & 1) == enable)
> > + return;
> > +
> > + usleep_range(25, 250);
>
> This would wait 25ms max. Is there a timeout value specified in the docs?
The datasheet says something like:
1. Define a timer interval (t_i2c_poll) equal 10 times the highest
signaling period. For 400kHz this is 25us.
2. Define max timeout parameter, MAX_T_POLL_COUNT, such that if any
repeated operation exeeds this maximum, an error is reported.
In this case I have:
t_i2c_poll = 25 (to 250 us)
MAX_T_POLL_COUNT = 100
> > + } while (timeout-- > 0);
>
> while (timeout--)?
OK, thanks.
--
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