From patchwork Mon Apr 14 21:35:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 3986641 X-Patchwork-Delegate: vinod.koul@intel.com Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 97D92BFF02 for ; Mon, 14 Apr 2014 21:35:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD27F20160 for ; Mon, 14 Apr 2014 21:35:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A7FD7201EC for ; Mon, 14 Apr 2014 21:35:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755434AbaDNVfp (ORCPT ); Mon, 14 Apr 2014 17:35:45 -0400 Received: from ducie-dc1.codethink.co.uk ([185.25.241.215]:53863 "EHLO ducie-dc1.codethink.co.uk" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755412AbaDNVfp (ORCPT ); Mon, 14 Apr 2014 17:35:45 -0400 Received: from localhost (localhost [127.0.0.1]) by ducie-dc1.codethink.co.uk (Postfix) with ESMTP id 45D964683C3; Mon, 14 Apr 2014 22:35:44 +0100 (BST) X-Virus-Scanned: Debian amavisd-new at ducie-dc1.codethink.co.uk Received: from ducie-dc1.codethink.co.uk ([127.0.0.1]) by localhost (ducie-dc1.codethink.co.uk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HaqO+o+errpD; Mon, 14 Apr 2014 22:35:39 +0100 (BST) Received: from rainbowdash.ducie.codethink.co.uk (rainbowdash.dyn.ducie.codethink.co.uk [10.24.1.133]) by ducie-dc1.codethink.co.uk (Postfix) with ESMTPS id 619BE464C58; Mon, 14 Apr 2014 22:35:15 +0100 (BST) Received: from ben by rainbowdash.ducie.codethink.co.uk with local (Exim 4.82) (envelope-from ) id 1WZoX5-0001I9-4s; Mon, 14 Apr 2014 22:35:15 +0100 From: Ben Dooks To: linux-kernel@lists.codethink.co.uk, dmaengine@vger.kernel.org Cc: vinod.koul@intel.com, dan.j.williams@intel.com, linux-sh@vger.kernel.org, magnus.damm@opensource.se, horms@verge.net.au, g.liakhovetski@gmx.d, kuninori.morimoto.gx@renesas.com, devicetree@vger.kernel.org, Ben Dooks Subject: [PATCH v2 9/9] DMA: shdma: wire r8a7790 Date: Mon, 14 Apr 2014 22:35:12 +0100 Message-Id: <1397511312-4845-10-git-send-email-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1397511312-4845-1-git-send-email-ben.dooks@codethink.co.uk> References: <1397511312-4845-1-git-send-email-ben.dooks@codethink.co.uk> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Add support for R8A7790 with new device tree code. Signed-off-by: Ben Dooks --- drivers/dma/sh/shdmac.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c index 0d765c0..eb57cf2 100644 --- a/drivers/dma/sh/shdmac.c +++ b/drivers/dma/sh/shdmac.c @@ -342,11 +342,21 @@ static const struct sh_dmae_slave_config *dmae_find_slave( if (cfg->slave_id == match) return cfg; } else { - for (i = 0, cfg = pdata->slave; i < pdata->slave_num; i++, cfg++) - if (cfg->mid_rid == match) { + if (!pdata->slave) { + cfg = shdma_find_slave_of(shdev, match, &i); + if (cfg) { sh_chan->shdma_chan.slave_id = i; return cfg; } + + return NULL; + } else + for (i = 0, cfg = pdata->slave; i < pdata->slave_num; + i++, cfg++) + if (cfg->mid_rid == match) { + sh_chan->shdma_chan.slave_id = i; + return cfg; + } } return NULL; @@ -677,7 +687,8 @@ static const struct shdma_ops sh_dmae_shdma_ops = { }; static const struct of_device_id sh_dmae_of_match[] = { - {.compatible = "renesas,shdma-r8a73a4", .data = r8a73a4_shdma_devid,}, + { .compatible = "renesas,shdma-r8a73a4", .data = r8a73a4_shdma_devid }, + { .compatible = "renesas,dma-r8a7790", .data = &shdma_arm_info }, {} }; MODULE_DEVICE_TABLE(of, sh_dmae_of_match); @@ -693,10 +704,17 @@ static int sh_dmae_probe(struct platform_device *pdev) struct dma_device *dma_dev; struct resource *chan, *dmars, *errirq_res, *chanirq_res; - if (pdev->dev.of_node) - pdata = of_match_device(sh_dmae_of_match, &pdev->dev)->data; - else + if (pdev->dev.of_node) { + const struct of_device_id *match; + + match = of_match_device(sh_dmae_of_match, &pdev->dev); + if (match->data == r8a73a4_shdma_devid) + pdata = match->data; + else + pdata = sh_dma_probe_of(pdev, match); + } else { pdata = dev_get_platdata(&pdev->dev); + } /* get platform data */ if (!pdata || !pdata->channel_num) @@ -745,7 +763,7 @@ static int sh_dmae_probe(struct platform_device *pdev) if (!pdata->slave_only) dma_cap_set(DMA_MEMCPY, dma_dev->cap_mask); - if (pdata->slave && pdata->slave_num) + if ((pdata->slave && pdata->slave_num) || pdev->dev.of_node) dma_cap_set(DMA_SLAVE, dma_dev->cap_mask); /* Default transfer size of 32 bytes requires 32-byte alignment */