Commit ccfc866356674cb3a61829d239c685af6e85f197
Committed by
Wolfram Sang
1 parent
d39f77b06a
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
i2c: omap: fix i207 errata handling
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-by: Felipe Balbi <balbi@ti.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Showing 1 changed file with 5 additions and 3 deletions Side-by-side Diff
drivers/i2c/busses/i2c-omap.c
... | ... | @@ -952,11 +952,13 @@ |
952 | 952 | if (dev->fifo_size) |
953 | 953 | num_bytes = dev->buf_len; |
954 | 954 | |
955 | - omap_i2c_receive_data(dev, num_bytes, true); | |
956 | - | |
957 | - if (dev->errata & I2C_OMAP_ERRATA_I207) | |
955 | + if (dev->errata & I2C_OMAP_ERRATA_I207) { | |
958 | 956 | i2c_omap_errata_i207(dev, stat); |
957 | + num_bytes = (omap_i2c_read_reg(dev, | |
958 | + OMAP_I2C_BUFSTAT_REG) >> 8) & 0x3F; | |
959 | + } | |
959 | 960 | |
961 | + omap_i2c_receive_data(dev, num_bytes, true); | |
960 | 962 | omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RDR); |
961 | 963 | continue; |
962 | 964 | } |