diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /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.h | 116 |
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 @@ | |||
1 | #ifndef _I8042_SPARCIO_H | ||
2 | #define _I8042_SPARCIO_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | #include <asm/io.h> | ||
6 | |||
7 | #ifdef CONFIG_PCI | ||
8 | #include <asm/oplib.h> | ||
9 | #include <asm/ebus.h> | ||
10 | #endif | ||
11 | |||
12 | static int i8042_kbd_irq = -1; | ||
13 | static int i8042_aux_irq = -1; | ||
14 | #define I8042_KBD_IRQ i8042_kbd_irq | ||
15 | #define I8042_AUX_IRQ i8042_aux_irq | ||
16 | |||
17 | #define I8042_KBD_PHYS_DESC "sparcps2/serio0" | ||
18 | #define I8042_AUX_PHYS_DESC "sparcps2/serio1" | ||
19 | #define I8042_MUX_PHYS_DESC "sparcps2/serio%d" | ||
20 | |||
21 | static void __iomem *kbd_iobase; | ||
22 | |||
23 | #define I8042_COMMAND_REG (kbd_iobase + 0x64UL) | ||
24 | #define I8042_DATA_REG (kbd_iobase + 0x60UL) | ||
25 | |||
26 | static inline int i8042_read_data(void) | ||
27 | { | ||
28 | return readb(kbd_iobase + 0x60UL); | ||
29 | } | ||
30 | |||
31 | static inline int i8042_read_status(void) | ||
32 | { | ||
33 | return readb(kbd_iobase + 0x64UL); | ||
34 | } | ||
35 | |||
36 | static inline void i8042_write_data(int val) | ||
37 | { | ||
38 | writeb(val, kbd_iobase + 0x60UL); | ||
39 | } | ||
40 | |||
41 | static inline void i8042_write_command(int val) | ||
42 | { | ||
43 | writeb(val, kbd_iobase + 0x64UL); | ||
44 | } | ||
45 | |||
46 | #define OBP_PS2KBD_NAME1 "kb_ps2" | ||
47 | #define OBP_PS2KBD_NAME2 "keyboard" | ||
48 | #define OBP_PS2MS_NAME1 "kdmouse" | ||
49 | #define OBP_PS2MS_NAME2 "mouse" | ||
50 | |||
51 | static int i8042_platform_init(void) | ||
52 | { | ||
53 | #ifndef CONFIG_PCI | ||
54 | return -1; | ||
55 | #else | ||
56 | char prop[128]; | ||
57 | int len; | ||
58 | |||
59 | len = prom_getproperty(prom_root_node, "name", prop, sizeof(prop)); | ||
60 | if (len < 0) { | ||
61 | printk("i8042: Cannot get name property of root OBP node.\n"); | ||
62 | return -1; | ||
63 | } | ||
64 | if (strncmp(prop, "SUNW,JavaStation-1", len) == 0) { | ||
65 | /* Hardcoded values for MrCoffee. */ | ||
66 | i8042_kbd_irq = i8042_aux_irq = 13 | 0x20; | ||
67 | kbd_iobase = ioremap(0x71300060, 8); | ||
68 | if (!kbd_iobase) | ||
69 | return -1; | ||
70 | } else { | ||
71 | struct linux_ebus *ebus; | ||
72 | struct linux_ebus_device *edev; | ||
73 | struct linux_ebus_child *child; | ||
74 | |||
75 | for_each_ebus(ebus) { | ||
76 | for_each_ebusdev(edev, ebus) { | ||
77 | if (!strcmp(edev->prom_name, "8042")) | ||
78 | goto edev_found; | ||
79 | } | ||
80 | } | ||
81 | return -1; | ||
82 | |||
83 | edev_found: | ||
84 | for_each_edevchild(edev, child) { | ||
85 | if (!strcmp(child->prom_name, OBP_PS2KBD_NAME1) || | ||
86 | !strcmp(child->prom_name, OBP_PS2KBD_NAME2)) { | ||
87 | i8042_kbd_irq = child->irqs[0]; | ||
88 | kbd_iobase = | ||
89 | ioremap(child->resource[0].start, 8); | ||
90 | } | ||
91 | if (!strcmp(child->prom_name, OBP_PS2MS_NAME1) || | ||
92 | !strcmp(child->prom_name, OBP_PS2MS_NAME2)) | ||
93 | i8042_aux_irq = child->irqs[0]; | ||
94 | } | ||
95 | if (i8042_kbd_irq == -1 || | ||
96 | i8042_aux_irq == -1) { | ||
97 | printk("i8042: Error, 8042 device lacks both kbd and " | ||
98 | "mouse nodes.\n"); | ||
99 | return -1; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | i8042_reset = 1; | ||
104 | |||
105 | return 0; | ||
106 | #endif /* CONFIG_PCI */ | ||
107 | } | ||
108 | |||
109 | static inline void i8042_platform_exit(void) | ||
110 | { | ||
111 | #ifdef CONFIG_PCI | ||
112 | iounmap(kbd_iobase); | ||
113 | #endif | ||
114 | } | ||
115 | |||
116 | #endif /* _I8042_SPARCIO_H */ | ||