Skip to content

Commit

Permalink
spi: sirf: fix spi full-duplex DMA transferring issue
Browse files Browse the repository at this point in the history
sometimes t->tx can be equal with t->rx. for example, spidev will make
tx and rx point to spidev->buffer at the same time. currently, for this
case, we map the buffer BIDIRECTION to fix the cache consistency.

Signed-off-by: Qipan Li <Qipan.Li@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Qipan Li authored and Mark Brown committed Apr 14, 2014
1 parent d77ec5d commit bf83fd6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/spi/spi-sirf.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,18 @@ static int spi_sirfsoc_transfer(struct spi_device *spi, struct spi_transfer *t)
struct dma_async_tx_descriptor *rx_desc, *tx_desc;

sspi->dst_start = dma_map_single(&spi->dev,
sspi->rx, t->len, DMA_FROM_DEVICE);
sspi->rx, t->len, (t->tx_buf != t->rx_buf) ?
DMA_FROM_DEVICE : DMA_BIDIRECTIONAL);
rx_desc = dmaengine_prep_slave_single(sspi->rx_chan,
sspi->dst_start, t->len, DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
rx_desc->callback = spi_sirfsoc_dma_fini_callback;
rx_desc->callback_param = &sspi->rx_done;

sspi->src_start = dma_map_single(&spi->dev,
(void *)sspi->tx, t->len, DMA_TO_DEVICE);
(void *)sspi->tx, t->len,
(t->tx_buf != t->rx_buf) ?
DMA_TO_DEVICE : DMA_BIDIRECTIONAL);
tx_desc = dmaengine_prep_slave_single(sspi->tx_chan,
sspi->src_start, t->len, DMA_MEM_TO_DEV,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
Expand Down

0 comments on commit bf83fd6

Please sign in to comment.