207-i2c-imx-add-retries-for-NAK-s-on-ventana-boards.patch 770 B

12345678910111213141516171819202122
  1. --- a/drivers/i2c/busses/i2c-imx.c
  2. +++ b/drivers/i2c/busses/i2c-imx.c
  3. @@ -469,6 +469,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 -ENXIO; /* No ACK */
  10. }
  11. @@ -1072,6 +1074,10 @@ static int i2c_imx_probe(struct platform
  12. i2c_imx->adapter.nr = pdev->id;
  13. i2c_imx->adapter.dev.of_node = pdev->dev.of_node;
  14. i2c_imx->base = base;
  15. + if (of_machine_is_compatible("gw,ventana") && phy_addr == 0x021a0000) {
  16. + dev_info(&pdev->dev, "Adding retries for Ventana GSC\n");
  17. + i2c_imx->adapter.retries = 3;
  18. + }
  19. /* Get I2C clock */
  20. i2c_imx->clk = devm_clk_get(&pdev->dev, NULL);