summaryrefslogtreecommitdiff
path: root/drivers/input/serio/i8042-sparcio.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-sparcio.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-sparcio.h')
-rw-r--r--drivers/input/serio/i8042-sparcio.h116
1 files changed, 116 insertions, 0 deletions
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
new file mode 100644
index 000000000000..da2a19812485
--- /dev/null
+++ b/drivers/input/serio/i8042-sparcio.h
@@ -0,0 +1,116 @@
+#ifndef _I8042_SPARCIO_H
+#define _I8042_SPARCIO_H
+
+#include <linux/config.h>
+#include <asm/io.h>
+
+#ifdef CONFIG_PCI
+#include <asm/oplib.h>
+#include <asm/ebus.h>
+#endif
+
+static int i8042_kbd_irq = -1;
+static int i8042_aux_irq = -1;
+#define I8042_KBD_IRQ i8042_kbd_irq
+#define I8042_AUX_IRQ i8042_aux_irq
+
+#define I8042_KBD_PHYS_DESC "sparcps2/serio0"
+#define I8042_AUX_PHYS_DESC "sparcps2/serio1"
+#define I8042_MUX_PHYS_DESC "sparcps2/serio%d"
+
+static void __iomem *kbd_iobase;
+
+#define I8042_COMMAND_REG (kbd_iobase + 0x64UL)
+#define I8042_DATA_REG (kbd_iobase + 0x60UL)
+
+static inline int i8042_read_data(void)
+{
+ return readb(kbd_iobase + 0x60UL);
+}
+
+static inline int i8042_read_status(void)
+{
+ return readb(kbd_iobase + 0x64UL);
+}
+
+static inline void i8042_write_data(int val)
+{
+ writeb(val, kbd_iobase + 0x60UL);
+}
+
+static inline void i8042_write_command(int val)
+{
+ writeb(val, kbd_iobase + 0x64UL);
+}
+
+#define OBP_PS2KBD_NAME1 "kb_ps2"
+#define OBP_PS2KBD_NAME2 "keyboard"
+#define OBP_PS2MS_NAME1 "kdmouse"
+#define OBP_PS2MS_NAME2 "mouse"
+
+static int i8042_platform_init(void)
+{
+#ifndef CONFIG_PCI
+ return -1;
+#else
+ char prop[128];
+ int len;
+
+ len = prom_getproperty(prom_root_node, "name", prop, sizeof(prop));
+ if (len < 0) {
+ printk("i8042: Cannot get name property of root OBP node.\n");
+ return -1;
+ }
+ if (strncmp(prop, "SUNW,JavaStation-1", len) == 0) {
+ /* Hardcoded values for MrCoffee. */
+ i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
+ kbd_iobase = ioremap(0x71300060, 8);
+ if (!kbd_iobase)
+ return -1;
+ } else {
+ struct linux_ebus *ebus;
+ struct linux_ebus_device *edev;
+ struct linux_ebus_child *child;
+
+ for_each_ebus(ebus) {
+ for_each_ebusdev(edev, ebus) {
+ if (!strcmp(edev->prom_name, "8042"))
+ goto edev_found;
+ }
+ }
+ return -1;
+
+ edev_found:
+ for_each_edevchild(edev, child) {
+ if (!strcmp(child->prom_name, OBP_PS2KBD_NAME1) ||
+ !strcmp(child->prom_name, OBP_PS2KBD_NAME2)) {
+ i8042_kbd_irq = child->irqs[0];
+ kbd_iobase =
+ ioremap(child->resource[0].start, 8);
+ }
+ if (!strcmp(child->prom_name, OBP_PS2MS_NAME1) ||
+ !strcmp(child->prom_name, OBP_PS2MS_NAME2))
+ i8042_aux_irq = child->irqs[0];
+ }
+ if (i8042_kbd_irq == -1 ||
+ i8042_aux_irq == -1) {
+ printk("i8042: Error, 8042 device lacks both kbd and "
+ "mouse nodes.\n");
+ return -1;
+ }
+ }
+
+ i8042_reset = 1;
+
+ return 0;
+#endif /* CONFIG_PCI */
+}
+
+static inline void i8042_platform_exit(void)
+{
+#ifdef CONFIG_PCI
+ iounmap(kbd_iobase);
+#endif
+}
+
+#endif /* _I8042_SPARCIO_H */