Skip to content

Commit

Permalink
i2c-omap: Fix I2C status ACK
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
  • Loading branch information
Nishanth Menon authored and Ben Dooks committed Aug 20, 2009
1 parent 64f1607 commit dcc4ec2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/i2c/busses/i2c-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,14 @@ omap_i2c_isr(int this_irq, void *dev_id)

err = 0;
complete:
omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat);
/*
* Ack the stat in one go, but [R/X]DR and [R/X]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));

if (stat & OMAP_I2C_STAT_NACK) {
err |= OMAP_I2C_STAT_NACK;
Expand Down

0 comments on commit dcc4ec2

Please sign in to comment.