Skip to content

Commit

Permalink
i2c-nomadik: reset the hw after status check
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
  • Loading branch information
Virupax Sadashivpetimath authored and Ben Dooks committed May 24, 2011
1 parent b5e890f commit 0511f64
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/i2c/busses/i2c-nomadik.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0511f64

Please sign in to comment.