aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBridge Wu <bridge.wu@marvell.com>2007-12-14 04:40:25 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-01-26 10:07:52 -0500
commit9a788c6b78802b4a378be3f0d4c2da30da811620 (patch)
tree4d0861fab8dbcbfe97b0be4e9918442e97469b2a
parent64eb036af42d3816364c4db49d93be3a4614389c (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>
-rw-r--r--arch/arm/mach-pxa/generic.c10
-rw-r--r--drivers/mmc/host/pxamci.c30
2 files changed, 33 insertions, 7 deletions
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 8bb70e70131e..a8d88704c8d4 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -259,6 +259,16 @@ static struct resource pxamci_resources[] = {
259 .end = IRQ_MMC, 259 .end = IRQ_MMC,
260 .flags = IORESOURCE_IRQ, 260 .flags = IORESOURCE_IRQ,
261 }, 261 },
262 [2] = {
263 .start = 21,
264 .end = 21,
265 .flags = IORESOURCE_DMA,
266 },
267 [3] = {
268 .start = 22,
269 .end = 22,
270 .flags = IORESOURCE_DMA,
271 },
262}; 272};
263 273
264static u64 pxamci_dmamask = 0xffffffffUL; 274static u64 pxamci_dmamask = 0xffffffffUL;
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
70static void pxamci_stop_clock(struct pxamci_host *host) 72static 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);