1 From a24914d34a4c6df4323c6d98950166600da79bc6 Mon Sep 17 00:00:00 2001
2 From: Matthew McClintock <mmcclint@codeaurora.org>
3 Date: Wed, 4 May 2016 16:33:42 -0500
4 Subject: [PATCH 15/37] spi: qup: refactor spi_qup_prep_sg to be more take
7 This is in preparation for splitting DMA into multiple transacations,
8 this contains no code changes just refactoring.
10 Signed-off-by: Matthew McClintock <mmcclint@codeaurora.org>
12 drivers/spi/spi-qup.c | 28 +++++++++++-----------------
13 1 file changed, 11 insertions(+), 17 deletions(-)
15 --- a/drivers/spi/spi-qup.c
16 +++ b/drivers/spi/spi-qup.c
17 @@ -379,27 +379,19 @@ static void spi_qup_write(struct spi_qup
21 -static int spi_qup_prep_sg(struct spi_master *master, struct spi_transfer *xfer,
22 - enum dma_transfer_direction dir,
23 - dma_async_tx_callback callback,
25 +static int spi_qup_prep_sg(struct spi_master *master, struct scatterlist *sgl,
26 + unsigned int nents, enum dma_transfer_direction dir,
27 + dma_async_tx_callback callback, void *data)
29 unsigned long flags = DMA_PREP_INTERRUPT | DMA_PREP_FENCE;
30 struct dma_async_tx_descriptor *desc;
31 - struct scatterlist *sgl;
32 struct dma_chan *chan;
36 - if (dir == DMA_MEM_TO_DEV) {
37 + if (dir == DMA_MEM_TO_DEV)
38 chan = master->dma_tx;
39 - nents = xfer->tx_sg.nents;
40 - sgl = xfer->tx_sg.sgl;
43 chan = master->dma_rx;
44 - nents = xfer->rx_sg.nents;
45 - sgl = xfer->rx_sg.sgl;
48 desc = dmaengine_prep_slave_sg(chan, sgl, nents, dir, flags);
49 if (IS_ERR_OR_NULL(desc))
50 @@ -602,8 +594,9 @@ unsigned long timeout)
54 - ret = spi_qup_prep_sg(master, xfer, DMA_DEV_TO_MEM, rx_done,
56 + ret = spi_qup_prep_sg(master, xfer->rx_sg.sgl,
57 + xfer->rx_sg.nents, DMA_DEV_TO_MEM,
58 + rx_done, &qup->done);
62 @@ -611,8 +604,9 @@ unsigned long timeout)
66 - ret = spi_qup_prep_sg(master, xfer, DMA_MEM_TO_DEV, tx_done,
68 + ret = spi_qup_prep_sg(master, xfer->tx_sg.sgl,
69 + xfer->tx_sg.nents, DMA_MEM_TO_DEV,
70 + tx_done, &qup->dma_tx_done);