summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-07-24 01:55:37 +0000
committerRalf Baechle <ralf@linux-mips.org>1997-07-24 01:55:37 +0000
commite940c15ebb25269923db9a8a912727046cfffa77 (patch)
tree0e4bbd46c2d69a129bfc30bd4e1f8dce132ba64b /include
parent79fa43ce85955f44a4b6fd7b5134743f12c225b0 (diff)
Cleanup the architecture specifics of keyboard and PS/2 mouse drivers.
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/keyboard.h36
-rw-r--r--include/asm-i386/keyboard.h48
-rw-r--r--include/asm-mips/keyboard.h229
-rw-r--r--include/asm-ppc/keyboard.h33
4 files changed, 146 insertions, 200 deletions
diff --git a/include/asm-alpha/keyboard.h b/include/asm-alpha/keyboard.h
index 3caa220eb..263cf8050 100644
--- a/include/asm-alpha/keyboard.h
+++ b/include/asm-alpha/keyboard.h
@@ -2,6 +2,8 @@
* linux/include/asm-alpha/keyboard.h
*
* Created 3 Nov 1996 by Geert Uytterhoeven
+ *
+ * $Id: keyboard.h,v 1.3 1997/07/22 23:18:14 ralf Exp $
*/
/*
@@ -13,6 +15,7 @@
#ifdef __KERNEL__
+#include <linux/config.h>
#include <linux/ioport.h>
#include <asm/io.h>
@@ -45,15 +48,32 @@ extern void pckbd_init_hw(void);
#define KBD_CNTL_REG (unsigned int) 0x64
#define KBD_DATA_REG (unsigned int) 0x60
-#define kbd_inb_p(port) inb_p(port)
-#define kbd_inb(port) inb(port)
-#define kbd_outb_p(data,port) outb_p(data,port)
-#define kbd_outb(data,port) outb(data,port)
+/* How to access the keyboard macros on this platform. */
+#define kbd_read_input() inb(KBD_DATA_REG)
+#define kbd_read_status() inb(KBD_STATUS_REG)
+#define kbd_write_output(val) outb(val, KBD_DATA_REG)
+#define kbd_write_command(val) outb(val, KBD_CNTL_REG)
+
+/* Some stoneage hardware needs delays after some operations. */
+#define kbd_pause() do { } while(0)
+
+#define keyboard_setup() \
+ request_region(0x60, 16, "keyboard")
+
+/*
+ * Machine specific bits for the PS/2 driver
+ */
+
+#if defined(CONFIG_PCI)
+#define AUX_IRQ 12
+#else
+#define AUX_IRQ 9 /* Jensen is odd indeed */
+#endif
+
+#define ps2_request_irq() \
+ request_irq(AUX_IRQ, aux_interrupt, 0, "PS/2 Mouse", NULL)
-extern __inline__ void keyboard_setup()
-{
- request_region(0x60,16,"keyboard");
-}
+#define ps2_free_irq(inode) free_irq(AUX_IRQ, NULL)
#endif /* __KERNEL__ */
#endif /* __ASM_ALPHA_KEYBOARD_H */
diff --git a/include/asm-i386/keyboard.h b/include/asm-i386/keyboard.h
index 2ea9ce385..eaf0fa874 100644
--- a/include/asm-i386/keyboard.h
+++ b/include/asm-i386/keyboard.h
@@ -2,6 +2,8 @@
* linux/include/asm-i386/keyboard.h
*
* Created 3 Nov 1996 by Geert Uytterhoeven
+ *
+ * $Id: keyboard.h,v 1.4 1997/07/23 06:06:09 ralf Exp $
*/
/*
@@ -13,6 +15,8 @@
#ifdef __KERNEL__
+#include <linux/config.h>
+#include <linux/kernel.h>
#include <asm/io.h>
#define KEYBOARD_IRQ 1
@@ -35,16 +39,42 @@ extern void pckbd_init_hw(void);
#define kbd_leds pckbd_leds
#define kbd_init_hw pckbd_init_hw
-#define kbd_inb_p(port) inb_p(port)
-#define kbd_inb(port) inb(port)
-#define kbd_outb_p(data,port) outb_p(data,port)
-#define kbd_outb(data,port) outb(data,port)
+/* How to access the keyboard macros on this platform. */
+#define kbd_read_input() inb(KBD_DATA_REG)
+#define kbd_read_status() inb(KBD_STATUS_REG)
+#define kbd_write_output(val) outb(val, KBD_DATA_REG)
+#define kbd_write_command(val) outb(val, KBD_CNTL_REG)
+
+/* Some stoneage hardware needs delays after some operations. */
+#define kbd_pause() do { SLOW_DOWN_IO; } while(0)
+
+#define keyboard_setup() \
+ request_region(0x60, 16, "keyboard")
+
+/*
+ * Machine specific bits for the PS/2 driver
+ */
+
+#define AUX_IRQ 12
+
+#ifdef CONFIG_MCA
+
+#define ps2_request_irq() \
+ request_irq(AUX_IRQ, aux_interrupt, MCA_bus ? SA_SHIRQ : 0, \
+ "PS/2 Mouse", inode)
+
+#else /* !defined(CONFIG_MCA) */
+
+#define ps2_request_irq() \
+ request_irq(AUX_IRQ, aux_interrupt, 0, "PS/2 Mouse", NULL)
+
+#endif /* !defined(CONFIG_MCA) */
-extern __inline__ void
-keyboard_setup()
-{
- request_region(0x60,16,"keyboard");
-}
+#ifdef CONFIG_MCA
+#define ps2_free_irq(inode) free_irq(AUX_IRQ, inode)
+#else
+#define ps2_free_irq(inode) free_irq(AUX_IRQ, NULL)
+#endif
#endif /* __KERNEL__ */
#endif /* __ASM_i386_KEYBOARD_H */
diff --git a/include/asm-mips/keyboard.h b/include/asm-mips/keyboard.h
index 1c746dc66..499024c3b 100644
--- a/include/asm-mips/keyboard.h
+++ b/include/asm-mips/keyboard.h
@@ -5,9 +5,7 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
- * This file is a mess. Put on your peril sensitive glasses.
- *
- * $Id:$
+ * $Id: keyboard.h,v 1.5 1997/07/23 17:41:07 ralf Exp $
*/
#ifndef __ASM_MIPS_KEYBOARD_H
#define __ASM_MIPS_KEYBOARD_H
@@ -17,6 +15,7 @@
#include <linux/config.h>
#include <linux/delay.h>
#include <linux/ioport.h>
+#include <asm/bootinfo.h>
extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
extern int pckbd_getkeycode(unsigned int scancode);
@@ -35,200 +34,72 @@ extern void pckbd_init_hw(void);
#define kbd_leds pckbd_leds
#define kbd_init_hw pckbd_init_hw
-/*
- * The default IO slowdown is doing 'inb()'s from 0x61, which should be
- * safe. But as that is the keyboard controller chip address, we do our
- * slowdowns here by doing short jumps: the keyboard controller should
- * be able to keep up
- */
-#define REALLY_SLOW_IO
-#define SLOW_IO_BY_JUMPING
-#include <asm/io.h>
+#define INIT_KBD /* full initialization for the keyboard controller. */
-/*
- * keyboard controller registers
- */
-#define M_KBD_STATUS_REG (unsigned int) 0x64
-#define M_KBD_CNTL_REG (unsigned int) 0x64
-#define M_KBD_DATA_REG (unsigned int) 0x60
+/* Some stoneage hardware needs delays after some operations. */
+#define kbd_pause() do { } while(0)
-#ifdef CONFIG_SGI
-#include <asm/segment.h>
-#include <asm/sgihpc.h>
-#endif
-#include <asm/bootinfo.h>
-#include <asm/jazz.h>
+/* Pointers to keyboard hardware access and init functions. */
+unsigned char (*kbd_read_input)(void);
+void (*kbd_write_output)(unsigned char val);
+void (*kbd_write_command)(unsigned char val);
+unsigned char (*kbd_read_status)(void);
-#ifdef CONFIG_SGI
-#define KEYBOARD_IRQ 20
-#else
-/* Not true for Jazz machines, we cheat a bit for 'em. */
-#define KEYBOARD_IRQ 1
-#endif
+void (*keyboard_setup)(void);
-#ifdef CONFIG_SGI
-#define DISABLE_KBD_DURING_INTERRUPTS 1
-#else
-#define DISABLE_KBD_DURING_INTERRUPTS 0
-#endif
+#ifdef CONFIG_MIPS_JAZZ
-int (*kbd_inb_p)(unsigned short port);
-int (*kbd_inb)(unsigned short port);
-void (*kbd_outb_p)(unsigned char data, unsigned short port);
-void (*kbd_outb)(unsigned char data, unsigned short port);
+/* Not true for Jazz machines, we cheat a bit for 'em. */
+#define KEYBOARD_IRQ 1
-#ifdef CONFIG_MIPS_JAZZ
-#define INIT_KBD /* full initialization for the keyboard controller. */
+/*
+ * No PS/2 style mouse support for Jazz machines
+ */
-static volatile keyboard_hardware *jazz_kh;
-
-static int
-jazz_kbd_inb_p(unsigned short port)
-{
- int result;
-
- if(port == M_KBD_DATA_REG)
- result = jazz_kh->data;
- else /* Must be M_KBD_STATUS_REG */
- result = jazz_kh->command;
- inb(0x80);
-
- return result;
-}
-
-static int
-jazz_kbd_inb(unsigned short port)
-{
- int result;
-
- if(port == M_KBD_DATA_REG)
- result = jazz_kh->data;
- else /* Must be M_KBD_STATUS_REG */
- result = jazz_kh->command;
-
- return result;
-}
-
-static void
-jazz_kbd_outb_p(unsigned char data, unsigned short port)
-{
- if(port == M_KBD_DATA_REG)
- jazz_kh->data = data;
- else if(port == M_KBD_CNTL_REG)
- jazz_kh->command = data;
- inb(0x80);
-}
-
-static void
-jazz_kbd_outb(unsigned char data, unsigned short port)
-{
- if(port == M_KBD_DATA_REG)
- jazz_kh->data = data;
- else if(port == M_KBD_CNTL_REG)
- jazz_kh->command = data;
-}
#endif /* CONFIG_MIPS_JAZZ */
#ifdef CONFIG_SGI
-#define INIT_KBD /* full initialization for the keyboard controller. */
+
+#define DISABLE_KBD_DURING_INTERRUPTS 1
+
+#define KEYBOARD_IRQ 20
/*
- * Global because the PS/2 MOUSE driver accesses it also.
+ * Machine specific bits for the PS/2 driver.
+ * Aux device and keyboard share the interrupt on the Indy.
*/
-volatile struct hpc_keyb *sgi_kh;
-
-static int
-sgi_kbd_inb(unsigned short port)
-{
- int result;
-
- if(port == M_KBD_DATA_REG)
- result = sgi_kh->data;
- else /* Must be M_KBD_STATUS_REG */
- result = sgi_kh->command;
-
- return result;
-}
-
-static void
-sgi_kbd_outb(unsigned char data, unsigned short port)
-{
- if(port == M_KBD_DATA_REG)
- sgi_kh->data = data;
- else if(port == M_KBD_CNTL_REG)
- sgi_kh->command = data;
-}
+
+#define ps2_request_irq() 0
+#define ps2_free_irq(void) do { } while(0);
+
#endif /* CONFIG_SGI */
+#if defined(CONFIG_ACER_PICA_61) || defined(CONFIG_SNI_RM200_PCI) \
+ || defined(CONFIG_DESKSTATION_RPC44) || defined(CONFIG_DESKSTATION_TYNE)
+#define CONF_KEYBOARD_USES_IO_PORTS
+#endif
+
+#ifdef CONF_KEYBOARD_USES_IO_PORTS
/*
* Most other MIPS machines access the keyboard controller via
- * ordinary I/O ports.
+ * memory mapped I/O ports.
*/
-static int
-port_kbd_inb_p(unsigned short port)
-{
- return inb_p(port);
-}
-
-static int
-port_kbd_inb(unsigned short port)
-{
- return inb(port);
-}
-
-static void
-port_kbd_outb_p(unsigned char data, unsigned short port)
-{
- return outb_p(data, port);
-}
-
-static void
-port_kbd_outb(unsigned char data, unsigned short port)
-{
- return outb(data, port);
-}
-
-extern __inline__ void keyboard_setup(void)
-{
-#ifdef CONFIG_MIPS_JAZZ
- if (mips_machgroup == MACH_GROUP_JAZZ) {
- jazz_kh = (void *) JAZZ_KEYBOARD_ADDRESS;
- kbd_inb_p = jazz_kbd_inb_p;
- kbd_inb = jazz_kbd_inb;
- kbd_outb_p = jazz_kbd_outb_p;
- kbd_outb = jazz_kbd_outb;
- /*
- * Enable keyboard interrupts.
- */
- *((volatile u16 *)JAZZ_IO_IRQ_ENABLE) |= JAZZ_IE_KEYBOARD;
- set_cp0_status(IE_IRQ1, IE_IRQ1);
- } else
-#endif
- if (mips_machgroup == MACH_GROUP_ARC || /* this is for Deskstation */
- (mips_machgroup == MACH_GROUP_SNI_RM
- && mips_machtype == MACH_SNI_RM200_PCI)) {
- /*
- * These machines address their keyboard via the normal
- * port address range.
- *
- * Also enable Scan Mode 2.
- */
- kbd_inb_p = port_kbd_inb_p;
- kbd_inb = port_kbd_inb;
- kbd_outb_p = port_kbd_outb_p;
- kbd_outb = port_kbd_outb;
- request_region(0x60,16,"keyboard");
- }
-#ifdef CONFIG_SGI
- if (mips_machgroup == MACH_GROUP_SGI) {
- sgi_kh = (struct hpc_keyb *) (KSEG1 + 0x1fbd9800 + 64);
- kbd_inb_p = sgi_kbd_inb;
- kbd_inb = sgi_kbd_inb;
- kbd_outb_p = sgi_kbd_outb;
- kbd_outb = sgi_kbd_outb;
- }
-#endif
-}
+#include <asm/io.h>
+
+#define KEYBOARD_IRQ 1
+
+/*
+ * Machine specific bits for the PS/2 driver
+ */
+
+#define AUX_IRQ 12
+
+#define ps2_request_irq() \
+ request_irq(AUX_IRQ, aux_interrupt, 0, "PS/2 Mouse", NULL)
+
+#define ps2_free_irq(inode) free_irq(AUX_IRQ, NULL)
+
+#endif /* CONF_KEYBOARD_USES_IO_PORTS */
#endif /* __KERNEL */
#endif /* __ASM_MIPS_KEYBOARD_H */
diff --git a/include/asm-ppc/keyboard.h b/include/asm-ppc/keyboard.h
index 418476b2d..9ac4139b9 100644
--- a/include/asm-ppc/keyboard.h
+++ b/include/asm-ppc/keyboard.h
@@ -2,6 +2,8 @@
* linux/include/asm-ppc/keyboard.h
*
* Created 3 Nov 1996 by Geert Uytterhoeven
+ *
+ * $Id: keyboard.h,v 1.3 1997/07/22 23:18:19 ralf Exp $
*/
/*
@@ -13,6 +15,8 @@
#ifdef __KERNEL__
+#include <asm/io.h>
+
#define KEYBOARD_IRQ 1
#define DISABLE_KBD_DURING_INTERRUPTS 0
@@ -33,12 +37,33 @@ extern void pckbd_init_hw(void);
#define kbd_leds pckbd_leds
#define kbd_init_hw pckbd_init_hw
+/* How to access the keyboard macros on this platform. */
+#define kbd_read_input() inb(KBD_DATA_REG)
+#define kbd_read_status() inb(KBD_STATUS_REG)
+#define kbd_write_output(val) outb(val, KBD_DATA_REG)
+#define kbd_write_command(val) outb(val, KBD_CNTL_REG)
+
+/* Some stoneage hardware needs delays after some operations. */
+#define kbd_pause() do { } while(0)
+
#define INIT_KBD
-extern __inline__ void keyboard_setup()
-{
- request_region(0x60,16,"keyboard");
-}
+#define keyboard_setup() \
+ request_region(0x60, 16, "keyboard")
+
+/*
+ * Machine specific bits for the PS/2 driver
+ *
+ * FIXME: does any PPC machine use the PS/2 driver at all? If so,
+ * this should work, if not it's dead code ...
+ */
+
+#define AUX_IRQ 12
+
+#define ps2_request_irq() \
+ request_irq(AUX_IRQ, aux_interrupt, 0, "PS/2 Mouse", NULL)
+
+#define ps2_free_irq(inode) free_irq(AUX_IRQ, NULL)
#endif /* __KERNEL__ */