linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Glauber <jglauber@cavium.com>
To: Wolfram Sang <wsa-dev@sang-engineering.com>
Cc: Paul Burton <paul.burton@imgtec.com>,
	"Steven J . Hill" <Steven.Hill@cavium.com>,
	linux-i2c@vger.kernel.org, linux-mips@linux-mips.org,
	David Daney <david.daney@cavium.com>,
	Jan Glauber <jglauber@cavium.com>
Subject: [PATCH 1/4] i2c: octeon: thunderx: TWSI software reset in recovery
Date: Fri,  9 Dec 2016 10:31:55 +0100	[thread overview]
Message-ID: <20161209093158.3161-2-jglauber@cavium.com> (raw)
In-Reply-To: <20161209093158.3161-1-jglauber@cavium.com>

I've seen i2c recovery reporting long loops of:

[ 1035.887818] i2c i2c-4: SCL is stuck low, exit recovery
[ 1037.999748] i2c i2c-4: SCL is stuck low, exit recovery
[ 1040.111694] i2c i2c-4: SCL is stuck low, exit recovery
...

Add a TWSI software reset which clears the status and
STA,STP,IFLG in SW_TWSI_EOP_TWSI_CTL.

With this the recovery works fine and above message is not seen.

Signed-off-by: Jan Glauber <jglauber@cavium.com>
---
 drivers/i2c/busses/i2c-octeon-core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/i2c/busses/i2c-octeon-core.c b/drivers/i2c/busses/i2c-octeon-core.c
index 5e63b17..2b8a7bf 100644
--- a/drivers/i2c/busses/i2c-octeon-core.c
+++ b/drivers/i2c/busses/i2c-octeon-core.c
@@ -789,6 +789,9 @@ static void octeon_i2c_prepare_recovery(struct i2c_adapter *adap)
 	struct octeon_i2c *i2c = i2c_get_adapdata(adap);
 
 	octeon_i2c_hlc_disable(i2c);
+	octeon_i2c_reg_write(i2c, SW_TWSI_EOP_TWSI_RST, 0);
+	/* wait for software reset to settle */
+	udelay(5);
 
 	/*
 	 * Bring control register to a good state regardless
-- 
2.9.0.rc0.21.g7777322

  reply	other threads:[~2016-12-09  9:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09  9:31 [PATCH 0/4] i2c octeon & thunderx bug fixes Jan Glauber
2016-12-09  9:31 ` Jan Glauber [this message]
2016-12-11 22:01   ` [PATCH 1/4] i2c: octeon: thunderx: TWSI software reset in recovery Wolfram Sang
2016-12-09  9:31 ` [PATCH 2/4] i2c: octeon: thunderx: Remove double-check after interrupt Jan Glauber
2016-12-11 22:01   ` Wolfram Sang
2016-12-09  9:31 ` [PATCH 3/4] i2c: octeon: thunderx: Limit register access retries Jan Glauber
2016-12-11 22:01   ` Wolfram Sang
2016-12-12 16:07     ` Jan Glauber
2016-12-12 16:07       ` Jan Glauber
2016-12-13 20:32       ` Wolfram Sang
2016-12-17 18:29   ` Wolfram Sang
2016-12-09  9:31 ` [PATCH 4/4] i2c: octeon: thunderx: Add I2C_CLASS_HWMON Jan Glauber
2016-12-11 22:04   ` Wolfram Sang
2017-01-25 20:49     ` Wolfram Sang
2017-01-26  6:10       ` Jan Glauber
2017-01-26  6:10         ` Jan Glauber

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=20161209093158.3161-2-jglauber@cavium.com \
    --to=jglauber@cavium.com \
    --cc=Steven.Hill@cavium.com \
    --cc=david.daney@cavium.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=paul.burton@imgtec.com \
    --cc=wsa-dev@sang-engineering.com \
    /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;
as well as URLs for NNTP newsgroup(s).