Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4203465ybi; Mon, 27 May 2019 13:16:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSo66C8Fs2jrV+NoCWSdm7nEjbjwuNDqgmViRuCNjFG23SvkPqm9ile8fJOc7QrOUpTCeZ X-Received: by 2002:a63:1e59:: with SMTP id p25mr18586161pgm.270.1558988197066; Mon, 27 May 2019 13:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558988197; cv=none; d=google.com; s=arc-20160816; b=NoGJs1rUQ/ocoVdH3ODPWz0CaB7V5j9YkOWe+cp4PPn8lxKFaKameCwcRVC6XCjJxJ 2Bmtc60nIbCE2ioZDwbB08YIifqmv1xoqzNdGYEY7eIEfytUwervQxA0Uv1EhitzcXNx sWIVHIY6KIo18zW1pv0uFmXFrJiUIHD0LZjeMCQrynOTZ/D9zEEXdH2oBRDIbCrKwijE i8KyW22MMU2yFDvwkUYyLkT4Hus79BcK62dO+Ps8wKz0dsFMuSdAS13xtte4cxFT1dpt 0PHXY9LdNPwc+gBRpgNWi4gU1uoJhskHPzSxDfq5INX6Q5NTFf3F77qgSVWFbOsqJsjq TbxA== 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 :dkim-signature; bh=pQgSnfiOxm9+C2oUtvzxOg9ar7+568ZBuQBswlwkWls=; b=akF6jQ/8nOrpsN/QtyRTSY8R+TGaFS2hX0GSsLWHna+y0B7TTGI619Xv1md/RfZ/JN DEX6g94EVNwYQLJihGywZEBxjHclh236RcaLMSQVk0gJua0e45vG7eBhUPA80Z1c0zTw ISewCoIgj+ku+ublkTaW3Dn56XY/OwaYLqQTExVoxsTnXXMDZcRmlmSN9c1FZX0MQodt n+r/kJ2erDIEG7D8AvFqggsHdOwuw6Hyp3EP41ga4POOMuHt1TfQdkMRQiegDB0VKhpe cXwuMVTgourRhpxSYI+ITZSQBfZHwgol/zZFFJSu0TZxBCRJPyxDaQsO3UIXcsyw6yK3 8oKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UB67cg6d; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7si18958513pgm.302.2019.05.27.13.16.21; Mon, 27 May 2019 13:16:37 -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=@gmail.com header.s=20161025 header.b=UB67cg6d; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727380AbfE0UPL (ORCPT + 99 others); Mon, 27 May 2019 16:15:11 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:36019 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726839AbfE0UPK (ORCPT ); Mon, 27 May 2019 16:15:10 -0400 Received: by mail-wm1-f68.google.com with SMTP id v22so541393wml.1; Mon, 27 May 2019 13:15:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pQgSnfiOxm9+C2oUtvzxOg9ar7+568ZBuQBswlwkWls=; b=UB67cg6dM2MYwdlgtwUEZNRNdFd0VssZcedutE7UD7ABLUFax7Of1ifqS7Ip1Sks/0 4syjuOAkx+BkGoh/P/1Y2IRqsjUecVbrl/T5WjVeOlPvTMrY5UjNwGc8QbJI0GXWCc6I eJPL8VCWLxJ/pKipq87k0fdwYEzHhGXgXjZBkvCuNw/6I062OIW1qeqq9tPXzKnqHjIu EAJ/rPKqCUrDE1FxBTIAGzrGjZspnA6PLewZCTT6avIqAdo/uSAF+osYqnc5L66PKYif K4MbE1EPFCh+8lQXLL7HTq6adUYOUHh09YBcW7oxNgjEoBXygmxoS0EmER64vHFLgINx IlEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pQgSnfiOxm9+C2oUtvzxOg9ar7+568ZBuQBswlwkWls=; b=K66632UxYTCbiZ3JE2fZYeypllTKwBGhTc88SF9Ms1IL527QiR/QEgtoA0ii8dk2UR m/M7VCJdjn8JYEOApq6vExkvWxCi7QxNAToYabv76Gh3VoSxFiSLdeUu0l8fMY5eTt62 KRPHM3BTJovfgivHIxMvscbEiedkWf1HD05740QIXm++J5eVa2dRXTz+xX1A3fhTvhxc Wgm4CzI7pH2PGZ/29XtXfHp7wJcnfQdHiLaI9FQ6k64AeUcqaCNX7+3R1u/+iT9wPpjW zZmOCPfN41AFj2M9Hc5JiVhaZjHzQOh7yGJColx/hZaPlkrT9nhfdPRd1EqcDvO/DWrh WAgQ== X-Gm-Message-State: APjAAAUB+tmM82xlDpFRuyU21JDiRkUogNuObSwb+YP2tguQDw6t+QDh YnGN9iLNPX4VgJ0jkgf7t6w= X-Received: by 2002:a1c:2889:: with SMTP id o131mr498095wmo.101.1558988107636; Mon, 27 May 2019 13:15:07 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:1f1:d0f0::4e2b:d7ca]) by smtp.gmail.com with ESMTPSA id i27sm347146wmb.16.2019.05.27.13.15.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 May 2019 13:15:06 -0700 (PDT) From: =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= To: Vinod Koul , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Dan Williams Cc: dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jernej Skrabec , =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= Subject: [PATCH v3 2/7] dmaengine: sun6i: Add a quirk for additional mbus clock Date: Mon, 27 May 2019 22:14:54 +0200 Message-Id: <20190527201459.20130-3-peron.clem@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190527201459.20130-1-peron.clem@gmail.com> References: <20190527201459.20130-1-peron.clem@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jernej Skrabec H6 DMA controller needs additional mbus clock to be enabled. Add a quirk for it and handle it accordingly. Signed-off-by: Jernej Skrabec Signed-off-by: Clément Péron --- 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..7d9606997251 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 has_mbus_clk; }; /* @@ -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->has_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->has_mbus_clk) { + ret = clk_prepare_enable(sdc->clk_mbus); + 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); 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.20.1