From patchwork Wed Apr 17 13:32:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 16165 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 74AF823911 for ; Wed, 17 Apr 2013 13:32:59 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id gd11sf2617165vcb.5 for ; Wed, 17 Apr 2013 06:32:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=vQBfStPNWcdPuEUxlQ4nnCY126chjfUDSbSxseJFOWM=; b=hxJdUjJPE55V3M/fzS8D3lED/wcBf54ypVftLtd0uetCCSN36K0qTF096unAO7KbDw 3QCKf7HTAyu7ajnQ9EW6+JKpOUWjLKQ5aq0vnYggyE5/mwVwLuGWfj5C/fDnIas4ao/U ua1HP5aTu5Dww3Et4NgYhFY7eERIHOHNlc13/AlLG+s5fcWx2xSVkoGnNzg+G8QqyUK+ kyBCkbGdiXHb8INduIF4AQuGi+2Q8W7Waqwd8hbTZOmS4k1t3uA7MaZY5KuFbKcBJkTi vKKREGPJy1lXoBjMRKns4DfVY+hkeeen1hYYOAi4ySrnpPNAi1OypFq9R0uPbekf9bhG KsGQ== X-Received: by 10.224.178.205 with SMTP id bn13mr4929877qab.3.1366205544217; Wed, 17 Apr 2013 06:32:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.1.4 with SMTP id 4ls945267qei.68.gmail; Wed, 17 Apr 2013 06:32:24 -0700 (PDT) X-Received: by 10.52.232.196 with SMTP id tq4mr4114370vdc.15.1366205543995; Wed, 17 Apr 2013 06:32:23 -0700 (PDT) Received: from mail-vb0-x230.google.com (mail-vb0-x230.google.com [2607:f8b0:400c:c02::230]) by mx.google.com with ESMTPS id xa7si3926536vdc.22.2013.04.17.06.32.23 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Apr 2013 06:32:23 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::230 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::230; Received: by mail-vb0-f48.google.com with SMTP id p13so1255071vbe.35 for ; Wed, 17 Apr 2013 06:32:23 -0700 (PDT) X-Received: by 10.52.228.71 with SMTP id sg7mr4023949vdc.51.1366205543842; Wed, 17 Apr 2013 06:32:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp73758veb; Wed, 17 Apr 2013 06:32:23 -0700 (PDT) X-Received: by 10.180.97.132 with SMTP id ea4mr11051725wib.23.1366205542768; Wed, 17 Apr 2013 06:32:22 -0700 (PDT) Received: from mail-wg0-x22a.google.com (mail-wg0-x22a.google.com [2a00:1450:400c:c00::22a]) by mx.google.com with ESMTPS id mb1si2125877wjb.238.2013.04.17.06.32.22 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Apr 2013 06:32:22 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::22a is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c00::22a; Received: by mail-wg0-f42.google.com with SMTP id m15so2246857wgh.5 for ; Wed, 17 Apr 2013 06:32:22 -0700 (PDT) X-Received: by 10.180.104.197 with SMTP id gg5mr14509267wib.13.1366205542136; Wed, 17 Apr 2013 06:32:22 -0700 (PDT) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id t14sm14550419wib.0.2013.04.17.06.32.20 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Apr 2013 06:32:21 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, Lee Jones , Russell King , Chris Ball , linux-mmc@vger.kernel.org Subject: [PATCH] mmc: mmci: Allow MMCI to request channels with information acquired from DT Date: Wed, 17 Apr 2013 14:32:14 +0100 Message-Id: <1366205534-25079-1-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQn6ZkMbEL4TFjEaRAWCjkSP9SId7I1MjU0gKt3NZqGd2MbyZU3sCxTnNCBy3dGfFLhJjPlH X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::230 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Currently, if DMA information isn't passed from platform data, then DMA will not be used. This patch allows DMA information obtained though Device Tree to be used as well. Cc: Russell King Cc: Chris Ball Cc: linux-mmc@vger.kernel.org Signed-off-by: Lee Jones --- drivers/mmc/host/mmci.c | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 372e921..42e8fec 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -298,15 +298,32 @@ 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; + const char *chan_name; + int count, i; + bool do_tx = false, do_rx = false; if (!plat || !plat->dma_filter) { - dev_info(mmc_dev(host->mmc), "no DMA platform data\n"); - return; + if (np) { + count = of_property_count_strings(np, "dma-names"); + for (i = 0; i < count; i++) { + of_property_read_string_index(np, "dma-names", + i, &chan_name); + if (strcmp(chan_name, "tx")) + do_tx = true; + else if (strcmp(chan_name, "rx")) + do_rx = true; + } + } else { + dev_info(mmc_dev(host->mmc), "no DMA platform data\n"); + return; + } } /* initialize pre request cookie */ @@ -321,19 +338,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->dma_rx_param || do_rx) { + 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->dma_tx_param || do_tx) { + 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 +1557,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);