diff options
author | Matthias Fuchs <matthias.fuchs@esd-electronics.com> | 2008-11-05 15:53:56 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2008-11-08 13:38:59 -0500 |
commit | 0a0e9e0cb90170f95b4351597fd5c0e65fab6bc5 (patch) | |
tree | 740f43631b98680b9cdac96b0ac55c9193188a38 | |
parent | b41d6fee37e2bebd58ad3623c288197e75787905 (diff) |
powerpc: Fix Book-E watchdog timer interval setting
This patch fixes the setting of the Book-E watchdog timer interval setup
on initialization and by ioctl().
On initialization the period bits have to be masked before setting
a new period.
In WDIOC_SETTIMEOUT ioctl we have to use the correct mask.
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r-- | drivers/watchdog/booke_wdt.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c index c3b78a76f173..225398fd5049 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c | |||
@@ -42,8 +42,10 @@ u32 booke_wdt_period = WDT_PERIOD_DEFAULT; | |||
42 | 42 | ||
43 | #ifdef CONFIG_FSL_BOOKE | 43 | #ifdef CONFIG_FSL_BOOKE |
44 | #define WDTP(x) ((((63-x)&0x3)<<30)|(((63-x)&0x3c)<<15)) | 44 | #define WDTP(x) ((((63-x)&0x3)<<30)|(((63-x)&0x3c)<<15)) |
45 | #define WDTP_MASK (WDTP(0)) | ||
45 | #else | 46 | #else |
46 | #define WDTP(x) (TCR_WP(x)) | 47 | #define WDTP(x) (TCR_WP(x)) |
48 | #define WDTP_MASK (TCR_WP_MASK) | ||
47 | #endif | 49 | #endif |
48 | 50 | ||
49 | static DEFINE_SPINLOCK(booke_wdt_lock); | 51 | static DEFINE_SPINLOCK(booke_wdt_lock); |
@@ -65,6 +67,7 @@ static void __booke_wdt_enable(void *data) | |||
65 | /* clear status before enabling watchdog */ | 67 | /* clear status before enabling watchdog */ |
66 | __booke_wdt_ping(NULL); | 68 | __booke_wdt_ping(NULL); |
67 | val = mfspr(SPRN_TCR); | 69 | val = mfspr(SPRN_TCR); |
70 | val &= ~WDTP_MASK; | ||
68 | val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); | 71 | val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); |
69 | 72 | ||
70 | mtspr(SPRN_TCR, val); | 73 | mtspr(SPRN_TCR, val); |
@@ -114,7 +117,7 @@ static long booke_wdt_ioctl(struct file *file, | |||
114 | case WDIOC_SETTIMEOUT: | 117 | case WDIOC_SETTIMEOUT: |
115 | if (get_user(booke_wdt_period, p)) | 118 | if (get_user(booke_wdt_period, p)) |
116 | return -EFAULT; | 119 | return -EFAULT; |
117 | mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WDTP(0)) | | 120 | mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WDTP_MASK) | |
118 | WDTP(booke_wdt_period)); | 121 | WDTP(booke_wdt_period)); |
119 | return 0; | 122 | return 0; |
120 | case WDIOC_GETTIMEOUT: | 123 | case WDIOC_GETTIMEOUT: |