aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m32r/kernel/io_opsput.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m32r/kernel/io_opsput.c')
-rw-r--r--arch/m32r/kernel/io_opsput.c79
1 files changed, 9 insertions, 70 deletions
diff --git a/arch/m32r/kernel/io_opsput.c b/arch/m32r/kernel/io_opsput.c
index aaf42f9f76da..e34951e8156f 100644
--- a/arch/m32r/kernel/io_opsput.c
+++ b/arch/m32r/kernel/io_opsput.c
@@ -1,10 +1,10 @@
1/* 1/*
2 * linux/arch/m32r/kernel/io_mappi.c 2 * linux/arch/m32r/kernel/io_opsput.c
3 * 3 *
4 * Typical I/O routines for OPSPUT board. 4 * Typical I/O routines for OPSPUT board.
5 * 5 *
6 * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, 6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Takeo Takahashi 7 * Hitoshi Yamamoto, Takeo Takahashi
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General 9 * This file is subject to the terms and conditions of the GNU General
10 * Public License. See the file "COPYING" in the main directory of this 10 * Public License. See the file "COPYING" in the main directory of this
@@ -98,7 +98,6 @@ unsigned char _inb(unsigned long port)
98{ 98{
99 if (port >= LAN_IOSTART && port < LAN_IOEND) 99 if (port >= LAN_IOSTART && port < LAN_IOEND)
100 return _ne_inb(PORT2ADDR_NE(port)); 100 return _ne_inb(PORT2ADDR_NE(port));
101
102#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) 101#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
103 else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { 102 else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
104 unsigned char b; 103 unsigned char b;
@@ -118,7 +117,6 @@ unsigned short _inw(unsigned long port)
118 else if(port >= 0x340 && port < 0x3a0) 117 else if(port >= 0x340 && port < 0x3a0)
119 return *(volatile unsigned short *)PORT2ADDR_USB(port); 118 return *(volatile unsigned short *)PORT2ADDR_USB(port);
120#endif 119#endif
121
122#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) 120#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
123 else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { 121 else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
124 unsigned short w; 122 unsigned short w;
@@ -143,55 +141,21 @@ unsigned long _inl(unsigned long port)
143 141
144unsigned char _inb_p(unsigned long port) 142unsigned char _inb_p(unsigned long port)
145{ 143{
146 unsigned char v; 144 unsigned char v = _inb(port);
147
148 if (port >= LAN_IOSTART && port < LAN_IOEND)
149 v = _ne_inb(PORT2ADDR_NE(port));
150 else
151#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
152 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
153 unsigned char b;
154 pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0);
155 return b;
156 } else
157#endif
158 v = *(volatile unsigned char *)PORT2ADDR(port);
159
160 delay(); 145 delay();
161 return (v); 146 return (v);
162} 147}
163 148
164unsigned short _inw_p(unsigned long port) 149unsigned short _inw_p(unsigned long port)
165{ 150{
166 unsigned short v; 151 unsigned short v = _inw(port);
167
168 if (port >= LAN_IOSTART && port < LAN_IOEND)
169 v = _ne_inw(PORT2ADDR_NE(port));
170 else
171#if defined(CONFIG_USB)
172 if(port >= 0x340 && port < 0x3a0)
173 return *(volatile unsigned short *)PORT2ADDR_USB(port);
174 else
175#endif
176
177#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
178 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
179 unsigned short w;
180 pcc_ioread_word(0, port, &w, sizeof(w), 1, 0);
181 return w;
182 } else
183#endif
184 v = *(volatile unsigned short *)PORT2ADDR(port);
185
186 delay(); 152 delay();
187 return (v); 153 return (v);
188} 154}
189 155
190unsigned long _inl_p(unsigned long port) 156unsigned long _inl_p(unsigned long port)
191{ 157{
192 unsigned long v; 158 unsigned long v = _inl(port);
193
194 v = *(volatile unsigned long *)PORT2ADDR(port);
195 delay(); 159 delay();
196 return (v); 160 return (v);
197} 161}
@@ -219,7 +183,6 @@ void _outw(unsigned short w, unsigned long port)
219 *(volatile unsigned short *)PORT2ADDR_USB(port) = w; 183 *(volatile unsigned short *)PORT2ADDR_USB(port) = w;
220 else 184 else
221#endif 185#endif
222
223#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) 186#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
224 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { 187 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
225 pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); 188 pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0);
@@ -240,43 +203,19 @@ void _outl(unsigned long l, unsigned long port)
240 203
241void _outb_p(unsigned char b, unsigned long port) 204void _outb_p(unsigned char b, unsigned long port)
242{ 205{
243 if (port >= LAN_IOSTART && port < LAN_IOEND) 206 _outb(b, port);
244 _ne_outb(b, PORT2ADDR_NE(port));
245 else
246#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
247 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
248 pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0);
249 } else
250#endif
251 *(volatile unsigned char *)PORT2ADDR(port) = b;
252
253 delay(); 207 delay();
254} 208}
255 209
256void _outw_p(unsigned short w, unsigned long port) 210void _outw_p(unsigned short w, unsigned long port)
257{ 211{
258 if (port >= LAN_IOSTART && port < LAN_IOEND) 212 _outw(w, port);
259 _ne_outw(w, PORT2ADDR_NE(port));
260 else
261#if defined(CONFIG_USB)
262 if(port >= 0x340 && port < 0x3a0)
263 *(volatile unsigned short *)PORT2ADDR_USB(port) = w;
264 else
265#endif
266
267#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
268 if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
269 pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0);
270 } else
271#endif
272 *(volatile unsigned short *)PORT2ADDR(port) = w;
273
274 delay(); 213 delay();
275} 214}
276 215
277void _outl_p(unsigned long l, unsigned long port) 216void _outl_p(unsigned long l, unsigned long port)
278{ 217{
279 *(volatile unsigned long *)PORT2ADDR(port) = l; 218 _outl(l, port);
280 delay(); 219 delay();
281} 220}
282 221