[PATCH 3/3] dma: apbh: Enable clock as a part of probing

Andrey Smirnov andrew.smirnov at gmail.com
Sat Mar 31 18:13:57 PDT 2018


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 at 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




More information about the barebox mailing list