Skip to contentSkip to conversation

watchdog: imxwd: get and enable clock

PATCH Applied Steffen Trumtrar 2 participants 2 messages Apr 19, 2021 – May 3, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: imxwd: get and enable clock

This it (at least) necessary for i.MX7s or otherwise barebox will hang when trying to access the registers of WDOG2/3/4.

---
 drivers/watchdog/imxwd.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/watchdog/imxwd.c +11 -0
index b2cfd1cd3a31..26c62b7bcb31 100644
@@ -21,6 +21,7 @@
 #include <restart.h>
 #include <watchdog.h>
 #include <reset_source.h>
+#include <linux/clk.h>
 
 struct imx_wd;
 
@@ -224,6 +225,7 @@ static int imx_wd_probe(struct device_d *dev)
 {
 	struct resource *iores;
 	struct imx_wd *priv;
+	struct clk *clk;
 	void *ops;
 	int ret;
 
@@ -237,6 +239,15 @@ static int imx_wd_probe(struct device_d *dev)
 		dev_err(dev, "could not get memory region\n");
 		return PTR_ERR(iores);
 	}
+
+	clk = clk_get(dev, NULL);
+	if (IS_ERR(clk))
+		return PTR_ERR(clk);
+
+	ret = clk_enable(clk);
+	if (ret)
+		return ret;
+
 	priv->base = IOMEM(iores->start);
 	priv->ops = ops;
 	priv->wd.set_timeout = imx_watchdog_set_timeout;
Signature · 7 lines
2.29.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#1 lore raw
Quoted 7 lines · Steffen Trumtrar

This it (at least) necessary for i.MX7s or otherwise barebox will hang when trying to access the registers of WDOG2/3/4.

---
 drivers/watchdog/imxwd.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Applied, thanks

Sascha

Quoted 46 lines
drivers/watchdog/imxwd.c +11 -0
index b2cfd1cd3a31..26c62b7bcb31 100644
@@ -21,6 +21,7 @@
 #include <restart.h>
 #include <watchdog.h>
 #include <reset_source.h>
+#include <linux/clk.h>
 
 struct imx_wd;
 
@@ -224,6 +225,7 @@ static int imx_wd_probe(struct device_d *dev)
 {
 	struct resource *iores;
 	struct imx_wd *priv;
+	struct clk *clk;
 	void *ops;
 	int ret;
 
@@ -237,6 +239,15 @@ static int imx_wd_probe(struct device_d *dev)
 		dev_err(dev, "could not get memory region\n");
 		return PTR_ERR(iores);
 	}
+
+	clk = clk_get(dev, NULL);
+	if (IS_ERR(clk))
+		return PTR_ERR(clk);
+
+	ret = clk_enable(clk);
+	if (ret)
+		return ret;
+
 	priv->base = IOMEM(iores->start);
 	priv->ops = ops;
 	priv->wd.set_timeout = imx_watchdog_set_timeout;
Signature · 7 lines
2.29.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox