diff options
author | Paul Mackerras <paulus@samba.org> | 2008-12-03 04:11:06 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-12-03 04:11:06 -0500 |
commit | 527491885554002837b5742202adc0ab5f536e54 (patch) | |
tree | 6d9c44776e0b4368eccd414b92b957fac3c5a4c6 /drivers/spi/pxa2xx_spi.c | |
parent | cea555d384b85271035814c5adad23e6c7fc5d2a (diff) | |
parent | 2434bbb30e79468c49cff3cff6005236f55ed188 (diff) |
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) | |||
352 | } else | 352 | } else |
353 | drv_data->tx_map_len = drv_data->len; | 353 | drv_data->tx_map_len = drv_data->len; |
354 | 354 | ||
355 | /* Stream map the rx buffer */ | 355 | /* Stream map the tx buffer. Always do DMA_TO_DEVICE first |
356 | drv_data->rx_dma = dma_map_single(dev, drv_data->rx, | 356 | * so we flush the cache *before* invalidating it, in case |
357 | drv_data->rx_map_len, | 357 | * the tx and rx buffers overlap. |
358 | DMA_FROM_DEVICE); | 358 | */ |
359 | if (dma_mapping_error(dev, drv_data->rx_dma)) | ||
360 | return 0; | ||
361 | |||
362 | /* Stream map the tx buffer */ | ||
363 | drv_data->tx_dma = dma_map_single(dev, drv_data->tx, | 359 | drv_data->tx_dma = dma_map_single(dev, drv_data->tx, |
364 | drv_data->tx_map_len, | 360 | drv_data->tx_map_len, DMA_TO_DEVICE); |
365 | DMA_TO_DEVICE); | 361 | if (dma_mapping_error(dev, drv_data->tx_dma)) |
362 | return 0; | ||
366 | 363 | ||
367 | if (dma_mapping_error(dev, drv_data->tx_dma)) { | 364 | /* Stream map the rx buffer */ |
368 | dma_unmap_single(dev, drv_data->rx_dma, | 365 | drv_data->rx_dma = dma_map_single(dev, drv_data->rx, |
369 | drv_data->rx_map_len, DMA_FROM_DEVICE); | 366 | drv_data->rx_map_len, DMA_FROM_DEVICE); |
367 | if (dma_mapping_error(dev, drv_data->rx_dma)) { | ||
368 | dma_unmap_single(dev, drv_data->tx_dma, | ||
369 | drv_data->tx_map_len, DMA_TO_DEVICE); | ||
370 | return 0; | 370 | return 0; |
371 | } | 371 | } |
372 | 372 | ||