Skip to content

Commit

Permalink
watchdog: sch311x_wdt: Fix Polarity when starting watchdog
Browse files Browse the repository at this point in the history
Some motherboards like the Advantech ARK3400 documentation
use a non-inverted GPIO pin. We fix this by assuming that
the BIOS will set the Polarity bit for the GPIO correctly
at startup and we keep the Bit-setting intact when we start
and stop the watchdog.

Reported-by: Jean-François Deverge <jf.deverge@gmail.com>
Signed-off-by: Dave Mueller <d.mueller@elsoft.ch>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  • Loading branch information
Wim Van Sebroeck committed Jul 23, 2012
1 parent 41814ee commit 7732c6b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/watchdog/sch311x_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ static void sch311x_wdt_set_timeout(int t)

static void sch311x_wdt_start(void)
{
unsigned char t;

spin_lock(&sch311x_wdt_data.io_lock);

/* set watchdog's timeout */
Expand All @@ -149,18 +151,22 @@ static void sch311x_wdt_start(void)
* Bit 4-6 (Reserved)
* Bit 7, Output Type: 0 = Push Pull Bit, 1 = Open Drain
*/
outb(0x0e, sch311x_wdt_data.runtime_reg + GP60);
t = inb(sch311x_wdt_data.runtime_reg + GP60);
outb((t & ~0x0d) | 0x0c, sch311x_wdt_data.runtime_reg + GP60);

spin_unlock(&sch311x_wdt_data.io_lock);

}

static void sch311x_wdt_stop(void)
{
unsigned char t;

spin_lock(&sch311x_wdt_data.io_lock);

/* stop the watchdog */
outb(0x01, sch311x_wdt_data.runtime_reg + GP60);
t = inb(sch311x_wdt_data.runtime_reg + GP60);
outb((t & ~0x0d) | 0x01, sch311x_wdt_data.runtime_reg + GP60);
/* disable timeout by setting it to 0 */
sch311x_wdt_set_timeout(0);

Expand Down

0 comments on commit 7732c6b

Please sign in to comment.