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