Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1488586 > unrolled thread
| Started by | Steffen Trumtrar <s.trumtrar@pengutronix.de> |
|---|---|
| First post | 2016-09-22 09:10 +0200 |
| Last post | 2016-09-22 15:20 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/3] watchdog: dw_wdt: get reset lines from dt Steffen Trumtrar <s.trumtrar@pengutronix.de> - 2016-09-22 09:10 +0200
Re: [PATCH 2/3] watchdog: dw_wdt: get reset lines from dt Guenter Roeck <linux@roeck-us.net> - 2016-09-22 15:20 +0200
| From | Steffen Trumtrar <s.trumtrar@pengutronix.de> |
|---|---|
| Date | 2016-09-22 09:10 +0200 |
| Subject | [PATCH 2/3] watchdog: dw_wdt: get reset lines from dt |
| Message-ID | <sk6iS-3g4-9@gated-at.bofh.it> |
The dw_wdt has an external reset line, that can keep the device in reset
and therefore rendering it useless and also is the only way of stopping
the watchdog once it was started.
Get the reset lines for this core from the devicetree.
If resets are not specified just warn but don't fail probing to be compatible
with all users.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-watchdog@vger.kernel.org
---
drivers/watchdog/dw_wdt.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index 2acb51cf5504..e024722e8b3b 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -31,6 +31,7 @@
#include <linux/pm.h>
#include <linux/platform_device.h>
#include <linux/reboot.h>
+#include <linux/reset.h>
#include <linux/watchdog.h>
#define WDOG_CONTROL_REG_OFFSET 0x00
@@ -56,6 +57,7 @@ struct dw_wdt {
struct clk *clk;
struct notifier_block restart_handler;
struct watchdog_device wdd;
+ struct reset_control *rst;
};
#define to_dw_wdt(wdd) container_of(wdd, struct dw_wdt, wdd)
@@ -231,6 +233,10 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
if (ret)
return ret;
+ dw_wdt->rst = devm_reset_control_get(&pdev->dev, "dw-wdt");
+ if (IS_ERR(dw_wdt->rst))
+ dev_warn(dev, "No reset lines. Will not be able to stop once started.\n");
+
wdd = &dw_wdt->wdd;
wdd->info = &dw_wdt_ident;
wdd->ops = &dw_wdt_ops;
@@ -268,6 +274,9 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
if (ret)
pr_warn("cannot register restart handler\n");
+ if (dw_wdt->rst)
+ reset_control_deassert(dw_wdt->rst);
+
return 0;
out_disable_clk:
--
2.8.1
[toc] | [next] | [standalone]
| From | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| Date | 2016-09-22 15:20 +0200 |
| Message-ID | <skc4W-6RE-11@gated-at.bofh.it> |
| In reply to | #1488586 |
On 09/22/2016 12:02 AM, Steffen Trumtrar wrote:
> The dw_wdt has an external reset line, that can keep the device in reset
> and therefore rendering it useless and also is the only way of stopping
> the watchdog once it was started.
>
> Get the reset lines for this core from the devicetree.
> If resets are not specified just warn but don't fail probing to be compatible
> with all users.
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> Cc: Wim Van Sebroeck <wim@iguana.be>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-watchdog@vger.kernel.org
> ---
> drivers/watchdog/dw_wdt.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
> index 2acb51cf5504..e024722e8b3b 100644
> --- a/drivers/watchdog/dw_wdt.c
> +++ b/drivers/watchdog/dw_wdt.c
> @@ -31,6 +31,7 @@
> #include <linux/pm.h>
> #include <linux/platform_device.h>
> #include <linux/reboot.h>
> +#include <linux/reset.h>
> #include <linux/watchdog.h>
>
> #define WDOG_CONTROL_REG_OFFSET 0x00
> @@ -56,6 +57,7 @@ struct dw_wdt {
> struct clk *clk;
> struct notifier_block restart_handler;
> struct watchdog_device wdd;
> + struct reset_control *rst;
> };
>
> #define to_dw_wdt(wdd) container_of(wdd, struct dw_wdt, wdd)
> @@ -231,6 +233,10 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> + dw_wdt->rst = devm_reset_control_get(&pdev->dev, "dw-wdt");
> + if (IS_ERR(dw_wdt->rst))
> + dev_warn(dev, "No reset lines. Will not be able to stop once started.\n");
This situation is already handled by the driver. Actually, I don't even
know what will happen, since the watchdog core will continue to ping
the watchdog after close, and it won't be possible to unload the driver
if the watchdog is running.
I don't think a warning is warranted in this case. We did not need one before,
we should not need one now.
> +
> wdd = &dw_wdt->wdd;
> wdd->info = &dw_wdt_ident;
> wdd->ops = &dw_wdt_ops;
> @@ -268,6 +274,9 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
> if (ret)
> pr_warn("cannot register restart handler\n");
>
> + if (dw_wdt->rst)
> + reset_control_deassert(dw_wdt->rst);
> +
> return 0;
>
> out_disable_clk:
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web