Commit 9cfce47b authored by John Crispin's avatar John Crispin Committed by Wim Van Sebroeck

watchdog: lantiq: fix watchdogs timeout handling

The enable function was using the global timeout variable for local operations.
This resulted in the value of the global variable being corrupted, thus
breaking the code.
Signed-off-by: default avatarJohn Crispin <blogic@openwrt.org>
Signed-off-by: default avatarThomas Langer <thomas.langer@lantiq.com>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org
Cc: linux-mips@linux-mips.org
parent dbc018ec
...@@ -51,16 +51,16 @@ static int ltq_wdt_ok_to_close; ...@@ -51,16 +51,16 @@ static int ltq_wdt_ok_to_close;
static void static void
ltq_wdt_enable(void) ltq_wdt_enable(void)
{ {
ltq_wdt_timeout = ltq_wdt_timeout * unsigned long int timeout = ltq_wdt_timeout *
(ltq_io_region_clk_rate / LTQ_WDT_DIVIDER) + 0x1000; (ltq_io_region_clk_rate / LTQ_WDT_DIVIDER) + 0x1000;
if (ltq_wdt_timeout > LTQ_MAX_TIMEOUT) if (timeout > LTQ_MAX_TIMEOUT)
ltq_wdt_timeout = LTQ_MAX_TIMEOUT; timeout = LTQ_MAX_TIMEOUT;
/* write the first password magic */ /* write the first password magic */
ltq_w32(LTQ_WDT_PW1, ltq_wdt_membase + LTQ_WDT_CR); ltq_w32(LTQ_WDT_PW1, ltq_wdt_membase + LTQ_WDT_CR);
/* write the second magic plus the configuration and new timeout */ /* write the second magic plus the configuration and new timeout */
ltq_w32(LTQ_WDT_SR_EN | LTQ_WDT_SR_PWD | LTQ_WDT_SR_CLKDIV | ltq_w32(LTQ_WDT_SR_EN | LTQ_WDT_SR_PWD | LTQ_WDT_SR_CLKDIV |
LTQ_WDT_PW2 | ltq_wdt_timeout, ltq_wdt_membase + LTQ_WDT_CR); LTQ_WDT_PW2 | timeout, ltq_wdt_membase + LTQ_WDT_CR);
} }
static void static void
......
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