aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-m68k
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2007-07-19 23:32:58 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-20 11:24:49 -0400
commitf9569e1d1540791f664aeb935b1ec11b6e56507c (patch)
tree42124a5027a9feb7f499beed73a8f467629046a4 /include/asm-m68k
parent3a5df1d451cfe3a3d6d63f144554cac286eecba1 (diff)
m68k iomem (based on Geert's tree + memcpy_... stuff)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-m68k')
-rw-r--r--include/asm-m68k/io.h75
-rw-r--r--include/asm-m68k/raw_io.h8
2 files changed, 69 insertions, 14 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}
156static 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}
155static inline u8 __iomem *isa_mtb(unsigned long addr) 166static 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);
351extern void dma_cache_wback(unsigned long start, unsigned long size); 390extern void dma_cache_wback(unsigned long start, unsigned long size);
352extern void dma_cache_inv(unsigned long start, unsigned long size); 391extern void dma_cache_inv(unsigned long start, unsigned long size);
353 392
393static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
394{
395 __builtin_memset((void __force *) addr, val, count);
396}
397static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
398{
399 __builtin_memcpy(dst, (void __force *) src, count);
400}
401static 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
diff --git a/include/asm-m68k/raw_io.h b/include/asm-m68k/raw_io.h
index 811ccd25d4a6..91c623f0994c 100644
--- a/include/asm-m68k/raw_io.h
+++ b/include/asm-m68k/raw_io.h
@@ -49,10 +49,16 @@ extern void __iounmap(void *addr, unsigned long size);
49#define raw_inb in_8 49#define raw_inb in_8
50#define raw_inw in_be16 50#define raw_inw in_be16
51#define raw_inl in_be32 51#define raw_inl in_be32
52#define __raw_readb in_8
53#define __raw_readw in_be16
54#define __raw_readl in_be32
52 55
53#define raw_outb(val,port) out_8((port),(val)) 56#define raw_outb(val,port) out_8((port),(val))
54#define raw_outw(val,port) out_be16((port),(val)) 57#define raw_outw(val,port) out_be16((port),(val))
55#define raw_outl(val,port) out_be32((port),(val)) 58#define raw_outl(val,port) out_be32((port),(val))
59#define __raw_writeb(val,addr) out_8((addr),(val))
60#define __raw_writew(val,addr) out_be16((addr),(val))
61#define __raw_writel(val,addr) out_be32((addr),(val))
56 62
57static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len) 63static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
58{ 64{
@@ -336,8 +342,6 @@ static inline void raw_outsw_swapw(volatile u16 __iomem *port, const u16 *buf,
336 : "d0", "a0", "a1", "d6"); 342 : "d0", "a0", "a1", "d6");
337} 343}
338 344
339#define __raw_writel raw_outl
340
341#endif /* __KERNEL__ */ 345#endif /* __KERNEL__ */
342 346
343#endif /* _RAW_IO_H */ 347#endif /* _RAW_IO_H */