1#ifndef _ASM_M32R_IO_H
2#define _ASM_M32R_IO_H
3
4#include <linux/string.h>
5#include <linux/compiler.h>
6#include <asm/page.h>
7
8#ifdef __KERNEL__
9
10#define IO_SPACE_LIMIT 0xFFFFFFFF
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25static inline unsigned long virt_to_phys(volatile void * address)
26{
27 return __pa(address);
28}
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43static inline void *phys_to_virt(unsigned long address)
44{
45 return __va(address);
46}
47
48extern void __iomem *
49__ioremap(unsigned long offset, unsigned long size, unsigned long flags);
50
51
52
53
54
55
56
57
58
59
60
61
62
63static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
64{
65 return __ioremap(offset, size, 0);
66}
67
68extern void iounmap(volatile void __iomem *addr);
69#define ioremap_nocache(off,size) ioremap(off,size)
70#define ioremap_wc ioremap_nocache
71#define ioremap_wt ioremap_nocache
72
73
74
75
76#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
77#define page_to_bus page_to_phys
78#define virt_to_bus virt_to_phys
79
80extern unsigned char _inb(unsigned long);
81extern unsigned short _inw(unsigned long);
82extern unsigned long _inl(unsigned long);
83extern unsigned char _inb_p(unsigned long);
84extern unsigned short _inw_p(unsigned long);
85extern unsigned long _inl_p(unsigned long);
86extern void _outb(unsigned char, unsigned long);
87extern void _outw(unsigned short, unsigned long);
88extern void _outl(unsigned long, unsigned long);
89extern void _outb_p(unsigned char, unsigned long);
90extern void _outw_p(unsigned short, unsigned long);
91extern void _outl_p(unsigned long, unsigned long);
92extern void _insb(unsigned int, void *, unsigned long);
93extern void _insw(unsigned int, void *, unsigned long);
94extern void _insl(unsigned int, void *, unsigned long);
95extern void _outsb(unsigned int, const void *, unsigned long);
96extern void _outsw(unsigned int, const void *, unsigned long);
97extern void _outsl(unsigned int, const void *, unsigned long);
98
99static inline unsigned char _readb(unsigned long addr)
100{
101 return *(volatile unsigned char __force *)addr;
102}
103
104static inline unsigned short _readw(unsigned long addr)
105{
106 return *(volatile unsigned short __force *)addr;
107}
108
109static inline unsigned long _readl(unsigned long addr)
110{
111 return *(volatile unsigned long __force *)addr;
112}
113
114static inline void _writeb(unsigned char b, unsigned long addr)
115{
116 *(volatile unsigned char __force *)addr = b;
117}
118
119static inline void _writew(unsigned short w, unsigned long addr)
120{
121 *(volatile unsigned short __force *)addr = w;
122}
123
124static inline void _writel(unsigned long l, unsigned long addr)
125{
126 *(volatile unsigned long __force *)addr = l;
127}
128
129#define inb _inb
130#define inw _inw
131#define inl _inl
132#define outb _outb
133#define outw _outw
134#define outl _outl
135
136#define inb_p _inb_p
137#define inw_p _inw_p
138#define inl_p _inl_p
139#define outb_p _outb_p
140#define outw_p _outw_p
141#define outl_p _outl_p
142
143#define insb _insb
144#define insw _insw
145#define insl _insl
146#define outsb _outsb
147#define outsw _outsw
148#define outsl _outsl
149
150#define readb(addr) _readb((unsigned long)(addr))
151#define readw(addr) _readw((unsigned long)(addr))
152#define readl(addr) _readl((unsigned long)(addr))
153#define __raw_readb readb
154#define __raw_readw readw
155#define __raw_readl readl
156#define readb_relaxed readb
157#define readw_relaxed readw
158#define readl_relaxed readl
159
160#define writeb(val, addr) _writeb((val), (unsigned long)(addr))
161#define writew(val, addr) _writew((val), (unsigned long)(addr))
162#define writel(val, addr) _writel((val), (unsigned long)(addr))
163#define __raw_writeb writeb
164#define __raw_writew writew
165#define __raw_writel writel
166#define writeb_relaxed writeb
167#define writew_relaxed writew
168#define writel_relaxed writel
169
170#define ioread8 read
171#define ioread16 readw
172#define ioread32 readl
173#define iowrite8 writeb
174#define iowrite16 writew
175#define iowrite32 writel
176
177#define ioread16be(addr) be16_to_cpu(readw(addr))
178#define ioread32be(addr) be32_to_cpu(readl(addr))
179#define iowrite16be(v, addr) writew(cpu_to_be16(v), (addr))
180#define iowrite32be(v, addr) writel(cpu_to_be32(v), (addr))
181
182#define mmiowb()
183
184#define flush_write_buffers() do { } while (0)
185
186static inline void
187memset_io(volatile void __iomem *addr, unsigned char val, int count)
188{
189 memset((void __force *) addr, val, count);
190}
191
192static inline void
193memcpy_fromio(void *dst, volatile void __iomem *src, int count)
194{
195 memcpy(dst, (void __force *) src, count);
196}
197
198static inline void
199memcpy_toio(volatile void __iomem *dst, const void *src, int count)
200{
201 memcpy((void __force *) dst, src, count);
202}
203
204
205
206
207
208#define xlate_dev_mem_ptr(p) __va(p)
209
210
211
212
213#define xlate_dev_kmem_ptr(p) p
214
215#endif
216
217#endif
218