linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Nikula <jarkko.nikula@bitmer.com>
To: linux-mmc@vger.kernel.org
Cc: Chris Ball <cjb@laptop.org>,
	aaro.koskinen@iki.fi, Jarkko Nikula <jarkko.nikula@bitmer.com>
Subject: [PATCH FIX+RESEND 7/7] mmc: omap: Get DMA request numbers via platform resource
Date: Sun,  6 Oct 2013 20:36:18 +0300	[thread overview]
Message-ID: <1381080978-29127-7-git-send-email-jarkko.nikula@bitmer.com> (raw)
In-Reply-To: <1381080978-29127-1-git-send-email-jarkko.nikula@bitmer.com>

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>
---
Aaro:
Sorry to bother you but I know you have OMAP1xxx based boards and I
apreciate if you can give a quick test :-)
I have tested this set on OMAP2420 based Nokia N810.
---
 drivers/mmc/host/omap.c | 39 +++++++++++++--------------------------
 1 file changed, 13 insertions(+), 26 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 1b56f06..eb22953 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
@@ -1328,7 +1317,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;
 
@@ -1394,22 +1382,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)
-- 
1.8.4.rc3


  parent reply	other threads:[~2013-10-06 17:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-06 17:36 [PATCH FIX+RESEND 1/7] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 2/7] mmc: omap: Convert to devm_kzalloc Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 3/7] mmc: omap: Remove duplicate host->irq assignment Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 4/7] mmc: omap: Remove mem_res field from struct mmc_omap_host Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 5/7] mmc: omap: Convert to devm_ioremap_resource Jarkko Nikula
2013-10-06 17:36 ` [PATCH FIX+RESEND 6/7] mmc: omap: Remove always set use_dma flag from struct mmc_omap_host Jarkko Nikula
2013-10-06 17:36 ` Jarkko Nikula [this message]
2013-10-26 14:55 ` [PATCH] mmc: omap: Add erase capability Jarkko Nikula
2013-11-16 15:53 ` [RESEND 1/8] mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet Jarkko Nikula
2013-11-16 15:53   ` [RESEND 2/8] mmc: omap: Convert to devm_kzalloc Jarkko Nikula
2013-11-16 15:53   ` [RESEND 3/8] mmc: omap: Remove duplicate host->irq assignment Jarkko Nikula
2013-11-16 15:53   ` [RESEND 4/8] mmc: omap: Remove mem_res field from struct mmc_omap_host Jarkko Nikula
2013-11-16 15:53   ` [RESEND 5/8] mmc: omap: Convert to devm_ioremap_resource Jarkko Nikula
2013-11-16 15:53   ` [RESEND 6/8] mmc: omap: Remove always set use_dma flag from struct mmc_omap_host Jarkko Nikula
2013-11-16 15:53   ` [RESEND 7/8] mmc: omap: Get DMA request numbers via platform resource Jarkko Nikula
2013-11-16 15:53   ` [RESEND 8/8] mmc: omap: Add erase capability Jarkko Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381080978-29127-7-git-send-email-jarkko.nikula@bitmer.com \
    --to=jarkko.nikula@bitmer.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=cjb@laptop.org \
    --cc=linux-mmc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).