All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
	linux-mmc@vger.kernel.org,
	Jarkko Lavinen <jarkko.lavinen@nokia.com>,
	Chris Ball <cjb@laptop.org>
Subject: Re: [PATCH 07/12] mmc: omap: add DMA engine support
Date: Mon, 23 Apr 2012 17:13:30 -0700	[thread overview]
Message-ID: <20120424001330.GD3739@atomide.com> (raw)
In-Reply-To: <E1SMLmZ-0002WS-Rd@rmk-PC.arm.linux.org.uk>

* Russell King <rmk+kernel@arm.linux.org.uk> [120423 09:11]:
> Add DMA engine support to the OMAP driver.  This supplements the
> private DMA API implementation contained within this driver, and the
> driver can be switched at build time between using DMA engine and the
> private DMA API.

Below is what's needed to use DMA request lines from platform data.
Note also the release_mem_region change that we'll now need for
this one also (but not as a fix).

I've posted a cleanup patch series to mostly remove plat-omap/devices.c
that takes care of passing the DMA request lines in platform data.
That series should get merged before the driver changes for this
driver to keep DMA working.

Regards,

Tony


--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1313,7 +1313,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
 	struct mmc_omap_host *host = NULL;
 	struct resource *res;
 	dma_cap_mask_t mask;
-	unsigned sig;
+	unsigned tx_req, rx_req;
 	int i, ret = 0;
 	int irq;
 
@@ -1389,37 +1389,44 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
 	host->dma_tx_burst = -1;
 	host->dma_rx_burst = -1;
 
-	if (cpu_is_omap24xx())
-		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) {
+		dev_err(host->dev, "cannot get DMA TX channel\n");
+		goto err_free_dma;
+	}
+	tx_req = res->start;
+
+	res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
+	if (!res) {
+		dev_err(host->dev, "cannot get DMA RX channel\n");
+		goto err_free_dma;
+	}
+	rx_req = res->start;
+
+	host->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &tx_req);
 #if 0
 	if (!host->dma_tx) {
 		dev_err(host->dev, "unable to obtain TX DMA engine channel %u\n",
-			sig);
-		goto err_dma;
+			tx_req);
+		goto err_free_dma;
 	}
 #else
 	if (!host->dma_tx)
 		dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n",
-			sig);
+			tx_req);
 #endif
-	if (cpu_is_omap24xx())
-		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);
+
+	host->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &rx_req);
 #if 0
 	if (!host->dma_rx) {
 		dev_err(host->dev, "unable to obtain RX DMA engine channel %u\n",
-			sig);
-		goto err_dma;
+			rx_req);
+		goto err_free_dma;
 	}
 #else
 	if (!host->dma_rx)
 		dev_warn(host->dev, "unable to obtain RX DMA engine channel %u\n",
-			sig);
+			rx_req);
 #endif
 
 	ret = request_irq(host->irq, mmc_omap_irq, 0, DRIVER_NAME, host);
@@ -1466,7 +1473,9 @@ err_free_mmc_host:
 err_ioremap:
 	kfree(host);
 err_free_mem_region:
-	release_mem_region(res->start, resource_size(res));
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (res)
+		release_mem_region(res->start, resource_size(res));
 	return ret;
 }
 

WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/12] mmc: omap: add DMA engine support
Date: Mon, 23 Apr 2012 17:13:30 -0700	[thread overview]
Message-ID: <20120424001330.GD3739@atomide.com> (raw)
In-Reply-To: <E1SMLmZ-0002WS-Rd@rmk-PC.arm.linux.org.uk>

* Russell King <rmk+kernel@arm.linux.org.uk> [120423 09:11]:
> Add DMA engine support to the OMAP driver.  This supplements the
> private DMA API implementation contained within this driver, and the
> driver can be switched at build time between using DMA engine and the
> private DMA API.

Below is what's needed to use DMA request lines from platform data.
Note also the release_mem_region change that we'll now need for
this one also (but not as a fix).

I've posted a cleanup patch series to mostly remove plat-omap/devices.c
that takes care of passing the DMA request lines in platform data.
That series should get merged before the driver changes for this
driver to keep DMA working.

Regards,

Tony


--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1313,7 +1313,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
 	struct mmc_omap_host *host = NULL;
 	struct resource *res;
 	dma_cap_mask_t mask;
-	unsigned sig;
+	unsigned tx_req, rx_req;
 	int i, ret = 0;
 	int irq;
 
@@ -1389,37 +1389,44 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
 	host->dma_tx_burst = -1;
 	host->dma_rx_burst = -1;
 
-	if (cpu_is_omap24xx())
-		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) {
+		dev_err(host->dev, "cannot get DMA TX channel\n");
+		goto err_free_dma;
+	}
+	tx_req = res->start;
+
+	res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
+	if (!res) {
+		dev_err(host->dev, "cannot get DMA RX channel\n");
+		goto err_free_dma;
+	}
+	rx_req = res->start;
+
+	host->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &tx_req);
 #if 0
 	if (!host->dma_tx) {
 		dev_err(host->dev, "unable to obtain TX DMA engine channel %u\n",
-			sig);
-		goto err_dma;
+			tx_req);
+		goto err_free_dma;
 	}
 #else
 	if (!host->dma_tx)
 		dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n",
-			sig);
+			tx_req);
 #endif
-	if (cpu_is_omap24xx())
-		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);
+
+	host->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &rx_req);
 #if 0
 	if (!host->dma_rx) {
 		dev_err(host->dev, "unable to obtain RX DMA engine channel %u\n",
-			sig);
-		goto err_dma;
+			rx_req);
+		goto err_free_dma;
 	}
 #else
 	if (!host->dma_rx)
 		dev_warn(host->dev, "unable to obtain RX DMA engine channel %u\n",
-			sig);
+			rx_req);
 #endif
 
 	ret = request_irq(host->irq, mmc_omap_irq, 0, DRIVER_NAME, host);
