Message ID | 1391508384-5013-1-git-send-email-geert@linux-m68k.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Tue, Feb 04, 2014 at 11:06:24AM +0100, Geert Uytterhoeven wrote: > From: Geert Uytterhoeven <geert+renesas@linux-m68k.org> > > rspi_wait_for_interrupt() unconditionally enables interrupts, even when the > wait condition is already satisfied. This causes a high interrupt load (2 > interrupts/byte for full-duplex Single SPI transfers, 1 interrupt/byte for > RSPI with TX Only mode, or QSPI in unidirectional Dual or Quad Transfer > mode). Applied but I am wondering if the interrupts are really worth it in the first place especially at higher clock rates - if you can get completion within a small number of polls it might be more efficient to just do that rather than take interrupts.
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index df637184f6f0..c76f718a3a45 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c @@ -393,6 +393,9 @@ static int rspi_wait_for_interrupt(struct rspi_data *rspi, u8 wait_mask, int ret; rspi->spsr = rspi_read8(rspi, RSPI_SPSR); + if (rspi->spsr & wait_mask) + return 0; + rspi_enable_irq(rspi, enable_bit); ret = wait_event_timeout(rspi->wait, rspi->spsr & wait_mask, HZ); if (ret == 0 && !(rspi->spsr & wait_mask))