diff options
-rw-r--r-- | drivers/spi/omap2_mcspi.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index 2a651e61bfbf..df85990bb335 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c | |||
@@ -397,7 +397,7 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) | |||
397 | 397 | ||
398 | if (tx != NULL) { | 398 | if (tx != NULL) { |
399 | wait_for_completion(&mcspi_dma->dma_tx_completion); | 399 | wait_for_completion(&mcspi_dma->dma_tx_completion); |
400 | dma_unmap_single(NULL, xfer->tx_dma, count, DMA_TO_DEVICE); | 400 | dma_unmap_single(&spi->dev, xfer->tx_dma, count, DMA_TO_DEVICE); |
401 | 401 | ||
402 | /* for TX_ONLY mode, be sure all words have shifted out */ | 402 | /* for TX_ONLY mode, be sure all words have shifted out */ |
403 | if (rx == NULL) { | 403 | if (rx == NULL) { |
@@ -412,7 +412,7 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) | |||
412 | 412 | ||
413 | if (rx != NULL) { | 413 | if (rx != NULL) { |
414 | wait_for_completion(&mcspi_dma->dma_rx_completion); | 414 | wait_for_completion(&mcspi_dma->dma_rx_completion); |
415 | dma_unmap_single(NULL, xfer->rx_dma, count, DMA_FROM_DEVICE); | 415 | dma_unmap_single(&spi->dev, xfer->rx_dma, count, DMA_FROM_DEVICE); |
416 | omap2_mcspi_set_enable(spi, 0); | 416 | omap2_mcspi_set_enable(spi, 0); |
417 | 417 | ||
418 | if (l & OMAP2_MCSPI_CHCONF_TURBO) { | 418 | if (l & OMAP2_MCSPI_CHCONF_TURBO) { |
@@ -1025,11 +1025,6 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m) | |||
1025 | if (m->is_dma_mapped || len < DMA_MIN_BYTES) | 1025 | if (m->is_dma_mapped || len < DMA_MIN_BYTES) |
1026 | continue; | 1026 | continue; |
1027 | 1027 | ||
1028 | /* Do DMA mapping "early" for better error reporting and | ||
1029 | * dcache use. Note that if dma_unmap_single() ever starts | ||
1030 | * to do real work on ARM, we'd need to clean up mappings | ||
1031 | * for previous transfers on *ALL* exits of this loop... | ||
1032 | */ | ||
1033 | if (tx_buf != NULL) { | 1028 | if (tx_buf != NULL) { |
1034 | t->tx_dma = dma_map_single(&spi->dev, (void *) tx_buf, | 1029 | t->tx_dma = dma_map_single(&spi->dev, (void *) tx_buf, |
1035 | len, DMA_TO_DEVICE); | 1030 | len, DMA_TO_DEVICE); |
@@ -1046,7 +1041,7 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m) | |||
1046 | dev_dbg(&spi->dev, "dma %cX %d bytes error\n", | 1041 | dev_dbg(&spi->dev, "dma %cX %d bytes error\n", |
1047 | 'R', len); | 1042 | 'R', len); |
1048 | if (tx_buf != NULL) | 1043 | if (tx_buf != NULL) |
1049 | dma_unmap_single(NULL, t->tx_dma, | 1044 | dma_unmap_single(&spi->dev, t->tx_dma, |
1050 | len, DMA_TO_DEVICE); | 1045 | len, DMA_TO_DEVICE); |
1051 | return -EINVAL; | 1046 | return -EINVAL; |
1052 | } | 1047 | } |