1 #ifndef _I8042_SPARCIO_H
2 #define _I8042_SPARCIO_H
4 #include <linux/config.h>
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)
59 len
= prom_getproperty(prom_root_node
, "name", prop
, sizeof(prop
));
61 printk("i8042: Cannot get name property of root OBP node.\n");
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);
71 struct linux_ebus
*ebus
;
72 struct linux_ebus_device
*edev
;
73 struct linux_ebus_child
*child
;
76 for_each_ebusdev(edev
, ebus
) {
77 if (!strcmp(edev
->prom_name
, "8042"))
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];
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 "
106 #endif /* CONFIG_PCI */
109 static inline void i8042_platform_exit(void)
116 #endif /* _I8042_SPARCIO_H */