lkml.org 
[lkml]   [2014]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] i2c: omap: fix i207 errata handling
On Fri, Nov 21, 2014 at 04:16:51AM +0400, Alexander Kochetkov wrote:
> commit 6d9939f651419a63e091105663821f9c7d3fec37 (i2c: omap: split out [XR]DR
> and [XR]RDY) changed the way how errata i207 (I2C: RDR Flag May Be Incorrectly
> Set) get handled. 6d9939f6514 code doesn't correspond to workaround provided by
> errata.
>
> According to errata ISR must filter out spurious RDR before data read not after.
> ISR must read RXSTAT to get number of bytes available to read. Because RDR
> could be set while there could no data in the receive FIFO.
>
> Restored pre 6d9939f6514 way of handling errata.
>
> Found by code review. Real impact haven't seen.
> Tested on Beagleboard XM C.
>
> Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
> Fixes: 6d9939f651419a63e09110 i2c: omap: split out [XR]DR and [XR]RDY

Tested on BBB and AM437x Starter Kit

Tested-by: Felipe Balbi <balbi@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>

> ---
> drivers/i2c/busses/i2c-omap.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 90dcc2e..e7cbcb0 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -958,11 +958,13 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
> if (dev->fifo_size)
> num_bytes = dev->buf_len;
>
> - omap_i2c_receive_data(dev, num_bytes, true);
> -
> - if (dev->errata & I2C_OMAP_ERRATA_I207)
> + if (dev->errata & I2C_OMAP_ERRATA_I207) {
> i2c_omap_errata_i207(dev, stat);
> + num_bytes = (omap_i2c_read_reg(dev,
> + OMAP_I2C_BUFSTAT_REG) >> 8) & 0x3F;
> + }
>
> + omap_i2c_receive_data(dev, num_bytes, true);
> omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RDR);
> continue;
> }
> --
> 1.7.9.5
>

--
balbi
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-11-21 17:42    [W:0.077 / U:2.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site