diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2014-06-02 09:38:14 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-06-02 10:49:35 -0400 |
commit | e4b52dc4625ee739195189d40c6ddc7d55ddf312 (patch) | |
tree | d7ce366d319b52d089eacc8fc367bb087813d025 /drivers/spi/spi-rspi.c | |
parent | 8393fa787bf63c05cb6f9cf0a58ba1ea213c3f01 (diff) |
spi: rspi: Pass sg_tables instead of spi_tranfer to rspi_*_dma()
The DMA routines only need access to the scatter-gather tables inside the
spi_transfer structures, hence just pass those.
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.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 3dea8adfdcf3..bfa5e7e5df5a 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
@@ -463,13 +463,13 @@ static void rspi_dma_complete(void *arg) | |||
463 | wake_up_interruptible(&rspi->wait); | 463 | wake_up_interruptible(&rspi->wait); |
464 | } | 464 | } |
465 | 465 | ||
466 | static int rspi_send_dma(struct rspi_data *rspi, struct spi_transfer *t) | 466 | static int rspi_send_dma(struct rspi_data *rspi, struct sg_table *tx) |
467 | { | 467 | { |
468 | struct dma_async_tx_descriptor *desc; | 468 | struct dma_async_tx_descriptor *desc; |
469 | int ret; | 469 | int ret; |
470 | 470 | ||
471 | desc = dmaengine_prep_slave_sg(rspi->master->dma_tx, t->tx_sg.sgl, | 471 | desc = dmaengine_prep_slave_sg(rspi->master->dma_tx, tx->sgl, |
472 | t->tx_sg.nents, DMA_TO_DEVICE, | 472 | tx->nents, DMA_TO_DEVICE, |
473 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 473 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
474 | if (!desc) | 474 | if (!desc) |
475 | return -EIO; | 475 | return -EIO; |
@@ -530,21 +530,22 @@ static void qspi_receive_init(const struct rspi_data *rspi) | |||
530 | rspi_write8(rspi, 0, QSPI_SPBFCR); | 530 | rspi_write8(rspi, 0, QSPI_SPBFCR); |
531 | } | 531 | } |
532 | 532 | ||
533 | static int rspi_send_receive_dma(struct rspi_data *rspi, struct spi_transfer *t) | 533 | static int rspi_send_receive_dma(struct rspi_data *rspi, struct sg_table *tx, |
534 | struct sg_table *rx) | ||
534 | { | 535 | { |
535 | struct dma_async_tx_descriptor *desc_tx, *desc_rx; | 536 | struct dma_async_tx_descriptor *desc_tx, *desc_rx; |
536 | int ret; | 537 | int ret; |
537 | 538 | ||
538 | /* prepare transmit transfer */ | 539 | /* prepare transmit transfer */ |
539 | desc_tx = dmaengine_prep_slave_sg(rspi->master->dma_tx, t->tx_sg.sgl, | 540 | desc_tx = dmaengine_prep_slave_sg(rspi->master->dma_tx, tx->sgl, |
540 | t->tx_sg.nents, DMA_TO_DEVICE, | 541 | tx->nents, DMA_TO_DEVICE, |
541 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 542 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
542 | if (!desc_tx) | 543 | if (!desc_tx) |
543 | return -EIO; | 544 | return -EIO; |
544 | 545 | ||
545 | /* prepare receive transfer */ | 546 | /* prepare receive transfer */ |
546 | desc_rx = dmaengine_prep_slave_sg(rspi->master->dma_rx, t->rx_sg.sgl, | 547 | desc_rx = dmaengine_prep_slave_sg(rspi->master->dma_rx, rx->sgl, |
547 | t->rx_sg.nents, DMA_FROM_DEVICE, | 548 | rx->nents, DMA_FROM_DEVICE, |
548 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 549 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
549 | if (!desc_rx) | 550 | if (!desc_rx) |
550 | return -EIO; | 551 | return -EIO; |
@@ -616,9 +617,10 @@ static int rspi_transfer_one(struct spi_master *master, struct spi_device *spi, | |||
616 | 617 | ||
617 | if (master->can_dma && __rspi_can_dma(rspi, xfer)) { | 618 | if (master->can_dma && __rspi_can_dma(rspi, xfer)) { |
618 | if (xfer->rx_buf) | 619 | if (xfer->rx_buf) |
619 | return rspi_send_receive_dma(rspi, xfer); | 620 | return rspi_send_receive_dma(rspi, &xfer->tx_sg, |
621 | &xfer->rx_sg); | ||
620 | else | 622 | else |
621 | return rspi_send_dma(rspi, xfer); | 623 | return rspi_send_dma(rspi, &xfer->tx_sg); |
622 | } | 624 | } |
623 | 625 | ||
624 | ret = rspi_pio_transfer(rspi, xfer->tx_buf, xfer->rx_buf, xfer->len); | 626 | ret = rspi_pio_transfer(rspi, xfer->tx_buf, xfer->rx_buf, xfer->len); |