From patchwork Wed Apr 24 10:58:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 2483691 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 BA0CADF25A for ; Wed, 24 Apr 2013 10:58:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932217Ab3DXK6w (ORCPT ); Wed, 24 Apr 2013 06:58:52 -0400 Received: from mail-we0-f170.google.com ([74.125.82.170]:40240 "EHLO mail-we0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932085Ab3DXK6v (ORCPT ); Wed, 24 Apr 2013 06:58:51 -0400 Received: by mail-we0-f170.google.com with SMTP id z2so1525911wey.15 for ; Wed, 24 Apr 2013 03:58:50 -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=XIGiXPZt6ooMQx8OCJMkkOdIN2fyDmXxR1leyzuVQPY=; b=PT1AJ2n26ODOWrP2fOcVfpzbOCmKVRYSJMBVFqZ/D3gMc7qu0zHGRzPZsEAmekxBqF hFoGCibUMzOtt8xhG0MGsfbEWojxqbUjlT6uoQ47nL4t8r0tJwyRyQ3y9rMvJixFHAs5 UBRK0jhQJZGCpxu5MK0fzR575s2KkOoyk3MSnc62XgY+5h8x8EC4Lpukb7eHmTJ5svjh ubCipJS4WaPnHpl8/yjs+kQB1DgEkZ0yfmwiwKqpPrcARTuKBnk8OKKXkqeEE9HUceQm n596AzKP0n65ERR0wdFYoZzvQHs7mCQfuEHjwi6nLxZUiGTMFzItr9MwvIZOq0aJwMMh TNtg== X-Received: by 10.194.222.100 with SMTP id ql4mr23672095wjc.59.1366801130413; Wed, 24 Apr 2013 03:58:50 -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 ESMTPSA id g4sm3289782wib.11.2013.04.24.03.58.48 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Apr 2013 03:58:49 -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, 24 Apr 2013 11:58:42 +0100 Message-Id: <1366801122-13302-1-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQny1eUKFStVN7gN1Ggegv+golBYeiLsIw2Q6gYE73EBRQyylFhkeOxUjPbysgTpNfSzLOVk 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, 22 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 372e921..ecd256b 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -304,10 +304,8 @@ static void mmci_dma_setup(struct mmci_host *host) 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"); - return; - } + host->dma_rx_channel = dma_request_slave_channel(dev, "rx"); + host->dma_tx_channel = dma_request_slave_channel(dev, "tx"); /* initialize pre request cookie */ host->next_data.cookie = 1; @@ -316,30 +314,33 @@ static void mmci_dma_setup(struct mmci_host *host) dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); - /* - * If only an RX channel is specified, the driver will - * 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, + if (plat && plat->dma_filter) { + if (!host->dma_rx_channel && plat->dma_rx_param) { + host->dma_rx_channel = dma_request_channel(mask, plat->dma_filter, plat->dma_rx_param); - /* E.g if no DMA hardware is present */ - if (!host->dma_rx_channel) - dev_err(mmc_dev(host->mmc), "no RX DMA channel\n"); - } + /* 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, + if (!host->dma_tx_channel && plat->dma_tx_param) { + host->dma_tx_channel = dma_request_channel(mask, plat->dma_filter, plat->dma_tx_param); - if (!host->dma_tx_channel) - dev_warn(mmc_dev(host->mmc), "no TX DMA channel\n"); - } else { - host->dma_tx_channel = host->dma_rx_channel; + if (!host->dma_tx_channel) + dev_warn(mmc_dev(host->mmc), "no TX DMA channel\n"); + } } + /* + * If only an RX channel is specified, the driver will + * attempt to use it bidirectionally, however if it is + * is specified but cannot be located, DMA will be disabled. + */ + if (host->dma_rx_channel && !host->dma_tx_channel) + host->dma_tx_channel = host->dma_rx_channel; + if (host->dma_rx_channel) rxname = dma_chan_name(host->dma_rx_channel); else