summaryrefslogtreecommitdiffstats
path: root/drivers/input/serio/i8042-ppcio.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/input/serio/i8042-ppcio.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/input/serio/i8042-ppcio.h')
-rw-r--r--drivers/input/serio/i8042-ppcio.h136
1 files changed, 136 insertions, 0 deletions
diff --git a/drivers/input/serio/i8042-ppcio.h b/drivers/input/serio/i8042-ppcio.h
new file mode 100644
index 00000000000..2906e1b60c0
--- /dev/null
+++ b/drivers/input/serio/i8042-ppcio.h
@@ -0,0 +1,136 @@
+#ifndef _I8042_PPCIO_H
+#define _I8042_PPCIO_H
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+
+#if defined(CONFIG_WALNUT)
+
+#define I8042_KBD_IRQ 25
+#define I8042_AUX_IRQ 26
+
+#define I8042_KBD_PHYS_DESC "walnutps2/serio0"
+#define I8042_AUX_PHYS_DESC "walnutps2/serio1"
+#define I8042_MUX_PHYS_DESC "walnutps2/serio%d"
+
+extern void *kb_cs;
+extern void *kb_data;
+
+#define I8042_COMMAND_REG (*(int *)kb_cs)
+#define I8042_DATA_REG (*(int *)kb_data)
+
+static inline int i8042_read_data(void)
+{
+ return readb(kb_data);
+}
+
+static inline int i8042_read_status(void)
+{
+ return readb(kb_cs);
+}
+
+static inline void i8042_write_data(int val)
+{
+ writeb(val, kb_data);
+}
+
+static inline void i8042_write_command(int val)
+{
+ writeb(val, kb_cs);
+}
+
+static inline int i8042_platform_init(void)
+{
+ i8042_reset = 1;
+ return 0;
+}
+
+static inline void i8042_platform_exit(void)
+{
+}
+
+#elif defined(CONFIG_SPRUCE)
+
+#define I8042_KBD_IRQ 22
+#define I8042_AUX_IRQ 21
+
+#define I8042_KBD_PHYS_DESC "spruceps2/serio0"
+#define I8042_AUX_PHYS_DESC "spruceps2/serio1"
+#define I8042_MUX_PHYS_DESC "spruceps2/serio%d"
+
+#define I8042_COMMAND_REG 0xff810000
+#define I8042_DATA_REG 0xff810001
+
+static inline int i8042_read_data(void)
+{
+ unsigned long kbd_data;
+
+ __raw_writel(0x00000088, 0xff500008);
+ eieio();
+
+ __raw_writel(0x03000000, 0xff50000c);
+ eieio();
+
+ asm volatile("lis 7,0xff88 \n\
+ lswi 6,7,0x8 \n\
+ mr %0,6"
+ : "=r" (kbd_data) :: "6", "7");
+
+ __raw_writel(0x00000000, 0xff50000c);
+ eieio();
+
+ return (unsigned char)(kbd_data >> 24);
+}
+
+static inline int i8042_read_status(void)
+{
+ unsigned long kbd_status;
+
+ __raw_writel(0x00000088, 0xff500008);
+ eieio();
+
+ __raw_writel(0x03000000, 0xff50000c);
+ eieio();
+
+ asm volatile("lis 7,0xff88 \n\
+ ori 7,7,0x8 \n\
+ lswi 6,7,0x8 \n\
+ mr %0,6"
+ : "=r" (kbd_status) :: "6", "7");
+
+ __raw_writel(0x00000000, 0xff50000c);
+ eieio();
+
+ return (unsigned char)(kbd_status >> 24);
+}
+
+static inline void i8042_write_data(int val)
+{
+ *((unsigned char *)0xff810000) = (char)val;
+}
+
+static inline void i8042_write_command(int val)
+{
+ *((unsigned char *)0xff810001) = (char)val;
+}
+
+static inline int i8042_platform_init(void)
+{
+ i8042_reset = 1;
+ return 0;
+}
+
+static inline void i8042_platform_exit(void)
+{
+}
+
+#else
+
+#include "i8042-io.h"
+
+#endif
+
+#endif /* _I8042_PPCIO_H */