public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Manjunatha GK <manjugk-l0cyMroinI0@public.gmane.org>
To: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org
Cc: Manjunatha GK <manjugk-l0cyMroinI0@public.gmane.org>,
	Nishanth Menon <nm-l0cyMroinI0@public.gmane.org>,
	"Sonasath, Moiz" <m-sonasath-l0cyMroinI0@public.gmane.org>,
	"Krishnamoorthy,
	Balaji T" <balajitk-l0cyMroinI0@public.gmane.org>,
	"Varadarajan, Charu Latha" <charu-l0cyMroinI0@public.gmane.org>,
	"George, Harith" <harith-l0cyMroinI0@public.gmane.org>
Subject: [PATCH v2] OMAP3 : Fix I2C lockup during timeout/error cases
Date: Fri, 11 Dec 2009 11:09:08 +0530	[thread overview]
Message-ID: <1260509948-12774-1-git-send-email-manjugk@ti.com> (raw)

Current OMAP3 I2C driver code does not follow the correct sequence for soft
reset. Due to this, lock up issues are reported during timeout/error cases.

This patch fixes above issue by disabling I2C controller as per OMAP3430 TRM
for soft reset. As per TRM, I2C controller needs to be disabled as a first
step during soft reset.

Here is correct soft reset sequence:
a. Ensure that the module is disabled
(clear the I2Ci.I2C_CON[15] I2C_EN bit to 0).
b. Set the I2Ci.I2C_SYSC[1] SRST bit to 1.
c. Enable the module by setting I2Ci.I2C_CON[15] I2C_EN bit to 1.
d. Check the I2Ci.I2C_SYSS[0] RDONE bit until it is set to 1 to
indicate the software reset is complete.


Tested on Zoom2, Zoom3, 3430SDP and 3630SDP

Signed-off-by: Manjunatha GK <manjugk-l0cyMroinI0@public.gmane.org>
Signed-off-by: George, Harith<harith-l0cyMroinI0@public.gmane.org>
Acked-by: Varadarajan, Charu Latha<charu-l0cyMroinI0@public.gmane.org>
---
v1 : Initital version
v2 : Removed delay since time taken for disabling I2C controller is zero
     jiffies

 drivers/i2c/busses/i2c-omap.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 827da08..74620c0 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -265,6 +265,11 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
 	unsigned long internal_clk = 0;
 
 	if (dev->rev >= OMAP_I2C_REV_2) {
+		/* Disable I2C controller before soft reset */
+		omap_i2c_write_reg(dev, OMAP_I2C_CON_REG,
+			omap_i2c_read_reg(dev, OMAP_I2C_CON_REG) &
+				~(OMAP_I2C_CON_EN));
+
 		omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, SYSC_SOFTRESET_MASK);
 		/* For some reason we need to set the EN bit before the
 		 * reset done bit gets set. */
-- 
1.6.0.4

             reply	other threads:[~2009-12-11  5:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-11  5:39 Manjunatha GK [this message]
     [not found] ` <1260509948-12774-1-git-send-email-manjugk-l0cyMroinI0@public.gmane.org>
2009-12-16 15:23   ` [PATCH v2] OMAP3 : Fix I2C lockup during timeout/error cases G, Manjunath Kondaiah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1260509948-12774-1-git-send-email-manjugk@ti.com \
    --to=manjugk-l0cymroini0@public.gmane.org \
    --cc=balajitk-l0cyMroinI0@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=charu-l0cyMroinI0@public.gmane.org \
    --cc=harith-l0cyMroinI0@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=m-sonasath-l0cyMroinI0@public.gmane.org \
    --cc=nm-l0cyMroinI0@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox