From: sxauwsk <sxauwsk@163.com>
To: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Cc: linux-kernel@vger.kernel.org, sxauwsk@163.com,
Michal Simek <michal.simek@xilinx.com>,
linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org
Subject: [PATCH] i2c: cadence: try reset when master receive arbitration lost
Date: Mon, 18 Feb 2019 16:35:22 +0800 [thread overview]
Message-ID: <20190218083522.4681-1-sxauwsk@163.com> (raw)
When the adapter receive arbitration lost error interrupts,
cdns_i2c_master_xfer return to the caller directly instead of resetting
the adapter which resulted in the adapter being out of control.
So when driver detect err_status such as arbitration lost,
then try to repair and fix it.
Signed-off-by: sxauwsk <sxauwsk@163.com>
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
drivers/i2c/busses/i2c-cadence.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index b13605718291..595b0d56ff1a 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -548,10 +548,6 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg,
cdns_i2c_writereg(CDNS_I2C_IXR_ALL_INTR_MASK,
CDNS_I2C_IDR_OFFSET);
- /* If it is bus arbitration error, try again */
- if (id->err_status & CDNS_I2C_IXR_ARB_LOST)
- return -EAGAIN;
-
return 0;
}
@@ -624,6 +620,12 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
if (id->err_status) {
cdns_i2c_master_reset(adap);
+ /* If it is bus arbitration error, try again */
+ if (id->err_status & CDNS_I2C_IXR_ARB_LOST) {
+ ret = -EAGAIN;
+ goto out;
+ }
+
if (id->err_status & CDNS_I2C_IXR_NACK) {
ret = -ENXIO;
goto out;
--
2.19.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2019-02-18 8:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-18 8:35 sxauwsk [this message]
2019-02-18 9:30 ` [PATCH] i2c: cadence: try reset when master receive arbitration lost Michal Simek
-- strict thread matches above, loose matches on Subject: below --
2019-02-18 9:41 Shikai Wang
2019-02-18 10:11 ` Michal Simek
2019-02-18 17:06 ` 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=20190218083522.4681-1-sxauwsk@163.com \
--to=sxauwsk@163.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=shubhrajyoti.datta@xilinx.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