diff options
author | Steffen Trumtrar <s.trumtrar@pengutronix.de> | 2017-05-22 10:51:39 +0200 |
---|---|---|
committer | Ziyuan Xu <xzy.xu@rock-chips.com> | 2019-03-12 16:21:14 +0800 |
commit | 328f02596a27fb38f46979afac04d00aaa16b8d9 (patch) | |
tree | 542a25e4859c546fcf2bef0ee8a3bc3819300b25 | |
parent | 3bec686dbb545ee0cc1ccf46b5564860fb6ce729 (diff) |
BACKPORT: watchdog: dw_wdt: get reset lines from dt
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. As these lines are
optional, use devm_reset_control_get_optional_shared. If the reset line
is not specified in the devicetree, the reset framework will just skip
deasserting and continue.
This way all users of the driver will continue to function without
any harm, even if the reset line is not specified in the devicetree.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: linux-watchdog@vger.kernel.org
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
(cherry picked from commit 65a3b6935d920a37820226864eb607467e49ba50)
Conflicts:
drivers/watchdog/dw_wdt.c
Change-Id: Iffbc95931869a5d595a348b6c08ee7da5a1e64e4
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
-rw-r--r-- | drivers/watchdog/dw_wdt.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c index cbe58aac5d8c..8c2021a79708 100644 --- a/drivers/watchdog/dw_wdt.c +++ b/drivers/watchdog/dw_wdt.c @@ -35,6 +35,7 @@ #include <linux/pm.h> #include <linux/platform_device.h> #include <linux/reboot.h> +#include <linux/reset.h> #include <linux/timer.h> #include <linux/uaccess.h> #include <linux/watchdog.h> @@ -69,6 +70,7 @@ static struct { struct timer_list timer; int expect_close; struct notifier_block restart_handler; + struct reset_control *rst; /* Save/restore */ u32 control; u32 timeout; @@ -367,6 +369,13 @@ static int dw_wdt_drv_probe(struct platform_device *pdev) goto out_disable_clk; } + dw_wdt.rst = devm_reset_control_get(&pdev->dev, "reset"); + if (IS_ERR(dw_wdt.rst)) + dev_warn(&pdev->dev, "Should better to setup a \'resets\' " + "property in dt, that must been named with reset\n"); + else + reset_control_deassert(dw_wdt.rst); + ret = misc_register(&dw_wdt_miscdev); if (ret) goto out_disable_clk; @@ -394,7 +403,8 @@ static int dw_wdt_drv_remove(struct platform_device *pdev) unregister_restart_handler(&dw_wdt.restart_handler); misc_deregister(&dw_wdt_miscdev); - + if (!IS_ERR(dw_wdt.rst)) + reset_control_assert(dw_wdt.rst); clk_disable_unprepare(dw_wdt.clk); return 0; |