watchdog: menz069_wdt: fix timeout setting

When setting the timeout for the menz069_wdt watchdog driver, we
erroneously read from the 'watchdog value register' (WVR) instead of the
'watchdog timer register' (WTR) and then write the value back into WTR.

This can potentially lead to wrong timeouts and wrong enable bit settings.

Signed-off-by: Johannes Thumshirn <jth@kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230418172531.177349-3-jth@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
This commit is contained in:
Johannes Thumshirn 2023-04-18 19:25:31 +02:00 committed by Wim Van Sebroeck
parent 87b22656ca
commit bd858e494c

View File

@ -77,7 +77,7 @@ static int men_z069_wdt_set_timeout(struct watchdog_device *wdt,
wdt->timeout = timeout; wdt->timeout = timeout;
val = timeout * MEN_Z069_TIMER_FREQ; val = timeout * MEN_Z069_TIMER_FREQ;
reg = readw(drv->base + MEN_Z069_WVR); reg = readw(drv->base + MEN_Z069_WTR);
ena = reg & MEN_Z069_WTR_WDEN; ena = reg & MEN_Z069_WTR_WDEN;
reg = ena | val; reg = ena | val;
writew(reg, drv->base + MEN_Z069_WTR); writew(reg, drv->base + MEN_Z069_WTR);