aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kochetkov <al.kochet@gmail.com>2014-11-22 14:47:13 -0500
committerWolfram Sang <wsa@the-dreams.de>2014-11-23 11:27:48 -0500
commitb76911d2fe1462e1fc7c449e3e6aef76331e816e (patch)
tree761eb0013ee5b0d8e0f1e2438a19bd153058ec81
parent0f5768bf894f853c21e5f336b5f495599172f39b (diff)
i2c: omap: don't reset controller if Arbitration Lost detected
Arbitration Lost is an expected situation in a multimaster environment. I2C controller (IP) correctly detect and report AL. The only one visible reason for resetting IP in the AL case is to avoid advisory 1.94 (omap3) and errata i595 (omap4): "I2C: After an Arbitration is Lost the Module Incorrectly Starts the Next Transfer". Errata workaround states: "The MST and STT bits inside I2C_CON should be set to 1 at the same moment (avoid setting the MST bit to 1 while STT = 0)." The driver never set MST and STT bits separately and doesn't create condition for errata. So the reset is not necessary. Also corrected return value for AL to -EAGAIN. Tested on Beagleboard XM C. Tested on BBB and AM437x Starter Kit by Felipe Balbi. Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com> Tested-by: Felipe Balbi <balbi@ti.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r--drivers/i2c/busses/i2c-omap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 4426e9970e8f..b70270d8efdc 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -703,13 +703,15 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
703 return 0; 703 return 0;
704 704
705 /* We have an error */ 705 /* We have an error */
706 if (dev->cmd_err & (OMAP_I2C_STAT_AL | OMAP_I2C_STAT_ROVR | 706 if (dev->cmd_err & (OMAP_I2C_STAT_ROVR | OMAP_I2C_STAT_XUDF)) {
707 OMAP_I2C_STAT_XUDF)) {
708 omap_i2c_reset(dev); 707 omap_i2c_reset(dev);
709 __omap_i2c_init(dev); 708 __omap_i2c_init(dev);
710 return -EIO; 709 return -EIO;
711 } 710 }
712 711
712 if (dev->cmd_err & OMAP_I2C_STAT_AL)
713 return -EAGAIN;
714
713 if (dev->cmd_err & OMAP_I2C_STAT_NACK) { 715 if (dev->cmd_err & OMAP_I2C_STAT_NACK) {
714 if (msg->flags & I2C_M_IGNORE_NAK) 716 if (msg->flags & I2C_M_IGNORE_NAK)
715 return 0; 717 return 0;