linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 12/14] i2c/i2c-nomadik: reset the hw after status check
@ 2011-05-13 10:30 Linus Walleij
  0 siblings, 0 replies; only message in thread
From: Linus Walleij @ 2011-05-13 10:30 UTC (permalink / raw)
  To: Ben Dooks, linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: Lee Jones, Virupax Sadashivpetimath, Linus Walleij

From: Virupax Sadashivpetimath <virupax.sadashivpetimath-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>

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-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
Reviewed-by: Jonas Aberg <jonas.aberg-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
Signed-off-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 drivers/i2c/busses/i2c-nomadik.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index b2de1a5..fa7b106 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;
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-13 10:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-13 10:30 [PATCH 12/14] i2c/i2c-nomadik: reset the hw after status check Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).