Automatic merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/driver...
[linux-2.6/verdex.git] / include / asm-v850 / io.h
blobbb5efd1b4b7d09a4782df938a73d6a4f10a4ba89
1 /*
2 * include/asm-v850/io.h -- Misc I/O operations
4 * Copyright (C) 2001,02,03,04 NEC Electronics Corporation
5 * Copyright (C) 2001,02,03,04 Miles Bader <miles@gnu.org>
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this
9 * archive for more details.
11 * Written by Miles Bader <miles@gnu.org>
14 #ifndef __V850_IO_H__
15 #define __V850_IO_H__
17 #define IO_SPACE_LIMIT 0xFFFFFFFF
19 #define readb(addr) \
20 ({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
21 #define readw(addr) \
22 ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
23 #define readl(addr) \
24 ({ unsigned long __v = (*(volatile unsigned long *) (addr)); __v; })
26 #define readb_relaxed(a) readb(a)
27 #define readw_relaxed(a) readw(a)
28 #define readl_relaxed(a) readl(a)
30 #define writeb(b, addr) \
31 (void)((*(volatile unsigned char *) (addr)) = (b))
32 #define writew(b, addr) \
33 (void)((*(volatile unsigned short *) (addr)) = (b))
34 #define writel(b, addr) \
35 (void)((*(volatile unsigned int *) (addr)) = (b))
37 #define __raw_readb readb
38 #define __raw_readw readw
39 #define __raw_readl readl
40 #define __raw_writeb writeb
41 #define __raw_writew writew
42 #define __raw_writel writel
44 #define inb(addr) readb (addr)
45 #define inw(addr) readw (addr)
46 #define inl(addr) readl (addr)
47 #define outb(x, addr) ((void) writeb (x, addr))
48 #define outw(x, addr) ((void) writew (x, addr))
49 #define outl(x, addr) ((void) writel (x, addr))
51 #define inb_p(port) inb((port))
52 #define outb_p(val, port) outb((val), (port))
53 #define inw_p(port) inw((port))
54 #define outw_p(val, port) outw((val), (port))
55 #define inl_p(port) inl((port))
56 #define outl_p(val, port) outl((val), (port))
58 static inline void insb (unsigned long port, void *dst, unsigned long count)
60 unsigned char *p = dst;
61 while (count--)
62 *p++ = inb (port);
64 static inline void insw (unsigned long port, void *dst, unsigned long count)
66 unsigned short *p = dst;
67 while (count--)
68 *p++ = inw (port);
70 static inline void insl (unsigned long port, void *dst, unsigned long count)
72 unsigned long *p = dst;
73 while (count--)
74 *p++ = inl (port);
77 static inline void
78 outsb (unsigned long port, const void *src, unsigned long count)
80 const unsigned char *p = src;
81 while (count--)
82 outb (*p++, port);
84 static inline void
85 outsw (unsigned long port, const void *src, unsigned long count)
87 const unsigned short *p = src;
88 while (count--)
89 outw (*p++, port);
91 static inline void
92 outsl (unsigned long port, const void *src, unsigned long count)
94 const unsigned long *p = src;
95 while (count--)
96 outl (*p++, port);
99 #define iounmap(addr) ((void)0)
100 #define ioremap(physaddr, size) (physaddr)
101 #define ioremap_nocache(physaddr, size) (physaddr)
102 #define ioremap_writethrough(physaddr, size) (physaddr)
103 #define ioremap_fullcache(physaddr, size) (physaddr)
105 #define mmiowb()
107 #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
108 #if 0
109 /* This is really stupid; don't define it. */
110 #define page_to_bus(page) page_to_phys (page)
111 #endif
113 /* Conversion between virtual and physical mappings. */
114 #define mm_ptov(addr) ((void *)__phys_to_virt (addr))
115 #define mm_vtop(addr) ((unsigned long)__virt_to_phys (addr))
116 #define phys_to_virt(addr) ((void *)__phys_to_virt (addr))
117 #define virt_to_phys(addr) ((unsigned long)__virt_to_phys (addr))
119 #define memcpy_fromio(dst, src, len) memcpy (dst, (void *)src, len)
120 #define memcpy_toio(dst, src, len) memcpy ((void *)dst, src, len)
123 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
124 * access
126 #define xlate_dev_mem_ptr(p) __va(p)
129 * Convert a virtual cached pointer to an uncached pointer
131 #define xlate_dev_kmem_ptr(p) p
133 #endif /* __V850_IO_H__ */