diff options
author | Vinod Koul <vinod.koul@linux.intel.com> | 2011-10-14 01:15:11 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@linux.intel.com> | 2011-10-31 00:10:25 -0400 |
commit | 05f5799cbe5c9e2c03f604b3de5783cf4d726227 (patch) | |
tree | c70394eb8154fb5e717168af98889631078789e7 | |
parent | 1d0c81e876fe04295ef5df387ba057bf9cfae3d8 (diff) |
mmc-host: move to dma_transfer_direction
fixup usage of dma direction by introducing dma_transfer_direction,
this patch moves mmc drivers to use new enum
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Chris Ball <cjb@laptop.org>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
-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 fa8cae1d7005..ac87803ab70e 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -653,6 +653,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
653 | struct scatterlist *sg; | 653 | struct scatterlist *sg; |
654 | unsigned int i; | 654 | unsigned int i; |
655 | enum dma_data_direction direction; | 655 | enum dma_data_direction direction; |
656 | enum dma_transfer_direction slave_dirn; | ||
656 | unsigned int sglen; | 657 | unsigned int sglen; |
657 | 658 | ||
658 | /* | 659 | /* |
@@ -681,16 +682,19 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
681 | if (atmci_is_mci2()) | 682 | if (atmci_is_mci2()) |
682 | mci_writel(host, DMA, MCI_DMA_CHKSIZE(3) | MCI_DMAEN); | 683 | mci_writel(host, DMA, MCI_DMA_CHKSIZE(3) | MCI_DMAEN); |
683 | 684 | ||
684 | if (data->flags & MMC_DATA_READ) | 685 | if (data->flags & MMC_DATA_READ) { |
685 | direction = DMA_FROM_DEVICE; | 686 | direction = DMA_FROM_DEVICE; |
686 | else | 687 | slave_dirn = DMA_DEV_TO_MEM; |
688 | } else { | ||
687 | direction = DMA_TO_DEVICE; | 689 | direction = DMA_TO_DEVICE; |
690 | slave_dirn = DMA_MEM_TO_DEV; | ||
691 | } | ||
688 | 692 | ||
689 | sglen = dma_map_sg(chan->device->dev, data->sg, | 693 | sglen = dma_map_sg(chan->device->dev, data->sg, |
690 | data->sg_len, direction); | 694 | data->sg_len, direction); |
691 | 695 | ||
692 | desc = chan->device->device_prep_slave_sg(chan, | 696 | desc = chan->device->device_prep_slave_sg(chan, |
693 | data->sg, sglen, direction, | 697 | data->sg, sglen, slave_dirn, |
694 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 698 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
695 | if (!desc) | 699 | if (!desc) |
696 | goto unmap_exit; | 700 | goto unmap_exit; |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 56e9a4168264..3abd51a9fec1 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -372,6 +372,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data, | |||
372 | struct dma_chan *chan; | 372 | struct dma_chan *chan; |
373 | struct dma_device *device; | 373 | struct dma_device *device; |
374 | struct dma_async_tx_descriptor *desc; | 374 | struct dma_async_tx_descriptor *desc; |
375 | enum dma_data_direction buffer_dirn; | ||
375 | int nr_sg; | 376 | int nr_sg; |
376 | 377 | ||
377 | /* Check if next job is already prepared */ | 378 | /* Check if next job is already prepared */ |
@@ -385,10 +386,12 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data, | |||
385 | } | 386 | } |
386 | 387 | ||
387 | if (data->flags & MMC_DATA_READ) { | 388 | if (data->flags & MMC_DATA_READ) { |
388 | conf.direction = DMA_FROM_DEVICE; | 389 | conf.direction = DMA_DEV_TO_MEM; |
390 | buffer_dirn = DMA_FROM_DEVICE; | ||
389 | chan = host->dma_rx_channel; | 391 | chan = host->dma_rx_channel; |
390 | } else { | 392 | } else { |
391 | conf.direction = DMA_TO_DEVICE; | 393 | conf.direction = DMA_MEM_TO_DEV; |
394 | buffer_dirn = DMA_TO_DEVICE; | ||
392 | chan = host->dma_tx_channel; | 395 | chan = host->dma_tx_channel; |
393 | } | 396 | } |
394 | 397 | ||
@@ -401,7 +404,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data, | |||
401 | return -EINVAL; | 404 | return -EINVAL; |
402 | 405 | ||
403 | device = chan->device; | 406 | device = chan->device; |
404 | nr_sg = dma_map_sg(device->dev, data->sg, data->sg_len, conf.direction); | 407 | nr_sg = dma_map_sg(device->dev, data->sg, data->sg_len, buffer_dirn); |
405 | if (nr_sg == 0) | 408 | if (nr_sg == 0) |
406 | return -EINVAL; | 409 | return -EINVAL; |
407 | 410 | ||
@@ -424,7 +427,7 @@ static int mmci_dma_prep_data(struct mmci_host *host, struct mmc_data *data, | |||
424 | unmap_exit: | 427 | unmap_exit: |
425 | if (!next) | 428 | if (!next) |
426 | dmaengine_terminate_all(chan); | 429 | dmaengine_terminate_all(chan); |
427 | dma_unmap_sg(device->dev, data->sg, data->sg_len, conf.direction); | 430 | dma_unmap_sg(device->dev, data->sg, data->sg_len, buffer_dirn); |
428 | return -ENOMEM; | 431 | return -ENOMEM; |
429 | } | 432 | } |
430 | 433 | ||
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index 14aa213b00da..8a816639b46c 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c | |||
@@ -217,6 +217,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data) | |||
217 | unsigned int blksz = data->blksz; | 217 | unsigned int blksz = data->blksz; |
218 | unsigned int datasize = nob * blksz; | 218 | unsigned int datasize = nob * blksz; |
219 | struct scatterlist *sg; | 219 | struct scatterlist *sg; |
220 | enum dma_transfer_direction slave_dirn; | ||
220 | int i, nents; | 221 | int i, nents; |
221 | 222 | ||
222 | if (data->flags & MMC_DATA_STREAM) | 223 | if (data->flags & MMC_DATA_STREAM) |
@@ -239,10 +240,13 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data) | |||
239 | } | 240 | } |
240 | } | 241 | } |
241 | 242 | ||
242 | if (data->flags & MMC_DATA_READ) | 243 | if (data->flags & MMC_DATA_READ) { |
243 | host->dma_dir = DMA_FROM_DEVICE; | 244 | host->dma_dir = DMA_FROM_DEVICE; |
244 | else | 245 | slave_dirn = DMA_DEV_TO_MEM; |
246 | } else { | ||
245 | host->dma_dir = DMA_TO_DEVICE; | 247 | host->dma_dir = DMA_TO_DEVICE; |
248 | slave_dirn = DMA_MEM_TO_DEV; | ||
249 | } | ||
246 | 250 | ||
247 | nents = dma_map_sg(host->dma->device->dev, data->sg, | 251 | nents = dma_map_sg(host->dma->device->dev, data->sg, |
248 | data->sg_len, host->dma_dir); | 252 | data->sg_len, host->dma_dir); |
@@ -250,7 +254,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data) | |||
250 | return -EINVAL; | 254 | return -EINVAL; |
251 | 255 | ||
252 | host->desc = host->dma->device->device_prep_slave_sg(host->dma, | 256 | host->desc = host->dma->device->device_prep_slave_sg(host->dma, |
253 | data->sg, data->sg_len, host->dma_dir, | 257 | data->sg, data->sg_len, slave_dirn, |
254 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 258 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
255 | 259 | ||
256 | if (!host->desc) { | 260 | if (!host->desc) { |
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index d513d47364d0..996b9a91d6f4 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c | |||
@@ -153,6 +153,7 @@ struct mxs_mmc_host { | |||
153 | struct dma_chan *dmach; | 153 | struct dma_chan *dmach; |
154 | struct mxs_dma_data dma_data; | 154 | struct mxs_dma_data dma_data; |
155 | unsigned int dma_dir; | 155 | unsigned int dma_dir; |
156 | enum dma_transfer_direction slave_dirn; | ||
156 | u32 ssp_pio_words[SSP_PIO_NUM]; | 157 | u32 ssp_pio_words[SSP_PIO_NUM]; |
157 | 158 | ||
158 | unsigned int version; | 159 | unsigned int version; |
@@ -323,7 +324,7 @@ static struct dma_async_tx_descriptor *mxs_mmc_prep_dma( | |||
323 | } | 324 | } |
324 | 325 | ||
325 | desc = host->dmach->device->device_prep_slave_sg(host->dmach, | 326 | desc = host->dmach->device->device_prep_slave_sg(host->dmach, |
326 | sgl, sg_len, host->dma_dir, append); | 327 | sgl, sg_len, host->slave_dirn, append); |
327 | if (desc) { | 328 | if (desc) { |
328 | desc->callback = mxs_mmc_dma_irq_callback; | 329 | desc->callback = mxs_mmc_dma_irq_callback; |
329 | desc->callback_param = host; | 330 | desc->callback_param = host; |
@@ -432,6 +433,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) | |||
432 | int i; | 433 | int i; |
433 | 434 | ||
434 | unsigned short dma_data_dir, timeout; | 435 | unsigned short dma_data_dir, timeout; |
436 | enum dma_transfer_direction slave_dirn; | ||
435 | unsigned int data_size = 0, log2_blksz; | 437 | unsigned int data_size = 0, log2_blksz; |
436 | unsigned int blocks = data->blocks; | 438 | unsigned int blocks = data->blocks; |
437 | 439 | ||
@@ -447,9 +449,11 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) | |||
447 | 449 | ||
448 | if (data->flags & MMC_DATA_WRITE) { | 450 | if (data->flags & MMC_DATA_WRITE) { |
449 | dma_data_dir = DMA_TO_DEVICE; | 451 | dma_data_dir = DMA_TO_DEVICE; |
452 | slave_dirn = DMA_MEM_TO_DEV; | ||
450 | read = 0; | 453 | read = 0; |
451 | } else { | 454 | } else { |
452 | dma_data_dir = DMA_FROM_DEVICE; | 455 | dma_data_dir = DMA_FROM_DEVICE; |
456 | slave_dirn = DMA_DEV_TO_MEM; | ||
453 | read = BM_SSP_CTRL0_READ; | 457 | read = BM_SSP_CTRL0_READ; |
454 | } | 458 | } |
455 | 459 | ||
@@ -517,6 +521,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) | |||
517 | WARN_ON(host->data != NULL); | 521 | WARN_ON(host->data != NULL); |
518 | host->data = data; | 522 | host->data = data; |
519 | host->dma_dir = dma_data_dir; | 523 | host->dma_dir = dma_data_dir; |
524 | host->slave_dirn = slave_dirn; | ||
520 | desc = mxs_mmc_prep_dma(host, 1); | 525 | desc = mxs_mmc_prep_dma(host, 1); |
521 | if (!desc) | 526 | if (!desc) |
522 | goto out; | 527 | goto out; |
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 557886bee9ce..0ae8d62dc976 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c | |||
@@ -230,7 +230,7 @@ static void sh_mmcif_start_dma_rx(struct sh_mmcif_host *host) | |||
230 | if (ret > 0) { | 230 | if (ret > 0) { |
231 | host->dma_active = true; | 231 | host->dma_active = true; |
232 | desc = chan->device->device_prep_slave_sg(chan, sg, ret, | 232 | desc = chan->device->device_prep_slave_sg(chan, sg, ret, |
233 | DMA_FROM_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 233 | DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
234 | } | 234 | } |
235 | 235 | ||
236 | if (desc) { | 236 | if (desc) { |
@@ -278,7 +278,7 @@ static void sh_mmcif_start_dma_tx(struct sh_mmcif_host *host) | |||
278 | if (ret > 0) { | 278 | if (ret > 0) { |
279 | host->dma_active = true; | 279 | host->dma_active = true; |
280 | desc = chan->device->device_prep_slave_sg(chan, sg, ret, | 280 | desc = chan->device->device_prep_slave_sg(chan, sg, ret, |
281 | DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 281 | DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
282 | } | 282 | } |
283 | 283 | ||
284 | if (desc) { | 284 | 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); |