mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 3/3] dma: apbh: Enable clock as a part of probing
Date: Sat, 31 Mar 2018 18:13:57 -0700	[thread overview]
Message-ID: <20180401011358.11621-4-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20180401011358.11621-1-andrew.smirnov@gmail.com>

Enable clock as a part of probing in order to avoid problems on SoCs
that do not have this block ungated out of reset (e.g. i.MX7).

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/dma/apbh_dma.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
index b84c0f798..79f25109f 100644
--- a/drivers/dma/apbh_dma.c
+++ b/drivers/dma/apbh_dma.c
@@ -17,6 +17,7 @@
 
 #include <dma/apbh-dma.h>
 #include <stmp-device.h>
+#include <linux/clk.h>
 #include <linux/list.h>
 #include <linux/err.h>
 #include <common.h>
@@ -55,6 +56,7 @@ enum mxs_dma_id {
 
 struct apbh_dma {
 	void __iomem *regs;
+	struct clk *clk;
 	enum mxs_dma_id id;
 };
 
@@ -606,6 +608,17 @@ static int apbh_dma_probe(struct device_d *dev)
 
 	apbh->id = id;
 
+	apbh->clk = clk_get(dev, NULL);
+	if (IS_ERR(apbh->clk))
+		return PTR_ERR(apbh->clk);
+
+	ret = clk_enable(apbh->clk);
+	if (ret) {
+		dev_err(dev, "Failed to enable clock: %s\n",
+			strerror(ret));
+		return ret;
+	}
+
 	ret = stmp_reset_block(apbh->regs, 0);
 	if (ret)
 		return ret;
-- 
2.14.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-04-01  1:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-01  1:13 [PATCH 0/3] APBH DMA fixes for i.MX7 Andrey Smirnov
2018-04-01  1:13 ` [PATCH 1/3] clk: i.MX7: Port NAND clock setup code from Linux Andrey Smirnov
2018-04-01  1:13 ` [PATCH 2/3] clk: Forward declare struct of_device_id in linux/clk.h Andrey Smirnov
2018-04-01  1:13 ` Andrey Smirnov [this message]
2018-04-01  1:13 ` [PATCH] Revert "startup: Load default environment earlier" Andrey Smirnov
2018-04-03  7:12 ` [PATCH 0/3] APBH DMA fixes for i.MX7 Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180401011358.11621-4-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox