diff options
author | Sanchayan Maity <maitysanchayan@gmail.com> | 2016-11-23 12:13:22 +0530 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2017-01-11 15:56:33 +0100 |
commit | 56ffbfa0a24d8fd51ce9a7f79e36150a75b68c2a (patch) | |
tree | 01b92515c7bf7fd9be5f4281d47d3dcaef94c651 /drivers/spi | |
parent | 90b6d2186ceb4ff76a63d474b7a991ae7be49388 (diff) |
spi: spi-fsl-dspi: Purge switch between EOQ and DMA mode
Currently the DMA transfer path switches to EOQ mode for transfers
less than or equal to the DSPI FIFO size. Remove this and rely on
DMA mode alone.
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-fsl-dspi.c | 53 |
1 files changed, 14 insertions, 39 deletions
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 0dd91f8f15b8..ffe16fc4325b 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -521,48 +521,20 @@ static int dspi_dma_xfer(struct fsl_dspi *dspi) curr_remaining_bytes = dspi->len; bytes_per_buffer = DSPI_DMA_BUFSIZE / DSPI_FIFO_SIZE; while (curr_remaining_bytes) { - if (curr_remaining_bytes > DSPI_FIFO_SIZE) { - dspi->devtype_data->trans_mode = DSPI_DMA_MODE; + /* Check if current transfer fits the DMA buffer */ + dma->curr_xfer_len = curr_remaining_bytes / word; + if (dma->curr_xfer_len > bytes_per_buffer) + dma->curr_xfer_len = bytes_per_buffer; - regmap_write(dspi->regmap, SPI_RSER, 0); - regmap_write(dspi->regmap, SPI_RSER, - SPI_RSER_TFFFE | SPI_RSER_TFFFD | - SPI_RSER_RFDFE | SPI_RSER_RFDFD); - - /* Check if current transfer fits the DMA buffer */ - dma->curr_xfer_len = curr_remaining_bytes / word; - if (dma->curr_xfer_len > bytes_per_buffer) - dma->curr_xfer_len = bytes_per_buffer; - - ret = dspi_next_xfer_dma_submit(dspi); - if (ret) { - dev_err(dev, "DMA transfer failed\n"); - goto exit; + ret = dspi_next_xfer_dma_submit(dspi); + if (ret) { + dev_err(dev, "DMA transfer failed\n"); + goto exit; - } else { - curr_remaining_bytes -= dma->curr_xfer_len * word; - if (curr_remaining_bytes < 0) - curr_remaining_bytes = 0; - } } else { - dspi->devtype_data->trans_mode = DSPI_EOQ_MODE; - - regmap_write(dspi->regmap, SPI_RSER, 0); - regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_EOQFE); - - dspi_eoq_write(dspi); - - if (wait_event_interruptible(dspi->waitq, - dspi->waitflags)) { - dev_err(dev, "wait transfer complete fail!\n"); - ret = -ETIMEDOUT; - dspi->waitflags = 0; - goto exit; - } - - dspi->waitflags = 0; - curr_remaining_bytes = dspi->len; - dspi->devtype_data->trans_mode = DSPI_DMA_MODE; + curr_remaining_bytes -= dma->curr_xfer_len * word; + if (curr_remaining_bytes < 0) + curr_remaining_bytes = 0; } } @@ -733,6 +705,9 @@ static int dspi_transfer_one_message(struct spi_master *master, dspi_tcfq_write(dspi); break; case DSPI_DMA_MODE: + regmap_write(dspi->regmap, SPI_RSER, + SPI_RSER_TFFFE | SPI_RSER_TFFFD | + SPI_RSER_RFDFE | SPI_RSER_RFDFD); status = dspi_dma_xfer(dspi); break; default: |