Commit f9569e1d1540791f664aeb935b1ec11b6e56507c

Authored by Al Viro
Committed by Linus Torvalds
1 parent 3a5df1d451

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>

Showing 3 changed files with 73 additions and 14 deletions Side-by-side Diff

... ... @@ -37,6 +37,10 @@
37 37 bool
38 38 default y
39 39  
  40 +config GENERIC_IOMAP
  41 + bool
  42 + default y
  43 +
40 44 config ARCH_MAY_HAVE_PC_FDC
41 45 bool
42 46 depends on Q40 || (BROKEN && SUN3X)
include/asm-m68k/io.h
... ... @@ -27,6 +27,7 @@
27 27 #include <asm/raw_io.h>
28 28 #include <asm/virtconvert.h>
29 29  
  30 +#include <asm-generic/iomap.h>
30 31  
31 32 #ifdef CONFIG_ATARI
32 33 #include <asm/atarihw.h>
... ... @@ -152,6 +153,16 @@
152 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 166 static inline u8 __iomem *isa_mtb(unsigned long addr)
156 167 {
157 168 switch(ISA_TYPE)
158 169  
... ... @@ -188,8 +199,10 @@
188 199  
189 200 #define isa_inb(port) in_8(isa_itb(port))
190 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 203 #define isa_outb(val,port) out_8(isa_itb(port),(val))
192 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 207 #define isa_readb(p) in_8(isa_mtb((unsigned long)(p)))
195 208 #define isa_readw(p) \
... ... @@ -234,6 +247,15 @@
234 247 #define isa_outsw(port, buf, nr) \
235 248 (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \
236 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 259 #endif /* CONFIG_ISA */
238 260  
239 261  
240 262  
241 263  
... ... @@ -246,14 +268,16 @@
246 268 #define inw_p isa_inw_p
247 269 #define outw isa_outw
248 270 #define outw_p isa_outw_p
249   -#define inl isa_inw
250   -#define inl_p isa_inw_p
251   -#define outl isa_outw
252   -#define outl_p isa_outw_p
  271 +#define inl isa_inl
  272 +#define inl_p isa_inl_p
  273 +#define outl isa_outl
  274 +#define outl_p isa_outl_p
253 275 #define insb isa_insb
254 276 #define insw isa_insw
  277 +#define insl isa_insl
255 278 #define outsb isa_outsb
256 279 #define outsw isa_outsw
  280 +#define outsl isa_outsl
257 281 #define readb isa_readb
258 282 #define readw isa_readw
259 283 #define writeb isa_writeb
... ... @@ -262,8 +286,6 @@
262 286  
263 287 #if defined(CONFIG_PCI)
264 288  
265   -#define inl(port) in_le32(port)
266   -#define outl(val,port) out_le32((port),(val))
267 289 #define readl(addr) in_le32(addr)
268 290 #define writel(val,addr) out_le32((addr),(val))
269 291  
... ... @@ -282,6 +304,8 @@
282 304 #define outb(val,port) out_8((port),(val))
283 305 #define inw(port) in_le16(port)
284 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 310 #else
287 311 /*
288 312  
289 313  
290 314  
291 315  
... ... @@ -306,20 +330,35 @@
306 330 #endif
307 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
314   -#define inb_p(port) 0xff
315   -#define outb(val,port) do { } while (0)
316   -#define outb_p(val,port) do { } while (0)
  337 +#define inb(port) 0xff
  338 +#define inb_p(port) 0xff
  339 +#define outb(val,port) ((void)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)
317 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)
  352 +
318 353 /*
319 354 * These should be valid on any ioremap()ed region
320 355 */
321 356 #define readb(addr) in_8(addr)
322 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 362 #define readl(addr) in_le32(addr)
324 363 #define writel(val,addr) out_le32((addr),(val))
325 364 #endif
... ... @@ -351,6 +390,18 @@
351 390 extern void dma_cache_wback(unsigned long start, unsigned long size);
352 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 406 #ifndef CONFIG_SUN3
356 407 #define IO_SPACE_LIMIT 0xffff
include/asm-m68k/raw_io.h
... ... @@ -49,10 +49,16 @@
49 49 #define raw_inb in_8
50 50 #define raw_inw in_be16
51 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 56 #define raw_outb(val,port) out_8((port),(val))
54 57 #define raw_outw(val,port) out_be16((port),(val))
55 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  
57 63 static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
58 64 {
... ... @@ -335,8 +341,6 @@
335 341 : "g" (port), "g" (buf), "g" (nr)
336 342 : "d0", "a0", "a1", "d6");
337 343 }
338   -
339   -#define __raw_writel raw_outl
340 344  
341 345 #endif /* __KERNEL__ */
342 346