diff mbox

[5/5] i2c: sirf: retry 3 times as sometimes we get random noack and timeout

Message ID 1376385091-30597-6-git-send-email-Baohua.Song@csr.com
State Accepted
Headers show

Commit Message

Barry Song Aug. 13, 2013, 9:11 a.m. UTC
From: Zhiwu Song <Zhiwu.Song@csr.com>

let i2c core retry 3 times as sometimes we get random noack and timeout
even when we access an existing i2c client.

Signed-off-by: Zhiwu Song <Zhiwu.Song@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
 drivers/i2c/busses/i2c-sirf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
index d2b7913..90adc2d 100644
--- a/drivers/i2c/busses/i2c-sirf.c
+++ b/drivers/i2c/busses/i2c-sirf.c
@@ -230,7 +230,7 @@  static int i2c_sirfsoc_xfer_msg(struct sirfsoc_i2c *siic, struct i2c_msg *msg)
 		while (readl(siic->base + SIRFSOC_I2C_CTRL) & SIRFSOC_I2C_RESET)
 			cpu_relax();
 	}
-	return siic->err_status ? -EIO : 0;
+	return siic->err_status ? -EAGAIN : 0;
 }
 
 static u32 i2c_sirfsoc_func(struct i2c_adapter *adap)
@@ -334,6 +334,7 @@  static int i2c_sirfsoc_probe(struct platform_device *pdev)
 
 	adap->algo = &i2c_sirfsoc_algo;
 	adap->algo_data = siic;
+	adap->retries = 3;
 
 	adap->dev.of_node = pdev->dev.of_node;
 	adap->dev.parent = &pdev->dev;