Correctly calculate the value to put in the imx wdog countdown register.

The correct value is seconds*2-1.  The code was using just seconds*2, which
led to being off by a half-second -- usually not a big deal, except when the
value was the max (128) it overflowed so zero would get written to the
countdown register, which equates to a timeout of a half second.
This commit is contained in:
ian 2018-07-07 19:03:38 +00:00
parent 7b30851ab8
commit 8a40e6d3ae

View File

@ -118,8 +118,7 @@ imx_watchdog(void *arg, u_int cmd, int *error)
sc->sc_timeout = timeout;
reg = RD2(sc, WDOG_CR_REG);
reg &= ~WDOG_CR_WT_MASK;
reg |= (timeout << (WDOG_CR_WT_SHIFT + 1)) &
WDOG_CR_WT_MASK;
reg |= ((2 * timeout - 1) << WDOG_CR_WT_SHIFT);
WR2(sc, WDOG_CR_REG, reg | WDOG_CR_WDE);
}
/* Refresh counter */