diff options
author | Linus Walleij <linus.walleij@stericsson.com> | 2010-12-22 17:13:07 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-12-23 23:06:43 -0500 |
commit | b729889686afb7d4366e07fe9c2f7a2737166462 (patch) | |
tree | 8063ce64045ee4f8834e3e52155d81ef843711db /drivers | |
parent | 9d32af66aa3a0e28d95fc607e208795ef6cc993a (diff) |
spi/pl022: map the buffers on the DMA engine
The struct device for the DMA engine is the apropriate one to use
when mapping/unmapping buffers. This is because the memory which
is addressable by DMA is determined by the DMA engine rather than
the device.
Reported-by: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/spi/amba-pl022.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c index 2e506319b60f..e29751af5c7b 100644 --- a/drivers/spi/amba-pl022.c +++ b/drivers/spi/amba-pl022.c | |||
@@ -782,9 +782,9 @@ static void *next_transfer(struct pl022 *pl022) | |||
782 | static void unmap_free_dma_scatter(struct pl022 *pl022) | 782 | static void unmap_free_dma_scatter(struct pl022 *pl022) |
783 | { | 783 | { |
784 | /* Unmap and free the SG tables */ | 784 | /* Unmap and free the SG tables */ |
785 | dma_unmap_sg(&pl022->adev->dev, pl022->sgt_tx.sgl, | 785 | dma_unmap_sg(pl022->dma_tx_channel->device->dev, pl022->sgt_tx.sgl, |
786 | pl022->sgt_tx.nents, DMA_TO_DEVICE); | 786 | pl022->sgt_tx.nents, DMA_TO_DEVICE); |
787 | dma_unmap_sg(&pl022->adev->dev, pl022->sgt_rx.sgl, | 787 | dma_unmap_sg(pl022->dma_rx_channel->device->dev, pl022->sgt_rx.sgl, |
788 | pl022->sgt_rx.nents, DMA_FROM_DEVICE); | 788 | pl022->sgt_rx.nents, DMA_FROM_DEVICE); |
789 | sg_free_table(&pl022->sgt_rx); | 789 | sg_free_table(&pl022->sgt_rx); |
790 | sg_free_table(&pl022->sgt_tx); | 790 | sg_free_table(&pl022->sgt_tx); |
@@ -991,12 +991,12 @@ static int configure_dma(struct pl022 *pl022) | |||
991 | pl022->cur_transfer->len, &pl022->sgt_tx); | 991 | pl022->cur_transfer->len, &pl022->sgt_tx); |
992 | 992 | ||
993 | /* Map DMA buffers */ | 993 | /* Map DMA buffers */ |
994 | sglen = dma_map_sg(&pl022->adev->dev, pl022->sgt_rx.sgl, | 994 | sglen = dma_map_sg(rxchan->device->dev, pl022->sgt_rx.sgl, |
995 | pl022->sgt_rx.nents, DMA_FROM_DEVICE); | 995 | pl022->sgt_rx.nents, DMA_FROM_DEVICE); |
996 | if (!sglen) | 996 | if (!sglen) |
997 | goto err_rx_sgmap; | 997 | goto err_rx_sgmap; |
998 | 998 | ||
999 | sglen = dma_map_sg(&pl022->adev->dev, pl022->sgt_tx.sgl, | 999 | sglen = dma_map_sg(txchan->device->dev, pl022->sgt_tx.sgl, |
1000 | pl022->sgt_tx.nents, DMA_TO_DEVICE); | 1000 | pl022->sgt_tx.nents, DMA_TO_DEVICE); |
1001 | if (!sglen) | 1001 | if (!sglen) |
1002 | goto err_tx_sgmap; | 1002 | goto err_tx_sgmap; |
@@ -1040,10 +1040,10 @@ err_txdesc: | |||
1040 | txchan->device->device_control(txchan, DMA_TERMINATE_ALL, 0); | 1040 | txchan->device->device_control(txchan, DMA_TERMINATE_ALL, 0); |
1041 | err_rxdesc: | 1041 | err_rxdesc: |
1042 | rxchan->device->device_control(rxchan, DMA_TERMINATE_ALL, 0); | 1042 | rxchan->device->device_control(rxchan, DMA_TERMINATE_ALL, 0); |
1043 | dma_unmap_sg(&pl022->adev->dev, pl022->sgt_tx.sgl, | 1043 | dma_unmap_sg(txchan->device->dev, pl022->sgt_tx.sgl, |
1044 | pl022->sgt_tx.nents, DMA_TO_DEVICE); | 1044 | pl022->sgt_tx.nents, DMA_TO_DEVICE); |
1045 | err_tx_sgmap: | 1045 | err_tx_sgmap: |
1046 | dma_unmap_sg(&pl022->adev->dev, pl022->sgt_rx.sgl, | 1046 | dma_unmap_sg(rxchan->device->dev, pl022->sgt_rx.sgl, |
1047 | pl022->sgt_tx.nents, DMA_FROM_DEVICE); | 1047 | pl022->sgt_tx.nents, DMA_FROM_DEVICE); |
1048 | err_rx_sgmap: | 1048 | err_rx_sgmap: |
1049 | sg_free_table(&pl022->sgt_tx); | 1049 | sg_free_table(&pl022->sgt_tx); |