From patchwork Wed Apr 16 17:17:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Yanovich X-Patchwork-Id: 4003181 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 E15719F2CC for ; Wed, 16 Apr 2014 17:20:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1838020377 for ; Wed, 16 Apr 2014 17:20:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 4500920374 for ; Wed, 16 Apr 2014 17:20:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WaTTi-0005WR-Md; Wed, 16 Apr 2014 17:18:30 +0000 Received: from mail-la0-x229.google.com ([2a00:1450:4010:c03::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WaTTf-0004xz-0G for linux-arm-kernel@lists.infradead.org; Wed, 16 Apr 2014 17:18:27 +0000 Received: by mail-la0-f41.google.com with SMTP id gl10so8553152lab.0 for ; Wed, 16 Apr 2014 10:18:04 -0700 (PDT) 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=1KwbZtLXnpq2qU588JXqJxwD7m2/WM+Exw7aDwQOCFI=; b=1F02CjewFC4aBmgSdnuD9xivH+or09LGB4nrKSZdYo/XKosd6ovgei3lNnaGHPNAGp chWqovcBJM+1OCUO/EpDjLZIUmMwHU7n3ONhePvdGWfzB1Kb8xRBkd27tokuatFmk54z z6CykzUK183sK0jINdImGbfqOmOlXoGw9+OumLGczm4W++E2WAUgHzj9cVI+1C33qi4U TEurjVoAhT20RJtIbT4FHuo6A+F9uULQ5T29JxM0GxbFo3MPtqQ1GKWPMf30+55xKWAT ebDOMW3pcpLpQeLDVnZXMq1I71lTbnv9Ug17YlZNq5hB4u+gdnsmKpEpPTOKTGOpRCwf zdbQ== X-Received: by 10.112.137.5 with SMTP id qe5mr3609194lbb.16.1397668684691; Wed, 16 Apr 2014 10:18:04 -0700 (PDT) Received: from host5.omatika.ru (0893675324.static.corbina.ru. [95.31.1.192]) by mx.google.com with ESMTPSA id q4sm21186297lbh.20.2014.04.16.10.18.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Apr 2014 10:18:04 -0700 (PDT) From: Sergei Ianovich To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 07/21] ARM: dts: parse DMA config in pxamci Date: Wed, 16 Apr 2014 21:17:12 +0400 Message-Id: <1397668667-27328-1-git-send-email-ynvich@gmail.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1397668411-27162-7-git-send-email-ynvich@gmail.com> References: <1397668411-27162-7-git-send-email-ynvich@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140416_101827_261796_6202CE05 X-CRM114-Status: GOOD ( 18.03 ) X-Spam-Score: -0.1 (/) Cc: Jaehoon Chung , Ulf Hansson , Arnd Bergmann , Mark Brown , Jingoo Han , linux-mmc@vger.kernel.org, Chris Ball , Haojian Zhuang , Daniel Mack , Sergei Ianovich 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=-2.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 The existing PXA MMC driver cannot get DMA channels in a proper way from the respective device tree binding. This patch provides temporary workaround which allows using the existing driver in DT machines by pointing to the proper dmaengine-based "marvell,pdma-1.0" DMA. Even though the new DMA provider is not present we can parse device node attributes manually and use channel numbers to acquire DMA channel from the existing non-dmaengine provider. When Daniel's DMA series is merged there will be no need to manually parse for "dmas" and this patch can be safely reverted. Signed-off-by: Sergei Ianovich CC: Daniel Mack CC: Haojian Zhuang CC: Arnd Bergmann --- v3..v4 * no changes v2..v3 * split into good (PATCH 07/21) and temporary (this one) parts v1..v2 * add binding for next-gen dma controller * use correct dma declararion * number changed from 5 to 3 drivers/mmc/host/pxamci.c | 59 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 11 deletions(-) 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;