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: 2453741 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 6C270DF23A for ; Wed, 17 Apr 2013 13:32:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966234Ab3DQNcY (ORCPT ); Wed, 17 Apr 2013 09:32:24 -0400 Received: from mail-wg0-f51.google.com ([74.125.82.51]:48387 "EHLO mail-wg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966186Ab3DQNcX (ORCPT ); Wed, 17 Apr 2013 09:32:23 -0400 Received: by mail-wg0-f51.google.com with SMTP id b13so1573715wgh.6 for ; Wed, 17 Apr 2013 06:32:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=vQBfStPNWcdPuEUxlQ4nnCY126chjfUDSbSxseJFOWM=; b=k5lSLpM5pBFYvz1bf7+ZUpiNA6i1sn7fyLJ3JAQsWW/Q42cSUwqTiZvmOtT/dcFEvd jT/g5pxAGoIrlQ1jOU+MPr4IIZK2Gth+QEG9RNAsnZHHO7OkR8vQO15OUONPcx1WYPW2 ziguHq0MjgDmRZGA8wdvLhKK6hFo4g9gC8xElUJdoJ1gROTugoJHtALf8K2cwahNTbjn 0Nk8kfFiC1mpdrWXftPO1kNeoysWO9tG/p7F7TG3Rw/iXDCVVQDYIuOjYylBmcRRvhCG v6WhV2i2S5BDLfVQMU3VKtub+CbziNm3TWPRsBGq2M9ULIxohwcduWuoAag2/nNt+6A7 yLLQ== 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: ALoCoQk0JeOjscfssmM2hizXcpY/lXKnepjaAhkYuMpJe0vzICU7YgVhg8SGuffcO25G0vbKoA3P Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org 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);