From: Lee Jones <lee.jones@linaro.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linus.walleij@stericsson.com,
Russell King <linux@arm.linux.org.uk>,
Chris Ball <cjb@laptop.org>,
linux-mmc@vger.kernel.org
Subject: Re: [PATCH] mmc: mmci: Allow MMCI to request channels with information acquired from DT
Date: Wed, 17 Apr 2013 16:04:37 +0100 [thread overview]
Message-ID: <20130417150437.GA3137@gmail.com> (raw)
In-Reply-To: <201304171550.56037.arnd@arndb.de>
> This looks unnecessarily complex.
That thought did cross my mind.
> Why not just do dma_request_slave_channel_compat() unconditionally here?
So how about something like this instead, as it keeps the current
semantics, and only differs in the case of DT.
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 372e921..1fd212a 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -298,14 +298,16 @@ static void mmci_init_sg(struct mmci_host *host, struct mmc_data *data)
* no custom DMA interfaces are supported.
*/
#ifdef CONFIG_DMA_ENGINE
-static void mmci_dma_setup(struct mmci_host *host)
+static void mmci_dma_setup(struct amba_device *dev,
+ struct mmci_host *host)
{
+ struct device_node *np = dev->dev.of_node;
struct mmci_platform_data *plat = host->plat;
const char *rxname, *txname;
dma_cap_mask_t mask;
- if (!plat || !plat->dma_filter) {
- dev_info(mmc_dev(host->mmc), "no DMA platform data\n");
+ if (!(plat && plat->dma_filter) && !np) {
+ dev_info(mmc_dev(host->mmc), "no DMA platform data or DT\n");
return;
}
@@ -321,19 +323,21 @@ static void mmci_dma_setup(struct mmci_host *host)
* attempt to use it bidirectionally, however if it is
* is specified but cannot be located, DMA will be disabled.
*/
- if (plat->dma_rx_param) {
- host->dma_rx_channel = dma_request_channel(mask,
- plat->dma_filter,
- plat->dma_rx_param);
+ if ((plat && plat->dma_rx_param) || np) {
+ host->dma_rx_channel = dma_request_slave_channel_compat(mask,
+ (plat) ? plat->dma_filter : NULL,
+ (plat) ? plat->dma_rx_param : NULL,
+ &dev->dev, "rx");
/* E.g if no DMA hardware is present */
if (!host->dma_rx_channel)
dev_err(mmc_dev(host->mmc), "no RX DMA channel\n");
}
- if (plat->dma_tx_param) {
- host->dma_tx_channel = dma_request_channel(mask,
- plat->dma_filter,
- plat->dma_tx_param);
+ if ((plat && plat->dma_tx_param) || np) {
+ host->dma_tx_channel = dma_request_slave_channel_compat(mask,
+ (plat) ? plat->dma_filter : NULL,
+ (plat) ? plat->dma_tx_param : NULL,
+ &dev->dev, "tx");
if (!host->dma_tx_channel)
dev_warn(mmc_dev(host->mmc), "no TX DMA channel\n");
} else {
@@ -1538,7 +1542,7 @@ static int mmci_probe(struct amba_device *dev,
amba_rev(dev), (unsigned long long)dev->res.start,
dev->irq[0], dev->irq[1]);
- mmci_dma_setup(host);
+ mmci_dma_setup(dev, host);
pm_runtime_set_autosuspend_delay(&dev->dev, 50);
pm_runtime_use_autosuspend(&dev->dev);
--
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2013-04-17 15:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-17 13:32 [PATCH] mmc: mmci: Allow MMCI to request channels with information acquired from DT Lee Jones
2013-04-17 13:50 ` Arnd Bergmann
2013-04-17 15:04 ` Lee Jones [this message]
2013-04-17 15:31 ` Arnd Bergmann
2013-04-18 8:02 ` Lee Jones
2013-04-18 8:15 ` Russell King - ARM Linux
2013-04-18 9:25 ` Arnd Bergmann
2013-04-18 9:30 ` Russell King - ARM Linux
2013-04-18 8:21 ` Ulf Hansson
2013-04-24 10:58 Lee Jones
2013-04-30 13:01 ` Linus Walleij
2013-04-30 13:12 ` Lee Jones
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=20130417150437.GA3137@gmail.com \
--to=lee.jones@linaro.org \
--cc=arnd@arndb.de \
--cc=cjb@laptop.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux@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 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).