Linux 2.6.25.3
[linux/fpc-iii.git] / include / asm-v850 / io.h
blobcdad251fba9ff1802d7f311c660f08b0d9fa0d71
1 /*
2 * include/asm-v850/io.h -- Misc I/O operations
4 * Copyright (C) 2001,02,03,04,05 NEC Electronics Corporation
5 * Copyright (C) 2001,02,03,04,05 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(val, addr) \
31 (void)((*(volatile unsigned char *) (addr)) = (val))
32 #define writew(val, addr) \
33 (void)((*(volatile unsigned short *) (addr)) = (val))
34 #define writel(val, addr) \
35 (void)((*(volatile unsigned int *) (addr)) = (val))
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);
100 /* Some places try to pass in an loff_t for PHYSADDR (?!), so we cast it to
101 long before casting it to a pointer to avoid compiler warnings. */
102 #define ioremap(physaddr, size) ((void __iomem *)(unsigned long)(physaddr))
103 #define iounmap(addr) ((void)0)
105 #define ioremap_nocache(physaddr, size) ioremap (physaddr, size)
106 #define ioremap_writethrough(physaddr, size) ioremap (physaddr, size)
107 #define ioremap_fullcache(physaddr, size) ioremap (physaddr, size)
109 #define ioread8(addr) readb (addr)
110 #define ioread16(addr) readw (addr)
111 #define ioread32(addr) readl (addr)
112 #define iowrite8(val, addr) writeb (val, addr)
113 #define iowrite16(val, addr) writew (val, addr)
114 #define iowrite32(val, addr) writel (val, addr)
116 #define mmiowb()
118 #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
119 #if 0
120 /* This is really stupid; don't define it. */
121 #define page_to_bus(page) page_to_phys (page)
122 #endif
124 /* Conversion between virtual and physical mappings. */
125 #define phys_to_virt(addr) ((void *)__phys_to_virt (addr))
126 #define virt_to_phys(addr) ((unsigned long)__virt_to_phys (addr))
128 #define memcpy_fromio(dst, src, len) memcpy (dst, (void *)src, len)
129 #define memcpy_toio(dst, src, len) memcpy ((void *)dst, src, len)
132 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
133 * access
135 #define xlate_dev_mem_ptr(p) __va(p)
138 * Convert a virtual cached pointer to an uncached pointer
140 #define xlate_dev_kmem_ptr(p) p
142 #endif /* __V850_IO_H__ */