~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/watchdog/it87_wdt.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 *                  http://www.ite.com.tw/
13
13
 *
14
14
 *      Support of the watchdog timers, which are available on
15
 
 *      IT8702, IT8712, IT8716, IT8718, IT8720 and IT8726.
 
15
 *      IT8702, IT8712, IT8716, IT8718, IT8720, IT8721 and IT8726.
16
16
 *
17
17
 *      This program is free software; you can redistribute it and/or
18
18
 *      modify it under the terms of the GNU General Public License
45
45
 
46
46
#include <asm/system.h>
47
47
 
48
 
#define WATCHDOG_VERSION        "1.13"
 
48
#define WATCHDOG_VERSION        "1.14"
49
49
#define WATCHDOG_NAME           "IT87 WDT"
50
50
#define PFX                     WATCHDOG_NAME ": "
51
51
#define DRIVER_VERSION          WATCHDOG_NAME " driver, v" WATCHDOG_VERSION "\n"
54
54
/* Defaults for Module Parameter */
55
55
#define DEFAULT_NOGAMEPORT      0
56
56
#define DEFAULT_EXCLUSIVE       1
57
 
#define DEFAULT_TIMEOUT         60
 
57
#define DEFAULT_TIMEOUT         60
58
58
#define DEFAULT_TESTMODE        0
59
59
#define DEFAULT_NOWAYOUT        WATCHDOG_NOWAYOUT
60
60
 
70
70
/* Configuration Registers and Functions */
71
71
#define LDNREG          0x07
72
72
#define CHIPID          0x20
73
 
#define CHIPREV         0x22
 
73
#define CHIPREV         0x22
74
74
#define ACTREG          0x30
75
 
#define BASEREG         0x60
 
75
#define BASEREG         0x60
76
76
 
77
77
/* Chip Id numbers */
78
78
#define NO_DEV_ID       0xffff
82
82
#define IT8716_ID       0x8716
83
83
#define IT8718_ID       0x8718
84
84
#define IT8720_ID       0x8720
 
85
#define IT8721_ID       0x8721
85
86
#define IT8726_ID       0x8726  /* the data sheet suggest wrongly 0x8716 */
86
87
 
87
88
/* GPIO Configuration Registers LDN=0x07 */
88
 
#define WDTCTRL         0x71
 
89
#define WDTCTRL         0x71
89
90
#define WDTCFG          0x72
90
91
#define WDTVALLSB       0x73
91
92
#define WDTVALMSB       0x74
94
95
#define WDT_CIRINT      0x80
95
96
#define WDT_MOUSEINT    0x40
96
97
#define WDT_KYBINT      0x20
97
 
#define WDT_GAMEPORT    0x10 /* not in it8718, it8720 */
 
98
#define WDT_GAMEPORT    0x10 /* not in it8718, it8720, it8721 */
98
99
#define WDT_FORCE       0x02
99
100
#define WDT_ZERO        0x01
100
101
 
102
103
#define WDT_TOV1        0x80
103
104
#define WDT_KRST        0x40
104
105
#define WDT_TOVE        0x20
105
 
#define WDT_PWROK       0x10
 
106
#define WDT_PWROK       0x10 /* not in it8721 */
106
107
#define WDT_INT_MASK    0x0f
107
108
 
108
109
/* CIR Configuration Register LDN=0x0a */
109
 
#define CIR_ILS         0x70
 
110
#define CIR_ILS         0x70
110
111
 
111
112
/* The default Base address is not always available, we use this */
112
113
#define CIR_BASE        0x0208
134
135
#define WDTS_USE_GP     4
135
136
#define WDTS_EXPECTED   5
136
137
 
137
 
static  unsigned int base, gpact, ciract, max_units;
 
138
static  unsigned int base, gpact, ciract, max_units, chip_type;
138
139
static  unsigned long wdt_status;
139
140
static  DEFINE_SPINLOCK(spinlock);
140
141
 
215
216
/* Internal function, should be called after superio_select(GPIO) */
216
217
static void wdt_update_timeout(void)
217
218
{
218
 
        unsigned char cfg = WDT_KRST | WDT_PWROK;
 
219
        unsigned char cfg = WDT_KRST;
219
220
        int tm = timeout;
220
221
 
221
222
        if (testmode)
226
227
        else
227
228
                tm /= 60;
228
229
 
 
230
        if (chip_type != IT8721_ID)
 
231
                cfg |= WDT_PWROK;
 
232
 
229
233
        superio_outb(cfg, WDTCFG);
230
234
        superio_outb(tm, WDTVALLSB);
231
235
        if (max_units > 255)
555
559
{
556
560
        int rc = 0;
557
561
        int try_gameport = !nogameport;
558
 
        u16 chip_type;
559
562
        u8  chip_rev;
560
563
        unsigned long flags;
561
564
 
581
584
                break;
582
585
        case IT8718_ID:
583
586
        case IT8720_ID:
 
587
        case IT8721_ID:
584
588
                max_units = 65535;
585
589
                try_gameport = 0;
586
590
                break;