Commit 213a02af authored by Jon Hunter's avatar Jon Hunter Committed by Kevin Hilman

ARM: DaVinci: reboot via watchdog fix

Before configuring the watchdog timer, the watchdog timer is not
placed into a known state. In other words, if someone happened to use
this timer as a regular timer in an application, the timer is not reset
before it is configured. Hence, I think that we should make sure the
timer is placed into reset before we start to configure the timer.
Signed-off-by: default avatarJon Hunter <jon-hunter@ti.com>
Signed-off-by: default avatarKevin Hilman <khilman@mvista.com>
parent 035e40d7
No related merge requests found
......@@ -292,17 +292,26 @@ struct sys_timer davinci_timer = {
void davinci_watchdog_reset(void) {
volatile davinci_timer_regs_t *davinci_wdt = (davinci_timer_regs_t *)IO_ADDRESS(DAVINCI_WDOG_BASE);
davinci_wdt->tgcr = 0x8;
davinci_wdt->tgcr |= 0x3;
davinci_wdt->tim12 = 0;
volatile davinci_timer_regs_t *davinci_wdt =
(volatile davinci_timer_regs_t *)IO_ADDRESS(DAVINCI_WDOG_BASE);
davinci_wdt->tcr = 0x0; /* disable timer */
davinci_wdt->tgcr = 0x0; /* reset timer */
davinci_wdt->tgcr = 0x8; /* configure timer2 as 64-bit */
davinci_wdt->tgcr |= 0x3; /* release timer from reset */
davinci_wdt->tim12 = 0; /* clear counter and period regs */
davinci_wdt->tim34 = 0;
davinci_wdt->prd12 = 0;
davinci_wdt->prd34 = 0;
davinci_wdt->wdtcr |= 0x4000;
davinci_wdt->tcr |= 0x40;
davinci_wdt->wdtcr |= 0x4000; /* enable watchdog timer */
/* put watchdog in pre-active state */
davinci_wdt->wdtcr = 0xA5C64000;
davinci_wdt->wdtcr = 0xDA7E4000;
/* put watchdog in active state */
davinci_wdt->wdtcr = 0xDA7E4000;
/* write an invalid value to the WDKEY field to trigger
* a watchdog reset */
davinci_wdt->wdtcr = 0x00004000;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment