Skip to content

Commit

Permalink
[POWERPC] ppc: Fix booke watchdog initialization
Browse files Browse the repository at this point in the history
Fix two problems in the book-e watchdog driver.

a) The 4xx default period was defined wrong
b) Clear status before enabling the watchdog exception

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Stefan Roese authored and Paul Mackerras committed Feb 8, 2007
1 parent 2366fb1 commit f31909c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions drivers/char/watchdog/booke_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#ifdef CONFIG_FSL_BOOKE
#define WDT_PERIOD_DEFAULT 63 /* Ex. wdt_period=28 bus=333Mhz , reset=~40sec */
#else
#define WDT_PERIOD_DEFAULT 4 /* Refer to the PPC40x and PPC4xx manuals */
#define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */
#endif /* for timing information */

u32 booke_wdt_enabled = 0;
Expand All @@ -47,27 +47,29 @@ u32 booke_wdt_period = WDT_PERIOD_DEFAULT;
#define WDTP(x) (TCR_WP(x))
#endif

/*
* booke_wdt_ping:
*/
static __inline__ void booke_wdt_ping(void)
{
mtspr(SPRN_TSR, TSR_ENW|TSR_WIS);
}

/*
* booke_wdt_enable:
*/
static __inline__ void booke_wdt_enable(void)
{
u32 val;

/* clear status before enabling watchdog */
booke_wdt_ping();
val = mfspr(SPRN_TCR);
val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period));

mtspr(SPRN_TCR, val);
}

/*
* booke_wdt_ping:
*/
static __inline__ void booke_wdt_ping(void)
{
mtspr(SPRN_TSR, TSR_ENW|TSR_WIS);
}

/*
* booke_wdt_write:
*/
Expand Down

0 comments on commit f31909c

Please sign in to comment.