From: Bernhard Beschow <[email protected]> In locked state, the WDE and WDT bits of the WCR register are one and need to be preserved when written. At the moment, the logic is reversed such that all but the locked bits are preserved in locked state. Fix that.
Cc: [email protected] Fixes: daca13d495a1 ("hw/watchdog: Implement full i.MX watchdog support") Reported-by: Bin Meng <[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]> --- hw/watchdog/wdt_imx2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/watchdog/wdt_imx2.c b/hw/watchdog/wdt_imx2.c index 3283990bbf88..d897ff6e52b0 100644 --- a/hw/watchdog/wdt_imx2.c +++ b/hw/watchdog/wdt_imx2.c @@ -161,13 +161,13 @@ static void imx2_wdt_write(void *opaque, hwaddr addr, s->wcr_locked = true; if (s->wcr_wde_locked) { value &= ~IMX2_WDT_WCR_WDE; - value |= (s->wcr & ~IMX2_WDT_WCR_WDE); + value |= (s->wcr & IMX2_WDT_WCR_WDE); } else if (value & IMX2_WDT_WCR_WDE) { s->wcr_wde_locked = true; } if (s->wcr_wdt_locked) { value &= ~IMX2_WDT_WCR_WDT; - value |= (s->wcr & ~IMX2_WDT_WCR_WDT); + value |= (s->wcr & IMX2_WDT_WCR_WDT); } else if (value & IMX2_WDT_WCR_WDT) { s->wcr_wdt_locked = true; } -- 2.55.0
