From patchwork Wed Apr 17 15:04:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 237266 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EF5292C010C for ; Thu, 18 Apr 2013 01:05:03 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1USTuj-00083V-Tm; Wed, 17 Apr 2013 15:04:50 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1USTuh-00070K-Bk; Wed, 17 Apr 2013 15:04:47 +0000 Received: from mail-wg0-f45.google.com ([74.125.82.45]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1USTue-000700-6L for linux-arm-kernel@lists.infradead.org; Wed, 17 Apr 2013 15:04:45 +0000 Received: by mail-wg0-f45.google.com with SMTP id l18so1720554wgh.12 for ; Wed, 17 Apr 2013 08:04:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent:x-gm-message-state; bh=YZzOEmN/1oMBbRoM2vvP8PwayB7cnxfTON86v0D3x6s=; b=lCVVAzG9o7d4+nhGqYYnhDuPPDTxXrOJ4Rlq7Mve8wTuD/Gp4hCU1G7JKzAFEgV9Ll g1ZwHuKHtMyMQyq6LVQlF/Dj1Pbtx1VwumhOuxLrTbOn54z3bVFAsHbsxrvbbl7a6sN3 Ik4a19F7Qno6gUTy3G6uJSpDCVR0IQ1My8PZq5An9uaQ7fwvIJNgBFrHQU+UXpl168t7 iwDSKh9+Oq+T5Y2b8Y4SCTOI2+Q+5sOPVMbKhYwMpJluio7NZMXg0HlCrZRhEaLPPfm6 sSScw1DHZTpW176p11SzX9Uw2zJ6rwKESQLN9Lwf+7tbzesxpyPowmndbC8LH5GVpNWj 8U7Q== X-Received: by 10.180.97.233 with SMTP id ed9mr26747047wib.32.1366211081952; Wed, 17 Apr 2013 08:04:41 -0700 (PDT) Received: from gmail.com (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id fz3sm10241381wib.0.2013.04.17.08.04.39 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 17 Apr 2013 08:04:40 -0700 (PDT) Date: Wed, 17 Apr 2013 16:04:37 +0100 From: Lee Jones To: Arnd Bergmann Subject: Re: [PATCH] mmc: mmci: Allow MMCI to request channels with information acquired from DT Message-ID: <20130417150437.GA3137@gmail.com> References: <1366205534-25079-1-git-send-email-lee.jones@linaro.org> <201304171550.56037.arnd@arndb.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201304171550.56037.arnd@arndb.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQkQIYesHXNBpqYmOFp/yHigs/qbKCev6JPRsWkKiHDGTM83hLxSddoRJPOKDU/pOL+5PB8B X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130417_110444_396112_DD256A8F X-CRM114-Status: GOOD ( 14.04 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.45 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Russell King , linus.walleij@stericsson.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Ball , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org > 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);