@@ -1466,7 +1473,9 @@ err_free_mmc_host:
 err_ioremap:
 	kfree(host);
 err_free_mem_region:
-	release_mem_region(res->start, resource_size(res));
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (res)
+		release_mem_region(res->start, resource_size(res));
 	return ret;
 }
 

  reply	other threads:[~2012-04-24  0:13 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23 16:04 [RFC 00/12] OMAP DMA engine conversion Russell King - ARM Linux
2012-04-23 16:04 ` Russell King - ARM Linux
2012-04-23 16:04 ` [PATCH 01/12] ARM: OMAP: fix DMA vs memory ordering Russell King
2012-04-23 16:04   ` Russell King
2012-04-23 16:04 ` [PATCH 02/12] dmaengine: split out virtual channel DMA support from sa11x0 driver Russell King
2012-04-23 16:04   ` Russell King
2012-04-27 18:57   ` Linus Walleij
2012-04-27 18:57     ` Linus Walleij
2012-04-23 16:05 ` [PATCH 03/12] dmaengine: add OMAP DMA engine driver Russell King
2012-04-23 16:05   ` Russell King
2012-04-23 16:05 ` [PATCH 04/12] mmc: omap_hsmmc: release correct resource Russell King
2012-04-23 16:05   ` Russell King
2012-04-23 16:05 ` [PATCH 05/12] mmc: omap_hsmmc: add DMA engine support Russell King
2012-04-23 16:05   ` Russell King
2012-04-24  0:16   ` Tony Lindgren
2012-04-24  0:16     ` Tony Lindgren
2012-04-27 19:00   ` Linus Walleij
2012-04-27 19:00     ` Linus Walleij
2012-04-27 19:03     ` Russell King - ARM Linux
2012-04-27 19:03       ` Russell King - ARM Linux
2012-04-27 20:34       ` Linus Walleij
2012-04-27 20:34         ` Linus Walleij
2012-04-23 16:06 ` [PATCH 06/12] mmc: omap_hsmmc: remove private DMA API implementation Russell King
2012-04-23 16:06   ` Russell King
2012-04-24  0:17   ` Tony Lindgren
2012-04-24  0:17     ` Tony Lindgren
2012-04-24 21:51   ` Grazvydas Ignotas
2012-04-24 21:51     ` Grazvydas Ignotas
2012-04-24 22:05     ` Russell King - ARM Linux
2012-04-24 22:05       ` Russell King - ARM Linux
2012-04-23 16:06 ` [PATCH 07/12] mmc: omap: add DMA engine support Russell King
2012-04-23 16:06   ` Russell King
2012-04-24  0:13   ` Tony Lindgren [this message]
2012-04-24  0:13     ` Tony Lindgren
2012-04-28 16:37     ` Russell King - ARM Linux
2012-04-28 16:37       ` Russell King - ARM Linux
2012-04-30 15:59       ` Tony Lindgren
2012-04-30 15:59         ` Tony Lindgren
2012-04-23 16:06 ` [PATCH 08/12] mmc: omap: remove private DMA API implementation Russell King
2012-04-23 16:06   ` Russell King
2012-04-23 16:07 ` [PATCH 09/12] ARM: omap: remove mmc platform data dma_mask and initialization Russell King
2012-04-23 16:07   ` Russell King
2012-04-23 16:07 ` [PATCH 10/12] spi: omap2-mcspi: add DMA engine support Russell King
2012-04-23 16:07   ` Russell King
2012-04-27 17:20   ` Grant Likely
2012-04-27 17:20     ` Grant Likely
2012-04-23 16:07 ` [PATCH 11/12] spi: omap2-mcspi: remove private DMA API implementation Russell King
2012-04-23 16:07   ` Russell King
2012-04-23 16:08 ` [PATCH 12/12] Add removal of old OMAP private DMA implementation to feature removal Russell King
2012-04-23 16:08   ` Russell King
2012-04-24  0:17   ` Tony Lindgren
2012-04-24  0:17     ` Tony Lindgren
2012-04-27 20:19   ` Linus Walleij
2012-04-27 20:19     ` Linus Walleij
2012-04-24 10:38 ` [RFC 00/12] OMAP DMA engine conversion Russell King - ARM Linux
2012-04-24 10:38   ` Russell King - ARM Linux
2012-04-24 16:51   ` Tony Lindgren
2012-04-24 16:51     ` Tony Lindgren
2012-04-24 22:47     ` Grazvydas Ignotas
2012-04-24 22:47       ` Grazvydas Ignotas
2012-04-24 23:29       ` Russell King - ARM Linux
2012-04-24 23:29         ` Russell King - ARM Linux
2012-04-24 23:59         ` Grazvydas Ignotas
2012-04-24 23:59           ` Grazvydas Ignotas
2012-05-09 12:25 ` T Krishnamoorthy, Balaji
2012-05-09 12:25   ` T Krishnamoorthy, Balaji
2012-05-15  4:19 ` Vinod Koul
2012-05-15  4:19   ` Vinod Koul
2012-05-15  7:41   ` Russell King - ARM Linux
2012-05-15  7:41     ` Russell King - ARM Linux
2012-05-15  8:59     ` Vinod Koul
2012-05-15  8:59       ` Vinod Koul
2012-05-15  9:32       ` Russell King - ARM Linux
2012-05-15  9:32         ` Russell King - ARM Linux

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=20120424001330.GD3739@atomide.com \
    --to=tony@atomide.com \
    --cc=cjb@laptop.org \
    --cc=jarkko.lavinen@nokia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.