diff options
author | Bridge Wu <bridge.wu@marvell.com> | 2007-12-14 04:40:25 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-26 10:07:52 -0500 |
commit | 9a788c6b78802b4a378be3f0d4c2da30da811620 (patch) | |
tree | 4d0861fab8dbcbfe97b0be4e9918442e97469b2a /drivers | |
parent | 64eb036af42d3816364c4db49d93be3a4614389c (diff) |
[ARM] 4711/1: pxa: mmc: move DMA specific code to platform layer
This patch is to move pxamci DMA specific code to corresponding
platform layer because using DRCMRRXMMC/DRCMRTXMMC in pxamci.c makes
the driver code dedicated to platform which is not extensible.
It is applicable to all pxa platforms.
Signed-off-by: Bridge Wu <bridge.wu@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/host/pxamci.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index 80df4b047c81..1ea8482037bb 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
@@ -65,6 +65,8 @@ struct pxamci_host { | |||
65 | unsigned int dma_len; | 65 | unsigned int dma_len; |
66 | 66 | ||
67 | unsigned int dma_dir; | 67 | unsigned int dma_dir; |
68 | unsigned int dma_drcmrrx; | ||
69 | unsigned int dma_drcmrtx; | ||
68 | }; | 70 | }; |
69 | 71 | ||
70 | static void pxamci_stop_clock(struct pxamci_host *host) | 72 | static void pxamci_stop_clock(struct pxamci_host *host) |
@@ -131,13 +133,13 @@ static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data) | |||
131 | if (data->flags & MMC_DATA_READ) { | 133 | if (data->flags & MMC_DATA_READ) { |
132 | host->dma_dir = DMA_FROM_DEVICE; | 134 | host->dma_dir = DMA_FROM_DEVICE; |
133 | dcmd = DCMD_INCTRGADDR | DCMD_FLOWTRG; | 135 | dcmd = DCMD_INCTRGADDR | DCMD_FLOWTRG; |
134 | DRCMRTXMMC = 0; | 136 | DRCMR(host->dma_drcmrtx) = 0; |
135 | DRCMRRXMMC = host->dma | DRCMR_MAPVLD; | 137 | DRCMR(host->dma_drcmrrx) = host->dma | DRCMR_MAPVLD; |
136 | } else { | 138 | } else { |
137 | host->dma_dir = DMA_TO_DEVICE; | 139 | host->dma_dir = DMA_TO_DEVICE; |
138 | dcmd = DCMD_INCSRCADDR | DCMD_FLOWSRC; | 140 | dcmd = DCMD_INCSRCADDR | DCMD_FLOWSRC; |
139 | DRCMRRXMMC = 0; | 141 | DRCMR(host->dma_drcmrrx) = 0; |
140 | DRCMRTXMMC = host->dma | DRCMR_MAPVLD; | 142 | DRCMR(host->dma_drcmrtx) = host->dma | DRCMR_MAPVLD; |
141 | } | 143 | } |
142 | 144 | ||
143 | dcmd |= DCMD_BURST32 | DCMD_WIDTH1; | 145 | dcmd |= DCMD_BURST32 | DCMD_WIDTH1; |
@@ -468,7 +470,7 @@ static int pxamci_probe(struct platform_device *pdev) | |||
468 | { | 470 | { |
469 | struct mmc_host *mmc; | 471 | struct mmc_host *mmc; |
470 | struct pxamci_host *host = NULL; | 472 | struct pxamci_host *host = NULL; |
471 | struct resource *r; | 473 | struct resource *r, *dmarx, *dmatx; |
472 | int ret, irq; | 474 | int ret, irq; |
473 | 475 | ||
474 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 476 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -583,6 +585,20 @@ static int pxamci_probe(struct platform_device *pdev) | |||
583 | 585 | ||
584 | platform_set_drvdata(pdev, mmc); | 586 | platform_set_drvdata(pdev, mmc); |
585 | 587 | ||
588 | dmarx = platform_get_resource(pdev, IORESOURCE_DMA, 0); | ||
589 | if (!dmarx) { | ||
590 | ret = -ENXIO; | ||
591 | goto out; | ||
592 | } | ||
593 | host->dma_drcmrrx = dmarx->start; | ||
594 | |||
595 | dmatx = platform_get_resource(pdev, IORESOURCE_DMA, 1); | ||
596 | if (!dmatx) { | ||
597 | ret = -ENXIO; | ||
598 | goto out; | ||
599 | } | ||
600 | host->dma_drcmrtx = dmatx->start; | ||
601 | |||
586 | if (host->pdata && host->pdata->init) | 602 | if (host->pdata && host->pdata->init) |
587 | host->pdata->init(&pdev->dev, pxamci_detect_irq, mmc); | 603 | host->pdata->init(&pdev->dev, pxamci_detect_irq, mmc); |
588 | 604 | ||
@@ -626,8 +642,8 @@ static int pxamci_remove(struct platform_device *pdev) | |||
626 | END_CMD_RES|PRG_DONE|DATA_TRAN_DONE, | 642 | END_CMD_RES|PRG_DONE|DATA_TRAN_DONE, |
627 | host->base + MMC_I_MASK); | 643 | host->base + MMC_I_MASK); |
628 | 644 | ||
629 | DRCMRRXMMC = 0; | 645 | DRCMR(host->dma_drcmrrx) = 0; |
630 | DRCMRTXMMC = 0; | 646 | DRCMR(host->dma_drcmrtx) = 0; |
631 | 647 | ||
632 | free_irq(host->irq, host); | 648 | free_irq(host->irq, host); |
633 | pxa_free_dma(host->dma); | 649 | pxa_free_dma(host->dma); |