Skip to content

Commit

Permalink
davinci: Fix watchdog reset code
Browse files Browse the repository at this point in the history
The davinci reset routine, davinci_watchdog_reset(), sets the
TCR register instead of the TGCR register as it should to put
the WDT into its "Initial State".

It also writes the WDTCR register without the proper WDKEY
which is pointless since the register will be write-protected.

Signed-off-by: David Griego <dgriego@mvista.com>
Signed-off-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
  • Loading branch information
David Griego authored and Kevin Hilman committed Aug 26, 2009
1 parent 75d0fa7 commit a23f7dc
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions arch/arm/mach-davinci/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,24 +420,20 @@ void davinci_watchdog_reset(void)

/* reset timer, set mode to 64-bit watchdog, and unreset */
tgcr = 0;
__raw_writel(tgcr, base + TCR);
__raw_writel(tgcr, base + TGCR);
tgcr = TGCR_TIMMODE_64BIT_WDOG << TGCR_TIMMODE_SHIFT;
tgcr |= (TGCR_UNRESET << TGCR_TIM12RS_SHIFT) |
(TGCR_UNRESET << TGCR_TIM34RS_SHIFT);
__raw_writel(tgcr, base + TCR);
__raw_writel(tgcr, base + TGCR);

/* clear counter and period regs */
__raw_writel(0, base + TIM12);
__raw_writel(0, base + TIM34);
__raw_writel(0, base + PRD12);
__raw_writel(0, base + PRD34);

/* enable */
wdtcr = __raw_readl(base + WDTCR);
wdtcr |= WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT;
__raw_writel(wdtcr, base + WDTCR);

/* put watchdog in pre-active state */
wdtcr = __raw_readl(base + WDTCR);
wdtcr = (WDTCR_WDKEY_SEQ0 << WDTCR_WDKEY_SHIFT) |
(WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT);
__raw_writel(wdtcr, base + WDTCR);
Expand Down

0 comments on commit a23f7dc

Please sign in to comment.