[PATCH 4/4] i2c-nomadik: fixup bus delays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We were missing a transfer delay in one execution path leading to
hangs and the bus timeout was too low leading to errors under
stress tests.

Acked-by: Srinidhi Kasagar <srinidhi.kasagar@xxxxxxxxxxxxxx>
Signed-off-by: Sundar R Iyer <sundar.iyer@xxxxxxxxxxxxxx>
Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxxxxxx>
---
 drivers/i2c/busses/i2c-nomadik.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index e461de7..c9fffd0 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -103,6 +103,9 @@
 /* maximum threshold value */
 #define MAX_I2C_FIFO_THRESHOLD	15
 
+/* per-transfer delay, required for the hardware to stabilize */
+#define I2C_DELAY		150
+
 enum i2c_status {
 	I2C_NOP,
 	I2C_ON_GOING,
@@ -118,7 +121,7 @@ enum i2c_operation {
 };
 
 /* controller response timeout in ms */
-#define I2C_TIMEOUT_MS	500
+#define I2C_TIMEOUT_MS	2000
 
 /**
  * struct i2c_nmk_client - client specific data
@@ -267,6 +270,7 @@ static int init_hw(struct nmk_i2c_dev *dev)
 
 	clk_disable(dev->clk);
 
+	udelay(I2C_DELAY);
 	return 0;
 }
 
@@ -599,7 +603,7 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
 			clk_disable(dev->clk);
 			return status;
 		}
-		mdelay(1);
+		udelay(I2C_DELAY);
 	}
 	clk_disable(dev->clk);
 
-- 
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux