linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
To: "Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Andreas Färber" <afaerber@suse.de>,
	"Wolfram Sang" <wsa@kernel.org>, "Peter Rosin" <peda@axentia.se>
Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-actions@lists.infradead.org
Subject: [PATCH 1/3] i2c: owl: Clear NACK and BUS error bits
Date: Fri,  9 Oct 2020 00:44:39 +0300	[thread overview]
Message-ID: <6ee573f2904c001ab07e30b386815257c05f6308.1602190168.git.cristian.ciocaltea@gmail.com> (raw)
In-Reply-To: <cover.1602190168.git.cristian.ciocaltea@gmail.com>

When the NACK and BUS error bits are set by the hardware, the driver is
responsible for clearing them by writing "1" into the corresponding
status registers.

Hence perform the necessary operations in owl_i2c_interrupt().

Fixes: d211e62af466 ("i2c: Add Actions Semiconductor Owl family S900 I2C driver")
Reported-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
---
 drivers/i2c/busses/i2c-owl.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/i2c/busses/i2c-owl.c b/drivers/i2c/busses/i2c-owl.c
index 672f1f239bd6..a163b8f308c1 100644
--- a/drivers/i2c/busses/i2c-owl.c
+++ b/drivers/i2c/busses/i2c-owl.c
@@ -176,6 +176,9 @@ static irqreturn_t owl_i2c_interrupt(int irq, void *_dev)
 	fifostat = readl(i2c_dev->base + OWL_I2C_REG_FIFOSTAT);
 	if (fifostat & OWL_I2C_FIFOSTAT_RNB) {
 		i2c_dev->err = -ENXIO;
+		/* Clear NACK error bit by writing "1" */
+		owl_i2c_update_reg(i2c_dev->base + OWL_I2C_REG_FIFOSTAT,
+				   OWL_I2C_FIFOSTAT_RNB, true);
 		goto stop;
 	}
 
@@ -183,6 +186,9 @@ static irqreturn_t owl_i2c_interrupt(int irq, void *_dev)
 	stat = readl(i2c_dev->base + OWL_I2C_REG_STAT);
 	if (stat & OWL_I2C_STAT_BEB) {
 		i2c_dev->err = -EIO;
+		/* Clear BUS error bit by writing "1" */
+		owl_i2c_update_reg(i2c_dev->base + OWL_I2C_REG_STAT,
+				   OWL_I2C_STAT_BEB, true);
 		goto stop;
 	}
 
-- 
2.28.0


  reply	other threads:[~2020-10-08 21:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 21:44 [PATCH 0/3] Improve Actions Semi Owl I2C driver Cristian Ciocaltea
2020-10-08 21:44 ` Cristian Ciocaltea [this message]
2020-10-10 11:16   ` [PATCH 1/3] i2c: owl: Clear NACK and BUS error bits Wolfram Sang
2020-10-11 14:09   ` Manivannan Sadhasivam
2020-10-12  9:05     ` Cristian Ciocaltea
2020-10-08 21:44 ` [PATCH 2/3] i2c: owl: Add support for atomic transfers Cristian Ciocaltea
2020-10-11 14:09   ` Manivannan Sadhasivam
2020-10-12  9:07     ` Cristian Ciocaltea
2020-11-03 20:57   ` Wolfram Sang
2020-10-08 21:44 ` [PATCH 3/3] i2c: owl: Enable asynchronous probing Cristian Ciocaltea
2020-10-11 14:06   ` Manivannan Sadhasivam
2020-10-12  9:08     ` Cristian Ciocaltea
2020-11-03 20:57   ` Wolfram Sang

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=6ee573f2904c001ab07e30b386815257c05f6308.1602190168.git.cristian.ciocaltea@gmail.com \
    --to=cristian.ciocaltea@gmail.com \
    --cc=afaerber@suse.de \
    --cc=linux-actions@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=peda@axentia.se \
    --cc=wsa@kernel.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;
as well as URLs for NNTP newsgroup(s).