diff mbox

[RESEND,7/8] mmc: omap: Get DMA request numbers via platform resource

Message ID 1384617194-22126-7-git-send-email-jarkko.nikula@bitmer.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jarkko Nikula Nov. 16, 2013, 3:53 p.m. UTC
There is no need to define MMC DMA TX and RX request numbers locally for
OMAP1xxx and OMAP24xx and assign them non-portable way since they already
come via platform resources. See commits

6c432f7 ("ARM: OMAP1: Pass dma request lines in platform data to MMC driver")
b955eef ("ARM: OMAP2: Use hwmod to initialize mmc for 2420")

Note that mmc_omap_probe doesn't change failure mechanism in case if it
fails get DMA request number or DMA channel. In that case it just falls
back to PIO transfer for TX and/or RX.

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
 drivers/mmc/host/omap.c | 39 +++++++++++++--------------------------
 1 file changed, 13 insertions(+), 26 deletions(-)
diff mbox

Patch

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index c975051..24235f1 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -90,17 +90,6 @@ 
 #define OMAP_MMC_CMDTYPE_AC	2
 #define OMAP_MMC_CMDTYPE_ADTC	3
 
-#define OMAP_DMA_MMC_TX		21
-#define OMAP_DMA_MMC_RX		22
-#define OMAP_DMA_MMC2_TX	54
-#define OMAP_DMA_MMC2_RX	55
-
-#define OMAP24XX_DMA_MMC2_TX	47
-#define OMAP24XX_DMA_MMC2_RX	48
-#define OMAP24XX_DMA_MMC1_TX	61
-#define OMAP24XX_DMA_MMC1_RX	62
-
-
 #define DRIVER_NAME "mmci-omap"
 
 /* Specifies how often in millisecs to poll for card status changes
@@ -1327,7 +1316,6 @@  static int mmc_omap_probe(struct platform_device *pdev)
 	struct mmc_omap_host *host = NULL;
 	struct resource *res;
 	dma_cap_mask_t mask;
-	unsigned sig;
 	int i, ret = 0;
 	int irq;
 
@@ -1393,22 +1381,21 @@  static int mmc_omap_probe(struct platform_device *pdev)
 	host->dma_tx_burst = -1;
 	host->dma_rx_burst = -1;
 
-	if (mmc_omap2())
-		sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX;
-	else
-		sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX;
-	host->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+	res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
+	if (res)
+		host->dma_tx = dma_request_channel(mask, omap_dma_filter_fn,
+						   &res->start);
 	if (!host->dma_tx)
-		dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n",
-			sig);
-	if (mmc_omap2())
-		sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX;
-	else
-		sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX;
-	host->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+		dev_warn(host->dev,
+			 "unable to obtain TX DMA. Falling back to PIO\n");
+
+	res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
+	if (res)
+		host->dma_rx = dma_request_channel(mask, omap_dma_filter_fn,
+						   &res->start);
 	if (!host->dma_rx)
-		dev_warn(host->dev, "unable to obtain RX DMA engine channel %u\n",
-			sig);
+		dev_warn(host->dev,
+			 "unable to obtain RX DMA. Falling back to PIO\n");
 
 	ret = request_irq(host->irq, mmc_omap_irq, 0, DRIVER_NAME, host);
 	if (ret)