diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-10-03 16:25:52 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-10-03 16:25:52 -0400 |
commit | 14866543ad22014a0b12e10657a917eb6b487248 (patch) | |
tree | 178f36abc7615347626ec28ee2bd0efffe5500ac | |
parent | bc0f424faa11a2017ba725bb8c5fc481ece7b440 (diff) |
sh: More I/O routine overhauling.
This tidies up a lot of the PIO/MMIO split. No in-tree platforms were
making use of the MMIO overloading through the machvec (nor have any of
them been in some time), so we just kill all of that off. The ISA I/O
routine wrapping remains unaffected, which remains the only special
casing outside of the iomap API that boards need to think about.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/include/asm/io.h | 257 | ||||
-rw-r--r-- | arch/sh/include/asm/io_generic.h | 7 | ||||
-rw-r--r-- | arch/sh/include/asm/machvec.h | 7 | ||||
-rw-r--r-- | arch/sh/kernel/io.c | 12 | ||||
-rw-r--r-- | arch/sh/kernel/io_generic.c | 61 | ||||
-rw-r--r-- | arch/sh/kernel/machvec.c | 3 |
6 files changed, 115 insertions, 232 deletions
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h index d9e794eff830..436c28539577 100644 --- a/arch/sh/include/asm/io.h +++ b/arch/sh/include/asm/io.h | |||
@@ -1,27 +1,26 @@ | |||
1 | #ifndef __ASM_SH_IO_H | 1 | #ifndef __ASM_SH_IO_H |
2 | #define __ASM_SH_IO_H | 2 | #define __ASM_SH_IO_H |
3 | |||
4 | /* | 3 | /* |
5 | * Convention: | 4 | * Convention: |
6 | * read{b,w,l}/write{b,w,l} are for PCI, | 5 | * read{b,w,l,q}/write{b,w,l,q} are for PCI, |
7 | * while in{b,w,l}/out{b,w,l} are for ISA | 6 | * while in{b,w,l}/out{b,w,l} are for ISA |
8 | * These may (will) be platform specific function. | 7 | * |
9 | * In addition we have 'pausing' versions: in{b,w,l}_p/out{b,w,l}_p | 8 | * In addition we have 'pausing' versions: in{b,w,l}_p/out{b,w,l}_p |
10 | * and 'string' versions: ins{b,w,l}/outs{b,w,l} | 9 | * and 'string' versions: ins{b,w,l}/outs{b,w,l} |
11 | * For read{b,w,l} and write{b,w,l} there are also __raw versions, which | ||
12 | * do not have a memory barrier after them. | ||
13 | * | 10 | * |
14 | * In addition, we have | 11 | * While read{b,w,l,q} and write{b,w,l,q} contain memory barriers |
15 | * ctrl_in{b,w,l}/ctrl_out{b,w,l} for SuperH specific I/O. | 12 | * automatically, there are also __raw versions, which do not. |
16 | * which are processor specific. | 13 | * |
17 | */ | 14 | * Historically, we have also had ctrl_in{b,w,l,q}/ctrl_out{b,w,l,q} for |
18 | 15 | * SuperH specific I/O (raw I/O to on-chip CPU peripherals). In practice | |
19 | /* | 16 | * these have the same semantics as the __raw variants, and as such, all |
20 | * We follow the Alpha convention here: | 17 | * new code should be using the __raw versions. |
21 | * __inb expands to an inline function call (which calls via the mv) | 18 | * |
22 | * _inb is a real function call (note ___raw fns are _ version of __raw) | 19 | * All ISA I/O routines are wrapped through the machine vector. If a |
23 | * inb by default expands to _inb, but the machine specific code may | 20 | * board does not provide overrides, a generic set that are copied in |
24 | * define it to __inb if it chooses. | 21 | * from the default machine vector are used instead. These are largely |
22 | * for old compat code for I/O offseting to SuperIOs, all of which are | ||
23 | * better handled through the machvec ioport mapping routines these days. | ||
25 | */ | 24 | */ |
26 | #include <asm/cache.h> | 25 | #include <asm/cache.h> |
27 | #include <asm/system.h> | 26 | #include <asm/system.h> |
@@ -31,7 +30,6 @@ | |||
31 | #include <asm-generic/iomap.h> | 30 | #include <asm-generic/iomap.h> |
32 | 31 | ||
33 | #ifdef __KERNEL__ | 32 | #ifdef __KERNEL__ |
34 | |||
35 | /* | 33 | /* |
36 | * Depending on which platform we are running on, we need different | 34 | * Depending on which platform we are running on, we need different |
37 | * I/O functions. | 35 | * I/O functions. |
@@ -40,90 +38,64 @@ | |||
40 | #include <asm/io_generic.h> | 38 | #include <asm/io_generic.h> |
41 | #include <asm/io_trapped.h> | 39 | #include <asm/io_trapped.h> |
42 | 40 | ||
43 | #define maybebadio(port) \ | 41 | #define inb(p) sh_mv.mv_inb((p)) |
44 | printk(KERN_ERR "bad PC-like io %s:%u for port 0x%lx at 0x%08x\n", \ | 42 | #define inw(p) sh_mv.mv_inw((p)) |
45 | __FUNCTION__, __LINE__, (port), (u32)__builtin_return_address(0)) | 43 | #define inl(p) sh_mv.mv_inl((p)) |
44 | #define outb(x,p) sh_mv.mv_outb((x),(p)) | ||
45 | #define outw(x,p) sh_mv.mv_outw((x),(p)) | ||
46 | #define outl(x,p) sh_mv.mv_outl((x),(p)) | ||
47 | |||
48 | #define inb_p(p) sh_mv.mv_inb_p((p)) | ||
49 | #define inw_p(p) sh_mv.mv_inw_p((p)) | ||
50 | #define inl_p(p) sh_mv.mv_inl_p((p)) | ||
51 | #define outb_p(x,p) sh_mv.mv_outb_p((x),(p)) | ||
52 | #define outw_p(x,p) sh_mv.mv_outw_p((x),(p)) | ||
53 | #define outl_p(x,p) sh_mv.mv_outl_p((x),(p)) | ||
54 | |||
55 | #define insb(p,b,c) sh_mv.mv_insb((p), (b), (c)) | ||
56 | #define insw(p,b,c) sh_mv.mv_insw((p), (b), (c)) | ||
57 | #define insl(p,b,c) sh_mv.mv_insl((p), (b), (c)) | ||
58 | #define outsb(p,b,c) sh_mv.mv_outsb((p), (b), (c)) | ||
59 | #define outsw(p,b,c) sh_mv.mv_outsw((p), (b), (c)) | ||
60 | #define outsl(p,b,c) sh_mv.mv_outsl((p), (b), (c)) | ||
61 | |||
62 | #define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile u8 __force *)(a) = (v)) | ||
63 | #define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile u16 __force *)(a) = (v)) | ||
64 | #define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v)) | ||
65 | #define __raw_writeq(v,a) (__chk_io_ptr(a), *(volatile u64 __force *)(a) = (v)) | ||
66 | |||
67 | #define __raw_readb(a) (__chk_io_ptr(a), *(volatile u8 __force *)(a)) | ||
68 | #define __raw_readw(a) (__chk_io_ptr(a), *(volatile u16 __force *)(a)) | ||
69 | #define __raw_readl(a) (__chk_io_ptr(a), *(volatile u32 __force *)(a)) | ||
70 | #define __raw_readq(a) (__chk_io_ptr(a), *(volatile u64 __force *)(a)) | ||
71 | |||
72 | #define readb(a) ({ u8 r_ = __raw_readb(a); mb(); r_; }) | ||
73 | #define readw(a) ({ u16 r_ = __raw_readw(a); mb(); r_; }) | ||
74 | #define readl(a) ({ u32 r_ = __raw_readl(a); mb(); r_; }) | ||
75 | #define readq(a) ({ u64 r_ = __raw_readq(a); mb(); r_; }) | ||
76 | |||
77 | #define writeb(v,a) ({ __raw_writeb((v),(a)); mb(); }) | ||
78 | #define writew(v,a) ({ __raw_writew((v),(a)); mb(); }) | ||
79 | #define writel(v,a) ({ __raw_writel((v),(a)); mb(); }) | ||
80 | #define writeq(v,a) ({ __raw_writeq((v),(a)); mb(); }) | ||
46 | 81 | ||
47 | /* | 82 | /* SuperH on-chip I/O functions */ |
48 | * Since boards are able to define their own set of I/O routines through | 83 | #define ctrl_inb __raw_readb |
49 | * their respective machine vector, we always wrap through the mv. | 84 | #define ctrl_inw __raw_readw |
50 | * | 85 | #define ctrl_inl __raw_readl |
51 | * Also, in the event that a board hasn't provided its own definition for | 86 | #define ctrl_inq __raw_readq |
52 | * a given routine, it will be wrapped to generic code at run-time. | ||
53 | */ | ||
54 | |||
55 | #define __inb(p) sh_mv.mv_inb((p)) | ||
56 | #define __inw(p) sh_mv.mv_inw((p)) | ||
57 | #define __inl(p) sh_mv.mv_inl((p)) | ||
58 | #define __outb(x,p) sh_mv.mv_outb((x),(p)) | ||
59 | #define __outw(x,p) sh_mv.mv_outw((x),(p)) | ||
60 | #define __outl(x,p) sh_mv.mv_outl((x),(p)) | ||
61 | |||
62 | #define __inb_p(p) sh_mv.mv_inb_p((p)) | ||
63 | #define __inw_p(p) sh_mv.mv_inw_p((p)) | ||
64 | #define __inl_p(p) sh_mv.mv_inl_p((p)) | ||
65 | #define __outb_p(x,p) sh_mv.mv_outb_p((x),(p)) | ||
66 | #define __outw_p(x,p) sh_mv.mv_outw_p((x),(p)) | ||
67 | #define __outl_p(x,p) sh_mv.mv_outl_p((x),(p)) | ||
68 | |||
69 | #define __insb(p,b,c) sh_mv.mv_insb((p), (b), (c)) | ||
70 | #define __insw(p,b,c) sh_mv.mv_insw((p), (b), (c)) | ||
71 | #define __insl(p,b,c) sh_mv.mv_insl((p), (b), (c)) | ||
72 | #define __outsb(p,b,c) sh_mv.mv_outsb((p), (b), (c)) | ||
73 | #define __outsw(p,b,c) sh_mv.mv_outsw((p), (b), (c)) | ||
74 | #define __outsl(p,b,c) sh_mv.mv_outsl((p), (b), (c)) | ||
75 | |||
76 | #define __readb(a) sh_mv.mv_readb((a)) | ||
77 | #define __readw(a) sh_mv.mv_readw((a)) | ||
78 | #define __readl(a) sh_mv.mv_readl((a)) | ||
79 | #define __writeb(v,a) sh_mv.mv_writeb((v),(a)) | ||
80 | #define __writew(v,a) sh_mv.mv_writew((v),(a)) | ||
81 | #define __writel(v,a) sh_mv.mv_writel((v),(a)) | ||
82 | |||
83 | #define inb __inb | ||
84 | #define inw __inw | ||
85 | #define inl __inl | ||
86 | #define outb __outb | ||
87 | #define outw __outw | ||
88 | #define outl __outl | ||
89 | |||
90 | #define inb_p __inb_p | ||
91 | #define inw_p __inw_p | ||
92 | #define inl_p __inl_p | ||
93 | #define outb_p __outb_p | ||
94 | #define outw_p __outw_p | ||
95 | #define outl_p __outl_p | ||
96 | |||
97 | #define insb __insb | ||
98 | #define insw __insw | ||
99 | #define insl __insl | ||
100 | #define outsb __outsb | ||
101 | #define outsw __outsw | ||
102 | #define outsl __outsl | ||
103 | |||
104 | #define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a) = (v)) | ||
105 | #define __raw_writew(v,a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v)) | ||
106 | #define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a) = (v)) | ||
107 | |||
108 | #define __raw_readb(a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a)) | ||
109 | #define __raw_readw(a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a)) | ||
110 | #define __raw_readl(a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a)) | ||
111 | |||
112 | void __raw_writesl(void __iomem *addr, const void *data, int longlen); | ||
113 | void __raw_readsl(const void __iomem *addr, void *data, int longlen); | ||
114 | 87 | ||
115 | /* | 88 | #define ctrl_outb __raw_writeb |
116 | * The platform header files may define some of these macros to use | 89 | #define ctrl_outw __raw_writew |
117 | * the inlined versions where appropriate. These macros may also be | 90 | #define ctrl_outl __raw_writel |
118 | * redefined by userlevel programs. | 91 | #define ctrl_outq __raw_writeq |
119 | */ | ||
120 | #define readb(a) ({ unsigned int r_ = __readb(a); mb(); r_; }) | ||
121 | #define readw(a) ({ unsigned int r_ = __readw(a); mb(); r_; }) | ||
122 | #define readl(a) ({ unsigned int r_ = __readl(a); mb(); r_; }) | ||
123 | 92 | ||
124 | #define writeb(v,a) ({ __writeb((v),(a)); mb(); }) | 93 | static inline void ctrl_delay(void) |
125 | #define writew(v,a) ({ __writew((v),(a)); mb(); }) | 94 | { |
126 | #define writel(v,a) ({ __writel((v),(a)); mb(); }) | 95 | #ifdef P2SEG |
96 | __raw_readw(P2SEG); | ||
97 | #endif | ||
98 | } | ||
127 | 99 | ||
128 | #define __BUILD_MEMORY_STRING(bwlq, type) \ | 100 | #define __BUILD_MEMORY_STRING(bwlq, type) \ |
129 | \ | 101 | \ |
@@ -151,18 +123,23 @@ static inline void __raw_reads##bwlq(volatile void __iomem *mem, \ | |||
151 | 123 | ||
152 | __BUILD_MEMORY_STRING(b, u8) | 124 | __BUILD_MEMORY_STRING(b, u8) |
153 | __BUILD_MEMORY_STRING(w, u16) | 125 | __BUILD_MEMORY_STRING(w, u16) |
126 | __BUILD_MEMORY_STRING(q, u64) | ||
127 | |||
128 | void __raw_writesl(void __iomem *addr, const void *data, int longlen); | ||
129 | void __raw_readsl(const void __iomem *addr, void *data, int longlen); | ||
154 | 130 | ||
155 | #define writesb __raw_writesb | 131 | #define writesb __raw_writesb |
156 | #define writesw __raw_writesw | 132 | #define writesw __raw_writesw |
157 | #define writesl __raw_writesl | 133 | #define writesl __raw_writesl |
158 | 134 | ||
159 | #define readsb __raw_readsb | 135 | #define readsb __raw_readsb |
160 | #define readsw __raw_readsw | 136 | #define readsw __raw_readsw |
161 | #define readsl __raw_readsl | 137 | #define readsl __raw_readsl |
162 | 138 | ||
163 | #define readb_relaxed(a) readb(a) | 139 | #define readb_relaxed(a) readb(a) |
164 | #define readw_relaxed(a) readw(a) | 140 | #define readw_relaxed(a) readw(a) |
165 | #define readl_relaxed(a) readl(a) | 141 | #define readl_relaxed(a) readl(a) |
142 | #define readq_relaxed(a) readq(a) | ||
166 | 143 | ||
167 | /* Simple MMIO */ | 144 | /* Simple MMIO */ |
168 | #define ioread8(a) __raw_readb(a) | 145 | #define ioread8(a) __raw_readb(a) |
@@ -185,15 +162,17 @@ __BUILD_MEMORY_STRING(w, u16) | |||
185 | #define iowrite16_rep(a, s, c) __raw_writesw((a), (s), (c)) | 162 | #define iowrite16_rep(a, s, c) __raw_writesw((a), (s), (c)) |
186 | #define iowrite32_rep(a, s, c) __raw_writesl((a), (s), (c)) | 163 | #define iowrite32_rep(a, s, c) __raw_writesl((a), (s), (c)) |
187 | 164 | ||
188 | #define mmiowb() wmb() /* synco on SH-4A, otherwise a nop */ | 165 | /* synco on SH-4A, otherwise a nop */ |
166 | #define mmiowb() wmb() | ||
189 | 167 | ||
190 | #define IO_SPACE_LIMIT 0xffffffff | 168 | #define IO_SPACE_LIMIT 0xffffffff |
191 | 169 | ||
192 | extern unsigned long generic_io_base; | 170 | extern unsigned long generic_io_base; |
193 | 171 | ||
194 | /* | 172 | /* |
195 | * This function provides a method for the generic case where a board-specific | 173 | * This function provides a method for the generic case where a |
196 | * ioport_map simply needs to return the port + some arbitrary port base. | 174 | * board-specific ioport_map simply needs to return the port + some |
175 | * arbitrary port base. | ||
197 | * | 176 | * |
198 | * We use this at board setup time to implicitly set the port base, and | 177 | * We use this at board setup time to implicitly set the port base, and |
199 | * as a result, we can use the generic ioport_map. | 178 | * as a result, we can use the generic ioport_map. |
@@ -206,57 +185,9 @@ static inline void __set_io_port_base(unsigned long pbase) | |||
206 | #define __ioport_map(p, n) sh_mv.mv_ioport_map((p), (n)) | 185 | #define __ioport_map(p, n) sh_mv.mv_ioport_map((p), (n)) |
207 | 186 | ||
208 | /* We really want to try and get these to memcpy etc */ | 187 | /* We really want to try and get these to memcpy etc */ |
209 | extern void memcpy_fromio(void *, volatile void __iomem *, unsigned long); | 188 | void memcpy_fromio(void *, const volatile void __iomem *, unsigned long); |
210 | extern void memcpy_toio(volatile void __iomem *, const void *, unsigned long); | 189 | void memcpy_toio(volatile void __iomem *, const void *, unsigned long); |
211 | extern void memset_io(volatile void __iomem *, int, unsigned long); | 190 | void memset_io(volatile void __iomem *, int, unsigned long); |
212 | |||
213 | /* SuperH on-chip I/O functions */ | ||
214 | static inline unsigned char ctrl_inb(unsigned long addr) | ||
215 | { | ||
216 | return *(volatile unsigned char*)addr; | ||
217 | } | ||
218 | |||
219 | static inline unsigned short ctrl_inw(unsigned long addr) | ||
220 | { | ||
221 | return *(volatile unsigned short*)addr; | ||
222 | } | ||
223 | |||
224 | static inline unsigned int ctrl_inl(unsigned long addr) | ||
225 | { | ||
226 | return *(volatile unsigned long*)addr; | ||
227 | } | ||
228 | |||
229 | static inline unsigned long long ctrl_inq(unsigned long addr) | ||
230 | { | ||
231 | return *(volatile unsigned long long*)addr; | ||
232 | } | ||
233 | |||
234 | static inline void ctrl_outb(unsigned char b, unsigned long addr) | ||
235 | { | ||
236 | *(volatile unsigned char*)addr = b; | ||
237 | } | ||
238 | |||
239 | static inline void ctrl_outw(unsigned short b, unsigned long addr) | ||
240 | { | ||
241 | *(volatile unsigned short*)addr = b; | ||
242 | } | ||
243 | |||
244 | static inline void ctrl_outl(unsigned int b, unsigned long addr) | ||
245 | { | ||
246 | *(volatile unsigned long*)addr = b; | ||
247 | } | ||
248 | |||
249 | static inline void ctrl_outq(unsigned long long b, unsigned long addr) | ||
250 | { | ||
251 | *(volatile unsigned long long*)addr = b; | ||
252 | } | ||
253 | |||
254 | static inline void ctrl_delay(void) | ||
255 | { | ||
256 | #ifdef P2SEG | ||
257 | ctrl_inw(P2SEG); | ||
258 | #endif | ||
259 | } | ||
260 | 191 | ||
261 | /* Quad-word real-mode I/O, don't ask.. */ | 192 | /* Quad-word real-mode I/O, don't ask.. */ |
262 | unsigned long long peek_real_address_q(unsigned long long addr); | 193 | unsigned long long peek_real_address_q(unsigned long long addr); |
@@ -347,6 +278,10 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags) | |||
347 | #define iounmap(addr) \ | 278 | #define iounmap(addr) \ |
348 | __iounmap((addr)) | 279 | __iounmap((addr)) |
349 | 280 | ||
281 | #define maybebadio(port) \ | ||
282 | printk(KERN_ERR "bad PC-like io %s:%u for port 0x%lx at 0x%08x\n", \ | ||
283 | __func__, __LINE__, (port), (u32)__builtin_return_address(0)) | ||
284 | |||
350 | /* | 285 | /* |
351 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | 286 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem |
352 | * access | 287 | * access |
diff --git a/arch/sh/include/asm/io_generic.h b/arch/sh/include/asm/io_generic.h index 92fc6070d7b3..1e5d375f55dc 100644 --- a/arch/sh/include/asm/io_generic.h +++ b/arch/sh/include/asm/io_generic.h | |||
@@ -33,13 +33,6 @@ void IO_CONCAT(__IO_PREFIX,outsb)(unsigned long, const void *src, unsigned long | |||
33 | void IO_CONCAT(__IO_PREFIX,outsw)(unsigned long, const void *src, unsigned long count); | 33 | void IO_CONCAT(__IO_PREFIX,outsw)(unsigned long, const void *src, unsigned long count); |
34 | void IO_CONCAT(__IO_PREFIX,outsl)(unsigned long, const void *src, unsigned long count); | 34 | void IO_CONCAT(__IO_PREFIX,outsl)(unsigned long, const void *src, unsigned long count); |
35 | 35 | ||
36 | u8 IO_CONCAT(__IO_PREFIX,readb)(void __iomem *); | ||
37 | u16 IO_CONCAT(__IO_PREFIX,readw)(void __iomem *); | ||
38 | u32 IO_CONCAT(__IO_PREFIX,readl)(void __iomem *); | ||
39 | void IO_CONCAT(__IO_PREFIX,writeb)(u8, void __iomem *); | ||
40 | void IO_CONCAT(__IO_PREFIX,writew)(u16, void __iomem *); | ||
41 | void IO_CONCAT(__IO_PREFIX,writel)(u32, void __iomem *); | ||
42 | |||
43 | void *IO_CONCAT(__IO_PREFIX,ioremap)(unsigned long offset, unsigned long size); | 36 | void *IO_CONCAT(__IO_PREFIX,ioremap)(unsigned long offset, unsigned long size); |
44 | void IO_CONCAT(__IO_PREFIX,iounmap)(void *addr); | 37 | void IO_CONCAT(__IO_PREFIX,iounmap)(void *addr); |
45 | 38 | ||
diff --git a/arch/sh/include/asm/machvec.h b/arch/sh/include/asm/machvec.h index b2e4124070ae..f1bae02ef7b6 100644 --- a/arch/sh/include/asm/machvec.h +++ b/arch/sh/include/asm/machvec.h | |||
@@ -42,13 +42,6 @@ struct sh_machine_vector { | |||
42 | void (*mv_outsw)(unsigned long, const void *src, unsigned long count); | 42 | void (*mv_outsw)(unsigned long, const void *src, unsigned long count); |
43 | void (*mv_outsl)(unsigned long, const void *src, unsigned long count); | 43 | void (*mv_outsl)(unsigned long, const void *src, unsigned long count); |
44 | 44 | ||
45 | u8 (*mv_readb)(void __iomem *); | ||
46 | u16 (*mv_readw)(void __iomem *); | ||
47 | u32 (*mv_readl)(void __iomem *); | ||
48 | void (*mv_writeb)(u8, void __iomem *); | ||
49 | void (*mv_writew)(u16, void __iomem *); | ||
50 | void (*mv_writel)(u32, void __iomem *); | ||
51 | |||
52 | int (*mv_irq_demux)(int irq); | 45 | int (*mv_irq_demux)(int irq); |
53 | 46 | ||
54 | void (*mv_init_irq)(void); | 47 | void (*mv_init_irq)(void); |
diff --git a/arch/sh/kernel/io.c b/arch/sh/kernel/io.c index 2b8991229900..29cf4588fc05 100644 --- a/arch/sh/kernel/io.c +++ b/arch/sh/kernel/io.c | |||
@@ -19,12 +19,12 @@ | |||
19 | * Copy data from IO memory space to "real" memory space. | 19 | * Copy data from IO memory space to "real" memory space. |
20 | * This needs to be optimized. | 20 | * This needs to be optimized. |
21 | */ | 21 | */ |
22 | void memcpy_fromio(void *to, volatile void __iomem *from, unsigned long count) | 22 | void memcpy_fromio(void *to, const volatile void __iomem *from, unsigned long count) |
23 | { | 23 | { |
24 | char *p = to; | 24 | unsigned char *p = to; |
25 | while (count) { | 25 | while (count) { |
26 | count--; | 26 | count--; |
27 | *p = readb((void __iomem *)from); | 27 | *p = readb(from); |
28 | p++; | 28 | p++; |
29 | from++; | 29 | from++; |
30 | } | 30 | } |
@@ -37,10 +37,10 @@ EXPORT_SYMBOL(memcpy_fromio); | |||
37 | */ | 37 | */ |
38 | void memcpy_toio(volatile void __iomem *to, const void *from, unsigned long count) | 38 | void memcpy_toio(volatile void __iomem *to, const void *from, unsigned long count) |
39 | { | 39 | { |
40 | const char *p = from; | 40 | const unsigned char *p = from; |
41 | while (count) { | 41 | while (count) { |
42 | count--; | 42 | count--; |
43 | writeb(*p, (void __iomem *)to); | 43 | writeb(*p, to); |
44 | p++; | 44 | p++; |
45 | to++; | 45 | to++; |
46 | } | 46 | } |
@@ -55,7 +55,7 @@ void memset_io(volatile void __iomem *dst, int c, unsigned long count) | |||
55 | { | 55 | { |
56 | while (count) { | 56 | while (count) { |
57 | count--; | 57 | count--; |
58 | writeb(c, (void __iomem *)dst); | 58 | writeb(c, dst); |
59 | dst++; | 59 | dst++; |
60 | } | 60 | } |
61 | } | 61 | } |
diff --git a/arch/sh/kernel/io_generic.c b/arch/sh/kernel/io_generic.c index f1b214d3bce3..5a7f554d9ca1 100644 --- a/arch/sh/kernel/io_generic.c +++ b/arch/sh/kernel/io_generic.c | |||
@@ -19,38 +19,33 @@ | |||
19 | /* SH3 has a PCMCIA bug that needs a dummy read from area 6 for a | 19 | /* SH3 has a PCMCIA bug that needs a dummy read from area 6 for a |
20 | * workaround. */ | 20 | * workaround. */ |
21 | /* I'm not sure SH7709 has this kind of bug */ | 21 | /* I'm not sure SH7709 has this kind of bug */ |
22 | #define dummy_read() ctrl_inb(0xba000000) | 22 | #define dummy_read() __raw_readb(0xba000000) |
23 | #else | 23 | #else |
24 | #define dummy_read() | 24 | #define dummy_read() |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | unsigned long generic_io_base; | 27 | unsigned long generic_io_base; |
28 | 28 | ||
29 | static inline void delay(void) | ||
30 | { | ||
31 | ctrl_inw(0xa0000000); | ||
32 | } | ||
33 | |||
34 | u8 generic_inb(unsigned long port) | 29 | u8 generic_inb(unsigned long port) |
35 | { | 30 | { |
36 | return ctrl_inb((unsigned long __force)__ioport_map(port, 1)); | 31 | return __raw_readb(__ioport_map(port, 1)); |
37 | } | 32 | } |
38 | 33 | ||
39 | u16 generic_inw(unsigned long port) | 34 | u16 generic_inw(unsigned long port) |
40 | { | 35 | { |
41 | return ctrl_inw((unsigned long __force)__ioport_map(port, 2)); | 36 | return __raw_readw(__ioport_map(port, 2)); |
42 | } | 37 | } |
43 | 38 | ||
44 | u32 generic_inl(unsigned long port) | 39 | u32 generic_inl(unsigned long port) |
45 | { | 40 | { |
46 | return ctrl_inl((unsigned long __force)__ioport_map(port, 4)); | 41 | return __raw_readl(__ioport_map(port, 4)); |
47 | } | 42 | } |
48 | 43 | ||
49 | u8 generic_inb_p(unsigned long port) | 44 | u8 generic_inb_p(unsigned long port) |
50 | { | 45 | { |
51 | unsigned long v = generic_inb(port); | 46 | unsigned long v = generic_inb(port); |
52 | 47 | ||
53 | delay(); | 48 | ctrl_delay(); |
54 | return v; | 49 | return v; |
55 | } | 50 | } |
56 | 51 | ||
@@ -58,7 +53,7 @@ u16 generic_inw_p(unsigned long port) | |||
58 | { | 53 | { |
59 | unsigned long v = generic_inw(port); | 54 | unsigned long v = generic_inw(port); |
60 | 55 | ||
61 | delay(); | 56 | ctrl_delay(); |
62 | return v; | 57 | return v; |
63 | } | 58 | } |
64 | 59 | ||
@@ -66,7 +61,7 @@ u32 generic_inl_p(unsigned long port) | |||
66 | { | 61 | { |
67 | unsigned long v = generic_inl(port); | 62 | unsigned long v = generic_inl(port); |
68 | 63 | ||
69 | delay(); | 64 | ctrl_delay(); |
70 | return v; | 65 | return v; |
71 | } | 66 | } |
72 | 67 | ||
@@ -112,35 +107,35 @@ void generic_insl(unsigned long port, void *dst, unsigned long count) | |||
112 | 107 | ||
113 | void generic_outb(u8 b, unsigned long port) | 108 | void generic_outb(u8 b, unsigned long port) |
114 | { | 109 | { |
115 | ctrl_outb(b, (unsigned long __force)__ioport_map(port, 1)); | 110 | __raw_writeb(b, __ioport_map(port, 1)); |
116 | } | 111 | } |
117 | 112 | ||
118 | void generic_outw(u16 b, unsigned long port) | 113 | void generic_outw(u16 b, unsigned long port) |
119 | { | 114 | { |
120 | ctrl_outw(b, (unsigned long __force)__ioport_map(port, 2)); | 115 | __raw_writew(b, __ioport_map(port, 2)); |
121 | } | 116 | } |
122 | 117 | ||
123 | void generic_outl(u32 b, unsigned long port) | 118 | void generic_outl(u32 b, unsigned long port) |
124 | { | 119 | { |
125 | ctrl_outl(b, (unsigned long __force)__ioport_map(port, 4)); | 120 | __raw_writel(b, __ioport_map(port, 4)); |
126 | } | 121 | } |
127 | 122 | ||
128 | void generic_outb_p(u8 b, unsigned long port) | 123 | void generic_outb_p(u8 b, unsigned long port) |
129 | { | 124 | { |
130 | generic_outb(b, port); | 125 | generic_outb(b, port); |
131 | delay(); | 126 | ctrl_delay(); |
132 | } | 127 | } |
133 | 128 | ||
134 | void generic_outw_p(u16 b, unsigned long port) | 129 | void generic_outw_p(u16 b, unsigned long port) |
135 | { | 130 | { |
136 | generic_outw(b, port); | 131 | generic_outw(b, port); |
137 | delay(); | 132 | ctrl_delay(); |
138 | } | 133 | } |
139 | 134 | ||
140 | void generic_outl_p(u32 b, unsigned long port) | 135 | void generic_outl_p(u32 b, unsigned long port) |
141 | { | 136 | { |
142 | generic_outl(b, port); | 137 | generic_outl(b, port); |
143 | delay(); | 138 | ctrl_delay(); |
144 | } | 139 | } |
145 | 140 | ||
146 | /* | 141 | /* |
@@ -184,36 +179,6 @@ void generic_outsl(unsigned long port, const void *src, unsigned long count) | |||
184 | dummy_read(); | 179 | dummy_read(); |
185 | } | 180 | } |
186 | 181 | ||
187 | u8 generic_readb(void __iomem *addr) | ||
188 | { | ||
189 | return ctrl_inb((unsigned long __force)addr); | ||
190 | } | ||
191 | |||
192 | u16 generic_readw(void __iomem *addr) | ||
193 | { | ||
194 | return ctrl_inw((unsigned long __force)addr); | ||
195 | } | ||
196 | |||
197 | u32 generic_readl(void __iomem *addr) | ||
198 | { | ||
199 | return ctrl_inl((unsigned long __force)addr); | ||
200 | } | ||
201 | |||
202 | void generic_writeb(u8 b, void __iomem *addr) | ||
203 | { | ||
204 | ctrl_outb(b, (unsigned long __force)addr); | ||
205 | } | ||
206 | |||
207 | void generic_writew(u16 b, void __iomem *addr) | ||
208 | { | ||
209 | ctrl_outw(b, (unsigned long __force)addr); | ||
210 | } | ||
211 | |||
212 | void generic_writel(u32 b, void __iomem *addr) | ||
213 | { | ||
214 | ctrl_outl(b, (unsigned long __force)addr); | ||
215 | } | ||
216 | |||
217 | void __iomem *generic_ioport_map(unsigned long addr, unsigned int size) | 182 | void __iomem *generic_ioport_map(unsigned long addr, unsigned int size) |
218 | { | 183 | { |
219 | return (void __iomem *)(addr + generic_io_base); | 184 | return (void __iomem *)(addr + generic_io_base); |
diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c index 8bfdd275e940..c1ea41e5812a 100644 --- a/arch/sh/kernel/machvec.c +++ b/arch/sh/kernel/machvec.c | |||
@@ -126,9 +126,6 @@ void __init sh_mv_setup(void) | |||
126 | mv_set(insb); mv_set(insw); mv_set(insl); | 126 | mv_set(insb); mv_set(insw); mv_set(insl); |
127 | mv_set(outsb); mv_set(outsw); mv_set(outsl); | 127 | mv_set(outsb); mv_set(outsw); mv_set(outsl); |
128 | 128 | ||
129 | mv_set(readb); mv_set(readw); mv_set(readl); | ||
130 | mv_set(writeb); mv_set(writew); mv_set(writel); | ||
131 | |||
132 | mv_set(ioport_map); | 129 | mv_set(ioport_map); |
133 | mv_set(ioport_unmap); | 130 | mv_set(ioport_unmap); |
134 | mv_set(irq_demux); | 131 | mv_set(irq_demux); |