]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * vrc4173.h, Include file for NEC VRC4173. | |
3 | * | |
4 | * Copyright (C) 2000 Michael R. McDonald | |
5 | * Copyright (C) 2001-2003 Montavista Software Inc. | |
6 | * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> | |
29ce2c76 | 7 | * Copyright (C) 2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> |
1da177e4 LT |
8 | * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; either version 2 of the License, or | |
13 | * (at your option) any later version. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | * GNU General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with this program; if not, write to the Free Software | |
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 | */ | |
42a3b4f2 RB |
24 | #ifndef __NEC_VRC4173_H |
25 | #define __NEC_VRC4173_H | |
1da177e4 | 26 | |
1da177e4 LT |
27 | #include <asm/io.h> |
28 | ||
1da177e4 LT |
29 | /* |
30 | * PCI I/O accesses | |
31 | */ | |
32 | #ifdef CONFIG_VRC4173 | |
33 | ||
34 | extern unsigned long vrc4173_io_offset; | |
35 | ||
36 | #define set_vrc4173_io_offset(offset) do { vrc4173_io_offset = (offset); } while (0) | |
37 | ||
38 | #define vrc4173_outb(val,port) outb((val), vrc4173_io_offset+(port)) | |
39 | #define vrc4173_outw(val,port) outw((val), vrc4173_io_offset+(port)) | |
40 | #define vrc4173_outl(val,port) outl((val), vrc4173_io_offset+(port)) | |
41 | #define vrc4173_outb_p(val,port) outb_p((val), vrc4173_io_offset+(port)) | |
42 | #define vrc4173_outw_p(val,port) outw_p((val), vrc4173_io_offset+(port)) | |
43 | #define vrc4173_outl_p(val,port) outl_p((val), vrc4173_io_offset+(port)) | |
44 | ||
45 | #define vrc4173_inb(port) inb(vrc4173_io_offset+(port)) | |
46 | #define vrc4173_inw(port) inw(vrc4173_io_offset+(port)) | |
47 | #define vrc4173_inl(port) inl(vrc4173_io_offset+(port)) | |
48 | #define vrc4173_inb_p(port) inb_p(vrc4173_io_offset+(port)) | |
49 | #define vrc4173_inw_p(port) inw_p(vrc4173_io_offset+(port)) | |
50 | #define vrc4173_inl_p(port) inl_p(vrc4173_io_offset+(port)) | |
51 | ||
52 | #define vrc4173_outsb(port,addr,count) outsb(vrc4173_io_offset+(port),(addr),(count)) | |
53 | #define vrc4173_outsw(port,addr,count) outsw(vrc4173_io_offset+(port),(addr),(count)) | |
54 | #define vrc4173_outsl(port,addr,count) outsl(vrc4173_io_offset+(port),(addr),(count)) | |
55 | ||
56 | #define vrc4173_insb(port,addr,count) insb(vrc4173_io_offset+(port),(addr),(count)) | |
57 | #define vrc4173_insw(port,addr,count) insw(vrc4173_io_offset+(port),(addr),(count)) | |
58 | #define vrc4173_insl(port,addr,count) insl(vrc4173_io_offset+(port),(addr),(count)) | |
59 | ||
60 | #else | |
61 | ||
62 | #define set_vrc4173_io_offset(offset) do {} while (0) | |
63 | ||
64 | #define vrc4173_outb(val,port) do {} while (0) | |
65 | #define vrc4173_outw(val,port) do {} while (0) | |
66 | #define vrc4173_outl(val,port) do {} while (0) | |
67 | #define vrc4173_outb_p(val,port) do {} while (0) | |
68 | #define vrc4173_outw_p(val,port) do {} while (0) | |
69 | #define vrc4173_outl_p(val,port) do {} while (0) | |
70 | ||
71 | #define vrc4173_inb(port) 0 | |
72 | #define vrc4173_inw(port) 0 | |
73 | #define vrc4173_inl(port) 0 | |
74 | #define vrc4173_inb_p(port) 0 | |
75 | #define vrc4173_inw_p(port) 0 | |
76 | #define vrc4173_inl_p(port) 0 | |
77 | ||
78 | #define vrc4173_outsb(port,addr,count) do {} while (0) | |
79 | #define vrc4173_outsw(port,addr,count) do {} while (0) | |
80 | #define vrc4173_outsl(port,addr,count) do {} while (0) | |
81 | ||
82 | #define vrc4173_insb(port,addr,count) do {} while (0) | |
83 | #define vrc4173_insw(port,addr,count) do {} while (0) | |
84 | #define vrc4173_insl(port,addr,count) do {} while (0) | |
85 | ||
86 | #endif | |
87 | ||
88 | /* | |
89 | * Clock Mask Unit | |
90 | */ | |
91 | typedef enum vrc4173_clock { | |
92 | VRC4173_PIU_CLOCK, | |
93 | VRC4173_KIU_CLOCK, | |
94 | VRC4173_AIU_CLOCK, | |
95 | VRC4173_PS2_CH1_CLOCK, | |
96 | VRC4173_PS2_CH2_CLOCK, | |
97 | VRC4173_USBU_PCI_CLOCK, | |
98 | VRC4173_CARDU1_PCI_CLOCK, | |
99 | VRC4173_CARDU2_PCI_CLOCK, | |
100 | VRC4173_AC97U_PCI_CLOCK, | |
101 | VRC4173_USBU_48MHz_CLOCK, | |
102 | VRC4173_EXT_48MHz_CLOCK, | |
103 | VRC4173_48MHz_CLOCK, | |
104 | } vrc4173_clock_t; | |
105 | ||
106 | #ifdef CONFIG_VRC4173 | |
107 | ||
108 | extern void vrc4173_supply_clock(vrc4173_clock_t clock); | |
109 | extern void vrc4173_mask_clock(vrc4173_clock_t clock); | |
110 | ||
111 | #else | |
112 | ||
113 | static inline void vrc4173_supply_clock(vrc4173_clock_t clock) {} | |
114 | static inline void vrc4173_mask_clock(vrc4173_clock_t clock) {} | |
115 | ||
116 | #endif | |
117 | ||
118 | /* | |
119 | * Interupt Control Unit | |
120 | */ | |
121 | ||
122 | #define VRC4173_PIUINT_COMMAND 0x0040 | |
123 | #define VRC4173_PIUINT_DATA 0x0020 | |
124 | #define VRC4173_PIUINT_PAGE1 0x0010 | |
125 | #define VRC4173_PIUINT_PAGE0 0x0008 | |
126 | #define VRC4173_PIUINT_DATALOST 0x0004 | |
127 | #define VRC4173_PIUINT_STATUSCHANGE 0x0001 | |
128 | ||
129 | #ifdef CONFIG_VRC4173 | |
130 | ||
131 | extern void vrc4173_enable_piuint(uint16_t mask); | |
132 | extern void vrc4173_disable_piuint(uint16_t mask); | |
133 | ||
134 | #else | |
135 | ||
136 | static inline void vrc4173_enable_piuint(uint16_t mask) {} | |
137 | static inline void vrc4173_disable_piuint(uint16_t mask) {} | |
138 | ||
139 | #endif | |
140 | ||
141 | #define VRC4173_AIUINT_INPUT_DMAEND 0x0800 | |
142 | #define VRC4173_AIUINT_INPUT_DMAHALT 0x0400 | |
143 | #define VRC4173_AIUINT_INPUT_DATALOST 0x0200 | |
144 | #define VRC4173_AIUINT_INPUT_DATA 0x0100 | |
145 | #define VRC4173_AIUINT_OUTPUT_DMAEND 0x0008 | |
146 | #define VRC4173_AIUINT_OUTPUT_DMAHALT 0x0004 | |
147 | #define VRC4173_AIUINT_OUTPUT_NODATA 0x0002 | |
148 | ||
149 | #ifdef CONFIG_VRC4173 | |
150 | ||
151 | extern void vrc4173_enable_aiuint(uint16_t mask); | |
152 | extern void vrc4173_disable_aiuint(uint16_t mask); | |
153 | ||
154 | #else | |
155 | ||
156 | static inline void vrc4173_enable_aiuint(uint16_t mask) {} | |
157 | static inline void vrc4173_disable_aiuint(uint16_t mask) {} | |
158 | ||
159 | #endif | |
160 | ||
161 | #define VRC4173_KIUINT_DATALOST 0x0004 | |
162 | #define VRC4173_KIUINT_DATAREADY 0x0002 | |
163 | #define VRC4173_KIUINT_SCAN 0x0001 | |
164 | ||
165 | #ifdef CONFIG_VRC4173 | |
166 | ||
167 | extern void vrc4173_enable_kiuint(uint16_t mask); | |
168 | extern void vrc4173_disable_kiuint(uint16_t mask); | |
169 | ||
170 | #else | |
171 | ||
172 | static inline void vrc4173_enable_kiuint(uint16_t mask) {} | |
173 | static inline void vrc4173_disable_kiuint(uint16_t mask) {} | |
174 | ||
175 | #endif | |
176 | ||
177 | /* | |
178 | * General-Purpose I/O Unit | |
179 | */ | |
180 | typedef enum vrc4173_function { | |
181 | PS2_CHANNEL1, | |
182 | PS2_CHANNEL2, | |
183 | TOUCHPANEL, | |
184 | KEYBOARD_8SCANLINES, | |
185 | KEYBOARD_10SCANLINES, | |
186 | KEYBOARD_12SCANLINES, | |
187 | GPIO_0_15PINS, | |
188 | GPIO_16_20PINS, | |
189 | } vrc4173_function_t; | |
190 | ||
191 | #ifdef CONFIG_VRC4173 | |
192 | ||
193 | extern void vrc4173_select_function(vrc4173_function_t function); | |
194 | ||
195 | #else | |
196 | ||
197 | static inline void vrc4173_select_function(vrc4173_function_t function) {} | |
198 | ||
199 | #endif | |
200 | ||
201 | #endif /* __NEC_VRC4173_H */ |