From patchwork Sun Dec 8 22:53:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Yanovich X-Patchwork-Id: 3307861 Return-Path: X-Original-To: patchwork-linux-arm@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 76AAF9F37A for ; Sun, 8 Dec 2013 22:57:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8987F20251 for ; Sun, 8 Dec 2013 22:57:58 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8D2EF2024F for ; Sun, 8 Dec 2013 22:57:57 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VpnGw-0003Gl-OG; Sun, 08 Dec 2013 22:56:23 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VpnGL-0007oW-VI; Sun, 08 Dec 2013 22:55:45 +0000 Received: from mail-lb0-x22a.google.com ([2a00:1450:4010:c04::22a]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VpnFZ-0007gr-RT for linux-arm-kernel@lists.infradead.org; Sun, 08 Dec 2013 22:54:59 +0000 Received: by mail-lb0-f170.google.com with SMTP id w7so1075866lbi.15 for ; Sun, 08 Dec 2013 14:54:36 -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=quX1C/n005tXEaA8gYYV06Jd8m3rDB/U/KnkGWk9EUI=; b=chxJQQbu7iq6cIGzKQygRT6rJzLKJNtXSx+MtQ5huzRhe9VYKdXfnpYwH9eszWAHFR S+P1O5Isrko1g/ZoAnLPvYN5iWhyljCu5W8z323ybJ5IlbzMxZbFDN1WoP2IUkLsQkqS g26aJHAABL4OwLNz3hfm9jNM0Rszk1IC4kCiIFpkIViNkgkoIuvDhBoUEpx2bS/RGujy BEkrhA8wE33xM36dEZAZ/yuxABNyUbcM4QXf+LTipI2y8IRCh1/PvZacG1iwyVeOx8+b ABlsovFiwAhDWHUNGNgxWxvq9toStPt3HBM5XdW28NVSENRt0a+wXsYZ9nb7+TO7mlH3 MncQ== X-Received: by 10.112.17.39 with SMTP id l7mr933191lbd.51.1386543276394; Sun, 08 Dec 2013 14:54:36 -0800 (PST) Received: from host5.omatika.ru (0893675324.static.corbina.ru. [95.31.1.192]) by mx.google.com with ESMTPSA id a8sm9892011lae.5.2013.12.08.14.54.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Dec 2013 14:54:35 -0800 (PST) From: Sergei Ianovich To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/9] ARM: dts: provide DMA config to pxamci Date: Mon, 9 Dec 2013 02:53:45 +0400 Message-Id: <1386543229-1542-6-git-send-email-ynvich@gmail.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1386543229-1542-1-git-send-email-ynvich@gmail.com> References: <1386348542-9584-1-git-send-email-ynvich@gmail.com> <1386543229-1542-1-git-send-email-ynvich@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131208_175458_109481_DEE8919E X-CRM114-Status: GOOD ( 14.40 ) X-Spam-Score: -1.9 (-) Cc: Mark Rutland , Jaehoon Chung , Ulf Hansson , Russell King , Arnd Bergmann , Pawel Moll , Stephen Warren , Seungwon Jeon , Ian Campbell , "open list:DOCUMENTATION" , Rob Herring , Daniel Mack , Sergei Ianovich , "open list:OPEN FIRMWARE AND..." , Rob Landley , Chris Ball X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SBL, RP_MATCHES_RCVD, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no 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 --- Documentation/devicetree/bindings/mmc/pxa-mmc.txt | 2 + arch/arm/boot/dts/pxa27x.dtsi | 4 ++ drivers/mmc/host/pxamci.c | 50 ++++++++++++++++++----- 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/Documentation/devicetree/bindings/mmc/pxa-mmc.txt b/Documentation/devicetree/bindings/mmc/pxa-mmc.txt index b7025de..27447ec 100644 --- a/Documentation/devicetree/bindings/mmc/pxa-mmc.txt +++ b/Documentation/devicetree/bindings/mmc/pxa-mmc.txt @@ -5,6 +5,7 @@ Driver bindings for the PXA MCI (MMC/SDIO) interfaces Required properties: - compatible: Should be "marvell,pxa-mmc". - vmmc-supply: A regulator for VMMC +- marvell,dma-channels: 2 PXA DMA channels [0] for RX, [1] for TX Optional properties: - marvell,detect-delay-ms: sets the detection delay timeout in ms. @@ -19,6 +20,7 @@ mmc0: mmc@41100000 { compatible = "marvell,pxa-mmc"; reg = <0x41100000 0x1000>; interrupts = <23>; + marvell,dma-channels = <21 22>; cd-gpios = <&gpio 23 0>; wp-gpios = <&gpio 24 0>; }; diff --git a/arch/arm/boot/dts/pxa27x.dtsi b/arch/arm/boot/dts/pxa27x.dtsi index 44df554..3f97520 100644 --- a/arch/arm/boot/dts/pxa27x.dtsi +++ b/arch/arm/boot/dts/pxa27x.dtsi @@ -16,5 +16,9 @@ interrupts = <8>, <9>, <10>; interrupt-names = "gpio0", "gpio1", "gpio_mux"; }; + + mmc@41100000 { + marvell,dma-channels = <21 22>; + }; }; }; diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index 32fe113..8c7a110 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c @@ -613,11 +613,37 @@ 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 ret; + + ret = of_property_read_u32_index(np, "marvell,dma-channels", 0, &tmp); + if (ret < 0) + return ret; + host->dma_drcmrrx = tmp; + + ret = of_property_read_u32_index(np, "marvell,dma-channels", 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 +767,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;