imx6: add i2c retries for Ventana /dev/i2c-0
[openwrt/openwrt.git] / target / linux / imx6 / patches-4.3 / 207-i2c-imx-add-retries-for-NAK-s-on-ventana-boards.patch
1 Index: linux-4.3/drivers/i2c/busses/i2c-imx.c
2 ===================================================================
3 --- linux-4.3.orig/drivers/i2c/busses/i2c-imx.c 2015-11-01 16:05:25.000000000 -0800
4 +++ linux-4.3/drivers/i2c/busses/i2c-imx.c 2015-12-18 10:39:44.971158318 -0800
5 @@ -461,6 +461,8 @@
6 {
7 if (imx_i2c_read_reg(i2c_imx, IMX_I2C_I2SR) & I2SR_RXAK) {
8 dev_dbg(&i2c_imx->adapter.dev, "<%s> No ACK\n", __func__);
9 + if (i2c_imx->adapter.retries)
10 + return -EAGAIN;
11 return -EIO; /* No ACK */
12 }
13
14 @@ -1010,6 +1012,10 @@
15 i2c_imx->adapter.nr = pdev->id;
16 i2c_imx->adapter.dev.of_node = pdev->dev.of_node;
17 i2c_imx->base = base;
18 + if (of_machine_is_compatible("gw,ventana") && phy_addr == 0x021a0000) {
19 + dev_info(&pdev->dev, "Adding retries for Ventana GSC\n");
20 + i2c_imx->adapter.retries = 3;
21 + }
22
23 /* Get I2C clock */
24 i2c_imx->clk = devm_clk_get(&pdev->dev, NULL);