Message ID | 20220206230028.476659-1-linus.walleij@linaro.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [v2] watchdog: ixp4xx: Implement restart | expand |
On Mon, Feb 07, 2022 at 12:00:28AM +0100, Linus Walleij wrote: > Implement watchdog restart in the IXP4xx watchdog timer. > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> > --- > ChangeLog v1->v2: > - Drop the msleep(1000) - it works fine without! > --- > drivers/watchdog/ixp4xx_wdt.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c > index 31b03fa71341..281a48d9889f 100644 > --- a/drivers/watchdog/ixp4xx_wdt.c > +++ b/drivers/watchdog/ixp4xx_wdt.c > @@ -84,10 +84,24 @@ static int ixp4xx_wdt_set_timeout(struct watchdog_device *wdd, > return 0; > } > > +static int ixp4xx_wdt_restart(struct watchdog_device *wdd, > + unsigned long action, void *data) > +{ > + struct ixp4xx_wdt *iwdt = to_ixp4xx_wdt(wdd); > + > + __raw_writel(IXP4XX_WDT_KEY, iwdt->base + IXP4XX_OSWK_OFFSET); > + __raw_writel(0, iwdt->base + IXP4XX_OSWT_OFFSET); > + __raw_writel(IXP4XX_WDT_COUNT_ENABLE | IXP4XX_WDT_RESET_ENABLE, > + iwdt->base + IXP4XX_OSWE_OFFSET); > + > + return 0; > +} > + > static const struct watchdog_ops ixp4xx_wdt_ops = { > .start = ixp4xx_wdt_start, > .stop = ixp4xx_wdt_stop, > .set_timeout = ixp4xx_wdt_set_timeout, > + .restart = ixp4xx_wdt_restart, > .owner = THIS_MODULE, > }; > > -- > 2.34.1 >
diff --git a/drivers/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c index 31b03fa71341..281a48d9889f 100644 --- a/drivers/watchdog/ixp4xx_wdt.c +++ b/drivers/watchdog/ixp4xx_wdt.c @@ -84,10 +84,24 @@ static int ixp4xx_wdt_set_timeout(struct watchdog_device *wdd, return 0; } +static int ixp4xx_wdt_restart(struct watchdog_device *wdd, + unsigned long action, void *data) +{ + struct ixp4xx_wdt *iwdt = to_ixp4xx_wdt(wdd); + + __raw_writel(IXP4XX_WDT_KEY, iwdt->base + IXP4XX_OSWK_OFFSET); + __raw_writel(0, iwdt->base + IXP4XX_OSWT_OFFSET); + __raw_writel(IXP4XX_WDT_COUNT_ENABLE | IXP4XX_WDT_RESET_ENABLE, + iwdt->base + IXP4XX_OSWE_OFFSET); + + return 0; +} + static const struct watchdog_ops ixp4xx_wdt_ops = { .start = ixp4xx_wdt_start, .stop = ixp4xx_wdt_stop, .set_timeout = ixp4xx_wdt_set_timeout, + .restart = ixp4xx_wdt_restart, .owner = THIS_MODULE, };
Implement watchdog restart in the IXP4xx watchdog timer. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- ChangeLog v1->v2: - Drop the msleep(1000) - it works fine without! --- drivers/watchdog/ixp4xx_wdt.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)