summaryrefslogtreecommitdiff
path: root/target/linux/imx6/patches-3.10
diff options
context:
space:
mode:
authorLuka Perkov <luka@openwrt.org>2013-09-10 22:26:34 +0000
committerLuka Perkov <luka@openwrt.org>2013-09-10 22:26:34 +0000
commitb2c852e685aaf6bef83fa60e5a98b0bc000e4cb2 (patch)
tree6eca6f25f4eea08b340f0f9ab62a46731a13a245 /target/linux/imx6/patches-3.10
parent460fb06e63216ef08c2e8499e31339ee39576cc3 (diff)
downloadmtk-20170518-b2c852e685aaf6bef83fa60e5a98b0bc000e4cb2.zip
mtk-20170518-b2c852e685aaf6bef83fa60e5a98b0bc000e4cb2.tar.gz
mtk-20170518-b2c852e685aaf6bef83fa60e5a98b0bc000e4cb2.tar.bz2
imx6: add i2c retry on NAK
Signed-off-by: Tim Harvey <tharvey@gateworks.com> SVN-Revision: 37935
Diffstat (limited to 'target/linux/imx6/patches-3.10')
-rw-r--r--target/linux/imx6/patches-3.10/0004-i2c-imx-retry-on-NAK.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/target/linux/imx6/patches-3.10/0004-i2c-imx-retry-on-NAK.patch b/target/linux/imx6/patches-3.10/0004-i2c-imx-retry-on-NAK.patch
new file mode 100644
index 0000000..aea87ea
--- /dev/null
+++ b/target/linux/imx6/patches-3.10/0004-i2c-imx-retry-on-NAK.patch
@@ -0,0 +1,40 @@
+From 0d1ee1f265cf9730feb214ddd18bc430c0800e8b Mon Sep 17 00:00:00 2001
+From: Tim Harvey <tharvey@gateworks.com>
+Date: Tue, 10 Sep 2013 21:42:29 +0200
+Subject: [PATCH] i2c: imx: retry on NAK
+
+In case of busy i2c try again to get ACK.
+
+Signed-off-by: Tim Harvey <tharvey@gateworks.com>
+Tested-by: Luka Perkov <luka@openwrt.org>
+---
+ drivers/i2c/busses/i2c-imx.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/i2c/busses/i2c-imx.c
++++ b/drivers/i2c/busses/i2c-imx.c
+@@ -62,6 +62,7 @@
+
+ /* Default value */
+ #define IMX_I2C_BIT_RATE 100000 /* 100kHz */
++#define IMX_I2C_MAX_RETRIES 3 /* number of retries to attempt */
+
+ /* IMX I2C registers */
+ #define IMX_I2C_IADR 0x00 /* i2c slave address */
+@@ -198,7 +199,7 @@ static int i2c_imx_acked(struct imx_i2c_
+ {
+ if (readb(i2c_imx->base + IMX_I2C_I2SR) & I2SR_RXAK) {
+ dev_dbg(&i2c_imx->adapter.dev, "<%s> No ACK\n", __func__);
+- return -EIO; /* No ACK */
++ return -EAGAIN; /* try again */
+ }
+
+ dev_dbg(&i2c_imx->adapter.dev, "<%s> ACK received\n", __func__);
+@@ -533,6 +534,7 @@ static int __init i2c_imx_probe(struct p
+ i2c_imx->adapter.dev.parent = &pdev->dev;
+ i2c_imx->adapter.nr = pdev->id;
+ i2c_imx->adapter.dev.of_node = pdev->dev.of_node;
++ i2c_imx->adapter.retries = IMX_I2C_MAX_RETRIES;
+ i2c_imx->base = base;
+
+ pinctrl = devm_pinctrl_get_select_default(&pdev->dev);