diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-03-03 01:22:27 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-03-03 01:22:27 +0000 |
commit | f9bbe9da79dbc8557c74efeb158b431cd67ace52 (patch) | |
tree | 3220d014a35f9d88a48668a1468524e988daebff /drivers/char | |
parent | 3d697109c1ff85ef563aec3d5e113ef225ed2792 (diff) |
Upgrade to 2.1.73.
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/pc_keyb.c | 25 | ||||
-rw-r--r-- | drivers/char/pc_keyb.h | 6 | ||||
-rw-r--r-- | drivers/char/pcwd.c | 7 |
3 files changed, 28 insertions, 10 deletions
diff --git a/drivers/char/pc_keyb.c b/drivers/char/pc_keyb.c index 849487b19..c17ae5e14 100644 --- a/drivers/char/pc_keyb.c +++ b/drivers/char/pc_keyb.c @@ -17,6 +17,7 @@ #include <linux/ioport.h> #include <linux/init.h> #include <linux/kbd_ll.h> +#include <linux/delay.h> #include <asm/keyboard.h> #include <asm/bitops.h> @@ -205,16 +206,21 @@ static volatile unsigned char resend = 0; /* * Wait for keyboard controller input buffer is empty. + * + * Don't use 'jiffies' so that we don't depend on + * interrupts.. */ static inline void kb_wait(void) { - unsigned long start = jiffies; + unsigned long timeout = KBC_TIMEOUT; do { if (! (kbd_read_status() & KBD_STAT_IBF)) return; - } while (jiffies - start < KBC_TIMEOUT); + udelay(1000); + timeout--; + } while (timeout); #ifdef KBD_REPORT_TIMEOUTS printk(KERN_WARNING "Keyboard timed out\n"); #endif @@ -544,30 +550,35 @@ static void keyboard_interrupt(int irq, void *dev_id, struct pt_regs *regs) * send_data sends a character to the keyboard and waits * for an acknowledge, possibly retrying if asked to. Returns * the success status. + * + * Don't use 'jiffies', so that we don't depend on interrupts */ static int send_data(unsigned char data) { int retries = 3; - unsigned long start; do { + unsigned long timeout = KBD_TIMEOUT; + kb_wait(); acknowledge = 0; resend = 0; reply_expected = 1; kbd_write_output(data); kbd_pause(); - start = jiffies; - do { + for (;;) { if (acknowledge) return 1; - if (jiffies - start >= KBD_TIMEOUT) { + if (resend) + break; + udelay(1000); + if (!--timeout) { #ifdef KBD_REPORT_TIMEOUTS printk(KERN_WARNING "Keyboard timeout\n"); #endif return 0; } - } while (!resend); + } } while (retries-- > 0); #ifdef KBD_REPORT_TIMEOUTS printk(KERN_WARNING "keyboard: Too many NACKs -- noisy kbd cable?\n"); diff --git a/drivers/char/pc_keyb.h b/drivers/char/pc_keyb.h index ffbfc49e2..a70763bf0 100644 --- a/drivers/char/pc_keyb.h +++ b/drivers/char/pc_keyb.h @@ -15,9 +15,9 @@ #define KBD_REPORT_TIMEOUTS /* Report keyboard timeouts */ #undef KBD_IS_FOCUS_9000 /* We have the brain-damaged FOCUS-9000 keyboard */ -#define KBD_INIT_TIMEOUT HZ /* Timeout for initializing the keyboard */ -#define KBC_TIMEOUT (HZ/4) /* Timeout for sending to keyboard controller */ -#define KBD_TIMEOUT (HZ/4) /* Timeout for keyboard command acknowledge */ +#define KBD_INIT_TIMEOUT HZ /* Timeout in jiffies for initializing the keyboard */ +#define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */ +#define KBD_TIMEOUT 250 /* Timeout in ms for keyboard command acknowledge */ /* * Internal variables of the driver diff --git a/drivers/char/pcwd.c b/drivers/char/pcwd.c index 207fc4cf4..2226f9f3c 100644 --- a/drivers/char/pcwd.c +++ b/drivers/char/pcwd.c @@ -30,6 +30,7 @@ * code bits, and added compatibility to 2.1.x. * 970912 Enabled board on open and disable on close. * 971107 Took account of recent VFS changes (broke read). + * 971210 Disable board on initialisation in case board already ticking. */ #include <linux/module.h> @@ -579,6 +580,12 @@ __initfunc(int pcwatchdog_init(void)) pcwd_showprevstate(); + /* Disable the board */ + if (revision == PCWD_REVISION_C) { + outb_p(0xA5, current_readport + 3); + outb_p(0xA5, current_readport + 3); + } + if (revision == PCWD_REVISION_A) request_region(current_readport, 2, "PCWD Rev.A (Berkshire)"); else |