summaryrefslogtreecommitdiffstats
path: root/include/asm-mips/keyboard.h
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/asm-mips/keyboard.h
parent79fa43ce85955f44a4b6fd7b5134743f12c225b0 (diff)
Cleanup the architecture specifics of keyboard and PS/2 mouse drivers.
Diffstat (limited to 'include/asm-mips/keyboard.h')
-rw-r--r--include/asm-mips/keyboard.h229
1 files changed, 50 insertions, 179 deletions
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 */