All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: cadence: try reset when master receive error interrupts
@ 2019-01-29 19:52 ` sxauwsk
  0 siblings, 0 replies; 10+ messages in thread
From: sxauwsk @ 2019-01-29 19:52 UTC (permalink / raw)
  To: Michal Simek; +Cc: linux-arm-kernel, linux-i2c, linux-kernel, sxauwsk

When the adapter receive error interrupts, such as NACK, arbitration lost,
cdns_i2c_master_xfer return to the caller directly instead of resuming 
the adapter which resulted in the adapter being out of control.

So when driver detect err_status then try to repair and fix it.

Signed-off-by: sxauwsk <sxauwsk@163.com>
---
 drivers/i2c/busses/i2c-cadence.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index b13605718291..e10048d7524a 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;
 }
 
@@ -617,13 +613,19 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
 			id->bus_hold_flag = 0;
 
 		ret = cdns_i2c_process_msg(id, msgs, adap);
-		if (ret)
+		if (!ret)
 			goto out;
 
 		/* Report the other error interrupts to application */
 		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



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] i2c: cadence: try reset when master receive error interrupts
@ 2019-01-29 19:52 ` sxauwsk
  0 siblings, 0 replies; 10+ messages in thread
From: sxauwsk @ 2019-01-29 19:52 UTC (permalink / raw)
  To: Michal Simek; +Cc: sxauwsk, linux-i2c, linux-arm-kernel, linux-kernel

When the adapter receive error interrupts, such as NACK, arbitration lost,
cdns_i2c_master_xfer return to the caller directly instead of resuming 
the adapter which resulted in the adapter being out of control.

So when driver detect err_status then try to repair and fix it.

Signed-off-by: sxauwsk <sxauwsk@163.com>
---
 drivers/i2c/busses/i2c-cadence.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index b13605718291..e10048d7524a 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;
 }
 
@@ -617,13 +613,19 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
 			id->bus_hold_flag = 0;
 
 		ret = cdns_i2c_process_msg(id, msgs, adap);
-		if (ret)
+		if (!ret)
 			goto out;
 
 		/* Report the other error interrupts to application */
 		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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] i2c: cadence: try reset when master receive error interrupts
  2019-01-29 19:52 ` sxauwsk
@ 2019-02-15 11:07   ` Shubhrajyoti Datta
  -1 siblings, 0 replies; 10+ messages in thread
From: Shubhrajyoti Datta @ 2019-02-15 11:07 UTC (permalink / raw)
  To: sxauwsk
  Cc: Michal Simek, linux-arm-kernel, linux-i2c, linux-kernel,
	Shubhrajyoti Datta

Hi Sxauwsk,

On Wed, Jan 30, 2019 at 3:13 PM sxauwsk <sxauwsk@163.com> wrote:
>
> When the adapter receive error interrupts, such as NACK, arbitration lost,
> cdns_i2c_master_xfer return to the caller directly instead of resuming
> the adapter which resulted in the adapter being out of control.
>
> So when driver detect err_status then try to repair and fix it.
>
> Signed-off-by: sxauwsk <sxauwsk@163.com>
> ---
>  drivers/i2c/busses/i2c-cadence.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> index b13605718291..e10048d7524a 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;
>  }
>
> @@ -617,13 +613,19 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
>                         id->bus_hold_flag = 0;
>
>                 ret = cdns_i2c_process_msg(id, msgs, adap);
> -               if (ret)
> +               if (!ret)
>                         goto out;
>
In case  the Arbitration error happend  the cdns_i2c_process_msg would return 0
and we will miss the check  below.

Am I missing something ?

>                 /* Report the other error interrupts to application */
>                 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
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] i2c: cadence: try reset when master receive error interrupts
@ 2019-02-15 11:07   ` Shubhrajyoti Datta
  0 siblings, 0 replies; 10+ messages in thread
From: Shubhrajyoti Datta @ 2019-02-15 11:07 UTC (permalink / raw)
  To: sxauwsk
  Cc: linux-kernel, Shubhrajyoti Datta, Michal Simek, linux-arm-kernel,
	linux-i2c

Hi Sxauwsk,

On Wed, Jan 30, 2019 at 3:13 PM sxauwsk <sxauwsk@163.com> wrote:
>
> When the adapter receive error interrupts, such as NACK, arbitration lost,
> cdns_i2c_master_xfer return to the caller directly instead of resuming
> the adapter which resulted in the adapter being out of control.
>
> So when driver detect err_status then try to repair and fix it.
>
> Signed-off-by: sxauwsk <sxauwsk@163.com>
> ---
>  drivers/i2c/busses/i2c-cadence.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> index b13605718291..e10048d7524a 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;
>  }
>
> @@ -617,13 +613,19 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
>                         id->bus_hold_flag = 0;
>
>                 ret = cdns_i2c_process_msg(id, msgs, adap);
> -               if (ret)
> +               if (!ret)
>                         goto out;
>
In case  the Arbitration error happend  the cdns_i2c_process_msg would return 0
and we will miss the check  below.

Am I missing something ?

>                 /* Report the other error interrupts to application */
>                 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] i2c: cadence: try reset when master receive error interrupts
  2019-02-15 11:07   ` Shubhrajyoti Datta
  (?)
