diff options
author | Sergei Antonov | 2023-07-30 20:14:16 +0300 |
---|---|---|
committer | Stefan Roese | 2023-08-10 08:39:16 +0200 |
commit | 160984ed3a91a4225b27ffe8bfc3b1b4dc08a4ea (patch) | |
tree | f5d055ffd1edc565ad2b7dab7a1920e592ebb839 /drivers | |
parent | 8ba4eae01da11e73e7ee9f7047979f4d2ebfe5fc (diff) |
watchdog: ftwdt010: need to reset watchdog in ftwdt010_wdt_start()
ftwdt010_wdt_start() has to call ftwdt010_wdt_reset() after setting-up
the timeout in the same fashion ftwdt010_wdt_expire_now() does it.
Without this patch the "wdt start <ms>" command does not actually start
the watchdog timer until the "wdt reset" command is executed.
Signed-off-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/watchdog/ftwdt010_wdt.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/drivers/watchdog/ftwdt010_wdt.c b/drivers/watchdog/ftwdt010_wdt.c index a6b33b17209..1f5f301b125 100644 --- a/drivers/watchdog/ftwdt010_wdt.c +++ b/drivers/watchdog/ftwdt010_wdt.c @@ -25,8 +25,27 @@ struct ftwdt010_wdt_priv { struct ftwdt010_wdt __iomem *regs; }; +static int ftwdt010_wdt_reset(struct udevice *dev) +{ + struct ftwdt010_wdt_priv *priv = dev_get_priv(dev); + struct ftwdt010_wdt *wd = priv->regs; + + debug("Reset WDT..\n"); + + /* clear control register */ + writel(0, &wd->wdcr); + + /* Write Magic number */ + writel(FTWDT010_WDRESTART_MAGIC, &wd->wdrestart); + + /* Enable WDT */ + writel(FTWDT010_WDCR_RST | FTWDT010_WDCR_ENABLE, &wd->wdcr); + + return 0; +} + /* - * Set the watchdog time interval. + * Set the watchdog time interval and start the timer. * Counter is 32 bit. */ static int ftwdt010_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) @@ -52,24 +71,7 @@ static int ftwdt010_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) writel(reg, &wd->wdload); - return 0; -} - -static int ftwdt010_wdt_reset(struct udevice *dev) -{ - struct ftwdt010_wdt_priv *priv = dev_get_priv(dev); - struct ftwdt010_wdt *wd = priv->regs; - - /* clear control register */ - writel(0, &wd->wdcr); - - /* Write Magic number */ - writel(FTWDT010_WDRESTART_MAGIC, &wd->wdrestart); - - /* Enable WDT */ - writel((FTWDT010_WDCR_RST | FTWDT010_WDCR_ENABLE), &wd->wdcr); - - return 0; + return ftwdt010_wdt_reset(dev); } static int ftwdt010_wdt_stop(struct udevice *dev) |