aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lepore <ian@FreeBSD.org>2015-11-21 23:30:47 +0000
committerIan Lepore <ian@FreeBSD.org>2015-11-21 23:30:47 +0000
commite0848bbb0ccf2573766fdc079e5c9a05f9e95606 (patch)
tree35635463f46e7ea605994628b6079ce87fff6ba1
parentf226507c0099931fd66cae551bf720e1066ae5d7 (diff)
downloadsrc-e0848bbb0ccf2573766fdc079e5c9a05f9e95606.tar.gz
src-e0848bbb0ccf2573766fdc079e5c9a05f9e95606.zip
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.
Notes
Notes: svn path=/head/; revision=291149
-rw-r--r--sys/arm/freescale/imx/imx_machdep.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/arm/freescale/imx/imx_machdep.c b/sys/arm/freescale/imx/imx_machdep.c
index 36186375b172..23626073e044 100644
--- a/sys/arm/freescale/imx/imx_machdep.c
+++ b/sys/arm/freescale/imx/imx_machdep.c
@@ -72,16 +72,14 @@ imx_wdog_cpu_reset(vm_offset_t wdcr_physaddr)
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;