summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-rspi.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2014-06-02 15:38:17 +0200
committerMark Brown <broonie@linaro.org>2014-06-02 15:49:35 +0100
commit4f12b5e529e4ff274eb478ec1c2ef41358ed9577 (patch)
tree20d86f05f6256125bc0004ec57da9d0be3b4cc7b /drivers/spi/spi-rspi.c
parent03e627c55752fa434d5b3eba5ee3e489c51672b6 (diff)
downloadlinux-4f12b5e529e4ff274eb478ec1c2ef41358ed9577.tar.gz
linux-4f12b5e529e4ff274eb478ec1c2ef41358ed9577.tar.bz2
linux-4f12b5e529e4ff274eb478ec1c2ef41358ed9577.zip
spi: rspi: Add DMA support for QSPI on R-Car Gen2
Enable DMA support for QSPI on R-Car Gen2, for Single, Dual, and Quad SPI Transfers. Performance figures for reading from a QSPI FLASH driven at 24.375 MHz on r8a7791/koelsch: - Single: 1.1 Mbps PIO, 23 Mbps DMA - Dual : 12.7 Mbps PIO, 48 Mbps DMA - Quad : 13 Mbps PIO, 70 Mbps DMA Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-rspi.c')
-rw-r--r--drivers/spi/spi-rspi.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index b7f8be81423b..bec81470dd9c 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -642,6 +642,9 @@ static int qspi_transfer_out_in(struct rspi_data *rspi,
qspi_receive_init(rspi);
+ if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer))
+ return rspi_dma_transfer(rspi, &xfer->tx_sg, &xfer->rx_sg);
+
ret = rspi_pio_transfer(rspi, xfer->tx_buf, xfer->rx_buf, xfer->len);
if (ret < 0)
return ret;
@@ -656,6 +659,9 @@ static int qspi_transfer_out(struct rspi_data *rspi, struct spi_transfer *xfer)
{
int ret;
+ if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer))
+ return rspi_dma_transfer(rspi, &xfer->tx_sg, NULL);
+
ret = rspi_pio_transfer(rspi, xfer->tx_buf, NULL, xfer->len);
if (ret < 0)
return ret;
@@ -668,6 +674,9 @@ static int qspi_transfer_out(struct rspi_data *rspi, struct spi_transfer *xfer)
static int qspi_transfer_in(struct rspi_data *rspi, struct spi_transfer *xfer)
{
+ if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer))
+ return rspi_dma_transfer(rspi, NULL, &xfer->rx_sg);
+
return rspi_pio_transfer(rspi, NULL, xfer->rx_buf, xfer->len);
}