Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp801749imc; Sun, 10 Mar 2019 22:48:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHlOfYJ1BdhEENTuTg/VVlAHwJK/JvOvGEEJgguQzF4z+A5cimDMCrBX1wsMqtcDW+IDUK X-Received: by 2002:a17:902:834b:: with SMTP id z11mr32505014pln.257.1552283331120; Sun, 10 Mar 2019 22:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552283331; cv=none; d=google.com; s=arc-20160816; b=kEWk//H6kJbu+RgDgi1/KrateJSkYcKWMkeswSCj91nKh49JqBaZuRAmVZATRBNcpJ g6uznA4cXbA3d0qzCcqonPDjWTLOlqzU+tQSz0y+6ze5QjYFJXRulgPHhImA+1qNz1AI YqL70dVGbDPoASusRwwxhBggWyvbJizknK08cSzuFujONWXhByg1G6q6gqzilKbyPZG1 H54hegNseVY9D3LyfDXzB6PLkRmfMDkEg6M/LVxntwQg3cRKv9akfa393R86gXQkIiOf pDPmGua5eiBER+pA1/H1k0SrBh08OpXKTO9HMaId2vc7H+zEEd5F1AU6Hl+YsyMYwovY w23w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=o5XIN70qtUoT1mTIXnxhjeBK1mgcR03eeDXZGpxVm1s=; b=dayTPlb9w8MnO8S8O3EUayZli+96T0n8uU4H6GRmPfbIESmMwe8+ckm1nLyI5d4nfD nbrCESQwb0HqT5b4gb7w15i0tqPGn1LiWFx+w7UX552JfdwUboYHWEfIm8Ga7dTQNynA +2y/+VYirww8KgWAaO0JgbKZaHbcutQyU5aOBm9rl5jMKtIaomjzlh0rL1BcEWiX1Vry Xsxn6Sh0Yi5R3pG8N5OG96p9pgIMTd/7CiZWRac2t1Kp3k3Dl0gG3CAC/TNWmZWmg8k1 Xal8dljFp10G+g2X6mtg9YvsFLtT90ieSTjFt8qJ0YHUSGfA/6OM8MAva+TlLgcatWip ScvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="KCzX6q/S"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s61si4731014plb.305.2019.03.10.22.48.35; Sun, 10 Mar 2019 22:48:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="KCzX6q/S"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726562AbfCKFr7 (ORCPT + 99 others); Mon, 11 Mar 2019 01:47:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:60916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725831AbfCKFr7 (ORCPT ); Mon, 11 Mar 2019 01:47:59 -0400 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 06AF5206DF; Mon, 11 Mar 2019 05:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552283277; bh=dvPU26e8PNP/AuAFulRw6zeHgmvQ5pRxCpsu5mVY484=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KCzX6q/SU/fdda/HoDgSaMuCS4SDnSJgypE2SgOt84IVgoaT2pgBpNjLCqhCPWuuJ 5SzQjnhjhdZ/uX/89cimZlio3X5gEj8kSdrkPyjHfW4Jfh/nuOakfoT0mfudUftebF 85/bp8OwHnT+q6cSJiESdkH47tjelZniOw0v61EU= Received: by mail-wm1-f49.google.com with SMTP id c13so13079970wmb.0; Sun, 10 Mar 2019 22:47:56 -0700 (PDT) X-Gm-Message-State: APjAAAU6qKh28Bt/EK6SAtzLRTHQZCJau5gaAtWdigL7Dpk7jB752XME LZwDhpvKwdCGlZQRexvXbS8JGE7cpdZujc0raxE= X-Received: by 2002:a1c:4c08:: with SMTP id z8mr14512901wmf.99.1552283275492; Sun, 10 Mar 2019 22:47:55 -0700 (PDT) MIME-Version: 1.0 References: <20190307165829.9086-1-jernej.skrabec@siol.net> <20190307165829.9086-3-jernej.skrabec@siol.net> In-Reply-To: <20190307165829.9086-3-jernej.skrabec@siol.net> From: Chen-Yu Tsai Date: Mon, 11 Mar 2019 13:47:43 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/6] dmaengine: sun6i: Add a quirk for additional mbus clock To: Jernej Skrabec Cc: Maxime Ripard , vkoul@kernel.org, Rob Herring , Mark Rutland , Dan Williams , dmaengine@vger.kernel.org, devicetree , linux-arm-kernel , linux-kernel , linux-sunxi Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 8, 2019 at 12:58 AM Jernej Skrabec wrote: > > H6 DMA controller needs additional mbus clock to be enabled. > > Add a quirk for it and handle it accordingly. > > Signed-off-by: Jernej Skrabec > --- > drivers/dma/sun6i-dma.c | 23 ++++++++++++++++++++++- > 1 file changed, 22 insertions(+), 1 deletion(-) > > diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c > index 0cd13f17fc11..761555080325 100644 > --- a/drivers/dma/sun6i-dma.c > +++ b/drivers/dma/sun6i-dma.c > @@ -129,6 +129,7 @@ struct sun6i_dma_config { > u32 dst_burst_lengths; > u32 src_addr_widths; > u32 dst_addr_widths; > + bool mbus_clk; Nit: has_mbus_clk. Be explicit. Leave nothing to assumptions. > }; > > /* > @@ -182,6 +183,7 @@ struct sun6i_dma_dev { > struct dma_device slave; > void __iomem *base; > struct clk *clk; > + struct clk *clk_mbus; > int irq; > spinlock_t lock; > struct reset_control *rstc; > @@ -1208,6 +1210,14 @@ static int sun6i_dma_probe(struct platform_device *pdev) > return PTR_ERR(sdc->clk); > } > > + if (sdc->cfg->mbus_clk) { > + sdc->clk_mbus = devm_clk_get(&pdev->dev, "mbus"); > + if (IS_ERR(sdc->clk_mbus)) { > + dev_err(&pdev->dev, "No mbus clock specified\n"); > + return PTR_ERR(sdc->clk_mbus); > + } > + } > + > sdc->rstc = devm_reset_control_get(&pdev->dev, NULL); > if (IS_ERR(sdc->rstc)) { > dev_err(&pdev->dev, "No reset controller specified\n"); > @@ -1312,11 +1322,19 @@ static int sun6i_dma_probe(struct platform_device *pdev) > goto err_reset_assert; > } > > + if (sdc->cfg->mbus_clk) { > + ret = clk_prepare_enable(sdc->clk_mbus); The clk API checks for NULL pointer, so you could just drop the conditional here. > + if (ret) { > + dev_err(&pdev->dev, "Couldn't enable mbus clock\n"); > + goto err_clk_disable; > + } > + } > + > ret = devm_request_irq(&pdev->dev, sdc->irq, sun6i_dma_interrupt, 0, > dev_name(&pdev->dev), sdc); > if (ret) { > dev_err(&pdev->dev, "Cannot request IRQ\n"); > - goto err_clk_disable; > + goto err_mbus_clk_disable; > } > > ret = dma_async_device_register(&sdc->slave); > @@ -1341,6 +1359,8 @@ static int sun6i_dma_probe(struct platform_device *pdev) > dma_async_device_unregister(&sdc->slave); > err_irq_disable: > sun6i_kill_tasklet(sdc); > +err_mbus_clk_disable: > + clk_disable_unprepare(sdc->clk_mbus); Since you aren't using it here either. ChenYu > err_clk_disable: > clk_disable_unprepare(sdc->clk); > err_reset_assert: > @@ -1359,6 +1379,7 @@ static int sun6i_dma_remove(struct platform_device *pdev) > > sun6i_kill_tasklet(sdc); > > + clk_disable_unprepare(sdc->clk_mbus); > clk_disable_unprepare(sdc->clk); > reset_control_assert(sdc->rstc); > > -- > 2.21.0 >