From patchwork Fri Dec 13 02:27:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Yanovich X-Patchwork-Id: 3336161 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 04FFF9F374 for ; Fri, 13 Dec 2013 02:32:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F647207D3 for ; Fri, 13 Dec 2013 02:32:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1FAB3207D1 for ; Fri, 13 Dec 2013 02:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752046Ab3LMC2i (ORCPT ); Thu, 12 Dec 2013 21:28:38 -0500 Received: from mail-la0-f42.google.com ([209.85.215.42]:45120 "EHLO mail-la0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752043Ab3LMC2g (ORCPT ); Thu, 12 Dec 2013 21:28:36 -0500 Received: by mail-la0-f42.google.com with SMTP id ec20so934720lab.1 for ; Thu, 12 Dec 2013 18:28:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cbMPosMb68gr4sl5JKMWlV9EgiNssV1HX9SuVhEy+Do=; b=M2Bp04DPz6NfbkQHf1JDLcwyH6RfxQIxvIfx5pJsD7B0mJH0gnf+8mWTSKlTyKgU0X 6IYso6L6SGXKj4IbyjSf7/a8V0PN6hnd7kzRm1nGfdKdD1mCzTTtFL9RXD7NtdGn+h8j Oitaj8fiZqafl+AfWX3FXhEDgLIxlpUetOw5XJgjfuyBvIgljhLl4fd0sxpg6QxHWKZp BLI0FDpdSA9vzH15T7pRnl1hswhxslxoMeD/lnXQJ99csVWiJtc2028IgzzTGy6Q52DF uBc0FGMa74GXXcWb4m0CaEhuI9tu8IIvP55WBxSTtQ33Sum07QhZFYXczmPLkC60mqjy PtUw== X-Received: by 10.152.203.168 with SMTP id kr8mr59339lac.44.1386901714827; Thu, 12 Dec 2013 18:28:34 -0800 (PST) Received: from host5.omatika.ru (0893675324.static.corbina.ru. [95.31.1.192]) by mx.google.com with ESMTPSA id e10sm809634laa.6.2013.12.12.18.28.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Dec 2013 18:28:33 -0800 (PST) From: Sergei Ianovich To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Sergei Ianovich , Daniel Mack , Arnd Bergmann , Rob Herring , Pawel Moll , Mark Rutland , Stephen Warren , Ian Campbell , Rob Landley , Russell King , Chris Ball , Viresh Kumar , Shawn Guo , Haojian Zhuang , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND...), linux-doc@vger.kernel.org (open list:DOCUMENTATION), linux-mmc@vger.kernel.org Subject: [PATCH v2 03/16] ARM: dts: provide DMA config to pxamci Date: Fri, 13 Dec 2013 06:27:12 +0400 Message-Id: <1386901645-28895-4-git-send-email-ynvich@gmail.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1386901645-28895-1-git-send-email-ynvich@gmail.com> References: <1386543229-1542-1-git-send-email-ynvich@gmail.com> <1386901645-28895-1-git-send-email-ynvich@gmail.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SBL, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Non-dts implementation supply required DMA channel numbers as IORESOURCE_DMA. However, there is was no way to get them from device tree. Signed-off-by: Sergei Ianovich CC: Daniel Mack CC: Arnd Bergmann --- v1..v2 * add binding for next-gen dma controller * use correct dma declararion * number changed from 5 to 3 Documentation/devicetree/bindings/mmc/pxa-mmc.txt | 5 ++ arch/arm/boot/dts/pxa27x.dtsi | 14 ++++++ drivers/mmc/host/pxamci.c | 59 ++++++++++++++++++----- 3 files changed, 67 insertions(+), 11 deletions(-) diff --git a/Documentation/devicetree/bindings/mmc/pxa-mmc.txt b/Documentation/devicetree/bindings/mmc/pxa-mmc.txt index b7025de..9f54c69 100644 --- a/Documentation/devicetree/bindings/mmc/pxa-mmc.txt +++ b/Documentation/devicetree/bindings/mmc/pxa-mmc.txt @@ -5,6 +5,8 @@ Driver bindings for the PXA MCI (MMC/SDIO) interfaces Required properties: - compatible: Should be "marvell,pxa-mmc". - vmmc-supply: A regulator for VMMC +- dmas: Should be DMA specifiers for RX and TX +- dma-names: Should be "rx" and "tx" Optional properties: - marvell,detect-delay-ms: sets the detection delay timeout in ms. @@ -21,5 +23,8 @@ mmc0: mmc@41100000 { interrupts = <23>; cd-gpios = <&gpio 23 0>; wp-gpios = <&gpio 24 0>; + dmas = <&dma 21 + &dma 22>; + dma-names = "rx", "tx"; }; diff --git a/arch/arm/boot/dts/pxa27x.dtsi b/arch/arm/boot/dts/pxa27x.dtsi index 44df554..c2a90c5 100644 --- a/arch/arm/boot/dts/pxa27x.dtsi +++ b/arch/arm/boot/dts/pxa27x.dtsi @@ -11,10 +11,24 @@ marvell,intc-nr-irqs = <34>; }; + dma: dma-controller@40000000 { + compatible = "marvell,pdma-1.0"; + reg = <0x40000000 0x10000>; + interrupts = <25>; + #dma-cells = <1>; + dma-channels = <32>; + }; + gpio: gpio@40e00000 { compatible = "intel,pxa27x-gpio"; interrupts = <8>, <9>, <10>; interrupt-names = "gpio0", "gpio1", "gpio_mux"; }; + + mmc@41100000 { + dmas = <&dma 21 + &dma 22>; + dma-names = "rx", "tx"; + }; }; }; diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index 32fe113..6b67764 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c @@ -613,11 +613,46 @@ static int pxamci_of_init(struct platform_device *pdev) return 0; } + +static int pxamci_of_init_dma(struct platform_device *pdev, + struct pxamci_host *host) +{ + struct device_node *np = pdev->dev.of_node; + u32 tmp; + int i; + int ret; + + i = of_property_match_string(np, "dma-names", "rx"); + if (i < 0) + return i; + + ret = of_property_read_u32_index(np, "dmas", 2 * i + 1, &tmp); + if (ret < 0) + return ret; + host->dma_drcmrrx = tmp; + + i = of_property_match_string(np, "dma-names", "tx"); + if (i < 0) + return i; + + ret = of_property_read_u32_index(np, "dmas", 2 * i + 1, &tmp); + if (ret < 0) + return ret; + host->dma_drcmrtx = tmp; + + return 0; +} #else static int pxamci_of_init(struct platform_device *pdev) { return 0; } + +static int pxamci_of_init_dma(struct platform_device *pdev, + struct pxamci_host *host) +{ + return -ENODATA; +} #endif static int pxamci_probe(struct platform_device *pdev) @@ -741,19 +776,21 @@ static int pxamci_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mmc); - dmarx = platform_get_resource(pdev, IORESOURCE_DMA, 0); - if (!dmarx) { - ret = -ENXIO; - goto out; - } - host->dma_drcmrrx = dmarx->start; + if (pxamci_of_init_dma(pdev, host) < 0) { + dmarx = platform_get_resource(pdev, IORESOURCE_DMA, 0); + if (!dmarx) { + ret = -ENXIO; + goto out; + } + host->dma_drcmrrx = dmarx->start; - dmatx = platform_get_resource(pdev, IORESOURCE_DMA, 1); - if (!dmatx) { - ret = -ENXIO; - goto out; + dmatx = platform_get_resource(pdev, IORESOURCE_DMA, 1); + if (!dmatx) { + ret = -ENXIO; + goto out; + } + host->dma_drcmrtx = dmatx->start; } - host->dma_drcmrtx = dmatx->start; if (host->pdata) { gpio_cd = host->pdata->gpio_card_detect;