Date: Sat, 7 Jul 2018 19:03:38 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336072 - head/sys/arm/freescale/imx Message-ID: <201807071903.w67J3c7w003700@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807071903.w67J3c7w003700>