@ 2019-02-16  7:50   ` sxauwsk
  2019-02-18  6:33       ` Shubhrajyoti Datta
  -1 siblings, 1 reply; 10+ messages in thread
From: sxauwsk @ 2019-02-16  7:50 UTC (permalink / raw)
  To: Shubhrajyoti Datta
  Cc: linux-kernel, Shubhrajyoti Datta, michal.simek, linux-arm-kernel,
	linux-i2c

>Hi Sxauwsk,
>
>On Wed, Jan 30, 2019 at 3:13 PM sxauwsk <sxauwsk@163.com> wrote:
>>
>> When the adapter receive error interrupts, such as NACK, arbitration lost,
>> cdns_i2c_master_xfer return to the caller directly instead of resuming
>> the adapter which resulted in the adapter being out of control.
>>
>> So when driver detect err_status then try to repair and fix it.
>>
>> Signed-off-by: sxauwsk <sxauwsk@163.com>
>> ---
>>  drivers/i2c/busses/i2c-cadence.c | 12 +++++++-----
>>  1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
>> index b13605718291..e10048d7524a 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;
>>  }
>>
>> @@ -617,13 +613,19 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
>>                         id->bus_hold_flag = 0;
>>
>>                 ret = cdns_i2c_process_msg(id, msgs, adap);
>> -               if (ret)
>> +               if (!ret)
>>                         goto out;
>>
>In case  the Arbitration error happend  the cdns_i2c_process_msg would return 0
>and we will miss the check  below.
>
>Am I missing something ?
>
>>                 /* Report the other error interrupts to application */
>>                 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
>>
>> 

In cdns_i2c_process_msg process, when detect arbitration lost error return -EAGAIN to  cdns_i2c_master_xfer,  not return 0
that mean cdns_i2c_process_msg  just go out ignore error check and  problem occur, So we should do something when arbitration error detect.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] i2c: cadence: try reset when master receive error interrupts
  2019-02-16  7:50   ` sxauwsk
@ 2019-02-18  6:33       ` Shubhrajyoti Datta
  0 siblings, 0 replies; 10+ messages in thread
From: Shubhrajyoti Datta @ 2019-02-18  6:33 UTC (permalink / raw)
  To: sxauwsk
  Cc: michal.simek, linux-arm-kernel, linux-i2c, linux-kernel,
	Shubhrajyoti Datta

Hi ,
On Sat, Feb 16, 2019 at 1:21 PM sxauwsk@163.com <sxauwsk@163.com> wrote:
>
> >Hi Sxauwsk,
> >
> >On Wed, Jan 30, 2019 at 3:13 PM sxauwsk <sxauwsk@163.com> wrote:
> >>
> >> When the adapter receive error interrupts, such as NACK, arbitration lost,
> >> cdns_i2c_master_xfer return to the caller directly instead of resuming
> >> the adapter which resulted in the adapter being out of control.
> >>
> >> So when driver detect err_status then try to repair and fix it.
> >>
> >> Signed-off-by: sxauwsk <sxauwsk@163.com>
> >> ---
> >>  drivers/i2c/busses/i2c-cadence.c | 12 +++++++-----
> >>  1 file changed, 7 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> >> index b13605718291..e10048d7524a 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;
> >>  }
> >>
> >> @@ -617,13 +613,19 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
> >>                         id->bus_hold_flag = 0;
> >>
> >>                 ret = cdns_i2c_process_msg(id, msgs, adap);
> >> -               if (ret)
> >> +               if (!ret)
> >>                         goto out;
> >>
> >In case  the Arbitration error happend  the cdns_i2c_process_msg would return 0
> >and we will miss the check  below.
> >
> >Am I missing something ?
> >
> >>                 /* Report the other error interrupts to application */
> >>                 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
> >>
> >>
>
> In cdns_i2c_process_msg process, when detect arbitration lost error return -EAGAIN to  cdns_i2c_master_xfer,  not return 0
> that mean cdns_i2c_process_msg  just go out ignore error check and  problem occur, So we should do something when arbitration error detect.

