aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/serio/i8042-ppcio.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/input/serio/i8042-ppcio.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-ppcio.h')
-rw-r--r--drivers/input/serio/i8042-ppcio.h136
1 files changed, 136 insertions, 0 deletions
diff --git a/drivers/input/serio/i8042-ppcio.h b/drivers/input/serio/i8042-ppcio.h
new file mode 100644
index 000000000000..2906e1b60c04
--- /dev/null
+++ b/drivers/input/serio/i8042-ppcio.h
@@ -0,0 +1,136 @@
1#ifndef _I8042_PPCIO_H
2#define _I8042_PPCIO_H
3
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 */
9
10#if defined(CONFIG_WALNUT)
11
12#define I8042_KBD_IRQ 25
13#define I8042_AUX_IRQ 26
14
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"
18
19extern void *kb_cs;
20extern void *kb_data;
21
22#define I8042_COMMAND_REG (*(int *)kb_cs)
23#define I8042_DATA_REG (*(int *)kb_data)
24
25static inline int i8042_read_data(void)
26{
27 return readb(kb_data);
28}
29
30static inline int i8042_read_status(void)
31{
32 return readb(kb_cs);
33}
34
35static inline void i8042_write_data(int val)
36{
37 writeb(val, kb_data);
38}
39
40static inline void i8042_write_command(int val)
41{
42 writeb(val, kb_cs);
43}
44
45static inline int i8042_platform_init(void)
46{
47 i8042_reset = 1;
48 return 0;
49}
50
51static inline void i8042_platform_exit(void)
52{
53}
54
55#elif defined(CONFIG_SPRUCE)
56
57#define I8042_KBD_IRQ 22
58#define I8042_AUX_IRQ 21
59
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"
63
64#define I8042_COMMAND_REG 0xff810000
65#define I8042_DATA_REG 0xff810001
66
67static inline int i8042_read_data(void)
68{
69 unsigned long kbd_data;
70
71 __raw_writel(0x00000088, 0xff500008);
72 eieio();
73
74 __raw_writel(0x03000000, 0xff50000c);
75 eieio();
76
77 asm volatile("lis 7,0xff88 \n\
78 lswi 6,7,0x8 \n\
79 mr %0,6"
80 : "=r" (kbd_data) :: "6", "7");
81
82 __raw_writel(0x00000000, 0xff50000c);
83 eieio();
84
85 return (unsigned char)(kbd_data >> 24);
86}
87
88static inline int i8042_read_status(void)
89{
90 unsigned long kbd_status;
91
92 __raw_writel(0x00000088, 0xff500008);
93 eieio();
94
95 __raw_writel(0x03000000, 0xff50000c);
96 eieio();
97
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");
103
104 __raw_writel(0x00000000, 0xff50000c);
105 eieio();
106
107 return (unsigned char)(kbd_status >> 24);
108}
109
110static inline void i8042_write_data(int val)
111{
112 *((unsigned char *)0xff810000) = (char)val;
113}
114
115static inline void i8042_write_command(int val)
116{
117 *((unsigned char *)0xff810001) = (char)val;
118}
119
120static inline int i8042_platform_init(void)
121{
122 i8042_reset = 1;
123 return 0;
124}
125
126static inline void i8042_platform_exit(void)
127{
128}
129
130#else
131
132#include "i8042-io.h"
133
134#endif
135
136#endif /* _I8042_PPCIO_H */