[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / drivers / input / serio / i8042-sparcio.h
blobda2a19812485208e72d4a5c55c60c3f0f2ed90af
1 #ifndef _I8042_SPARCIO_H
2 #define _I8042_SPARCIO_H
4 #include <linux/config.h>
5 #include <asm/io.h>
7 #ifdef CONFIG_PCI
8 #include <asm/oplib.h>
9 #include <asm/ebus.h>
10 #endif
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
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"
21 static void __iomem *kbd_iobase;
23 #define I8042_COMMAND_REG (kbd_iobase + 0x64UL)
24 #define I8042_DATA_REG (kbd_iobase + 0x60UL)
26 static inline int i8042_read_data(void)
28 return readb(kbd_iobase + 0x60UL);
31 static inline int i8042_read_status(void)
33 return readb(kbd_iobase + 0x64UL);
36 static inline void i8042_write_data(int val)
38 writeb(val, kbd_iobase + 0x60UL);
41 static inline void i8042_write_command(int val)
43 writeb(val, kbd_iobase + 0x64UL);
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"
51 static int i8042_platform_init(void)
53 #ifndef CONFIG_PCI
54 return -1;
55 #else
56 char prop[128];
57 int len;
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;
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;
75 for_each_ebus(ebus) {
76 for_each_ebusdev(edev, ebus) {
77 if (!strcmp(edev->prom_name, "8042"))
78 goto edev_found;
81 return -1;
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);
91 if (!strcmp(child->prom_name, OBP_PS2MS_NAME1) ||
92 !strcmp(child->prom_name, OBP_PS2MS_NAME2))
93 i8042_aux_irq = child->irqs[0];
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;
103 i8042_reset = 1;
105 return 0;
106 #endif /* CONFIG_PCI */
109 static inline void i8042_platform_exit(void)
111 #ifdef CONFIG_PCI
112 iounmap(kbd_iobase);
113 #endif
116 #endif /* _I8042_SPARCIO_H */