Arbitration lost is fine how about other errors like NACK.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] i2c: cadence: try reset when master receive error interrupts
@ 2019-02-18  6:33       ` Shubhrajyoti Datta
  0 siblings, 0 replies; 10+ messages in thread
From: Shubhrajyoti Datta @ 2019-02-18  6:33 UTC (permalink / raw)
  To: sxauwsk
  Cc: linux-kernel, Shubhrajyoti Datta, michal.simek, linux-arm-kernel,
	linux-i2c

Hi ,
On Sat, Feb 16, 2019 at 1:21 PM sxauwsk@163.com <sxauwsk@163.com> wrote:
>
> >Hi Sxauwsk,
> >
> >On Wed, Jan 30, 2019 at 3:13 PM sxauwsk <sxauwsk@163.com> wrote:
> >>
> >> When the adapter receive error interrupts, such as NACK, arbitration lost,
> >> cdns_i2c_master_xfer return to the caller directly instead of resuming
> >> the adapter which resulted in the adapter being out of control.
> >>
> >> So when driver detect err_status then try to repair and fix it.
> >>
> >> Signed-off-by: sxauwsk <sxauwsk@163.com>
> >> ---
> >>  drivers/i2c/busses/i2c-cadence.c | 12 +++++++-----
> >>  1 file changed, 7 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> >> index b13605718291..e10048d7524a 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;
> >>  }
> >>
> >> @@ -617,13 +613,19 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
> >>                         id->bus_hold_flag = 0;
> >>
> >>                 ret = cdns_i2c_process_msg(id, msgs, adap);
> >> -               if (ret)
> >> +               if (!ret)
> >>                         goto out;
> >>
> >In case  the Arbitration error happend  the cdns_i2c_process_msg would return 0
> >and we will miss the check  below.
> >
> >Am I missing something ?
> >
> >>                 /* Report the other error interrupts to application */
> >>                 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
> >>
> >>
>
> In cdns_i2c_process_msg process, when detect arbitration lost error return -EAGAIN to  cdns_i2c_master_xfer,  not return 0
> that mean cdns_i2c_process_msg  just go out ignore error check and  problem occur, So we should do something when arbitration error detect.

Arbitration lost is fine how about other errors like NACK.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: [PATCH] i2c: cadence: try reset when master receive error interrupts
  2019-02-18  6:33       ` Shubhrajyoti Datta
  (?)
@ 2019-02-18  7:16       ` sxauwsk
  2019-02-18  7:59           ` Shubhrajyoti Datta
  -1 siblings, 1 reply; 10+ messages in thread
From: sxauwsk @ 2019-02-18  7:16 UTC (permalink / raw)
  To: Shubhrajyoti Datta
  Cc: linux-kernel, Shubhrajyoti Datta, michal.simek, linux-arm-kernel,
	linux-i2c

Hi , Shubhrajyoti

>Hi ,
>On Sat, Feb 16, 2019 at 1:21 PM sxauwsk@163.com <sxauwsk@163.com> wrote:
>>
>> >Hi Sxauwsk,
>> >
>> >On Wed, Jan 30, 2019 at 3:13 PM sxauwsk <sxauwsk@163.com> wrote:
>> >>
>> >> When the adapter receive error interrupts, such as NACK, arbitration lost,
>> >> cdns_i2c_master_xfer return to the caller directly instead of resuming
>> >> the adapter which resulted in the adapter being out of control.
>> >>
>> >> So when driver detect err_status then try to repair and fix it.
>> >>
>> >> Signed-off-by: sxauwsk <sxauwsk@163.com>
>> >> ---
>> >>  drivers/i2c/busses/i2c-cadence.c | 12 +++++++-----
>> >>  1 file changed, 7 insertions(+), 5 deletions(-)
>> >>
>> >> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
>> >> index b13605718291..e10048d7524a 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;
>> >>  }
>> >>
>> >> @@ -617,13 +613,19 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
>> >>                         id->bus_hold_flag = 0;
>> >>
>> >>                 ret = cdns_i2c_process_msg(id, msgs, adap);
>> >> -               if (ret)
>> >> +               if (!ret)
>> >>                         goto out;
>> >>
>> >In case  the Arbitration error happend  the cdns_i2c_process_msg would return 0
>> >and we will miss the check  below.
>> >
>> >Am I missing something ?
>> >
>> >>                 /* Report the other error interrupts to application */
>> >>                 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
>> >>
>> >>
>>
>> In cdns_i2c_process_msg process, when detect arbitration lost error return -EAGAIN to  cdns_i2c_master_xfer,  not return 0
>> that mean cdns_i2c_process_msg  just go out ignore error check and  problem occur, So we should do something when arbitration error detect.
>
>Arbitration lost is fine how about other errors like NACK. 

