linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] mmc: atmel-mci: allow DMA transfers for AVR32
@ 2015-07-27 11:53 Andy Shevchenko
  2015-07-27 12:24 ` Arnd Bergmann
  2015-08-12 15:49 ` [PATCH] [wip] repair mci dma transfers for avr32 Ludovic Desroches
  0 siblings, 2 replies; 8+ messages in thread
From: Andy Shevchenko @ 2015-07-27 11:53 UTC (permalink / raw)
  To: Ludovic Desroches, Ulf Hansson, linux-mmc; +Cc: Andy Shevchenko

The commit ecb89f2f5f3e (mmc: atmel-mci: remove compat for non DT board when
requesting dma chan) removes compat transfer which breaks DMA
support for ATNGW100. This patch returns back that functionality.

Cc: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mmc/host/atmel-mci.c | 49 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 9a39e0b..70865be 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -2277,12 +2277,55 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
 	mmc_free_host(slot->mmc);
 }
 
-static int atmci_configure_dma(struct atmel_mci *host)
+static bool atmci_filter(struct dma_chan *chan, void *pdata)
 {
+	struct mci_platform_data *sl_pdata = pdata;
+	struct mci_dma_data *sl;
+
+	if (!sl_pdata)
+		return false;
+
+	sl = sl_pdata->dma_slave;
+	if (sl && find_slave_dev(sl) == chan->device->dev) {
+		chan->private = slave_data_ptr(sl);
+		return true;
+	} else {
+		return false;
+	}
+}
+
+static int atmci_dma_request_channel(struct atmel_mci *host)
+{
+	struct mci_platform_data	*pdata;
+	dma_cap_mask_t mask;
+
 	host->dma.chan = dma_request_slave_channel_reason(&host->pdev->dev,
 							"rxtx");
-	if (IS_ERR(host->dma.chan))
-		return PTR_ERR(host->dma.chan);
+	if (!IS_ERR(host->dma.chan))
+		return 0;
+
+	if (PTR_ERR(host->dma.chan) == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
+
+	pdata = host->pdev->dev.platform_data;
+
+	dma_cap_zero(mask);
+	dma_cap_set(DMA_SLAVE, mask);
+
+	host->dma.chan = dma_request_channel(mask, atmci_filter, pdata);
+	if (!host->dma.chan)
+		return -ENODEV;
+
+	return 0;
+}
+
+static int atmci_configure_dma(struct atmel_mci *host)
+{
+	int ret;
+
+	ret = atmci_dma_request_channel(host);
+	if (ret)
+		return ret;
 
 	dev_info(&host->pdev->dev, "using %s for DMA transfers\n",
 		 dma_chan_name(host->dma.chan));
-- 
2.4.6


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-01-11  8:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-27 11:53 [PATCH v1 1/1] mmc: atmel-mci: allow DMA transfers for AVR32 Andy Shevchenko
2015-07-27 12:24 ` Arnd Bergmann
2015-07-27 14:45   ` Andy Shevchenko
2015-08-06  7:01     ` Ludovic Desroches
2015-08-06 13:16       ` Arnd Bergmann
2015-08-12 15:49 ` [PATCH] [wip] repair mci dma transfers for avr32 Ludovic Desroches
2015-08-12 16:51   ` Andy Shevchenko
2016-01-11  8:54   ` Andy Shevchenko

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).