svn commit: r336072 - head/sys/arm/freescale/imx
Ian Lepore
ian at FreeBSD.org
Sat Jul 7 19:03:39 UTC 2018
Author: ian
Date: Sat Jul 7 19:03:38 2018
New Revision: 336072
URL: https://svnweb.freebsd.org/changeset/base/336072
Log:
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.
Modified:
head/sys/arm/freescale/imx/imx_wdog.c
Modified: head/sys/arm/freescale/imx/imx_wdog.c
==============================================================================
--- head/sys/arm/freescale/imx/imx_wdog.c Sat Jul 7 17:58:20 2018 (r336071)
+++ head/sys/arm/freescale/imx/imx_wdog.c Sat Jul 7 19:03:38 2018 (r336072)
@@ -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 */
More information about the svn-src-head
mailing list