aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorGrygorii Strashko <grygorii.strashko@ti.com>2013-06-07 14:46:07 -0400
committerWolfram Sang <wsa@the-dreams.de>2013-08-19 08:08:19 -0400
commitcda2109a26eb6fa58acfeae878eed87492480eae (patch)
tree4dce2af0e318dd77b33f0c279d8be066def96409 /drivers/i2c
parent869c6a3ededbb108b03a11a7c9d4c8a4fb607063 (diff)
i2c: omap: query STP always when NACK is received
According to I2C specification the NACK should be handled as folowing: "When SDA remains HIGH during this ninth clock pulse, this is defined as the Not Acknowledge signal. The master can then gene rate either a STOP condition to abort the transfer, or a repeated START condition to start a new transfer." [http://www.nxp.com/documents/user_manual/UM10204.pdf] The same is recomened by TI I2C wiki: http://processors.wiki.ti.com/index.php/I2C_Tips Currently, the OMAP I2C driver interrupts I2C trunsfer in case of NACK, but It queries Stop condition OMAP_I2C_CON_REG.STP=1 only if NACK has been received during the last message transmitting/recieving. This may lead to stuck Bus in "Bus Busy" until I2C IP reset (idle/enable). Hence, fix it by querying Stop condition (STP) always when NACK is received. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Hein Tibosch <hein_tibosch@yahoo.es> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-omap.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index d09512e4f488..c6db76ec5a22 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -615,11 +615,10 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
615 if (dev->cmd_err & OMAP_I2C_STAT_NACK) { 615 if (dev->cmd_err & OMAP_I2C_STAT_NACK) {
616 if (msg->flags & I2C_M_IGNORE_NAK) 616 if (msg->flags & I2C_M_IGNORE_NAK)
617 return 0; 617 return 0;
618 if (stop) { 618
619 w = omap_i2c_read_reg(dev, OMAP_I2C_CON_REG); 619 w = omap_i2c_read_reg(dev, OMAP_I2C_CON_REG);
620 w |= OMAP_I2C_CON_STP; 620 w |= OMAP_I2C_CON_STP;
621 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, w); 621 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, w);
622 }
623 return -EREMOTEIO; 622 return -EREMOTEIO;
624 } 623 }
625 return -EIO; 624 return -EIO;