public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@misterjones.org>
To: <wim@iguana.be>, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] watchdog/max63xx: be careful when disabling the watchdog
Date: Thu, 15 Apr 2010 16:09:35 +0200	[thread overview]
Message-ID: <b618a3827c2a4d627640f260cca3c71a@localhost> (raw)

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

Wim,

The attached patch fixes a nasty error with the max63xx driver,
potentially leaving the platform dead (and watchdog disabled...).

Cheers,

        M.
-- 
Who you jivin' with that Cosmik Debris?

[-- Attachment #2: watchdog-max63xx-be-careful-when-disabling-the-watch.patch --]
[-- Type: text/plain, Size: 1150 bytes --]

From 4212d84a08845a6adf3f67367a24d9dbf076f9d6 Mon Sep 17 00:00:00 2001
From: Marc Zyngier <maz@misterjones.org>
Date: Fri, 9 Apr 2010 17:43:33 +0100
Subject: [PATCH] watchdog/max63xx: be careful when disabling the watchdog

When shutting down the watchdog timer, special care must be taken
not to overwrite other bits in the register, as it may be shared
with other peripherals.

For example, on the Arcom Vulcan, the register is shared between
the watchdog and the PCI reset line...

Signed-off-by: Marc Zyngier <maz@misterjones.org>
---
 drivers/watchdog/max63xx_wdt.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/watchdog/max63xx_wdt.c b/drivers/watchdog/max63xx_wdt.c
index 75f3a83..3053ff0 100644
--- a/drivers/watchdog/max63xx_wdt.c
+++ b/drivers/watchdog/max63xx_wdt.c
@@ -154,9 +154,14 @@ static void max63xx_wdt_enable(struct max63xx_timeout *entry)
 
 static void max63xx_wdt_disable(void)
 {
+	u8 val;
+
 	spin_lock(&io_lock);
 
-	__raw_writeb(3, wdt_base);
+	val = __raw_readb(wdt_base);
+	val &= ~MAX6369_WDSET;
+	val |= 3;
+	__raw_writeb(val, wdt_base);
 
 	spin_unlock(&io_lock);
 
-- 
1.7.0


             reply	other threads:[~2010-04-15 14:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15 14:09 Marc Zyngier [this message]
2010-04-15 18:25 ` [PATCH] watchdog/max63xx: be careful when disabling the watchdog Wim Van Sebroeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b618a3827c2a4d627640f260cca3c71a@localhost \
    --to=maz@misterjones.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox