summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorWim Van Sebroeck <wim@iguana.be>2017-09-09 11:41:24 -0400
committerWim Van Sebroeck <wim@iguana.be>2017-09-09 11:41:24 -0400
commitfc61e83a29308601e6e8a0759e24fc8fe2122692 (patch)
tree1c850a3c2cb972b42fef44008030f211ffa3d7ce /drivers/watchdog
parent0e271fd59fe9e6d8c932309e7a42a4519c5aac6f (diff)
watchdog: Revert "iTCO_wdt: all versions count down twice"
This reverts commit 1fccb73011ea8a5fa0c6d357c33fa29c695139ea. Reported as Bug 196509 - iTCO_wdt regression reboot before timeout expire Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/iTCO_wdt.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index c4f65873bfa4..347f0389b089 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -306,15 +306,16 @@ static int iTCO_wdt_ping(struct watchdog_device *wd_dev)
306 306
307 iTCO_vendor_pre_keepalive(p->smi_res, wd_dev->timeout); 307 iTCO_vendor_pre_keepalive(p->smi_res, wd_dev->timeout);
308 308
309 /* Reset the timeout status bit so that the timer
310 * needs to count down twice again before rebooting */
311 outw(0x0008, TCO1_STS(p)); /* write 1 to clear bit */
312
313 /* Reload the timer by writing to the TCO Timer Counter register */ 309 /* Reload the timer by writing to the TCO Timer Counter register */
314 if (p->iTCO_version >= 2) 310 if (p->iTCO_version >= 2) {
315 outw(0x01, TCO_RLD(p)); 311 outw(0x01, TCO_RLD(p));
316 else if (p->iTCO_version == 1) 312 } else if (p->iTCO_version == 1) {
313 /* Reset the timeout status bit so that the timer
314 * needs to count down twice again before rebooting */
315 outw(0x0008, TCO1_STS(p)); /* write 1 to clear bit */
316
317 outb(0x01, TCO_RLD(p)); 317 outb(0x01, TCO_RLD(p));
318 }
318 319
319 spin_unlock(&p->io_lock); 320 spin_unlock(&p->io_lock);
320 return 0; 321 return 0;
@@ -327,8 +328,11 @@ static int iTCO_wdt_set_timeout(struct watchdog_device *wd_dev, unsigned int t)
327 unsigned char val8; 328 unsigned char val8;
328 unsigned int tmrval; 329 unsigned int tmrval;
329 330
330 /* The timer counts down twice before rebooting */ 331 tmrval = seconds_to_ticks(p, t);
331 tmrval = seconds_to_ticks(p, t) / 2; 332
333 /* For TCO v1 the timer counts down twice before rebooting */
334 if (p->iTCO_version == 1)
335 tmrval /= 2;
332 336
333 /* from the specs: */ 337 /* from the specs: */
334 /* "Values of 0h-3h are ignored and should not be attempted" */ 338 /* "Values of 0h-3h are ignored and should not be attempted" */
@@ -381,8 +385,6 @@ static unsigned int iTCO_wdt_get_timeleft(struct watchdog_device *wd_dev)
381 spin_lock(&p->io_lock); 385 spin_lock(&p->io_lock);
382 val16 = inw(TCO_RLD(p)); 386 val16 = inw(TCO_RLD(p));
383 val16 &= 0x3ff; 387 val16 &= 0x3ff;
384 if (!(inw(TCO1_STS(p)) & 0x0008))
385 val16 += (inw(TCOv2_TMR(p)) & 0x3ff);
386 spin_unlock(&p->io_lock); 388 spin_unlock(&p->io_lock);
387 389
388 time_left = ticks_to_seconds(p, val16); 390 time_left = ticks_to_seconds(p, val16);