aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/mmci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/mmci.c')
-rw-r--r--drivers/mmc/host/mmci.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 50b5f9926f6..0b44d6bbe5d 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -374,6 +374,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
374 struct dma_chan *chan; 374 struct dma_chan *chan;
375 struct dma_device *device; 375 struct dma_device *device;
376 struct dma_async_tx_descriptor *desc; 376 struct dma_async_tx_descriptor *desc;
377 enum dma_data_direction buffer_dirn;
377 int nr_sg; 378 int nr_sg;
378 379
379 /* Check if next job is already prepared */ 380 /* Check if next job is already prepared */
@@ -387,10 +388,12 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
387 } 388 }
388 389
389 if (data->flags & MMC_DATA_READ) { 390 if (data->flags & MMC_DATA_READ) {
390 conf.direction = DMA_FROM_DEVICE; 391 conf.direction = DMA_DEV_TO_MEM;
392 buffer_dirn = DMA_FROM_DEVICE;
391 chan = host->dma_rx_channel; 393 chan = host->dma_rx_channel;
392 } else { 394 } else {
393 conf.direction = DMA_TO_DEVICE; 395 conf.direction = DMA_MEM_TO_DEV;
396 buffer_dirn = DMA_TO_DEVICE;
394 chan = host->dma_tx_channel; 397 chan = host->dma_tx_channel;
395 } 398 }
396 399
@@ -403,7 +406,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
403 return -EINVAL; 406 return -EINVAL;
404 407
405 device = chan->device; 408 device = chan->device;
406 nr_sg = dma_map_sg(device->dev, data->sg, data->sg_len, conf.direction); 409 nr_sg = dma_map_sg(device->dev, data->sg, data->sg_len, buffer_dirn);
407 if (nr_sg == 0) 410 if (nr_sg == 0)
408 return -EINVAL; 411 return -EINVAL;
409 412
@@ -426,7 +429,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data,
426 unmap_exit: 429 unmap_exit:
427 if (!next) 430 if (!next)
428 dmaengine_terminate_all(chan); 431 dmaengine_terminate_all(chan);
429 dma_unmap_sg(device->dev, data->sg, data->sg_len, conf.direction); 432 dma_unmap_sg(device->dev, data->sg, data->sg_len, buffer_dirn);
430 return -ENOMEM; 433 return -ENOMEM;
431} 434}
432 435