Skip to content

Commit

Permalink
i2c: omap: fix i207 errata handling
Browse files Browse the repository at this point in the history
commit 6d9939f (i2c: omap: split out [XR]DR
and [XR]RDY) changed the way how errata i207 (I2C: RDR Flag May Be Incorrectly
Set) get handled. 6d9939f 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 6d9939f way of handling errata.

Found by code review. Real impact haven't seen.
Tested on Beagleboard XM C.

Signed-off-by: Alexander Kochetkov <[email protected]>
Fixes: 6d9939f i2c: omap: split out [XR]DR and [XR]RDY
Tested-by: Felipe Balbi <[email protected]>
Reviewed-by: Felipe Balbi <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>
  • Loading branch information
akochetkov authored and Wolfram Sang committed Nov 22, 2014
1 parent d39f77b commit ccfc866
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/i2c/busses/i2c-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,11 +952,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;
}
Expand Down

0 comments on commit ccfc866

Please sign in to comment.