diff options
author | Frode Isaksen <fisaksen@baylibre.com> | 2017-02-23 13:02:00 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-03-15 15:35:39 -0400 |
commit | 4dd9becbce4f10009322c3e2297f9db3ace94a10 (patch) | |
tree | 09a1f660b4fd532335aa44d8df4220fcb37f835b | |
parent | 0718b764880434ac7a5b7c0f5cb2c805c589a807 (diff) |
spi: davinci: do not use DMA for vmalloc'ed buffers
Using vmalloc'ed buffers will fail since daVinci has
VIVT cache and only the kernel lowmem virtual address
is invalidated/flushed when performing DMA.
The virtual address returned from vmalloc() is not
invalidated/flushed and may contain stale data when
returning from spi_sync().
Fixes errors when running UBIFS over SPI NOR.
Revert this when all upper layer users of vmalloc'ed
buffers sent to SPI handles cache flushing/invalidating.
Signed-off-by: Frode Isaksen <fisaksen@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/spi/spi-davinci.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 75c658e4e487..f37bbdd18d61 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -482,7 +482,9 @@ static bool davinci_spi_can_dma(struct spi_master *master, | |||
482 | 482 | ||
483 | if (spicfg) | 483 | if (spicfg) |
484 | can_dma = (spicfg->io_type == SPI_IO_TYPE_DMA) && | 484 | can_dma = (spicfg->io_type == SPI_IO_TYPE_DMA) && |
485 | (xfer->len >= DMA_MIN_BYTES); | 485 | (xfer->len >= DMA_MIN_BYTES) && |
486 | !is_vmalloc_addr(xfer->rx_buf) && | ||
487 | !is_vmalloc_addr(xfer->tx_buf); | ||
486 | 488 | ||
487 | return can_dma; | 489 | return can_dma; |
488 | } | 490 | } |