add SDHC support in mmc driver
[u-boot-openmoko/mini2440.git] / include / asm-microblaze / io.h
blob90d18428ad1e960ab67b3e48849e7c0207b8a4ce
1 /*
2 * include/asm-microblaze/io.h -- Misc I/O operations
4 * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
5 * Copyright (C) 2001,02 NEC Corporation
6 * Copyright (C) 2001,02 Miles Bader <miles@gnu.org>
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file COPYING in the main directory of this
10 * archive for more details.
12 * Written by Miles Bader <miles@gnu.org>
13 * Microblaze port by John Williams
16 #ifndef __MICROBLAZE_IO_H__
17 #define __MICROBLAZE_IO_H__
19 #define IO_SPACE_LIMIT 0xFFFFFFFF
21 #define readb(addr) \
22 ({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
23 #define readw(addr) \
24 ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
25 #define readl(addr) \
26 ({ unsigned long __v = (*(volatile unsigned long *) (addr)); __v; })
28 #define writeb(b, addr) \
29 (void)((*(volatile unsigned char *) (addr)) = (b))
30 #define writew(b, addr) \
31 (void)((*(volatile unsigned short *) (addr)) = (b))
32 #define writel(b, addr) \
33 (void)((*(volatile unsigned int *) (addr)) = (b))
35 #define memset_io(a,b,c) memset((void *)(a),(b),(c))
36 #define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
37 #define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
39 #define inb(addr) readb (addr)
40 #define inw(addr) readw (addr)
41 #define inl(addr) readl (addr)
42 #define outb(x, addr) ((void) writeb (x, addr))
43 #define outw(x, addr) ((void) writew (x, addr))
44 #define outl(x, addr) ((void) writel (x, addr))
46 /* Some #definitions to keep strange Xilinx code happy */
47 #define in_8(addr) readb (addr)
48 #define in_be16(addr) readw (addr)
49 #define in_be32(addr) readl (addr)
51 #define out_8(addr,x ) outb (x,addr)
52 #define out_be16(addr,x ) outw (x,addr)
53 #define out_be32(addr,x ) outl (x,addr)
56 #define inb_p(port) inb((port))
57 #define outb_p(val, port) outb((val), (port))
58 #define inw_p(port) inw((port))
59 #define outw_p(val, port) outw((val), (port))
60 #define inl_p(port) inl((port))
61 #define outl_p(val, port) outl((val), (port))
63 /* Some defines to keep the MTD flash drivers happy */
65 #define __raw_readb readb
66 #define __raw_readw readw
67 #define __raw_readl readl
68 #define __raw_writeb writeb
69 #define __raw_writew writew
70 #define __raw_writel writel
72 static inline void io_insb (unsigned long port, void *dst, unsigned long count)
74 unsigned char *p = dst;
75 while (count--)
76 *p++ = inb (port);
78 static inline void io_insw (unsigned long port, void *dst, unsigned long count)
80 unsigned short *p = dst;
81 while (count--)
82 *p++ = inw (port);
84 static inline void io_insl (unsigned long port, void *dst, unsigned long count)
86 unsigned long *p = dst;
87 while (count--)
88 *p++ = inl (port);
91 static inline void
92 io_outsb (unsigned long port, const void *src, unsigned long count)
94 const unsigned char *p = src;
95 while (count--)
96 outb (*p++, port);
98 static inline void
99 io_outsw (unsigned long port, const void *src, unsigned long count)
101 const unsigned short *p = src;
102 while (count--)
103 outw (*p++, port);
105 static inline void
106 io_outsl (unsigned long port, const void *src, unsigned long count)
108 const unsigned long *p = src;
109 while (count--)
110 outl (*p++, port);
113 #define outsb(a,b,l) io_outsb(a,b,l)
114 #define outsw(a,b,l) io_outsw(a,b,l)
115 #define outsl(a,b,l) io_outsl(a,b,l)
117 #define insb(a,b,l) io_insb(a,b,l)
118 #define insw(a,b,l) io_insw(a,b,l)
119 #define insl(a,b,l) io_insl(a,b,l)
122 #define iounmap(addr) ((void)0)
123 #define ioremap(physaddr, size) (physaddr)
124 #define ioremap_nocache(physaddr, size) (physaddr)
125 #define ioremap_writethrough(physaddr, size) (physaddr)
126 #define ioremap_fullcache(physaddr, size) (physaddr)
128 static inline void sync(void)
133 * Given a physical address and a length, return a virtual address
134 * that can be used to access the memory range with the caching
135 * properties specified by "flags".
137 typedef unsigned long phys_addr_t;
139 #define MAP_NOCACHE (0)
140 #define MAP_WRCOMBINE (0)
141 #define MAP_WRBACK (0)
142 #define MAP_WRTHROUGH (0)
144 static inline void *
145 map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
147 return (void *)paddr;
151 * Take down a mapping set up by map_physmem().
153 static inline void unmap_physmem(void *vaddr, unsigned long flags)
158 #endif /* __MICROBLAZE_IO_H__ */