diff options
Diffstat (limited to 'arch/m32r/kernel/io_usrv.c')
-rw-r--r-- | arch/m32r/kernel/io_usrv.c | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/arch/m32r/kernel/io_usrv.c b/arch/m32r/kernel/io_usrv.c index 27928a0b99ed..9eb161dcc104 100644 --- a/arch/m32r/kernel/io_usrv.c +++ b/arch/m32r/kernel/io_usrv.c | |||
@@ -3,8 +3,8 @@ | |||
3 | * | 3 | * |
4 | * Typical I/O routines for uServer board. | 4 | * Typical I/O routines for uServer board. |
5 | * | 5 | * |
6 | * Copyright (c) 2001 - 2003 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 |
@@ -39,7 +39,7 @@ extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); | |||
39 | 39 | ||
40 | #define PORT2ADDR(port) _port2addr(port) | 40 | #define PORT2ADDR(port) _port2addr(port) |
41 | 41 | ||
42 | static __inline__ void *_port2addr(unsigned long port) | 42 | static inline void *_port2addr(unsigned long port) |
43 | { | 43 | { |
44 | #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) | 44 | #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) |
45 | if (port >= UART0_IOSTART && port <= UART0_IOEND) | 45 | if (port >= UART0_IOSTART && port <= UART0_IOEND) |
@@ -50,7 +50,7 @@ static __inline__ void *_port2addr(unsigned long port) | |||
50 | return (void *)(port + NONCACHE_OFFSET); | 50 | return (void *)(port + NONCACHE_OFFSET); |
51 | } | 51 | } |
52 | 52 | ||
53 | static __inline__ void delay(void) | 53 | static inline void delay(void) |
54 | { | 54 | { |
55 | __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); | 55 | __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); |
56 | } | 56 | } |
@@ -87,39 +87,22 @@ unsigned long _inl(unsigned long port) | |||
87 | 87 | ||
88 | unsigned char _inb_p(unsigned long port) | 88 | unsigned char _inb_p(unsigned long port) |
89 | { | 89 | { |
90 | unsigned char b; | 90 | unsigned char v = _inb(port); |
91 | 91 | delay(); | |
92 | if (port >= CFC_IOSTART && port <= CFC_IOEND) { | 92 | return v; |
93 | pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); | ||
94 | return b; | ||
95 | } else { | ||
96 | b = *(volatile unsigned char *)PORT2ADDR(port); | ||
97 | delay(); | ||
98 | return b; | ||
99 | } | ||
100 | } | 93 | } |
101 | 94 | ||
102 | unsigned short _inw_p(unsigned long port) | 95 | unsigned short _inw_p(unsigned long port) |
103 | { | 96 | { |
104 | unsigned short w; | 97 | unsigned short v = _inw(port); |
105 | 98 | delay(); | |
106 | if (port >= CFC_IOSTART && port <= CFC_IOEND) { | 99 | return v; |
107 | pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); | ||
108 | return w; | ||
109 | } else { | ||
110 | w = *(volatile unsigned short *)PORT2ADDR(port); | ||
111 | delay(); | ||
112 | return w; | ||
113 | } | ||
114 | } | 100 | } |
115 | 101 | ||
116 | unsigned long _inl_p(unsigned long port) | 102 | unsigned long _inl_p(unsigned long port) |
117 | { | 103 | { |
118 | unsigned long v; | 104 | unsigned long v = _inl(port); |
119 | |||
120 | v = *(volatile unsigned long *)PORT2ADDR(port); | ||
121 | delay(); | 105 | delay(); |
122 | |||
123 | return v; | 106 | return v; |
124 | } | 107 | } |
125 | 108 | ||
@@ -149,25 +132,19 @@ void _outl(unsigned long l, unsigned long port) | |||
149 | 132 | ||
150 | void _outb_p(unsigned char b, unsigned long port) | 133 | void _outb_p(unsigned char b, unsigned long port) |
151 | { | 134 | { |
152 | if (port >= CFC_IOSTART && port <= CFC_IOEND) | 135 | _outb(b, port); |
153 | pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); | ||
154 | else | ||
155 | *(volatile unsigned char *)PORT2ADDR(port) = b; | ||
156 | delay(); | 136 | delay(); |
157 | } | 137 | } |
158 | 138 | ||
159 | void _outw_p(unsigned short w, unsigned long port) | 139 | void _outw_p(unsigned short w, unsigned long port) |
160 | { | 140 | { |
161 | if (port >= CFC_IOSTART && port <= CFC_IOEND) | 141 | _outw(w, port); |
162 | pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); | ||
163 | else | ||
164 | *(volatile unsigned short *)PORT2ADDR(port) = w; | ||
165 | delay(); | 142 | delay(); |
166 | } | 143 | } |
167 | 144 | ||
168 | void _outl_p(unsigned long l, unsigned long port) | 145 | void _outl_p(unsigned long l, unsigned long port) |
169 | { | 146 | { |
170 | *(volatile unsigned long *)PORT2ADDR(port) = l; | 147 | _outl(l, port); |
171 | delay(); | 148 | delay(); |
172 | } | 149 | } |
173 | 150 | ||