aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/pcwd.c
diff options
context:
space:
mode:
authorWim Van Sebroeck <wim@iguana.be>2006-02-12 10:37:36 -0500
committerWim Van Sebroeck <wim@iguana.be>2006-04-02 12:36:43 -0400
commit4206f0c4de9f9683676a8507ef56941535761579 (patch)
tree730291d3ee46e2bfe2751794f9133b1727d98e73 /drivers/char/watchdog/pcwd.c
parent683aa4012f53b2ada0f430487e05d37b0d94e90a (diff)
[WATCHDOG] pcwd.c control status patch
Clean-up the control status code (insert tabs where relevant), Add new Control Status defines, Make sure that the R2DS bit stays the same. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/char/watchdog/pcwd.c')
-rw-r--r--drivers/char/watchdog/pcwd.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c
index 8d6b249ad66b..c6e27e2f0390 100644
--- a/drivers/char/watchdog/pcwd.c
+++ b/drivers/char/watchdog/pcwd.c
@@ -73,8 +73,8 @@
73#include <asm/io.h> /* For inb/outb/... */ 73#include <asm/io.h> /* For inb/outb/... */
74 74
75/* Module and version information */ 75/* Module and version information */
76#define WATCHDOG_VERSION "1.16" 76#define WATCHDOG_VERSION "1.17"
77#define WATCHDOG_DATE "03 Jan 2006" 77#define WATCHDOG_DATE "12 Feb 2006"
78#define WATCHDOG_DRIVER_NAME "ISA-PC Watchdog" 78#define WATCHDOG_DRIVER_NAME "ISA-PC Watchdog"
79#define WATCHDOG_NAME "pcwd" 79#define WATCHDOG_NAME "pcwd"
80#define PFX WATCHDOG_NAME ": " 80#define PFX WATCHDOG_NAME ": "
@@ -96,15 +96,19 @@
96 * PCI-PC Watchdog card. 96 * PCI-PC Watchdog card.
97*/ 97*/
98/* Port 1 : Control Status #1 for the PC Watchdog card, revision A. */ 98/* Port 1 : Control Status #1 for the PC Watchdog card, revision A. */
99#define WD_WDRST 0x01 /* Previously reset state */ 99#define WD_WDRST 0x01 /* Previously reset state */
100#define WD_T110 0x02 /* Temperature overheat sense */ 100#define WD_T110 0x02 /* Temperature overheat sense */
101#define WD_HRTBT 0x04 /* Heartbeat sense */ 101#define WD_HRTBT 0x04 /* Heartbeat sense */
102#define WD_RLY2 0x08 /* External relay triggered */ 102#define WD_RLY2 0x08 /* External relay triggered */
103#define WD_SRLY2 0x80 /* Software external relay triggered */ 103#define WD_SRLY2 0x80 /* Software external relay triggered */
104/* Port 1 : Control Status #1 for the PC Watchdog card, revision C. */ 104/* Port 1 : Control Status #1 for the PC Watchdog card, revision C. */
105#define WD_REVC_WTRP 0x01 /* Watchdog Trip status */ 105#define WD_REVC_WTRP 0x01 /* Watchdog Trip status */
106#define WD_REVC_HRBT 0x02 /* Watchdog Heartbeat */ 106#define WD_REVC_HRBT 0x02 /* Watchdog Heartbeat */
107#define WD_REVC_TTRP 0x04 /* Temperature Trip status */ 107#define WD_REVC_TTRP 0x04 /* Temperature Trip status */
108#define WD_REVC_RL2A 0x08 /* Relay 2 activated by on-board processor */
109#define WD_REVC_RL1A 0x10 /* Relay 1 active */
110#define WD_REVC_R2DS 0x40 /* Relay 2 disable */
111#define WD_REVC_RLY2 0x80 /* Relay 2 activated? */
108/* Port 2 : Control Status #2 */ 112/* Port 2 : Control Status #2 */
109#define WD_WDIS 0x10 /* Watchdog Disabled */ 113#define WD_WDIS 0x10 /* Watchdog Disabled */
110#define WD_ENTP 0x20 /* Watchdog Enable Temperature Trip */ 114#define WD_ENTP 0x20 /* Watchdog Enable Temperature Trip */
@@ -407,7 +411,7 @@ static int pcwd_set_heartbeat(int t)
407 411
408static int pcwd_get_status(int *status) 412static int pcwd_get_status(int *status)
409{ 413{
410 int card_status; 414 int control_status;
411 415
412 *status=0; 416 *status=0;
413 spin_lock(&pcwd_private.io_lock); 417 spin_lock(&pcwd_private.io_lock);
@@ -415,22 +419,22 @@ static int pcwd_get_status(int *status)
415 /* Rev A cards return status information from 419 /* Rev A cards return status information from
416 * the base register, which is used for the 420 * the base register, which is used for the
417 * temperature in other cards. */ 421 * temperature in other cards. */
418 card_status = inb(pcwd_private.io_addr); 422 control_status = inb(pcwd_private.io_addr);
419 else { 423 else {
420 /* Rev C cards return card status in the base 424 /* Rev C cards return card status in the base
421 * address + 1 register. And use different bits 425 * address + 1 register. And use different bits
422 * to indicate a card initiated reset, and an 426 * to indicate a card initiated reset, and an
423 * over-temperature condition. And the reboot 427 * over-temperature condition. And the reboot
424 * status can be reset. */ 428 * status can be reset. */
425 card_status = inb(pcwd_private.io_addr + 1); 429 control_status = inb(pcwd_private.io_addr + 1);
426 } 430 }
427 spin_unlock(&pcwd_private.io_lock); 431 spin_unlock(&pcwd_private.io_lock);
428 432
429 if (pcwd_private.revision == PCWD_REVISION_A) { 433 if (pcwd_private.revision == PCWD_REVISION_A) {
430 if (card_status & WD_WDRST) 434 if (control_status & WD_WDRST)
431 *status |= WDIOF_CARDRESET; 435 *status |= WDIOF_CARDRESET;
432 436
433 if (card_status & WD_T110) { 437 if (control_status & WD_T110) {
434 *status |= WDIOF_OVERHEAT; 438 *status |= WDIOF_OVERHEAT;
435 if (temp_panic) { 439 if (temp_panic) {
436 printk (KERN_INFO PFX "Temperature overheat trip!\n"); 440 printk (KERN_INFO PFX "Temperature overheat trip!\n");
@@ -438,10 +442,10 @@ static int pcwd_get_status(int *status)
438 } 442 }
439 } 443 }
440 } else { 444 } else {
441 if (card_status & WD_REVC_WTRP) 445 if (control_status & WD_REVC_WTRP)
442 *status |= WDIOF_CARDRESET; 446 *status |= WDIOF_CARDRESET;
443 447
444 if (card_status & WD_REVC_TTRP) { 448 if (control_status & WD_REVC_TTRP) {
445 *status |= WDIOF_OVERHEAT; 449 *status |= WDIOF_OVERHEAT;
446 if (temp_panic) { 450 if (temp_panic) {
447 printk (KERN_INFO PFX "Temperature overheat trip!\n"); 451 printk (KERN_INFO PFX "Temperature overheat trip!\n");
@@ -455,9 +459,16 @@ static int pcwd_get_status(int *status)
455 459
456static int pcwd_clear_status(void) 460static int pcwd_clear_status(void)
457{ 461{
462 int control_status;
463
458 if (pcwd_private.revision == PCWD_REVISION_C) { 464 if (pcwd_private.revision == PCWD_REVISION_C) {
459 spin_lock(&pcwd_private.io_lock); 465 spin_lock(&pcwd_private.io_lock);
460 outb_p(0x00, pcwd_private.io_addr + 1); /* clear reset status */ 466
467 control_status = inb_p(pcwd_private.io_addr + 1);
468
469 /* clear reset status & Keep Relay 2 disable state as it is */
470 outb_p((control_status & WD_REVC_R2DS), pcwd_private.io_addr + 1);
471
461 spin_unlock(&pcwd_private.io_lock); 472 spin_unlock(&pcwd_private.io_lock);
462 } 473 }
463 return 0; 474 return 0;