Commit 7732c6b9 authored by Wim Van Sebroeck's avatar Wim Van Sebroeck

watchdog: sch311x_wdt: Fix Polarity when starting watchdog

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: default avatarJean-François Deverge <jf.deverge@gmail.com>
Signed-off-by: default avatarDave Mueller <d.mueller@elsoft.ch>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 41814eed
...@@ -136,6 +136,8 @@ static void sch311x_wdt_set_timeout(int t) ...@@ -136,6 +136,8 @@ static void sch311x_wdt_set_timeout(int t)
static void sch311x_wdt_start(void) static void sch311x_wdt_start(void)
{ {
unsigned char t;
spin_lock(&sch311x_wdt_data.io_lock); spin_lock(&sch311x_wdt_data.io_lock);
/* set watchdog's timeout */ /* set watchdog's timeout */
...@@ -149,7 +151,8 @@ static void sch311x_wdt_start(void) ...@@ -149,7 +151,8 @@ static void sch311x_wdt_start(void)
* Bit 4-6 (Reserved) * Bit 4-6 (Reserved)
* Bit 7, Output Type: 0 = Push Pull Bit, 1 = Open Drain * 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); spin_unlock(&sch311x_wdt_data.io_lock);
...@@ -157,10 +160,13 @@ static void sch311x_wdt_start(void) ...@@ -157,10 +160,13 @@ static void sch311x_wdt_start(void)
static void sch311x_wdt_stop(void) static void sch311x_wdt_stop(void)
{ {
unsigned char t;
spin_lock(&sch311x_wdt_data.io_lock); spin_lock(&sch311x_wdt_data.io_lock);
/* stop the watchdog */ /* 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 */ /* disable timeout by setting it to 0 */
sch311x_wdt_set_timeout(0); sch311x_wdt_set_timeout(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment