diff options
author | Paul Mackerras | 2008-12-03 10:11:06 +0100 |
---|---|---|
committer | Paul Mackerras | 2008-12-03 10:11:06 +0100 |
commit | 527491885554002837b5742202adc0ab5f536e54 (patch) | |
tree | 6d9c44776e0b4368eccd414b92b957fac3c5a4c6 /drivers/spi/pxa2xx_spi.c | |
parent | Merge branch 'linux-2.6' into next (diff) | |
parent | powerpc: Fix dma_map_sg() cache flushing on non coherent platforms (diff) | |
download | kernel-qcow2-linux-527491885554002837b5742202adc0ab5f536e54.tar.gz kernel-qcow2-linux-527491885554002837b5742202adc0ab5f536e54.tar.xz kernel-qcow2-linux-527491885554002837b5742202adc0ab5f536e54.zip |
Merge branch 'merge'
Diffstat (limited to 'drivers/spi/pxa2xx_spi.c')
-rw-r--r-- | drivers/spi/pxa2xx_spi.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index dae87b1a4c6e..cf12f2d84be2 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c @@ -352,21 +352,21 @@ static int map_dma_buffers(struct driver_data *drv_data) } else drv_data->tx_map_len = drv_data->len; - /* Stream map the rx buffer */ - drv_data->rx_dma = dma_map_single(dev, drv_data->rx, - drv_data->rx_map_len, - DMA_FROM_DEVICE); - if (dma_mapping_error(dev, drv_data->rx_dma)) - return 0; - - /* Stream map the tx buffer */ + /* Stream map the tx buffer. Always do DMA_TO_DEVICE first + * so we flush the cache *before* invalidating it, in case + * the tx and rx buffers overlap. + */ drv_data->tx_dma = dma_map_single(dev, drv_data->tx, - drv_data->tx_map_len, - DMA_TO_DEVICE); + drv_data->tx_map_len, DMA_TO_DEVICE); + if (dma_mapping_error(dev, drv_data->tx_dma)) + return 0; - if (dma_mapping_error(dev, drv_data->tx_dma)) { - dma_unmap_single(dev, drv_data->rx_dma, + /* Stream map the rx buffer */ + drv_data->rx_dma = dma_map_single(dev, drv_data->rx, drv_data->rx_map_len, DMA_FROM_DEVICE); + if (dma_mapping_error(dev, drv_data->rx_dma)) { + dma_unmap_single(dev, drv_data->tx_dma, + drv_data->tx_map_len, DMA_TO_DEVICE); return 0; } |