diff mbox series

i2c: omap: Fix standard mode false ACK readings

Message ID 20230424195344.627861-1-reidt@ti.com
State Superseded
Headers show
Series i2c: omap: Fix standard mode false ACK readings | expand

Commit Message

reidt April 24, 2023, 7:53 p.m. UTC
Using standard mode, rare false ACK responses were appearing with
i2cdetect tool. This was happening due to NACK interrupt triggering
ISR thread before register access interrupt was ready. Removing the
NACK interrupt's ability to trigger ISR thread lets register access
ready interrupt do this instead.

Fixes: 3b2f8f82dad7 ("i2c: omap: switch to threaded IRQ support")

Signed-off-by: Reid Tonking <reidt@ti.com>
---
Fixes: LCPD-29949

 drivers/i2c/busses/i2c-omap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andi Shyti April 25, 2023, 12:45 p.m. UTC | #1
Hi Reid,

On Mon, Apr 24, 2023 at 02:53:44PM -0500, Reid Tonking wrote:
> Using standard mode, rare false ACK responses were appearing with
> i2cdetect tool. This was happening due to NACK interrupt triggering
> ISR thread before register access interrupt was ready. Removing the
> NACK interrupt's ability to trigger ISR thread lets register access
> ready interrupt do this instead.
> 
> Fixes: 3b2f8f82dad7 ("i2c: omap: switch to threaded IRQ support")
> 
> Signed-off-by: Reid Tonking <reidt@ti.com>

please don't leave any space between Fixes and SoB.

Add also:

Cc: <stable@vger.kernel.org> # v3.7+

and Cc the stable list.

Andi

> ---
> Fixes: LCPD-29949
> 
>  drivers/i2c/busses/i2c-omap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index f9ae520aed22..7ec252199706 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1058,7 +1058,7 @@ omap_i2c_isr(int irq, void *dev_id)
>  	u16 stat;
>  
>  	stat = omap_i2c_read_reg(omap, OMAP_I2C_STAT_REG);
> -	mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG);
> +	mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG) & ~OMAP_I2C_STAT_NACK;
>  
>  	if (stat & mask)
>  		ret = IRQ_WAKE_THREAD;
> -- 
> 2.34.1
>
reidt April 25, 2023, 3:51 p.m. UTC | #2
This is a resend to add stable list to cc as well as linux-i2c list
which fell off somehow.

On 09:56-20230425, Reid Tonking wrote:
> Hi Andi,
> 
> On 14:45-20230425, Andi Shyti wrote:
> > Hi Reid,
> > 
> > On Mon, Apr 24, 2023 at 02:53:44PM -0500, Reid Tonking wrote:
> > > Using standard mode, rare false ACK responses were appearing with
> > > i2cdetect tool. This was happening due to NACK interrupt triggering
> > > ISR thread before register access interrupt was ready. Removing the
> > > NACK interrupt's ability to trigger ISR thread lets register access
> > > ready interrupt do this instead.
> > > 
> > > Fixes: 3b2f8f82dad7 ("i2c: omap: switch to threaded IRQ support")
> > > 
> > > Signed-off-by: Reid Tonking <reidt@ti.com>
> > 
> > please don't leave any space between Fixes and SoB.
> > 
> > Add also:
> > 
> > Cc: <stable@vger.kernel.org> # v3.7+
> > 
> > and Cc the stable list.
> > 
> > Andi
> >
> 
> Thanks for the feedback, I'll make that change going forward.
> 
> -Reid

-Reid
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index f9ae520aed22..7ec252199706 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1058,7 +1058,7 @@  omap_i2c_isr(int irq, void *dev_id)
 	u16 stat;
 
 	stat = omap_i2c_read_reg(omap, OMAP_I2C_STAT_REG);
-	mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG);
+	mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG) & ~OMAP_I2C_STAT_NACK;
 
 	if (stat & mask)
 		ret = IRQ_WAKE_THREAD;