From e0848bbb0ccf2573766fdc079e5c9a05f9e95606 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Sat, 21 Nov 2015 23:30:47 +0000 Subject: [PATCH] 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. --- sys/arm/freescale/imx/imx_machdep.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/arm/freescale/imx/imx_machdep.c b/sys/arm/freescale/imx/imx_machdep.c index 36186375b17..23626073e04 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;