svn commit: r291149 - head/sys/arm/freescale/imx

Ian Lepore ian at FreeBSD.org
Sat Nov 21 23:30:48 UTC 2015


Author: ian
Date: Sat Nov 21 23:30:47 2015
New Revision: 291149
URL: https://svnweb.freebsd.org/changeset/base/291149

Log:
  Update the imx5/imx6 cpu_reset() implementation based on a new understanding
  of the SRS (software reset) bit in the watchdog control register.  Despite
  what the manual seems to imply, this bit DOES trigger an immediate reset, as
  opposed to simply flagging the type of reset as software-triggered.

Modified:
  head/sys/arm/freescale/imx/imx_machdep.c

Modified: head/sys/arm/freescale/imx/imx_machdep.c
==============================================================================
--- head/sys/arm/freescale/imx/imx_machdep.c	Sat Nov 21 23:04:12 2015	(r291148)
+++ head/sys/arm/freescale/imx/imx_machdep.c	Sat Nov 21 23:30:47 2015	(r291149)
@@ -72,16 +72,14 @@ imx_wdog_cpu_reset(vm_offset_t wdcr_phys
 	volatile uint16_t * pcr;
 
 	/*
-	 * The deceptively simple write of WDOG_CR_WDE enables the watchdog,
-	 * sets the timeout to its minimum value (half a second), and also
-	 * clears the SRS bit which results in the SFTW (software-requested
-	 * reset) bit being set in the watchdog status register after the reset.
-	 * This is how software can distinguish a reset from a wdog timeout.
+	 * Trigger an immediate reset by clearing the SRS bit in the watchdog
+	 * control register.  The reset happens on the next cycle of the wdog
+	 * 32KHz clock, so hang out in a spin loop until the reset takes effect.
 	 */
 	if ((pcr = arm_devmap_ptov(wdcr_physaddr, sizeof(*pcr))) == NULL) {
 		printf("cpu_reset() can't find its control register... locking up now.");
 	} else {
-		*pcr = WDOG_CR_WDE;
+		*pcr &= ~WDOG_CR_SRS;
 	}
 	for (;;)
 		continue;


More information about the svn-src-head mailing list