summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-davinci.c
diff options
context:
space:
mode:
authorFrode Isaksen <fisaksen@baylibre.com>2017-02-23 21:02:00 +0300
committerMark Brown <broonie@kernel.org>2017-03-15 22:35:39 +0300
commit4dd9becbce4f10009322c3e2297f9db3ace94a10 (patch)
tree09a1f660b4fd532335aa44d8df4220fcb37f835b /drivers/spi/spi-davinci.c
parent0718b764880434ac7a5b7c0f5cb2c805c589a807 (diff)
downloadlinux-4dd9becbce4f10009322c3e2297f9db3ace94a10.tar.xz
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>
Diffstat (limited to 'drivers/spi/spi-davinci.c')
-rw-r--r--drivers/spi/spi-davinci.c4
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,
if (spicfg)
can_dma = (spicfg->io_type == SPI_IO_TYPE_DMA) &&
- (xfer->len >= DMA_MIN_BYTES);
+ (xfer->len >= DMA_MIN_BYTES) &&
+ !is_vmalloc_addr(xfer->rx_buf) &&
+ !is_vmalloc_addr(xfer->tx_buf);
return can_dma;
}