diff options
Diffstat (limited to 'include/asm-m68k/io.h')
-rw-r--r-- | include/asm-m68k/io.h | 75 |
1 files changed, 63 insertions, 12 deletions
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h index 5e0fcf41804d..47bb9cf107b7 100644 --- a/include/asm-m68k/io.h +++ b/include/asm-m68k/io.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <asm/raw_io.h> | 27 | #include <asm/raw_io.h> |
28 | #include <asm/virtconvert.h> | 28 | #include <asm/virtconvert.h> |
29 | 29 | ||
30 | #include <asm-generic/iomap.h> | ||
30 | 31 | ||
31 | #ifdef CONFIG_ATARI | 32 | #ifdef CONFIG_ATARI |
32 | #include <asm/atarihw.h> | 33 | #include <asm/atarihw.h> |
@@ -152,6 +153,16 @@ static inline u16 __iomem *isa_itw(unsigned long addr) | |||
152 | default: return NULL; /* avoid warnings, just in case */ | 153 | default: return NULL; /* avoid warnings, just in case */ |
153 | } | 154 | } |
154 | } | 155 | } |
156 | static inline u32 __iomem *isa_itl(unsigned long addr) | ||
157 | { | ||
158 | switch(ISA_TYPE) | ||
159 | { | ||
160 | #ifdef CONFIG_AMIGA_PCMCIA | ||
161 | case AG_ISA: return (u32 __iomem *)AG_ISA_IO_W(addr); | ||
162 | #endif | ||
163 | default: return 0; /* avoid warnings, just in case */ | ||
164 | } | ||
165 | } | ||
155 | static inline u8 __iomem *isa_mtb(unsigned long addr) | 166 | static inline u8 __iomem *isa_mtb(unsigned long addr) |
156 | { | 167 | { |
157 | switch(ISA_TYPE) | 168 | switch(ISA_TYPE) |
@@ -188,8 +199,10 @@ static inline u16 __iomem *isa_mtw(unsigned long addr) | |||
188 | 199 | ||
189 | #define isa_inb(port) in_8(isa_itb(port)) | 200 | #define isa_inb(port) in_8(isa_itb(port)) |
190 | #define isa_inw(port) (ISA_SEX ? in_be16(isa_itw(port)) : in_le16(isa_itw(port))) | 201 | #define isa_inw(port) (ISA_SEX ? in_be16(isa_itw(port)) : in_le16(isa_itw(port))) |
202 | #define isa_inl(port) (ISA_SEX ? in_be32(isa_itl(port)) : in_le32(isa_itl(port))) | ||
191 | #define isa_outb(val,port) out_8(isa_itb(port),(val)) | 203 | #define isa_outb(val,port) out_8(isa_itb(port),(val)) |
192 | #define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val))) | 204 | #define isa_outw(val,port) (ISA_SEX ? out_be16(isa_itw(port),(val)) : out_le16(isa_itw(port),(val))) |
205 | #define isa_outl(val,port) (ISA_SEX ? out_be32(isa_itl(port),(val)) : out_le32(isa_itl(port),(val))) | ||
193 | 206 | ||
194 | #define isa_readb(p) in_8(isa_mtb((unsigned long)(p))) | 207 | #define isa_readb(p) in_8(isa_mtb((unsigned long)(p))) |
195 | #define isa_readw(p) \ | 208 | #define isa_readw(p) \ |
@@ -234,6 +247,15 @@ static inline void isa_delay(void) | |||
234 | #define isa_outsw(port, buf, nr) \ | 247 | #define isa_outsw(port, buf, nr) \ |
235 | (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \ | 248 | (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \ |
236 | raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr))) | 249 | raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr))) |
250 | |||
251 | #define isa_insl(port, buf, nr) \ | ||
252 | (ISA_SEX ? raw_insl(isa_itl(port), (u32 *)(buf), (nr)) : \ | ||
253 | raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) | ||
254 | |||
255 | #define isa_outsl(port, buf, nr) \ | ||
256 | (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) : \ | ||
257 | raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) | ||
258 | |||
237 | #endif /* CONFIG_ISA */ | 259 | #endif /* CONFIG_ISA */ |
238 | 260 | ||
239 | 261 | ||
@@ -246,14 +268,16 @@ static inline void isa_delay(void) | |||
246 | #define inw_p isa_inw_p | 268 | #define inw_p isa_inw_p |
247 | #define outw isa_outw | 269 | #define outw isa_outw |
248 | #define outw_p isa_outw_p | 270 | #define outw_p isa_outw_p |
249 | #define inl isa_inw | 271 | #define inl isa_inl |
250 | #define inl_p isa_inw_p | 272 | #define inl_p isa_inl_p |
251 | #define outl isa_outw | 273 | #define outl isa_outl |
252 | #define outl_p isa_outw_p | 274 | #define outl_p isa_outl_p |
253 | #define insb isa_insb | 275 | #define insb isa_insb |
254 | #define insw isa_insw | 276 | #define insw isa_insw |
277 | #define insl isa_insl | ||
255 | #define outsb isa_outsb | 278 | #define outsb isa_outsb |
256 | #define outsw isa_outsw | 279 | #define outsw isa_outsw |
280 | #define outsl isa_outsl | ||
257 | #define readb isa_readb | 281 | #define readb isa_readb |
258 | #define readw isa_readw | 282 | #define readw isa_readw |
259 | #define writeb isa_writeb | 283 | #define writeb isa_writeb |
@@ -262,8 +286,6 @@ static inline void isa_delay(void) | |||
262 | 286 | ||
263 | #if defined(CONFIG_PCI) | 287 | #if defined(CONFIG_PCI) |
264 | 288 | ||
265 | #define inl(port) in_le32(port) | ||
266 | #define outl(val,port) out_le32((port),(val)) | ||
267 | #define readl(addr) in_le32(addr) | 289 | #define readl(addr) in_le32(addr) |
268 | #define writel(val,addr) out_le32((addr),(val)) | 290 | #define writel(val,addr) out_le32((addr),(val)) |
269 | 291 | ||
@@ -282,6 +304,8 @@ static inline void isa_delay(void) | |||
282 | #define outb(val,port) out_8((port),(val)) | 304 | #define outb(val,port) out_8((port),(val)) |
283 | #define inw(port) in_le16(port) | 305 | #define inw(port) in_le16(port) |
284 | #define outw(val,port) out_le16((port),(val)) | 306 | #define outw(val,port) out_le16((port),(val)) |
307 | #define inl(port) in_le32(port) | ||
308 | #define outl(val,port) out_le32((port),(val)) | ||
285 | 309 | ||
286 | #else | 310 | #else |
287 | /* | 311 | /* |
@@ -306,20 +330,35 @@ static inline void isa_delay(void) | |||
306 | #endif | 330 | #endif |
307 | #endif /* CONFIG_PCI */ | 331 | #endif /* CONFIG_PCI */ |
308 | 332 | ||
309 | #if !defined(CONFIG_ISA) && !defined(CONFIG_PCI) && defined(CONFIG_HP300) | 333 | #if !defined(CONFIG_ISA) && !defined(CONFIG_PCI) |
310 | /* | 334 | /* |
311 | * We need to define dummy functions otherwise drivers/serial/8250.c doesn't link | 335 | * We need to define dummy functions for GENERIC_IOMAP support. |
312 | */ | 336 | */ |
313 | #define inb(port) 0xff | 337 | #define inb(port) 0xff |
314 | #define inb_p(port) 0xff | 338 | #define inb_p(port) 0xff |
315 | #define outb(val,port) do { } while (0) | 339 | #define outb(val,port) ((void)0) |
316 | #define outb_p(val,port) do { } while (0) | 340 | #define outb_p(val,port) ((void)0) |
341 | #define inw(port) 0xffff | ||
342 | #define outw(val,port) ((void)0) | ||
343 | #define inl(port) 0xffffffffUL | ||
344 | #define outl(val,port) ((void)0) | ||
345 | |||
346 | #define insb(port,buf,nr) ((void)0) | ||
347 | #define outsb(port,buf,nr) ((void)0) | ||
348 | #define insw(port,buf,nr) ((void)0) | ||
349 | #define outsw(port,buf,nr) ((void)0) | ||
350 | #define insl(port,buf,nr) ((void)0) | ||
351 | #define outsl(port,buf,nr) ((void)0) | ||
317 | 352 | ||
318 | /* | 353 | /* |
319 | * These should be valid on any ioremap()ed region | 354 | * These should be valid on any ioremap()ed region |
320 | */ | 355 | */ |
321 | #define readb(addr) in_8(addr) | 356 | #define readb(addr) in_8(addr) |
322 | #define writeb(val,addr) out_8((addr),(val)) | 357 | #define writeb(val,addr) out_8((addr),(val)) |
358 | #define readw(addr) in_le16(addr) | ||
359 | #define writew(val,addr) out_le16((addr),(val)) | ||
360 | #endif | ||
361 | #if !defined(CONFIG_PCI) | ||
323 | #define readl(addr) in_le32(addr) | 362 | #define readl(addr) in_le32(addr) |
324 | #define writel(val,addr) out_le32((addr),(val)) | 363 | #define writel(val,addr) out_le32((addr),(val)) |
325 | #endif | 364 | #endif |
@@ -351,6 +390,18 @@ extern void dma_cache_wback_inv(unsigned long start, unsigned long size); | |||
351 | extern void dma_cache_wback(unsigned long start, unsigned long size); | 390 | extern void dma_cache_wback(unsigned long start, unsigned long size); |
352 | extern void dma_cache_inv(unsigned long start, unsigned long size); | 391 | extern void dma_cache_inv(unsigned long start, unsigned long size); |
353 | 392 | ||
393 | static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) | ||
394 | { | ||
395 | __builtin_memset((void __force *) addr, val, count); | ||
396 | } | ||
397 | static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) | ||
398 | { | ||
399 | __builtin_memcpy(dst, (void __force *) src, count); | ||
400 | } | ||
401 | static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count) | ||
402 | { | ||
403 | __builtin_memcpy((void __force *) dst, src, count); | ||
404 | } | ||
354 | 405 | ||
355 | #ifndef CONFIG_SUN3 | 406 | #ifndef CONFIG_SUN3 |
356 | #define IO_SPACE_LIMIT 0xffff | 407 | #define IO_SPACE_LIMIT 0xffff |