diff options
author | Vinod Koul <vinod.koul@linux.intel.com> | 2011-11-17 04:24:38 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@linux.intel.com> | 2011-11-17 04:24:57 -0500 |
commit | e0d23ef29ed637dc6bd739f590985746d9ad9caa (patch) | |
tree | c5b5856dc88582697997bb10ccacad6fc2535465 /drivers/mmc | |
parent | ca7fe2db892dcf91b2c72ee352eda4ff867903a7 (diff) | |
parent | 55ba4e5ed4ac57b60fe56acfd324f6a87123cc34 (diff) |
Merge branch 'dma_slave_direction' into next_test_dirn
resolved conflicts:
drivers/media/video/mx3_camera.c
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/atmel-mci.c | 10 | ||||
-rw-r--r-- | drivers/mmc/host/mmci.c | 11 | ||||
-rw-r--r-- | drivers/mmc/host/mxcmmc.c | 10 | ||||
-rw-r--r-- | drivers/mmc/host/mxs-mmc.c | 7 | ||||
-rw-r--r-- | drivers/mmc/host/sh_mmcif.c | 4 | ||||
-rw-r--r-- | drivers/mmc/host/tmio_mmc_dma.c | 4 |
6 files changed, 31 insertions, 15 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index a7ee50271465..fcfe1eb5acc8 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -823,6 +823,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
823 | struct scatterlist *sg; | 823 | struct scatterlist *sg; |
824 | unsigned int i; | 824 | unsigned int i; |
825 | enum dma_data_direction direction; | 825 | enum dma_data_direction direction; |
826 | enum dma_transfer_direction slave_dirn; | ||
826 | unsigned int sglen; | 827 | unsigned int sglen; |
827 | u32 iflags; | 828 | u32 iflags; |
828 | 829 | ||
@@ -860,16 +861,19 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
860 | if (host->caps.has_dma) | 861 | if (host->caps.has_dma) |
861 | atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(3) | ATMCI_DMAEN); | 862 | atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(3) | ATMCI_DMAEN); |
862 | 863 | ||
863 | if (data->flags & MMC_DATA_READ) | 864 | if (data->flags & MMC_DATA_READ) { |
864 | direction = DMA_FROM_DEVICE; | 865 | direction = DMA_FROM_DEVICE; |
865 | else | 866 | slave_dirn = DMA_DEV_TO_MEM; |
867 | } else { | ||
866 | direction = DMA_TO_DEVICE; | 868 | direction = DMA_TO_DEVICE; |
869 | slave_dirn = DMA_MEM_TO_DEV; | ||
870 | } | ||
867 | 871 | ||
868 | sglen = dma_map_sg(chan->device->dev, data->sg, | 872 | sglen = dma_map_sg(chan->device->dev, data->sg, |
869 | data->sg_len, direction); | 873 | data->sg_len, direction); |
870 | 874 | ||
871 | desc = chan->device->device_prep_slave_sg(chan, | 875 | desc = chan->device->device_prep_slave_sg(chan, |
872 | data->sg, sglen, direction, | 876 | data->sg, sglen, slave_dirn, |
873 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 877 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
874 | if (!desc) | 878 | if (!desc) |
875 | goto unmap_exit; | 879 | goto unmap_exit; |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 50b5f9926f64..0b44d6bbe5d7 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 | ||
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index 325ea61e12d3..a17bc1217859 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c | |||
@@ -218,6 +218,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data) | |||
218 | unsigned int blksz = data->blksz; | 218 | unsigned int blksz = data->blksz; |
219 | unsigned int datasize = nob * blksz; | 219 | unsigned int datasize = nob * blksz; |
220 | struct scatterlist *sg; | 220 | struct scatterlist *sg; |
221 | enum dma_transfer_direction slave_dirn; | ||
221 | int i, nents; | 222 | int i, nents; |
222 | 223 | ||
223 | if (data->flags & MMC_DATA_STREAM) | 224 | if (data->flags & MMC_DATA_STREAM) |
@@ -240,10 +241,13 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data) | |||
240 | } | 241 | } |
241 | } | 242 | } |
242 | 243 | ||
243 | if (data->flags & MMC_DATA_READ) | 244 | if (data->flags & MMC_DATA_READ) { |
244 | host->dma_dir = DMA_FROM_DEVICE; | 245 | host->dma_dir = DMA_FROM_DEVICE; |
245 | else | 246 | slave_dirn = DMA_DEV_TO_MEM; |
247 | } else { | ||
246 | host->dma_dir = DMA_TO_DEVICE; | 248 | host->dma_dir = DMA_TO_DEVICE; |
249 | slave_dirn = DMA_MEM_TO_DEV; | ||
250 | } | ||
247 | 251 | ||
248 | nents = dma_map_sg(host->dma->device->dev, data->sg, | 252 | nents = dma_map_sg(host->dma->device->dev, data->sg, |
249 | data->sg_len, host->dma_dir); | 253 | data->sg_len, host->dma_dir); |
@@ -251,7 +255,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data) | |||
251 | return -EINVAL; | 255 | return -EINVAL; |
252 | 256 | ||
253 | host->desc = host->dma->device->device_prep_slave_sg(host->dma, | 257 | host->desc = host->dma->device->device_prep_slave_sg(host->dma, |
254 | data->sg, data->sg_len, host->dma_dir, | 258 | data->sg, data->sg_len, slave_dirn, |
255 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 259 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
256 | 260 | ||
257 | if (!host->desc) { | 261 | if (!host->desc) { |
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index 99b449d26a4d..0a878b181341 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c | |||
@@ -154,6 +154,7 @@ struct mxs_mmc_host { | |||
154 | struct dma_chan *dmach; | 154 | struct dma_chan *dmach; |
155 | struct mxs_dma_data dma_data; | 155 | struct mxs_dma_data dma_data; |
156 | unsigned int dma_dir; | 156 | unsigned int dma_dir; |
157 | enum dma_transfer_direction slave_dirn; | ||
157 | u32 ssp_pio_words[SSP_PIO_NUM]; | 158 | u32 ssp_pio_words[SSP_PIO_NUM]; |
158 | 159 | ||
159 | unsigned int version; | 160 | unsigned int version; |
@@ -324,7 +325,7 @@ static struct dma_async_tx_descriptor *mxs_mmc_prep_dma( | |||
324 | } | 325 | } |
325 | 326 | ||
326 | desc = host->dmach->device->device_prep_slave_sg(host->dmach, | 327 | desc = host->dmach->device->device_prep_slave_sg(host->dmach, |
327 | sgl, sg_len, host->dma_dir, append); | 328 | sgl, sg_len, host->slave_dirn, append); |
328 | if (desc) { | 329 | if (desc) { |
329 | desc->callback = mxs_mmc_dma_irq_callback; | 330 | desc->callback = mxs_mmc_dma_irq_callback; |
330 | desc->callback_param = host; | 331 | desc->callback_param = host; |
@@ -433,6 +434,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) | |||
433 | int i; | 434 | int i; |
434 | 435 | ||
435 | unsigned short dma_data_dir, timeout; | 436 | unsigned short dma_data_dir, timeout; |
437 | enum dma_transfer_direction slave_dirn; | ||
436 | unsigned int data_size = 0, log2_blksz; | 438 | unsigned int data_size = 0, log2_blksz; |
437 | unsigned int blocks = data->blocks; | 439 | unsigned int blocks = data->blocks; |
438 | 440 | ||
@@ -448,9 +450,11 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) | |||
448 | 450 | ||
449 | if (data->flags & MMC_DATA_WRITE) { | 451 | if (data->flags & MMC_DATA_WRITE) { |
450 | dma_data_dir = DMA_TO_DEVICE; | 452 | dma_data_dir = DMA_TO_DEVICE; |
453 | slave_dirn = DMA_MEM_TO_DEV; | ||
451 | read = 0; | 454 | read = 0; |
452 | } else { | 455 | } else { |
453 | dma_data_dir = DMA_FROM_DEVICE; | 456 | dma_data_dir = DMA_FROM_DEVICE; |
457 | slave_dirn = DMA_DEV_TO_MEM; | ||
454 | read = BM_SSP_CTRL0_READ; | 458 | read = BM_SSP_CTRL0_READ; |
455 | } | 459 | } |
456 | 460 | ||
@@ -518,6 +522,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) | |||
518 | WARN_ON(host->data != NULL); | 522 | WARN_ON(host->data != NULL); |
519 | host->data = data; | 523 | host->data = data; |
520 | host->dma_dir = dma_data_dir; | 524 | host->dma_dir = dma_data_dir; |
525 | host->slave_dirn = slave_dirn; | ||
521 | desc = mxs_mmc_prep_dma(host, 1); | 526 | desc = mxs_mmc_prep_dma(host, 1); |
522 | if (!desc) | 527 | if (!desc) |
523 | goto out; | 528 | goto out; |
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 369366c8e205..1c0c10bd2d3b 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c | |||
@@ -233,7 +233,7 @@ static void sh_mmcif_start_dma_rx(struct sh_mmcif_host *host) | |||
233 | if (ret > 0) { | 233 | if (ret > 0) { |
234 | host->dma_active = true; | 234 | host->dma_active = true; |
235 | desc = chan->device->device_prep_slave_sg(chan, sg, ret, | 235 | desc = chan->device->device_prep_slave_sg(chan, sg, ret, |
236 | DMA_FROM_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 236 | DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
237 | } | 237 | } |
238 | 238 | ||
239 | if (desc) { | 239 | if (desc) { |
@@ -281,7 +281,7 @@ static void sh_mmcif_start_dma_tx(struct sh_mmcif_host *host) | |||
281 | if (ret > 0) { | 281 | if (ret > 0) { |
282 | host->dma_active = true; | 282 | host->dma_active = true; |
283 | desc = chan->device->device_prep_slave_sg(chan, sg, ret, | 283 | desc = chan->device->device_prep_slave_sg(chan, sg, ret, |
284 | DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 284 | DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
285 | } | 285 | } |
286 | 286 | ||
287 | if (desc) { | 287 | if (desc) { |
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c index 86f259cdfcbc..7a6e6cc8f8b8 100644 --- a/drivers/mmc/host/tmio_mmc_dma.c +++ b/drivers/mmc/host/tmio_mmc_dma.c | |||
@@ -77,7 +77,7 @@ static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host) | |||
77 | ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_FROM_DEVICE); | 77 | ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_FROM_DEVICE); |
78 | if (ret > 0) | 78 | if (ret > 0) |
79 | desc = chan->device->device_prep_slave_sg(chan, sg, ret, | 79 | desc = chan->device->device_prep_slave_sg(chan, sg, ret, |
80 | DMA_FROM_DEVICE, DMA_CTRL_ACK); | 80 | DMA_DEV_TO_MEM, DMA_CTRL_ACK); |
81 | 81 | ||
82 | if (desc) { | 82 | if (desc) { |
83 | cookie = dmaengine_submit(desc); | 83 | cookie = dmaengine_submit(desc); |
@@ -158,7 +158,7 @@ static void tmio_mmc_start_dma_tx(struct tmio_mmc_host *host) | |||
158 | ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_TO_DEVICE); | 158 | ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_TO_DEVICE); |
159 | if (ret > 0) | 159 | if (ret > 0) |
160 | desc = chan->device->device_prep_slave_sg(chan, sg, ret, | 160 | desc = chan->device->device_prep_slave_sg(chan, sg, ret, |
161 | DMA_TO_DEVICE, DMA_CTRL_ACK); | 161 | DMA_MEM_TO_DEV, DMA_CTRL_ACK); |
162 | 162 | ||
163 | if (desc) { | 163 | if (desc) { |
164 | cookie = dmaengine_submit(desc); | 164 | cookie = dmaengine_submit(desc); |