|
@@ -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)
|
|
|
- at91_twi_read_next_byte(dev);
|
|
|
+ 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 {
|
|
|
+ at91_twi_read_next_byte(dev);
|
|
|
+ } while (at91_twi_read(dev, AT91_TWI_SR) & AT91_TWI_RXRDY);
|
|
|
+ }
|
|
|
|
|
|
/*
|
|
|
* When a NACK condition is detected, the I2C controller sets the NACK,
|