>> >>                 ret = cdns_i2c_process_msg(id, msgs, adap);
>> >> -               if (ret)
>> >> +               if (!ret)
>> >>                         goto out;

Yes, you're right,  This place I should't make any change,  perfect solution!

>> >>
>> >> -       /* If it is bus arbitration error, try again */
>> >> -       if (id->err_status & CDNS_I2C_IXR_ARB_LOST)
>> >> -               return -EAGAIN;
>> >> -
>> >>         return 0;
>> >>  }


>> >>                 /* Report the other error interrupts to application */
>> >>                 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;
>> >> +                       }
>> >> +

Maybe Just remove Arbitration lost Detect part from  cdns_i2c_process_msg function,  then add to cdns_i2c_master_xfer,  Do you think?




_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: [PATCH] i2c: cadence: try reset when master receive error interrupts
  2019-02-18  7:16       ` sxauwsk
@ 2019-02-18  7:59           ` Shubhrajyoti Datta
  0 siblings, 0 replies; 10+ messages in thread
From: Shubhrajyoti Datta @ 2019-02-18  7:59 UTC (permalink / raw)
  To: sxauwsk
  Cc: michal.simek, linux-arm-kernel, linux-i2c, linux-kernel,
	Shubhrajyoti Datta

On Mon, Feb 18, 2019 at 12:48 PM sxauwsk@163.com <sxauwsk@163.com> wrote:
>
> Hi , Shubhrajyoti
>
> >Hi ,
> >On Sat, Feb 16, 2019 at 1:21 PM sxauwsk@163.com <sxauwsk@163.com> wrote:
> >>
> >> >Hi Sxauwsk,
> >> >
> >> >On Wed, Jan 30, 2019 at 3:13 PM sxauwsk <sxauwsk@163.com> wrote:
> >> >>
> >> >> When the adapter receive error interrupts, such as NACK, arbitration lost,
> >> >> cdns_i2c_master_xfer return to the caller directly instead of resuming
> >> >> the adapter which resulted in the adapter being out of control.
> >> >>
> >> >> So when driver detect err_status then try to repair and fix it.
> >> >>
> >> >> Signed-off-by: sxauwsk <sxauwsk@163.com>
> >> >> ---
> >> >>  drivers/i2c/busses/i2c-cadence.c | 12 +++++++-----
> >> >>  1 file changed, 7 insertions(+), 5 deletions(-)
> >> >>
> >> >> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> >> >> index b13605718291..e10048d7524a 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;
> >> >>  }
> >> >>
> >> >> @@ -617,13 +613,19 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
> >> >>                         id->bus_hold_flag = 0;
> >> >>
> >> >>                 ret = cdns_i2c_process_msg(id, msgs, adap);
> >> >> -               if (ret)
> >> >> +               if (!ret)
> >> >>                         goto out;
> >> >>
> >> >In case  the Arbitration error happend  the cdns_i2c_process_msg would return 0
> >> >and we will miss the check  below.
> >> >
> >> >Am I missing something ?
> >> >
> >> >>                 /* Report the other error interrupts to application */
> >> >>                 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
> >> >>
> >> >>
> >>
> >> In cdns_i2c_process_msg process, when detect arbitration lost error return -EAGAIN to  cdns_i2c_master_xfer,  not return 0
> >> that mean cdns_i2c_process_msg  just go out ignore error check and  problem occur, So we should do something when arbitration error detect.
> >
> >Arbitration lost is fine how about other errors like NACK.
>
> >> >>                 ret = cdns_i2c_process_msg(id, msgs, adap);
> >> >> -               if (ret)
> >> >> +               if (!ret)
> >> >>                         goto out;
>
> Yes, you're right,  This place I should't make any change,  perfect solution!
>
> >> >>
> >> >> -       /* If it is bus arbitration error, try again */
> >> >> -       if (id->err_status & CDNS_I2C_IXR_ARB_LOST)
> >> >> -               return -EAGAIN;
> >> >> -
> >> >>         return 0;
> >> >>  }
>
>
> >> >>                 /* Report the other error interrupts to application */
> >> >>                 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;
> >> >> +                       }
> >> >> +
>
> Maybe Just remove Arbitration lost Detect part from  cdns_i2c_process_msg function,  then add to cdns_i2c_master_xfer,  Do you think?

