diff options
author | Daniel Walker <dwalker@codeaurora.org> | 2011-01-18 18:03:25 -0500 |
---|---|---|
committer | David Brown <davidb@codeaurora.org> | 2011-01-21 19:57:52 -0500 |
commit | 208028de5fa7732704d12cdd3f8fd45d2d8445e3 (patch) | |
tree | b0498c14fdfad3fbf024a37523d4cd0a0fade231 | |
parent | c56eb8fb6dccb83d9fe62fd4dc00c834de9bc470 (diff) |
mmc: msm: fix dma usage not to use internal APIs
Remove parts of this driver which use internal API calls. This
replaces the calls as suggested by Russell King.
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
-rw-r--r-- | drivers/mmc/host/msm_sdcc.c | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c index 5decfd0bd61d..733d2333da36 100644 --- a/drivers/mmc/host/msm_sdcc.c +++ b/drivers/mmc/host/msm_sdcc.c | |||
@@ -383,14 +383,30 @@ static int msmsdcc_config_dma(struct msmsdcc_host *host, struct mmc_data *data) | |||
383 | host->curr.user_pages = 0; | 383 | host->curr.user_pages = 0; |
384 | 384 | ||
385 | box = &nc->cmd[0]; | 385 | box = &nc->cmd[0]; |
386 | for (i = 0; i < host->dma.num_ents; i++) { | ||
387 | box->cmd = CMD_MODE_BOX; | ||
388 | 386 | ||
389 | /* Initialize sg dma address */ | 387 | /* location of command block must be 64 bit aligned */ |
390 | sg->dma_address = page_to_dma(mmc_dev(host->mmc), sg_page(sg)) | 388 | BUG_ON(host->dma.cmd_busaddr & 0x07); |
391 | + sg->offset; | 389 | |
390 | nc->cmdptr = (host->dma.cmd_busaddr >> 3) | CMD_PTR_LP; | ||
391 | host->dma.hdr.cmdptr = DMOV_CMD_PTR_LIST | | ||
392 | DMOV_CMD_ADDR(host->dma.cmdptr_busaddr); | ||
393 | host->dma.hdr.complete_func = msmsdcc_dma_complete_func; | ||
394 | |||
395 | n = dma_map_sg(mmc_dev(host->mmc), host->dma.sg, | ||
396 | host->dma.num_ents, host->dma.dir); | ||
397 | if (n == 0) { | ||
398 | printk(KERN_ERR "%s: Unable to map in all sg elements\n", | ||
399 | mmc_hostname(host->mmc)); | ||
400 | host->dma.sg = NULL; | ||
401 | host->dma.num_ents = 0; | ||
402 | return -ENOMEM; | ||
403 | } | ||
404 | |||
405 | for_each_sg(host->dma.sg, sg, n, i) { | ||
406 | |||
407 | box->cmd = CMD_MODE_BOX; | ||
392 | 408 | ||
393 | if (i == (host->dma.num_ents - 1)) | 409 | if (i == n - 1) |
394 | box->cmd |= CMD_LC; | 410 | box->cmd |= CMD_LC; |
395 | rows = (sg_dma_len(sg) % MCI_FIFOSIZE) ? | 411 | rows = (sg_dma_len(sg) % MCI_FIFOSIZE) ? |
396 | (sg_dma_len(sg) / MCI_FIFOSIZE) + 1 : | 412 | (sg_dma_len(sg) / MCI_FIFOSIZE) + 1 : |
@@ -418,27 +434,6 @@ static int msmsdcc_config_dma(struct msmsdcc_host *host, struct mmc_data *data) | |||
418 | box->cmd |= CMD_DST_CRCI(crci); | 434 | box->cmd |= CMD_DST_CRCI(crci); |
419 | } | 435 | } |
420 | box++; | 436 | box++; |
421 | sg++; | ||
422 | } | ||
423 | |||
424 | /* location of command block must be 64 bit aligned */ | ||
425 | BUG_ON(host->dma.cmd_busaddr & 0x07); | ||
426 | |||
427 | nc->cmdptr = (host->dma.cmd_busaddr >> 3) | CMD_PTR_LP; | ||
428 | host->dma.hdr.cmdptr = DMOV_CMD_PTR_LIST | | ||
429 | DMOV_CMD_ADDR(host->dma.cmdptr_busaddr); | ||
430 | host->dma.hdr.complete_func = msmsdcc_dma_complete_func; | ||
431 | |||
432 | n = dma_map_sg(mmc_dev(host->mmc), host->dma.sg, | ||
433 | host->dma.num_ents, host->dma.dir); | ||
434 | /* dsb inside dma_map_sg will write nc out to mem as well */ | ||
435 | |||
436 | if (n != host->dma.num_ents) { | ||
437 | printk(KERN_ERR "%s: Unable to map in all sg elements\n", | ||
438 | mmc_hostname(host->mmc)); | ||
439 | host->dma.sg = NULL; | ||
440 | host->dma.num_ents = 0; | ||
441 | return -ENOMEM; | ||
442 | } | 437 | } |
443 | 438 | ||
444 | return 0; | 439 | return 0; |