diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-08-03 18:59:36 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-08-09 20:17:47 +0200 |
commit | 47caa7d3676dac07d9807834827127db179cff7d (patch) | |
tree | 1fb40ef2c8426c8def2c08608e95bfd80bf9a37c /drivers/watchdog | |
parent | 75c17bc9345d806b106925b4abe672b87d229948 (diff) | |
download | barebox-47caa7d3676dac07d9807834827127db179cff7d.tar.gz barebox-47caa7d3676dac07d9807834827127db179cff7d.tar.xz |
watchdog: imxwd: register explicit warm reset handler
With fsl,ext-reset-output and WDOG_B muxed correctly, the i.MX watchdog
will toggle an external signal to effect a PMIC reset.
That's good for normal use, but when exchanging information with the
BootROM over GPRs, a warm reset is required. This is needed e.g. to
set the reboot mode. Support this by defining a second, lower
priority, reset that will never toggle external lines.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210803165937.31608-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/imxwd.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c index 26c62b7bcb..a109f6fee7 100644 --- a/drivers/watchdog/imxwd.c +++ b/drivers/watchdog/imxwd.c @@ -39,6 +39,7 @@ struct imx_wd { struct device_d *dev; const struct imx_wd_ops *ops; struct restart_handler restart; + struct restart_handler restart_warm; bool ext_reset; bool bigendian; }; @@ -183,6 +184,14 @@ static void __noreturn imxwd_force_soc_reset(struct restart_handler *rst) hang(); } +static void __noreturn imxwd_force_soc_reset_internal(struct restart_handler *rst) +{ + struct imx_wd *priv = container_of(rst, struct imx_wd, restart_warm); + + priv->ext_reset = false; + imxwd_force_soc_reset(&priv->restart); +} + static void imx_watchdog_detect_reset_source(struct imx_wd *priv) { u16 val = imxwd_read(priv, IMX21_WDOG_WSTR); @@ -284,9 +293,16 @@ static int imx_wd_probe(struct device_d *dev) priv->restart.name = "imxwd"; priv->restart.restart = imxwd_force_soc_reset; + priv->restart.priority = RESTART_DEFAULT_PRIORITY; restart_handler_register(&priv->restart); + priv->restart_warm.name = "imxwd-warm"; + priv->restart_warm.restart = imxwd_force_soc_reset_internal; + priv->restart_warm.priority = RESTART_DEFAULT_PRIORITY - 10; + + restart_handler_register(&priv->restart_warm); + return 0; error_unregister: |