Commit b5bb2cad authored by Wolfram Sang's avatar Wolfram Sang Committed by Greg Kroah-Hartman

watchdog: renesas_wdt: don't set divider while watchdog is running

[ Upstream commit e990e127 ]

The datasheet says we must stop the timer before changing the clock
divider. This can happen when the restart handler is called while the
watchdog is running.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarFabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent f06d48b0
...@@ -77,12 +77,17 @@ static int rwdt_init_timeout(struct watchdog_device *wdev) ...@@ -77,12 +77,17 @@ static int rwdt_init_timeout(struct watchdog_device *wdev)
static int rwdt_start(struct watchdog_device *wdev) static int rwdt_start(struct watchdog_device *wdev)
{ {
struct rwdt_priv *priv = watchdog_get_drvdata(wdev); struct rwdt_priv *priv = watchdog_get_drvdata(wdev);
u8 val;
pm_runtime_get_sync(wdev->parent); pm_runtime_get_sync(wdev->parent);
rwdt_write(priv, 0, RWTCSRB); /* Stop the timer before we modify any register */
rwdt_write(priv, priv->cks, RWTCSRA); val = readb_relaxed(priv->base + RWTCSRA) & ~RWTCSRA_TME;
rwdt_write(priv, val, RWTCSRA);
rwdt_init_timeout(wdev); rwdt_init_timeout(wdev);
rwdt_write(priv, priv->cks, RWTCSRA);
rwdt_write(priv, 0, RWTCSRB);
while (readb_relaxed(priv->base + RWTCSRA) & RWTCSRA_WRFLG) while (readb_relaxed(priv->base + RWTCSRA) & RWTCSRA_WRFLG)
cpu_relax(); cpu_relax();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment