From: Raag Jadav <raagjadav@gmail.com>
To: Ludovic Desroches <ludovic.desroches@microchip.com>
Cc: linux-kernel@vger.kernel.org, alexandre.belloni@bootlin.com,
linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] i2c: at91: handle TXRDY interrupt spam
Date: Tue, 30 Apr 2019 04:03:32 +0530 [thread overview]
Message-ID: <20190429223332.GA3908@pc> (raw)
In-Reply-To: <20190429090005.f6ydghzu5n5yruav@M43218.corp.atmel.com>
On Mon, Apr 29, 2019 at 11:00:05AM +0200, Ludovic Desroches wrote:
> Hello Raag,
>
> On Tue, Apr 23, 2019 at 01:06:48PM +0530, Raag Jadav wrote:
> > External E-Mail
> >
> >
> > Performing i2c write operation while SDA or SCL line is held
> > or grounded by slave device, we go into infinite at91_twi_write_next_byte
> > loop with TXRDY interrupt spam.
>
> Sorry but I am not sure to have the full picture, the controller is in
> slave or master mode?
>
> SVREAD is only used in slave mode. When SVREAD is set, it means that a read
> access is performed and your issue concerns the write operation.
>
> Regards
>
> Ludovic
Yes, even though the datasheet suggests that SVREAD is irrelevant in master mode,
TXRDY and SVREAD are the only ones being set in status register upon reproducing the issue.
Couldn't think of a better way to handle such strange behaviour.
Any suggestions would be appreciated.
Cheers,
Raag
>
> >
> > Signed-off-by: Raag Jadav <raagjadav@gmail.com>
> > ---
> > drivers/i2c/busses/i2c-at91.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> > index 3f3e8b3..b2f5fdb 100644
> > --- a/drivers/i2c/busses/i2c-at91.c
> > +++ b/drivers/i2c/busses/i2c-at91.c
> > @@ -72,6 +72,7 @@
> > #define AT91_TWI_TXCOMP BIT(0) /* Transmission Complete */
> > #define AT91_TWI_RXRDY BIT(1) /* Receive Holding Register Ready */
> > #define AT91_TWI_TXRDY BIT(2) /* Transmit Holding Register Ready */
> > +#define AT91_TWI_SVREAD BIT(3) /* Slave Read */
> > #define AT91_TWI_OVRE BIT(6) /* Overrun Error */
> > #define AT91_TWI_UNRE BIT(7) /* Underrun Error */
> > #define AT91_TWI_NACK BIT(8) /* Not Acknowledged */
> > @@ -571,7 +572,10 @@ static irqreturn_t atmel_twi_interrupt(int irq, void *dev_id)
> > at91_disable_twi_interrupts(dev);
> > complete(&dev->cmd_complete);
> > } else if (irqstatus & AT91_TWI_TXRDY) {
> > - at91_twi_write_next_byte(dev);
> > + if ((status & AT91_TWI_SVREAD) && (dev->buf_len == 0))
> > + at91_twi_write(dev, AT91_TWI_IDR, AT91_TWI_TXRDY);
> > + else
> > + at91_twi_write_next_byte(dev);
> > }
> >
> > /* catch error flags */
> > --
> > 2.7.4
> >
> >
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-04-29 22:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 7:36 [PATCH] i2c: at91: handle TXRDY interrupt spam Raag Jadav
2019-04-29 9:00 ` Ludovic Desroches
2019-04-29 22:33 ` Raag Jadav [this message]
2019-05-02 14:01 ` Ludovic Desroches
2019-05-03 23:58 ` Raag Jadav
2019-05-06 8:19 ` Eugen.Hristev
2019-05-06 16:02 ` Raag Jadav
2019-05-14 8:52 ` Ludovic Desroches
2019-05-14 8:42 ` Ludovic Desroches
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=20190429223332.GA3908@pc \
--to=raagjadav@gmail.com \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@microchip.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;
as well as URLs for NNTP newsgroup(s).