diff mbox series

i2c: cadence: try reset when master receive arbitration lost

Message ID 20190218094132.5226-1-sxauwsk@163.com (mailing list archive)
State New, archived
Headers show
Series i2c: cadence: try reset when master receive arbitration lost | expand

Commit Message

sxauwsk@163.com Feb. 18, 2019, 9:41 a.m. UTC
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: Shikai Wang <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(-)

Comments

Michal Simek Feb. 18, 2019, 10:11 a.m. UTC | #1
On 18. 02. 19 10:41, Shikai Wang wrote:
> 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: Shikai Wang <sxauwsk@163.com>

ok. This is much better.

> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>

I haven't see that Shubhrajyoti gave you this line that he is coauthor
of this.
It means you shouldn't add this SoB line if he didn't work on this.
He reviewed it that's why you should wait what he is going to sent.

Anyway based on email I see that this is 3rd version but I can't see any
version in subject and also description of changes.

That's why please take a look at this
Documentation/process/submitting-patches.rst

And send proper version. I would suggest to use v2 or v3.

Thanks,
Michal
Wolfram Sang Feb. 18, 2019, 5:06 p.m. UTC | #2
On Mon, Feb 18, 2019 at 05:41:32PM +0800, Shikai Wang wrote:
> 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.

Thanks for working on this issue.

> Signed-off-by: Shikai Wang <sxauwsk@163.com>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>

Reading the previous thread, isn't this more of an acked-by or
reviewed-by than a Signed-off?

Also, is there a suitable Fixes tag?
diff mbox series

Patch

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;