From patchwork Tue Sep 23 15:04:56 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Fuchs X-Patchwork-Id: 1113 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 5BB18DE744 for ; Wed, 24 Sep 2008 01:06:24 +1000 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.183]) by ozlabs.org (Postfix) with ESMTP id AEBDEDDFCC for ; Wed, 24 Sep 2008 01:06:05 +1000 (EST) Received: from comm-neu.esd (a89-182-151-249.net-htp.de [89.182.151.249]) by mrelayeu.kundenserver.de (node=mrelayeu4) with ESMTP (Nemesis) id 0ML21M-1Ki9Sj21Rd-0007tH; Tue, 23 Sep 2008 17:06:02 +0200 Received: from localhost (localhost [127.0.0.1]) by comm-neu.esd (Postfix) with ESMTP id 12AC6108050; Tue, 23 Sep 2008 17:05:10 +0200 (CEST) Received: from comm-neu.esd ([127.0.0.1]) by localhost (comm [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 02473-02-6; Tue, 23 Sep 2008 17:05:01 +0200 (CEST) Received: from debby.esd (debby.esd [10.0.0.190]) by comm-neu.esd (Postfix) with ESMTP id 1102C10801C; Tue, 23 Sep 2008 17:05:01 +0200 (CEST) From: Matthias Fuchs To: Kumar Gala Subject: [PATCH V2] powerpc: Fix Book-E watchdog timer interval setting Date: Tue, 23 Sep 2008 17:04:56 +0200 User-Agent: KMail/1.9.5 References: <200808071448.06183.matthias.fuchs@esd-electronics.com> <200809192328.36159.matthias.fuchs@esd-electronics.com> <7CA29A12-6DC4-4939-9541-6270FE5D910A@kernel.crashing.org> In-Reply-To: <7CA29A12-6DC4-4939-9541-6270FE5D910A@kernel.crashing.org> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200809231704.56449.matthias.fuchs@esd-electronics.com> X-Virus-Scanned: by amavisd at esd-GmbH-Hannover X-Provags-ID: V01U2FsdGVkX1/7lqpLWw/vMlBPpFz1DfQNYk5dpwSj9T1Y9qq +GR91aa4g96AJkuEseEdMt99af3U0AckDpK58bFvh9ceIFDmoG Y+fALlSATKvSjyRC6Trig== Cc: linuxppc-dev@ozlabs.org X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org 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 currect mask. Signed-off-by: Matthias Fuchs --- 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 c3b78a7..41ba9b8 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c @@ -42,8 +42,10 @@ u32 booke_wdt_period = WDT_PERIOD_DEFAULT; #ifdef CONFIG_FSL_BOOKE #define WDTP(x) ((((63-x)&0x3)<<30)|(((63-x)&0x3c)<<15)) +#define WDTP_MASK (WDTP(63)) #else #define WDTP(x) (TCR_WP(x)) +#define WDTP_MASK (TCR_WP_MASK) #endif static DEFINE_SPINLOCK(booke_wdt_lock); @@ -65,6 +67,7 @@ static void __booke_wdt_enable(void *data) /* clear status before enabling watchdog */ __booke_wdt_ping(NULL); val = mfspr(SPRN_TCR); + val &= ~WDTP_MASK; val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); mtspr(SPRN_TCR, val); @@ -114,7 +117,7 @@ static long booke_wdt_ioctl(struct file *file, case WDIOC_SETTIMEOUT: if (get_user(booke_wdt_period, p)) return -EFAULT; - mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WDTP(0)) | + mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WDTP_MASK) | WDTP(booke_wdt_period)); return 0; case WDIOC_GETTIMEOUT: