Re: [PATCH] i2c: at91: disable TXRDY interrupt after sending data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 01, 2019 at 10:35:52PM +0530, Raag Jadav wrote:
> External E-Mail
> 
> 
> On Wed, Jul 31, 2019 at 02:37:35PM +0200, Ludovic Desroches wrote:
> > Hi,
> > 
> > On Mon, Jul 22, 2019 at 08:55:27PM +0200, Michał Mirosław wrote:
> > > 
> > > Driver was not disabling TXRDY interrupt after last TX byte.
> > > This caused interrupt storm until transfer timeouts for slow
> > > or broken device on the bus. The patch fixes the interrupt storm
> > > on my SAMA5D2-based board.
> > > 
> > > Cc: stable@xxxxxxxxxxxxxxx # 5.2.x
> > > [v5.2 introduced file split; the patch should apply to i2c-at91.c before the split]
> > > Fixes: fac368a0404 ("i2c: at91: add new driver")
> > > Signed-off-by: Michał Mirosław <mirq-linux@xxxxxxxxxxxx>
> > Acked-by: Ludovic Desroches <ludovic.desroches@xxxxxxxxxxxxx> 
> 
> Tested-by: Raag Jadav <raagjadav@xxxxxxxxx>
> 
> > 
> > Sounds good to me as AT91_TWI_TXRDY is only used to send the next byte.
> > 
> > Raag, you added you in the copy list as it seems close to your issue. I am
> > really sorry, I didn't have time to go further with your issue. Is this
> > patch solves your issue?
> 
> Yes, although I had a v2 ready to send out with similar changes,
> this patch does the job as well.

Great, thanks for the test Raag.

Regards

Ludovic

> 
> Cheers,
> Raag
> 
> > 
> > Thanks for this patch.
> > 
> > Ludovic
> > 
> > > ---
> > >  drivers/i2c/busses/i2c-at91-master.c | 9 +++++----
> > >  1 file changed, 5 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/drivers/i2c/busses/i2c-at91-master.c b/drivers/i2c/busses/i2c-at91-master.c
> > > index e87232f2e708..a3fcc35ffd3b 100644
> > > --- a/drivers/i2c/busses/i2c-at91-master.c
> > > +++ b/drivers/i2c/busses/i2c-at91-master.c
> > > @@ -122,9 +122,11 @@ static void at91_twi_write_next_byte(struct at91_twi_dev *dev)
> > >  	writeb_relaxed(*dev->buf, dev->base + AT91_TWI_THR);
> > >  
> > >  	/* send stop when last byte has been written */
> > > -	if (--dev->buf_len == 0)
> > > +	if (--dev->buf_len == 0) {
> > >  		if (!dev->use_alt_cmd)
> > >  			at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_STOP);
> > > +		at91_twi_write(dev, AT91_TWI_IDR, AT91_TWI_TXRDY);
> > > +	}
> > >  
> > >  	dev_dbg(dev->dev, "wrote 0x%x, to go %zu\n", *dev->buf, dev->buf_len);
> > >  
> > > @@ -542,9 +544,8 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev)
> > >  		} else {
> > >  			at91_twi_write_next_byte(dev);
> > >  			at91_twi_write(dev, AT91_TWI_IER,
> > > -				       AT91_TWI_TXCOMP |
> > > -				       AT91_TWI_NACK |
> > > -				       AT91_TWI_TXRDY);
> > > +				       AT91_TWI_TXCOMP | AT91_TWI_NACK |
> > > +				       (dev->buf_len ? AT91_TWI_TXRDY : 0));
> > >  		}
> > >  	}
> > >  
> > > -- 
> > > 2.20.1
> > > 



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux