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.
This commit is contained in:
Ian Lepore 2015-11-21 23:30:47 +00:00
parent f226507c00
commit e0848bbb0c

View file

@ -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;