diff options
Diffstat (limited to 'target/linux/ipq806x/patches-4.9/0016-spi-qup-allow-mulitple-DMA-transactions-per-spi-xfer.patch')
-rw-r--r-- | target/linux/ipq806x/patches-4.9/0016-spi-qup-allow-mulitple-DMA-transactions-per-spi-xfer.patch | 70 |
1 files changed, 33 insertions, 37 deletions
diff --git a/target/linux/ipq806x/patches-4.9/0016-spi-qup-allow-mulitple-DMA-transactions-per-spi-xfer.patch b/target/linux/ipq806x/patches-4.9/0016-spi-qup-allow-mulitple-DMA-transactions-per-spi-xfer.patch index de324ffd6e..ce59d492e2 100644 --- a/target/linux/ipq806x/patches-4.9/0016-spi-qup-allow-mulitple-DMA-transactions-per-spi-xfer.patch +++ b/target/linux/ipq806x/patches-4.9/0016-spi-qup-allow-mulitple-DMA-transactions-per-spi-xfer.patch @@ -44,58 +44,54 @@ Signed-off-by: Matthew McClintock <mmcclint@codeaurora.org> - ret = spi_qup_io_config(spi, xfer); - if (ret) - return ret; -- ++ rx_sgl = xfer->rx_sg.sgl; ++ tx_sgl = xfer->tx_sg.sgl; + - /* before issuing the descriptors, set the QUP to run */ - ret = spi_qup_set_state(qup, QUP_STATE_RUN); - if (ret) { - dev_warn(qup->dev, "cannot set RUN state\n"); - return ret; - } -- ++ do { ++ int rx_nents = 0, tx_nents = 0; + - if (!qup->qup_v1) { - if (xfer->rx_buf) - rx_done = spi_qup_dma_done; -- ++ if (rx_sgl) { ++ rx_nents = sg_nents_for_len(rx_sgl, SPI_MAX_XFER); ++ if (rx_nents < 0) ++ rx_nents = sg_nents(rx_sgl); + - if (xfer->tx_buf) - tx_done = spi_qup_dma_done; - } -- ++ qup->n_words = spi_qup_sgl_get_size(rx_sgl, rx_nents) / ++ qup->w_size; ++ } + - if (xfer->rx_buf) { - ret = spi_qup_prep_sg(master, xfer->rx_sg.sgl, - xfer->rx_sg.nents, DMA_DEV_TO_MEM, - rx_done, &qup->done); - if (ret) - return ret; -+ rx_sgl = xfer->rx_sg.sgl; -+ tx_sgl = xfer->tx_sg.sgl; ++ if (tx_sgl) { ++ tx_nents = sg_nents_for_len(tx_sgl, SPI_MAX_XFER); ++ if (tx_nents < 0) ++ tx_nents = sg_nents(tx_sgl); - dma_async_issue_pending(master->dma_rx); - } -+ do { -+ int rx_nents = 0, tx_nents = 0; ++ qup->n_words = spi_qup_sgl_get_size(tx_sgl, tx_nents) / ++ qup->w_size; ++ } - if (xfer->tx_buf) { - ret = spi_qup_prep_sg(master, xfer->tx_sg.sgl, - xfer->tx_sg.nents, DMA_MEM_TO_DEV, - tx_done, &qup->dma_tx_done); -+ if (rx_sgl) { -+ rx_nents = sg_nents_for_len(rx_sgl, SPI_MAX_XFER); -+ if (rx_nents < 0) -+ rx_nents = sg_nents(rx_sgl); -+ -+ qup->n_words = spi_qup_sgl_get_size(rx_sgl, rx_nents) / -+ qup->w_size; -+ } -+ -+ if (tx_sgl) { -+ tx_nents = sg_nents_for_len(tx_sgl, SPI_MAX_XFER); -+ if (tx_nents < 0) -+ tx_nents = sg_nents(tx_sgl); -+ -+ qup->n_words = spi_qup_sgl_get_size(tx_sgl, tx_nents) / -+ qup->w_size; -+ } -+ + + ret = spi_qup_io_config(spi, xfer); if (ret) @@ -109,17 +105,22 @@ Signed-off-by: Matthew McClintock <mmcclint@codeaurora.org> + dev_warn(qup->dev, "cannot set RUN state\n"); + return ret; + } -+ + +- if (xfer->rx_buf && !wait_for_completion_timeout(&qup->done, timeout)) +- return -ETIMEDOUT; + if (!qup->qup_v1) { + if (rx_sgl) { + rx_done = spi_qup_dma_done; + } -+ + +- if (xfer->tx_buf && !wait_for_completion_timeout(&qup->dma_tx_done, timeout)) +- ret = -ETIMEDOUT; + if (tx_sgl) { + tx_done = spi_qup_dma_done; + } + } -+ + +- return ret; + if (rx_sgl) { + ret = spi_qup_prep_sg(master, rx_sgl, rx_nents, + DMA_DEV_TO_MEM, rx_done, @@ -149,17 +150,12 @@ Signed-off-by: Matthew McClintock <mmcclint@codeaurora.org> + pr_emerg(" tx timed out\n"); + return -ETIMEDOUT; + } - -- if (xfer->rx_buf && !wait_for_completion_timeout(&qup->done, timeout)) -- return -ETIMEDOUT; ++ + for (; rx_sgl && rx_nents--; rx_sgl = sg_next(rx_sgl)); + for (; tx_sgl && tx_nents--; tx_sgl = sg_next(tx_sgl)); - -- if (xfer->tx_buf && !wait_for_completion_timeout(&qup->dma_tx_done, timeout)) -- ret = -ETIMEDOUT; ++ + } while (rx_sgl || tx_sgl); - -- return ret; ++ + return 0; } |