Commit e8f39e9f authored by David Engraf's avatar David Engraf Committed by Wolfram Sang
Browse files

i2c: at91: Read all available bytes at once

With FIFO enabled it is possible to read multiple bytes
at once in the interrupt handler as long as RXRDY is
set. This may also reduce the number of interrupts.

This patch polls RXRDY and reads all available bytes at
Signed-off-by: default avatarDavid Engraf <>
Acked-by: default avatarLudovic Desroches <>
[wsa: reformatted comment]
Signed-off-by: default avatarWolfram Sang <>
parent 562de4ff
......@@ -518,8 +518,16 @@ static irqreturn_t atmel_twi_interrupt(int irq, void *dev_id)
* the RXRDY interrupt first in order to not keep garbage data in the
* Receive Holding Register for the next transfer.
if (irqstatus & AT91_TWI_RXRDY)
if (irqstatus & AT91_TWI_RXRDY) {
* Read all available bytes at once by polling RXRDY usable w/
* and w/o FIFO. With FIFO enabled we could also read RXFL and
* avoid polling RXRDY.
do {
} while (at91_twi_read(dev, AT91_TWI_SR) & AT91_TWI_RXRDY);
* When a NACK condition is detected, the I2C controller sets the NACK,
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment