@@ -927,7 +927,9 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m)
__raw_writel(0, cs->base
+ OMAP2_MCSPI_TX0);
- if (m->is_dma_mapped || t->len >= DMA_MIN_BYTES)
+ if (m->is_dma_mapped || (t->len >= DMA_MIN_BYTES
+ && t->tx_buf < high_memory
+ && t->rx_buf < high_memory))
count = omap2_mcspi_txrx_dma(spi, t);
else
count = omap2_mcspi_txrx_pio(spi, t);
@@ -1004,6 +1006,11 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master,
if (m->is_dma_mapped || len < DMA_MIN_BYTES)
continue;
+ if (tx_buf >= high_memory || rx_buf >= high_memory) {
+ WARN_ONCE(1, "high memory is invalid for DMA, falling back to PIO\n");
+ continue;
+ }
+
if (tx_buf != NULL) {
t->tx_dma = dma_map_single(mcspi->dev, (void *) tx_buf,
len, DMA_TO_DEVICE);
UBI uses vmalloc'ed buffers in some cases which are not valid for DMA, so use PIO instead. Signed-off-by: Jan Luebbe <jlu@pengutronix.de> --- drivers/spi/spi-omap2-mcspi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)