Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5156915imb; Thu, 7 Mar 2019 08:59:36 -0800 (PST) X-Google-Smtp-Source: APXvYqxCBCYJxinEQzWtfjX4rs0lnvNrdpBuxA2zL19q+z5NdUU3YPDfZjy4oHtMSbQpiVGzUGIY X-Received: by 2002:aa7:8c4d:: with SMTP id e13mr13829287pfd.53.1551977976356; Thu, 07 Mar 2019 08:59:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551977976; cv=none; d=google.com; s=arc-20160816; b=S6fJuOaL6uEebutQCJGZpFEPdvwZ2cKwoObX2iEiN2ByG/HkQuKPxIPXpODRhV4sFT NJ8zYdOsy71WIIYliS1vJZ6yO/doHJSOn8w3d/EY34mLNbev5/ZxuH7lKLfvCqwnjCeV icFKptfIgXpYbVJZm27OnGuKwrhh8zpGUg/goTW/ryBiFIMMGlwVdYCdIZXB5+wg+SJS W0M0Tg6rHQhhMEpIMlqp7815AXDRm3OU6XKlxzUYXjDWONVy5gqJlXB8xKXaH0nCxu22 WWSIr8A38vi7A2Nnpin7F7GehTgXwCctLj73Bz6jnbUb/NBsLjSUuuyensa6ywDPxKP/ IqqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Q4F6k5awRPkiCqxeYkvxz8wH1sqOMBYVFAvAZzFnNFY=; b=oJZukuOYY2PRUhMaMtww00TePNya4qgrIoztoCZrhggOLawK+jrGLKSIKVGDaGGaIk 4vesE+0vTxBtRX55KEgpo7MyfQHYu5zzLVlTo4WcYFPEXTN0ZthsISXZ6fJIQEmaGnJU ExuIybLzTZTDWqUmVyMitBeyKx0X/mCRHQ/7hQsRh4QhPWA44ozd4m7nFiGu/RaA1/2/ JIcViFY7aJOdpL+dQrFaRl0yjI8eYR73i98QjZ3/fe7yp94lO2DGS2UHkGh8LoVOHIgm wj9Af4M1IzoP7RM6kvDOkTTidsOVDXMY6s+hVXUp7mZH/NCCQqNNGf52yx9da54SpJnx q/AA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si4144429pgr.203.2019.03.07.08.59.20; Thu, 07 Mar 2019 08:59:36 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726544AbfCGQ6s (ORCPT + 99 others); Thu, 7 Mar 2019 11:58:48 -0500 Received: from mailoutvs33.siol.net ([185.57.226.224]:46004 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726269AbfCGQ6q (ORCPT ); Thu, 7 Mar 2019 11:58:46 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTP id D88495237D4; Thu, 7 Mar 2019 17:58:42 +0100 (CET) X-Virus-Scanned: amavisd-new at psrvmta12.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta12.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id a4s5xj_GwEib; Thu, 7 Mar 2019 17:58:42 +0100 (CET) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTPS id 767F5523799; Thu, 7 Mar 2019 17:58:42 +0100 (CET) Received: from localhost.localdomain (cpe-86-58-52-202.static.triera.net [86.58.52.202]) (Authenticated sender: 031275009) by mail.siol.net (Zimbra) with ESMTPSA id E83EA5237C3; Thu, 7 Mar 2019 17:58:39 +0100 (CET) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org Cc: vkoul@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, dan.j.williams@intel.com, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, jernej.skrabec@siol.net Subject: [PATCH 2/6] dmaengine: sun6i: Add a quirk for additional mbus clock Date: Thu, 7 Mar 2019 17:58:25 +0100 Message-Id: <20190307165829.9086-3-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190307165829.9086-1-jernej.skrabec@siol.net> References: <20190307165829.9086-1-jernej.skrabec@siol.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; }; =20 /* @@ -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); } =20 + if (sdc->cfg->mbus_clk) { + sdc->clk_mbus =3D 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 =3D 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; } =20 + if (sdc->cfg->mbus_clk) { + ret =3D clk_prepare_enable(sdc->clk_mbus); + if (ret) { + dev_err(&pdev->dev, "Couldn't enable mbus clock\n"); + goto err_clk_disable; + } + } + ret =3D 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; } =20 ret =3D 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); err_clk_disable: clk_disable_unprepare(sdc->clk); err_reset_assert: @@ -1359,6 +1379,7 @@ static int sun6i_dma_remove(struct platform_device = *pdev) =20 sun6i_kill_tasklet(sdc); =20 + clk_disable_unprepare(sdc->clk_mbus); clk_disable_unprepare(sdc->clk); reset_control_assert(sdc->rstc); =20 --=20 2.21.0