From: Bernhard Beschow <[email protected]> The WDT bit gets reset and becomes writeable after power on reset which imx2_wdt_reset() represents. While the WDT bit in the WCR register already gets reset, its locked attribute wasn't. Fix this inconsistency by adding the missing unlock of its locked attribute.
Cc: [email protected] Fixes: daca13d495a1 ("hw/watchdog: Implement full i.MX watchdog support") Reported-by: Peter Maydell <[email protected]> Reviewed-by: Bin Meng <[email protected]> Reviewed-by: Peter Maydell <[email protected]> Signed-off-by: Bernhard Beschow <[email protected]> Message-ID: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- include/hw/watchdog/wdt_imx2.h | 2 +- hw/watchdog/wdt_imx2.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/hw/watchdog/wdt_imx2.h b/include/hw/watchdog/wdt_imx2.h index ad36b8820d84..fc01fc46e736 100644 --- a/include/hw/watchdog/wdt_imx2.h +++ b/include/hw/watchdog/wdt_imx2.h @@ -85,7 +85,7 @@ struct IMX2WdtState { bool wcr_locked; /* affects WDZST, WDBG, and WDW */ bool wcr_wde_locked; /* affects WDE */ - bool wcr_wdt_locked; /* affects WDT (never cleared) */ + bool wcr_wdt_locked; /* affects WDT, cleared on POR */ }; #endif /* WDT_IMX2_H */ diff --git a/hw/watchdog/wdt_imx2.c b/hw/watchdog/wdt_imx2.c index d897ff6e52b0..a15f452d4890 100644 --- a/hw/watchdog/wdt_imx2.c +++ b/hw/watchdog/wdt_imx2.c @@ -60,6 +60,7 @@ static void imx2_wdt_reset(DeviceState *dev) s->wicr_locked = false; s->wcr_locked = false; s->wcr_wde_locked = false; + s->wcr_wdt_locked = false; s->wcr = IMX2_WDT_WCR_WDA | IMX2_WDT_WCR_SRS; s->wsr = 0; -- 2.55.0
