blob: bb7a85c186e4c7d663c7798b6f25d453f2c4a6a3 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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>
7 * Copyright (C) 2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
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 */
Ralf Baechle42a3b4f2005-09-03 15:56:17 -070024#ifndef __NEC_VRC4173_H
25#define __NEC_VRC4173_H
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
27#include <linux/config.h>
28#include <asm/io.h>
29
30/*
31 * Interrupt Number
32 */
33#define VRC4173_IRQ_BASE 72
34#define VRC4173_IRQ(x) (VRC4173_IRQ_BASE + (x))
35#define VRC4173_USB_IRQ VRC4173_IRQ(0)
36#define VRC4173_PCMCIA2_IRQ VRC4173_IRQ(1)
37#define VRC4173_PCMCIA1_IRQ VRC4173_IRQ(2)
38#define VRC4173_PS2CH2_IRQ VRC4173_IRQ(3)
39#define VRC4173_PS2CH1_IRQ VRC4173_IRQ(4)
40#define VRC4173_PIU_IRQ VRC4173_IRQ(5)
41#define VRC4173_AIU_IRQ VRC4173_IRQ(6)
42#define VRC4173_KIU_IRQ VRC4173_IRQ(7)
43#define VRC4173_GIU_IRQ VRC4173_IRQ(8)
44#define VRC4173_AC97_IRQ VRC4173_IRQ(9)
45#define VRC4173_AC97INT1_IRQ VRC4173_IRQ(10)
46/* RFU */
47#define VRC4173_DOZEPIU_IRQ VRC4173_IRQ(13)
48#define VRC4173_IRQ_LAST VRC4173_DOZEPIU_IRQ
49
50/*
51 * PCI I/O accesses
52 */
53#ifdef CONFIG_VRC4173
54
55extern unsigned long vrc4173_io_offset;
56
57#define set_vrc4173_io_offset(offset) do { vrc4173_io_offset = (offset); } while (0)
58
59#define vrc4173_outb(val,port) outb((val), vrc4173_io_offset+(port))
60#define vrc4173_outw(val,port) outw((val), vrc4173_io_offset+(port))
61#define vrc4173_outl(val,port) outl((val), vrc4173_io_offset+(port))
62#define vrc4173_outb_p(val,port) outb_p((val), vrc4173_io_offset+(port))
63#define vrc4173_outw_p(val,port) outw_p((val), vrc4173_io_offset+(port))
64#define vrc4173_outl_p(val,port) outl_p((val), vrc4173_io_offset+(port))
65
66#define vrc4173_inb(port) inb(vrc4173_io_offset+(port))
67#define vrc4173_inw(port) inw(vrc4173_io_offset+(port))
68#define vrc4173_inl(port) inl(vrc4173_io_offset+(port))
69#define vrc4173_inb_p(port) inb_p(vrc4173_io_offset+(port))
70#define vrc4173_inw_p(port) inw_p(vrc4173_io_offset+(port))
71#define vrc4173_inl_p(port) inl_p(vrc4173_io_offset+(port))
72
73#define vrc4173_outsb(port,addr,count) outsb(vrc4173_io_offset+(port),(addr),(count))
74#define vrc4173_outsw(port,addr,count) outsw(vrc4173_io_offset+(port),(addr),(count))
75#define vrc4173_outsl(port,addr,count) outsl(vrc4173_io_offset+(port),(addr),(count))
76
77#define vrc4173_insb(port,addr,count) insb(vrc4173_io_offset+(port),(addr),(count))
78#define vrc4173_insw(port,addr,count) insw(vrc4173_io_offset+(port),(addr),(count))
79#define vrc4173_insl(port,addr,count) insl(vrc4173_io_offset+(port),(addr),(count))
80
81#else
82
83#define set_vrc4173_io_offset(offset) do {} while (0)
84
85#define vrc4173_outb(val,port) do {} while (0)
86#define vrc4173_outw(val,port) do {} while (0)
87#define vrc4173_outl(val,port) do {} while (0)
88#define vrc4173_outb_p(val,port) do {} while (0)
89#define vrc4173_outw_p(val,port) do {} while (0)
90#define vrc4173_outl_p(val,port) do {} while (0)
91
92#define vrc4173_inb(port) 0
93#define vrc4173_inw(port) 0
94#define vrc4173_inl(port) 0
95#define vrc4173_inb_p(port) 0
96#define vrc4173_inw_p(port) 0
97#define vrc4173_inl_p(port) 0
98
99#define vrc4173_outsb(port,addr,count) do {} while (0)
100#define vrc4173_outsw(port,addr,count) do {} while (0)
101#define vrc4173_outsl(port,addr,count) do {} while (0)
102
103#define vrc4173_insb(port,addr,count) do {} while (0)
104#define vrc4173_insw(port,addr,count) do {} while (0)
105#define vrc4173_insl(port,addr,count) do {} while (0)
106
107#endif
108
109/*
110 * Clock Mask Unit
111 */
112typedef enum vrc4173_clock {
113 VRC4173_PIU_CLOCK,
114 VRC4173_KIU_CLOCK,
115 VRC4173_AIU_CLOCK,
116 VRC4173_PS2_CH1_CLOCK,
117 VRC4173_PS2_CH2_CLOCK,
118 VRC4173_USBU_PCI_CLOCK,
119 VRC4173_CARDU1_PCI_CLOCK,
120 VRC4173_CARDU2_PCI_CLOCK,
121 VRC4173_AC97U_PCI_CLOCK,
122 VRC4173_USBU_48MHz_CLOCK,
123 VRC4173_EXT_48MHz_CLOCK,
124 VRC4173_48MHz_CLOCK,
125} vrc4173_clock_t;
126
127#ifdef CONFIG_VRC4173
128
129extern void vrc4173_supply_clock(vrc4173_clock_t clock);
130extern void vrc4173_mask_clock(vrc4173_clock_t clock);
131
132#else
133
134static inline void vrc4173_supply_clock(vrc4173_clock_t clock) {}
135static inline void vrc4173_mask_clock(vrc4173_clock_t clock) {}
136
137#endif
138
139/*
140 * Interupt Control Unit
141 */
142
143#define VRC4173_PIUINT_COMMAND 0x0040
144#define VRC4173_PIUINT_DATA 0x0020
145#define VRC4173_PIUINT_PAGE1 0x0010
146#define VRC4173_PIUINT_PAGE0 0x0008
147#define VRC4173_PIUINT_DATALOST 0x0004
148#define VRC4173_PIUINT_STATUSCHANGE 0x0001
149
150#ifdef CONFIG_VRC4173
151
152extern void vrc4173_enable_piuint(uint16_t mask);
153extern void vrc4173_disable_piuint(uint16_t mask);
154
155#else
156
157static inline void vrc4173_enable_piuint(uint16_t mask) {}
158static inline void vrc4173_disable_piuint(uint16_t mask) {}
159
160#endif
161
162#define VRC4173_AIUINT_INPUT_DMAEND 0x0800
163#define VRC4173_AIUINT_INPUT_DMAHALT 0x0400
164#define VRC4173_AIUINT_INPUT_DATALOST 0x0200
165#define VRC4173_AIUINT_INPUT_DATA 0x0100
166#define VRC4173_AIUINT_OUTPUT_DMAEND 0x0008
167#define VRC4173_AIUINT_OUTPUT_DMAHALT 0x0004
168#define VRC4173_AIUINT_OUTPUT_NODATA 0x0002
169
170#ifdef CONFIG_VRC4173
171
172extern void vrc4173_enable_aiuint(uint16_t mask);
173extern void vrc4173_disable_aiuint(uint16_t mask);
174
175#else
176
177static inline void vrc4173_enable_aiuint(uint16_t mask) {}
178static inline void vrc4173_disable_aiuint(uint16_t mask) {}
179
180#endif
181
182#define VRC4173_KIUINT_DATALOST 0x0004
183#define VRC4173_KIUINT_DATAREADY 0x0002
184#define VRC4173_KIUINT_SCAN 0x0001
185
186#ifdef CONFIG_VRC4173
187
188extern void vrc4173_enable_kiuint(uint16_t mask);
189extern void vrc4173_disable_kiuint(uint16_t mask);
190
191#else
192
193static inline void vrc4173_enable_kiuint(uint16_t mask) {}
194static inline void vrc4173_disable_kiuint(uint16_t mask) {}
195
196#endif
197
198/*
199 * General-Purpose I/O Unit
200 */
201typedef enum vrc4173_function {
202 PS2_CHANNEL1,
203 PS2_CHANNEL2,
204 TOUCHPANEL,
205 KEYBOARD_8SCANLINES,
206 KEYBOARD_10SCANLINES,
207 KEYBOARD_12SCANLINES,
208 GPIO_0_15PINS,
209 GPIO_16_20PINS,
210} vrc4173_function_t;
211
212#ifdef CONFIG_VRC4173
213
214extern void vrc4173_select_function(vrc4173_function_t function);
215
216#else
217
218static inline void vrc4173_select_function(vrc4173_function_t function) {}
219
220#endif
221
222#endif /* __NEC_VRC4173_H */