From patchwork Wed Jun 26 14:40:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2785601 Return-Path: X-Original-To: patchwork-linux-sh@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 CAC84C0AB1 for ; Wed, 26 Jun 2013 14:41:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 968BB2055B for ; Wed, 26 Jun 2013 14:41:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D52362055A for ; Wed, 26 Jun 2013 14:41:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752501Ab3FZOlP (ORCPT ); Wed, 26 Jun 2013 10:41:15 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:50499 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752168Ab3FZOlL (ORCPT ); Wed, 26 Jun 2013 10:41:11 -0400 Received: from axis700.grange (dslb-178-001-151-028.pools.arcor-ip.net [178.1.151.28]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0M51UE-1U3ZUl3JVe-00zSlX; Wed, 26 Jun 2013 16:40:58 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 2D8FD40BB3; Wed, 26 Jun 2013 16:40:57 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1Urqu0-0002au-OG; Wed, 26 Jun 2013 16:40:56 +0200 From: Guennadi Liakhovetski To: linux-sh@vger.kernel.org Cc: devicetree-discuss@lists.ozlabs.org, Magnus Damm , Simon Horman , Guennadi Liakhovetski , Vinod Koul Subject: [PATCH/RFC 1/7] DMA: shdma: also support single top-level DMAC DT nodes Date: Wed, 26 Jun 2013 16:40:50 +0200 Message-Id: <1372257656-9944-2-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1372257656-9944-1-git-send-email-g.liakhovetski@gmx.de> References: <1372257656-9944-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:qKEHbHBsogBPNbwmT0PEeKb+7rQn0tvu5yxlpBuiEPA AUqnFVoRDL6x9tbCZtIJqgzqJSsIfvOUIMibovA0cX7S/xM2T5 1xBaa59URSILcPyfidRcTdlBS5cWu7d1DlB8UtQjrajSxS/cZl rHelsNEvLgKm8Zisx9JSEx/LOkl9smmNfmSzeLXqtHN9Xlh2mI ak9wL7bQP/n5BBS0nmfVtCH1AEc78EShVdANYwGfKn4CP5oDgU wB+FrjlId0/D0bMc/41bYDYgjDoJITLs+c267tTwxCBGOyvReV 2Kv2zzn7MxFB2maU2gUm/i3P/WZ7WmBIJSnhiumIC7xoPO7UIO RWoZcBmqb/k0uA24XNp1KAZjlhD24ZKrwfpHGtqGQNjKzxCzF3 QqhvD9YE5rMAw== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, 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 Currently we support DMAC DT nodes, located under a multiplexer. This also supports systems with a single DMAC instance by placing it alone under such a multiplexer node, but this is rather unnatural. This patch adds an ability to shdma support such single DT nodes with no dummy multiplexer. Signed-off-by: Guennadi Liakhovetski Cc: Vinod Koul --- drivers/dma/sh/shdma-of.c | 5 +++-- drivers/dma/sh/shdma.c | 16 ++++++++++++++++ include/linux/sh_dma.h | 5 +++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/dma/sh/shdma-of.c b/drivers/dma/sh/shdma-of.c index 9ab869d..fd2fa10 100644 --- a/drivers/dma/sh/shdma-of.c +++ b/drivers/dma/sh/shdma-of.c @@ -19,8 +19,8 @@ #define to_shdma_chan(c) container_of(c, struct shdma_chan, dma_chan) -static struct dma_chan *shdma_of_xlate(struct of_phandle_args *dma_spec, - struct of_dma *ofdma) +struct dma_chan *shdma_of_xlate(struct of_phandle_args *dma_spec, + struct of_dma *ofdma) { u32 id = dma_spec->args[0]; dma_cap_mask_t mask; @@ -39,6 +39,7 @@ static struct dma_chan *shdma_of_xlate(struct of_phandle_args *dma_spec, return chan; } +EXPORT_SYMBOL(shdma_of_xlate); static int shdma_of_probe(struct platform_device *pdev) { diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c index 70bc99a..98b2693 100644 --- a/drivers/dma/sh/shdma.c +++ b/drivers/dma/sh/shdma.c @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include #include @@ -849,6 +851,15 @@ static int sh_dmae_probe(struct platform_device *pdev) pm_runtime_put(&pdev->dev); + if (pdev->dev.of_node && + !of_device_is_compatible(pdev->dev.of_node->parent, + "renesas,shdma-mux")) { + err = of_dma_controller_register(pdev->dev.of_node, + shdma_of_xlate, pdev); + if (err < 0) + goto eofdma; + } + err = dma_async_device_register(&shdev->shdma_dev.dma_dev); if (err < 0) goto edmadevreg; @@ -856,6 +867,8 @@ static int sh_dmae_probe(struct platform_device *pdev) return err; edmadevreg: + of_dma_controller_free(pdev->dev.of_node); +eofdma: pm_runtime_get(&pdev->dev); chan_probe_err: @@ -901,6 +914,9 @@ static int sh_dmae_remove(struct platform_device *pdev) dma_async_device_unregister(dma_dev); + /* Is a NOP if this controller isn't registered with of-dma */ + of_dma_controller_free(pdev->dev.of_node); + if (errirq > 0) free_irq(errirq, shdev); diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h index 4e83f3e..887977d 100644 --- a/include/linux/sh_dma.h +++ b/include/linux/sh_dma.h @@ -99,4 +99,9 @@ struct sh_dmae_pdata { #define CHCR_TE 0x00000002 #define CHCR_IE 0x00000004 +struct of_phandle_args; +struct of_dma; +struct dma_chan *shdma_of_xlate(struct of_phandle_args *dma_spec, + struct of_dma *ofdma); + #endif