I agree.
>
>
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: [PATCH] i2c: cadence: try reset when master receive error interrupts
@ 2019-02-18  7:59           ` Shubhrajyoti Datta
  0 siblings, 0 replies; 10+ messages in thread
From: Shubhrajyoti Datta @ 2019-02-18  7:59 UTC (permalink / raw)
  To: sxauwsk
  Cc: linux-kernel, Shubhrajyoti Datta, michal.simek, linux-arm-kernel,
	linux-i2c

On Mon, Feb 18, 2019 at 12:48 PM sxauwsk@163.com <sxauwsk@163.com> wrote:
>
> Hi , Shubhrajyoti
>
> >Hi ,
> >On Sat, Feb 16, 2019 at 1:21 PM sxauwsk@163.com <sxauwsk@163.com> wrote:
> >>
> >> >Hi Sxauwsk,
> >> >
> >> >On Wed, Jan 30, 2019 at 3:13 PM sxauwsk <sxauwsk@163.com> wrote:
> >> >>
> >> >> When the adapter receive error interrupts, such as NACK, arbitration lost,
> >> >> cdns_i2c_master_xfer return to the caller directly instead of resuming
> >> >> the adapter which resulted in the adapter being out of control.
> >> >>
> >> >> So when driver detect err_status then try to repair and fix it.
> >> >>
> >> >> Signed-off-by: sxauwsk <sxauwsk@163.com>
> >> >> ---
> >> >>  drivers/i2c/busses/i2c-cadence.c | 12 +++++++-----
> >> >>  1 file changed, 7 insertions(+), 5 deletions(-)
> >> >>
> >> >> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> >> >> index b13605718291..e10048d7524a 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;
> >> >>  }
> >> >>
> >> >> @@ -617,13 +613,19 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
> >> >>                         id->bus_hold_flag = 0;
> >> >>
> >> >>                 ret = cdns_i2c_process_msg(id, msgs, adap);
> >> >> -               if (ret)
> >> >> +               if (!ret)
> >> >>                         goto out;
> >> >>
> >> >In case  the Arbitration error happend  the cdns_i2c_process_msg would return 0
> >> >and we will miss the check  below.
> >> >
> >> >Am I missing something ?
> >> >
> >> >>                 /* Report the other error interrupts to application */
> >> >>                 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
> >> >>
> >> >>
> >>
> >> In cdns_i2c_process_msg process, when detect arbitration lost error return -EAGAIN to  cdns_i2c_master_xfer,  not return 0
> >> that mean cdns_i2c_process_msg  just go out ignore error check and  problem occur, So we should do something when arbitration error detect.
> >
> >Arbitration lost is fine how about other errors like NACK.
>
> >> >>                 ret = cdns_i2c_process_msg(id, msgs, adap);
> >> >> -               if (ret)
> >> >> +               if (!ret)
> >> >>                         goto out;
>
> Yes, you're right,  This place I should't make any change,  perfect solution!
>
> >> >>
> >> >> -       /* If it is bus arbitration error, try again */
> >> >> -       if (id->err_status & CDNS_I2C_IXR_ARB_LOST)
> >> >> -               return -EAGAIN;
> >> >> -
> >> >>         return 0;
> >> >>  }
>
>
> >> >>                 /* Report the other error interrupts to application */
> >> >>                 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;
> >> >> +                       }
> >> >> +
>
> Maybe Just remove Arbitration lost Detect part from  cdns_i2c_process_msg function,  then add to cdns_i2c_master_xfer,  Do you think?

I agree.
>
>
>
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-02-18  7:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 19:52 [PATCH] i2c: cadence: try reset when master receive error interrupts sxauwsk
2019-01-29 19:52 ` sxauwsk
2019-02-15 11:07 ` Shubhrajyoti Datta
2019-02-15 11:07   ` Shubhrajyoti Datta
2019-02-16  7:50   ` sxauwsk
2019-02-18  6:33     ` Shubhrajyoti Datta
2019-02-18  6:33       ` Shubhrajyoti Datta
2019-02-18  7:16       ` sxauwsk
2019-02-18  7:59         ` Shubhrajyoti Datta
2019-02-18  7:59           ` Shubhrajyoti Datta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.