Skip to contentSkip to conversation

I2C:OMAP: fix status ack

PATCH New Nishanth Menon 1 participant 1 message Jun 25, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 I2C:OMAP: fix status ack

I2C status ack for [RX]RDR and [RX]RDY could cause race conditions of clearing the event twice and a violation of the programing sequence as defined in TRM This patch fixes the same.

Issue identified by Jagadeesh Pakaravoor and Ulrik Bech Hald.

---
 drivers/i2c/busses/i2c-omap.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-omap.c +8 -1
index ece0125..0db0051 100644
@@ -651,7 +651,14 @@ omap_i2c_isr(int this_irq, void *dev_id)
 			break;
 		}
 
-		omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat);
+		/*
+		 * Ack the stat in one go, but [rx]dr and [rx]rdy should be
+		 * acked after the data operation is complete.
+		 * Ref: TRM SWPU114Q Figure 18-31
+		 */
+		omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat &
+				~(OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR |
+				OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
 
 		err = 0;
 		if (stat & OMAP_I2C_STAT_NACK) {
Signature · 1 line
1.5.4.3