diff options
author | Martin Sperl <kernel@martin.sperl.org> | 2015-03-29 10:03:25 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-03-29 12:53:30 -0400 |
commit | e3a2be3030e2fec27a2577d3c52203da090a4366 (patch) | |
tree | 91d1180ee0742a9403c2448cd1ceb5d1d967653c | |
parent | 1e4df62d46fa45109123f2b265b2d8146031db16 (diff) |
spi: bcm2835: fill FIFO before enabling interrupts to reduce interrupts/message
To reduce the number of interrupts/message we fill the FIFO before
enabling interrupts - for short messages this reduces the interrupt count
from 2 to 1 interrupt.
There have been rare cases where short (<200ns) chip-select switches with
native CS have been observed during such operation, this is why this
optimization is only enabled for GPIO-CS.
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Tested-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/spi/spi-bcm2835.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index 2e6533e34b19..08e5406c5029 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c | |||
@@ -203,6 +203,22 @@ static int bcm2835_spi_transfer_one(struct spi_master *master, | |||
203 | bs->tx_len = tfr->len; | 203 | bs->tx_len = tfr->len; |
204 | bs->rx_len = tfr->len; | 204 | bs->rx_len = tfr->len; |
205 | 205 | ||
206 | /* fill in fifo if we have gpio-cs | ||
207 | * note that there have been rare events where the native-CS | ||
208 | * flapped for <1us which may change the behaviour | ||
209 | * with gpio-cs this does not happen, so it is implemented | ||
210 | * only for this case | ||
211 | */ | ||
212 | if (gpio_is_valid(spi->cs_gpio)) { | ||
213 | /* enable HW block, but without interrupts enabled | ||
214 | * this would triggern an immediate interrupt | ||
215 | */ | ||
216 | bcm2835_wr(bs, BCM2835_SPI_CS, | ||
217 | cs | BCM2835_SPI_CS_TA); | ||
218 | /* fill in tx fifo as much as possible */ | ||
219 | bcm2835_wr_fifo(bs); | ||
220 | } | ||
221 | |||
206 | /* | 222 | /* |
207 | * Enable the HW block. This will immediately trigger a DONE (TX | 223 | * Enable the HW block. This will immediately trigger a DONE (TX |
208 | * empty) interrupt, upon which we will fill the TX FIFO with the | 224 | * empty) interrupt, upon which we will fill the TX FIFO with the |