diff mbox

[12/13] i2c/i2c-nomadik: reset the hw after status check

Message ID BANLkTimLXt83xSTZvUrNXc5Rvbp7dtewjg@mail.gmail.com
State Accepted
Headers show

Commit Message

Linus Walleij May 10, 2011, 11:49 p.m. UTC
---------- Forwarded message ----------
From: Linus Walleij <linus.walleij@linaro.org>
Date: 2011/5/9
Subject: [PATCH 12/13] i2c/i2c-nomadik: reset the hw after status check
To: Ben Dooks <ben-linux@fluff.org>, linux-i2c@vger.kernel.org
Kopia: Virupax Sadashivpetimath
<virupax.sadashivpetimath@stericsson.com>, Linus Walleij
<linus.walleij@linaro.org>


From: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>

In case of I2C timeout, reset the HW only after the HW status
is read, otherwise the staus will be lost.

Signed-off-by: Virupax Sadashivpetimath
<virupax.sadashivpetimath@stericsson.com>
Reviewed-by: Jonas Aberg <jonas.aberg@stericsson.com>
Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/i2c/busses/i2c-nomadik.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

--
1.7.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index a94445e..dc57c6e 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -428,10 +428,9 @@  static int read_i2c(struct nmk_i2c_dev *dev)
       }

       if (timeout == 0) {
-               /* controller has timedout, re-init the h/w */
+               /* Controller timed out */
               dev_err(&dev->pdev->dev, "read from slave 0x%x timed out\n",
                               dev->cli.slave_adr);
-               (void) init_hw(dev);
               status = -ETIMEDOUT;
       }
       return status;
@@ -516,10 +515,9 @@  static int write_i2c(struct nmk_i2c_dev *dev)
       }

       if (timeout == 0) {
-               /* controller has timedout, re-init the h/w */
+               /* Controller timed out */
               dev_err(&dev->pdev->dev, "write to slave 0x%x timed out\n",
                               dev->cli.slave_adr);
-               (void) init_hw(dev);
               status = -ETIMEDOUT;
       }

@@ -638,6 +636,8 @@  static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
                                               abort_causes[cause]);
                               }

+                               (void) init_hw(dev);
+
                               status = status ? status : dev->result;

                               break;