Linux 2.6.34-rc3
[pohmelfs.git] / drivers / input / serio / i8042-ppcio.h
blob2906e1b60c04009a4d16ffb743ecf4f436bb7237
1 #ifndef _I8042_PPCIO_H
2 #define _I8042_PPCIO_H
4 /*
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
10 #if defined(CONFIG_WALNUT)
12 #define I8042_KBD_IRQ 25
13 #define I8042_AUX_IRQ 26
15 #define I8042_KBD_PHYS_DESC "walnutps2/serio0"
16 #define I8042_AUX_PHYS_DESC "walnutps2/serio1"
17 #define I8042_MUX_PHYS_DESC "walnutps2/serio%d"
19 extern void *kb_cs;
20 extern void *kb_data;
22 #define I8042_COMMAND_REG (*(int *)kb_cs)
23 #define I8042_DATA_REG (*(int *)kb_data)
25 static inline int i8042_read_data(void)
27 return readb(kb_data);
30 static inline int i8042_read_status(void)
32 return readb(kb_cs);
35 static inline void i8042_write_data(int val)
37 writeb(val, kb_data);
40 static inline void i8042_write_command(int val)
42 writeb(val, kb_cs);
45 static inline int i8042_platform_init(void)
47 i8042_reset = 1;
48 return 0;
51 static inline void i8042_platform_exit(void)
55 #elif defined(CONFIG_SPRUCE)
57 #define I8042_KBD_IRQ 22
58 #define I8042_AUX_IRQ 21
60 #define I8042_KBD_PHYS_DESC "spruceps2/serio0"
61 #define I8042_AUX_PHYS_DESC "spruceps2/serio1"
62 #define I8042_MUX_PHYS_DESC "spruceps2/serio%d"
64 #define I8042_COMMAND_REG 0xff810000
65 #define I8042_DATA_REG 0xff810001
67 static inline int i8042_read_data(void)
69 unsigned long kbd_data;
71 __raw_writel(0x00000088, 0xff500008);
72 eieio();
74 __raw_writel(0x03000000, 0xff50000c);
75 eieio();
77 asm volatile("lis 7,0xff88 \n\
78 lswi 6,7,0x8 \n\
79 mr %0,6"
80 : "=r" (kbd_data) :: "6", "7");
82 __raw_writel(0x00000000, 0xff50000c);
83 eieio();
85 return (unsigned char)(kbd_data >> 24);
88 static inline int i8042_read_status(void)
90 unsigned long kbd_status;
92 __raw_writel(0x00000088, 0xff500008);
93 eieio();
95 __raw_writel(0x03000000, 0xff50000c);
96 eieio();
98 asm volatile("lis 7,0xff88 \n\
99 ori 7,7,0x8 \n\
100 lswi 6,7,0x8 \n\
101 mr %0,6"
102 : "=r" (kbd_status) :: "6", "7");
104 __raw_writel(0x00000000, 0xff50000c);
105 eieio();
107 return (unsigned char)(kbd_status >> 24);
110 static inline void i8042_write_data(int val)
112 *((unsigned char *)0xff810000) = (char)val;
115 static inline void i8042_write_command(int val)
117 *((unsigned char *)0xff810001) = (char)val;
120 static inline int i8042_platform_init(void)
122 i8042_reset = 1;
123 return 0;
126 static inline void i8042_platform_exit(void)
130 #else
132 #include "i8042-io.h"
134 #endif
136 #endif /* _I8042_PPCIO_H */