Commit 0511f643 authored by Virupax Sadashivpetimath's avatar Virupax Sadashivpetimath Committed by Ben Dooks

i2c-nomadik: reset the hw after status check

In case of I2C timeout, reset the HW only after the HW status
is read, otherwise the staus will be lost.
Signed-off-by: default avatarVirupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>
Reviewed-by: default avatarJonas Aberg <jonas.aberg@stericsson.com>
Reviewed-by: default avatarSrinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
parent b5e890f7
...@@ -428,10 +428,9 @@ static int read_i2c(struct nmk_i2c_dev *dev) ...@@ -428,10 +428,9 @@ static int read_i2c(struct nmk_i2c_dev *dev)
} }
if (timeout == 0) { 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_err(&dev->pdev->dev, "read from slave 0x%x timed out\n",
dev->cli.slave_adr); dev->cli.slave_adr);
(void) init_hw(dev);
status = -ETIMEDOUT; status = -ETIMEDOUT;
} }
return status; return status;
...@@ -516,10 +515,9 @@ static int write_i2c(struct nmk_i2c_dev *dev) ...@@ -516,10 +515,9 @@ static int write_i2c(struct nmk_i2c_dev *dev)
} }
if (timeout == 0) { 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_err(&dev->pdev->dev, "write to slave 0x%x timed out\n",
dev->cli.slave_adr); dev->cli.slave_adr);
(void) init_hw(dev);
status = -ETIMEDOUT; status = -ETIMEDOUT;
} }
...@@ -638,6 +636,8 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, ...@@ -638,6 +636,8 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
abort_causes[cause]); abort_causes[cause]);
} }
(void) init_hw(dev);
status = status ? status : dev->result; status = status ? status : dev->result;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment