mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
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 65a3b6935d)
Conflicts:
drivers/watchdog/dw_wdt.c
Change-Id: Iffbc95931869a5d595a348b6c08ee7da5a1e64e4
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
This commit is contained in:
committed by
Ziyuan Xu
parent
3bec686dbb
commit
328f02596a
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user