aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ixp4xx/include/mach/io.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-ixp4xx/include/mach/io.h')
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/io.h307
1 files changed, 133 insertions, 174 deletions
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h
index 8a947d42a6f1..6ea7e2fb2701 100644
--- a/arch/arm/mach-ixp4xx/include/mach/io.h
+++ b/arch/arm/mach-ixp4xx/include/mach/io.h
@@ -26,22 +26,20 @@ extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
26/* 26/*
27 * IXP4xx provides two methods of accessing PCI memory space: 27 * IXP4xx provides two methods of accessing PCI memory space:
28 * 28 *
29 * 1) A direct mapped window from 0x48000000 to 0x4bffffff (64MB). 29 * 1) A direct mapped window from 0x48000000 to 0x4BFFFFFF (64MB).
30 * To access PCI via this space, we simply ioremap() the BAR 30 * To access PCI via this space, we simply ioremap() the BAR
31 * into the kernel and we can use the standard read[bwl]/write[bwl] 31 * into the kernel and we can use the standard read[bwl]/write[bwl]
32 * macros. This is the preffered method due to speed but it 32 * macros. This is the preffered method due to speed but it
33 * limits the system to just 64MB of PCI memory. This can be 33 * limits the system to just 64MB of PCI memory. This can be
34 * problamatic if using video cards and other memory-heavy 34 * problematic if using video cards and other memory-heavy targets.
35 * targets.
36 *
37 * 2) If > 64MB of memory space is required, the IXP4xx can be configured
38 * to use indirect registers to access PCI (as we do below for I/O
39 * transactions). This allows for up to 128MB (0x48000000 to 0x4fffffff)
40 * of memory on the bus. The disadvantage of this is that every
41 * PCI access requires three local register accesses plus a spinlock,
42 * but in some cases the performance hit is acceptable. In addition,
43 * you cannot mmap() PCI devices in this case.
44 * 35 *
36 * 2) If > 64MB of memory space is required, the IXP4xx can use indirect
37 * registers to access the whole 4 GB of PCI memory space (as we do below
38 * for I/O transactions). This allows currently for up to 1 GB (0x10000000
39 * to 0x4FFFFFFF) of memory on the bus. The disadvantage of this is that
40 * every PCI access requires three local register accesses plus a spinlock,
41 * but in some cases the performance hit is acceptable. In addition, you
42 * cannot mmap() PCI devices in this case.
45 */ 43 */
46#ifndef CONFIG_IXP4XX_INDIRECT_PCI 44#ifndef CONFIG_IXP4XX_INDIRECT_PCI
47 45
@@ -55,48 +53,52 @@ extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
55 * access registers. If something outside of PCI is ioremap'd, we 53 * access registers. If something outside of PCI is ioremap'd, we
56 * fallback to the default. 54 * fallback to the default.
57 */ 55 */
58static inline void __iomem * 56
59__ixp4xx_ioremap(unsigned long addr, size_t size, unsigned int mtype) 57static inline int is_pci_memory(u32 addr)
58{
59 return (addr >= PCIBIOS_MIN_MEM) && (addr <= 0x4FFFFFFF);
60}
61
62static inline void __iomem * __indirect_ioremap(unsigned long addr, size_t size,
63 unsigned int mtype)
60{ 64{
61 if((addr < PCIBIOS_MIN_MEM) || (addr > 0x4fffffff)) 65 if (!is_pci_memory(addr))
62 return __arm_ioremap(addr, size, mtype); 66 return __arm_ioremap(addr, size, mtype);
63 67
64 return (void __iomem *)addr; 68 return (void __iomem *)addr;
65} 69}
66 70
67static inline void 71static inline void __indirect_iounmap(void __iomem *addr)
68__ixp4xx_iounmap(void __iomem *addr)
69{ 72{
70 if ((__force u32)addr >= VMALLOC_START) 73 if (!is_pci_memory((__force u32)addr))
71 __iounmap(addr); 74 __iounmap(addr);
72} 75}
73 76
74#define __arch_ioremap(a, s, f) __ixp4xx_ioremap(a, s, f) 77#define __arch_ioremap(a, s, f) __indirect_ioremap(a, s, f)
75#define __arch_iounmap(a) __ixp4xx_iounmap(a) 78#define __arch_iounmap(a) __indirect_iounmap(a)
76 79
77#define writeb(v, p) __ixp4xx_writeb(v, p) 80#define writeb(v, p) __indirect_writeb(v, p)
78#define writew(v, p) __ixp4xx_writew(v, p) 81#define writew(v, p) __indirect_writew(v, p)
79#define writel(v, p) __ixp4xx_writel(v, p) 82#define writel(v, p) __indirect_writel(v, p)
80 83
81#define writesb(p, v, l) __ixp4xx_writesb(p, v, l) 84#define writesb(p, v, l) __indirect_writesb(p, v, l)
82#define writesw(p, v, l) __ixp4xx_writesw(p, v, l) 85#define writesw(p, v, l) __indirect_writesw(p, v, l)
83#define writesl(p, v, l) __ixp4xx_writesl(p, v, l) 86#define writesl(p, v, l) __indirect_writesl(p, v, l)
84
85#define readb(p) __ixp4xx_readb(p)
86#define readw(p) __ixp4xx_readw(p)
87#define readl(p) __ixp4xx_readl(p)
88
89#define readsb(p, v, l) __ixp4xx_readsb(p, v, l)
90#define readsw(p, v, l) __ixp4xx_readsw(p, v, l)
91#define readsl(p, v, l) __ixp4xx_readsl(p, v, l)
92 87
93static inline void 88#define readb(p) __indirect_readb(p)
94__ixp4xx_writeb(u8 value, volatile void __iomem *p) 89#define readw(p) __indirect_readw(p)
90#define readl(p) __indirect_readl(p)
91
92#define readsb(p, v, l) __indirect_readsb(p, v, l)
93#define readsw(p, v, l) __indirect_readsw(p, v, l)
94#define readsl(p, v, l) __indirect_readsl(p, v, l)
95
96static inline void __indirect_writeb(u8 value, volatile void __iomem *p)
95{ 97{
96 u32 addr = (u32)p; 98 u32 addr = (u32)p;
97 u32 n, byte_enables, data; 99 u32 n, byte_enables, data;
98 100
99 if (addr >= VMALLOC_START) { 101 if (!is_pci_memory(addr)) {
100 __raw_writeb(value, addr); 102 __raw_writeb(value, addr);
101 return; 103 return;
102 } 104 }
@@ -107,20 +109,19 @@ __ixp4xx_writeb(u8 value, volatile void __iomem *p)
107 ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data); 109 ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data);
108} 110}
109 111
110static inline void 112static inline void __indirect_writesb(volatile void __iomem *bus_addr,
111__ixp4xx_writesb(volatile void __iomem *bus_addr, const u8 *vaddr, int count) 113 const u8 *vaddr, int count)
112{ 114{
113 while (count--) 115 while (count--)
114 writeb(*vaddr++, bus_addr); 116 writeb(*vaddr++, bus_addr);
115} 117}
116 118
117static inline void 119static inline void __indirect_writew(u16 value, volatile void __iomem *p)
118__ixp4xx_writew(u16 value, volatile void __iomem *p)
119{ 120{
120 u32 addr = (u32)p; 121 u32 addr = (u32)p;
121 u32 n, byte_enables, data; 122 u32 n, byte_enables, data;
122 123
123 if (addr >= VMALLOC_START) { 124 if (!is_pci_memory(addr)) {
124 __raw_writew(value, addr); 125 __raw_writew(value, addr);
125 return; 126 return;
126 } 127 }
@@ -131,18 +132,18 @@ __ixp4xx_writew(u16 value, volatile void __iomem *p)
131 ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data); 132 ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data);
132} 133}
133 134
134static inline void 135static inline void __indirect_writesw(volatile void __iomem *bus_addr,
135__ixp4xx_writesw(volatile void __iomem *bus_addr, const u16 *vaddr, int count) 136 const u16 *vaddr, int count)
136{ 137{
137 while (count--) 138 while (count--)
138 writew(*vaddr++, bus_addr); 139 writew(*vaddr++, bus_addr);
139} 140}
140 141
141static inline void 142static inline void __indirect_writel(u32 value, volatile void __iomem *p)
142__ixp4xx_writel(u32 value, volatile void __iomem *p)
143{ 143{
144 u32 addr = (__force u32)p; 144 u32 addr = (__force u32)p;
145 if (addr >= VMALLOC_START) { 145
146 if (!is_pci_memory(addr)) {
146 __raw_writel(value, p); 147 __raw_writel(value, p);
147 return; 148 return;
148 } 149 }
@@ -150,20 +151,19 @@ __ixp4xx_writel(u32 value, volatile void __iomem *p)
150 ixp4xx_pci_write(addr, NP_CMD_MEMWRITE, value); 151 ixp4xx_pci_write(addr, NP_CMD_MEMWRITE, value);
151} 152}
152 153
153static inline void 154static inline void __indirect_writesl(volatile void __iomem *bus_addr,
154__ixp4xx_writesl(volatile void __iomem *bus_addr, const u32 *vaddr, int count) 155 const u32 *vaddr, int count)
155{ 156{
156 while (count--) 157 while (count--)
157 writel(*vaddr++, bus_addr); 158 writel(*vaddr++, bus_addr);
158} 159}
159 160
160static inline unsigned char 161static inline unsigned char __indirect_readb(const volatile void __iomem *p)
161__ixp4xx_readb(const volatile void __iomem *p)
162{ 162{
163 u32 addr = (u32)p; 163 u32 addr = (u32)p;
164 u32 n, byte_enables, data; 164 u32 n, byte_enables, data;
165 165
166 if (addr >= VMALLOC_START) 166 if (!is_pci_memory(addr))
167 return __raw_readb(addr); 167 return __raw_readb(addr);
168 168
169 n = addr % 4; 169 n = addr % 4;
@@ -174,20 +174,19 @@ __ixp4xx_readb(const volatile void __iomem *p)
174 return data >> (8*n); 174 return data >> (8*n);
175} 175}
176 176
177static inline void 177static inline void __indirect_readsb(const volatile void __iomem *bus_addr,
178__ixp4xx_readsb(const volatile void __iomem *bus_addr, u8 *vaddr, u32 count) 178 u8 *vaddr, u32 count)
179{ 179{
180 while (count--) 180 while (count--)
181 *vaddr++ = readb(bus_addr); 181 *vaddr++ = readb(bus_addr);
182} 182}
183 183
184static inline unsigned short 184static inline unsigned short __indirect_readw(const volatile void __iomem *p)
185__ixp4xx_readw(const volatile void __iomem *p)
186{ 185{
187 u32 addr = (u32)p; 186 u32 addr = (u32)p;
188 u32 n, byte_enables, data; 187 u32 n, byte_enables, data;
189 188
190 if (addr >= VMALLOC_START) 189 if (!is_pci_memory(addr))
191 return __raw_readw(addr); 190 return __raw_readw(addr);
192 191
193 n = addr % 4; 192 n = addr % 4;
@@ -198,20 +197,19 @@ __ixp4xx_readw(const volatile void __iomem *p)
198 return data>>(8*n); 197 return data>>(8*n);
199} 198}
200 199
201static inline void 200static inline void __indirect_readsw(const volatile void __iomem *bus_addr,
202__ixp4xx_readsw(const volatile void __iomem *bus_addr, u16 *vaddr, u32 count) 201 u16 *vaddr, u32 count)
203{ 202{
204 while (count--) 203 while (count--)
205 *vaddr++ = readw(bus_addr); 204 *vaddr++ = readw(bus_addr);
206} 205}
207 206
208static inline unsigned long 207static inline unsigned long __indirect_readl(const volatile void __iomem *p)
209__ixp4xx_readl(const volatile void __iomem *p)
210{ 208{
211 u32 addr = (__force u32)p; 209 u32 addr = (__force u32)p;
212 u32 data; 210 u32 data;
213 211
214 if (addr >= VMALLOC_START) 212 if (!is_pci_memory(addr))
215 return __raw_readl(p); 213 return __raw_readl(p);
216 214
217 if (ixp4xx_pci_read(addr, NP_CMD_MEMREAD, &data)) 215 if (ixp4xx_pci_read(addr, NP_CMD_MEMREAD, &data))
@@ -220,8 +218,8 @@ __ixp4xx_readl(const volatile void __iomem *p)
220 return data; 218 return data;
221} 219}
222 220
223static inline void 221static inline void __indirect_readsl(const volatile void __iomem *bus_addr,
224__ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count) 222 u32 *vaddr, u32 count)
225{ 223{
226 while (count--) 224 while (count--)
227 *vaddr++ = readl(bus_addr); 225 *vaddr++ = readl(bus_addr);
@@ -235,7 +233,7 @@ __ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count)
235#define memcpy_fromio(a,c,l) _memcpy_fromio((a),(c),(l)) 233#define memcpy_fromio(a,c,l) _memcpy_fromio((a),(c),(l))
236#define memcpy_toio(c,a,l) _memcpy_toio((c),(a),(l)) 234#define memcpy_toio(c,a,l) _memcpy_toio((c),(a),(l))
237 235
238#endif 236#endif /* CONFIG_IXP4XX_INDIRECT_PCI */
239 237
240#ifndef CONFIG_PCI 238#ifndef CONFIG_PCI
241 239
@@ -250,25 +248,8 @@ __ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count)
250 * transaction. This means that we need to override the default 248 * transaction. This means that we need to override the default
251 * I/O functions. 249 * I/O functions.
252 */ 250 */
253#define outb(p, v) __ixp4xx_outb(p, v)
254#define outw(p, v) __ixp4xx_outw(p, v)
255#define outl(p, v) __ixp4xx_outl(p, v)
256
257#define outsb(p, v, l) __ixp4xx_outsb(p, v, l)
258#define outsw(p, v, l) __ixp4xx_outsw(p, v, l)
259#define outsl(p, v, l) __ixp4xx_outsl(p, v, l)
260 251
261#define inb(p) __ixp4xx_inb(p) 252static inline void outb(u8 value, u32 addr)
262#define inw(p) __ixp4xx_inw(p)
263#define inl(p) __ixp4xx_inl(p)
264
265#define insb(p, v, l) __ixp4xx_insb(p, v, l)
266#define insw(p, v, l) __ixp4xx_insw(p, v, l)
267#define insl(p, v, l) __ixp4xx_insl(p, v, l)
268
269
270static inline void
271__ixp4xx_outb(u8 value, u32 addr)
272{ 253{
273 u32 n, byte_enables, data; 254 u32 n, byte_enables, data;
274 n = addr % 4; 255 n = addr % 4;
@@ -277,15 +258,13 @@ __ixp4xx_outb(u8 value, u32 addr)
277 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data); 258 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data);
278} 259}
279 260
280static inline void 261static inline void outsb(u32 io_addr, const u8 *vaddr, u32 count)
281__ixp4xx_outsb(u32 io_addr, const u8 *vaddr, u32 count)
282{ 262{
283 while (count--) 263 while (count--)
284 outb(*vaddr++, io_addr); 264 outb(*vaddr++, io_addr);
285} 265}
286 266
287static inline void 267static inline void outw(u16 value, u32 addr)
288__ixp4xx_outw(u16 value, u32 addr)
289{ 268{
290 u32 n, byte_enables, data; 269 u32 n, byte_enables, data;
291 n = addr % 4; 270 n = addr % 4;
@@ -294,28 +273,24 @@ __ixp4xx_outw(u16 value, u32 addr)
294 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data); 273 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data);
295} 274}
296 275
297static inline void 276static inline void outsw(u32 io_addr, const u16 *vaddr, u32 count)
298__ixp4xx_outsw(u32 io_addr, const u16 *vaddr, u32 count)
299{ 277{
300 while (count--) 278 while (count--)
301 outw(cpu_to_le16(*vaddr++), io_addr); 279 outw(cpu_to_le16(*vaddr++), io_addr);
302} 280}
303 281
304static inline void 282static inline void outl(u32 value, u32 addr)
305__ixp4xx_outl(u32 value, u32 addr)
306{ 283{
307 ixp4xx_pci_write(addr, NP_CMD_IOWRITE, value); 284 ixp4xx_pci_write(addr, NP_CMD_IOWRITE, value);
308} 285}
309 286
310static inline void 287static inline void outsl(u32 io_addr, const u32 *vaddr, u32 count)
311__ixp4xx_outsl(u32 io_addr, const u32 *vaddr, u32 count)
312{ 288{
313 while (count--) 289 while (count--)
314 outl(*vaddr++, io_addr); 290 outl(cpu_to_le32(*vaddr++), io_addr);
315} 291}
316 292
317static inline u8 293static inline u8 inb(u32 addr)
318__ixp4xx_inb(u32 addr)
319{ 294{
320 u32 n, byte_enables, data; 295 u32 n, byte_enables, data;
321 n = addr % 4; 296 n = addr % 4;
@@ -326,15 +301,13 @@ __ixp4xx_inb(u32 addr)
326 return data >> (8*n); 301 return data >> (8*n);
327} 302}
328 303
329static inline void 304static inline void insb(u32 io_addr, u8 *vaddr, u32 count)
330__ixp4xx_insb(u32 io_addr, u8 *vaddr, u32 count)
331{ 305{
332 while (count--) 306 while (count--)
333 *vaddr++ = inb(io_addr); 307 *vaddr++ = inb(io_addr);
334} 308}
335 309
336static inline u16 310static inline u16 inw(u32 addr)
337__ixp4xx_inw(u32 addr)
338{ 311{
339 u32 n, byte_enables, data; 312 u32 n, byte_enables, data;
340 n = addr % 4; 313 n = addr % 4;
@@ -345,15 +318,13 @@ __ixp4xx_inw(u32 addr)
345 return data>>(8*n); 318 return data>>(8*n);
346} 319}
347 320
348static inline void 321static inline void insw(u32 io_addr, u16 *vaddr, u32 count)
349__ixp4xx_insw(u32 io_addr, u16 *vaddr, u32 count)
350{ 322{
351 while (count--) 323 while (count--)
352 *vaddr++ = le16_to_cpu(inw(io_addr)); 324 *vaddr++ = le16_to_cpu(inw(io_addr));
353} 325}
354 326
355static inline u32 327static inline u32 inl(u32 addr)
356__ixp4xx_inl(u32 addr)
357{ 328{
358 u32 data; 329 u32 data;
359 if (ixp4xx_pci_read(addr, NP_CMD_IOREAD, &data)) 330 if (ixp4xx_pci_read(addr, NP_CMD_IOREAD, &data))
@@ -362,11 +333,10 @@ __ixp4xx_inl(u32 addr)
362 return data; 333 return data;
363} 334}
364 335
365static inline void 336static inline void insl(u32 io_addr, u32 *vaddr, u32 count)
366__ixp4xx_insl(u32 io_addr, u32 *vaddr, u32 count)
367{ 337{
368 while (count--) 338 while (count--)
369 *vaddr++ = inl(io_addr); 339 *vaddr++ = le32_to_cpu(inl(io_addr));
370} 340}
371 341
372#define PIO_OFFSET 0x10000UL 342#define PIO_OFFSET 0x10000UL
@@ -374,194 +344,183 @@ __ixp4xx_insl(u32 io_addr, u32 *vaddr, u32 count)
374 344
375#define __is_io_address(p) (((unsigned long)p >= PIO_OFFSET) && \ 345#define __is_io_address(p) (((unsigned long)p >= PIO_OFFSET) && \
376 ((unsigned long)p <= (PIO_MASK + PIO_OFFSET))) 346 ((unsigned long)p <= (PIO_MASK + PIO_OFFSET)))
377static inline unsigned int 347
378__ixp4xx_ioread8(const void __iomem *addr) 348#define ioread8(p) ioread8(p)
349static inline unsigned int ioread8(const void __iomem *addr)
379{ 350{
380 unsigned long port = (unsigned long __force)addr; 351 unsigned long port = (unsigned long __force)addr;
381 if (__is_io_address(port)) 352 if (__is_io_address(port))
382 return (unsigned int)__ixp4xx_inb(port & PIO_MASK); 353 return (unsigned int)inb(port & PIO_MASK);
383 else 354 else
384#ifndef CONFIG_IXP4XX_INDIRECT_PCI 355#ifndef CONFIG_IXP4XX_INDIRECT_PCI
385 return (unsigned int)__raw_readb(port); 356 return (unsigned int)__raw_readb(port);
386#else 357#else
387 return (unsigned int)__ixp4xx_readb(addr); 358 return (unsigned int)__indirect_readb(addr);
388#endif 359#endif
389} 360}
390 361
391static inline void 362#define ioread8_rep(p, v, c) ioread8_rep(p, v, c)
392__ixp4xx_ioread8_rep(const void __iomem *addr, void *vaddr, u32 count) 363static inline void ioread8_rep(const void __iomem *addr, void *vaddr, u32 count)
393{ 364{
394 unsigned long port = (unsigned long __force)addr; 365 unsigned long port = (unsigned long __force)addr;
395 if (__is_io_address(port)) 366 if (__is_io_address(port))
396 __ixp4xx_insb(port & PIO_MASK, vaddr, count); 367 insb(port & PIO_MASK, vaddr, count);
397 else 368 else
398#ifndef CONFIG_IXP4XX_INDIRECT_PCI 369#ifndef CONFIG_IXP4XX_INDIRECT_PCI
399 __raw_readsb(addr, vaddr, count); 370 __raw_readsb(addr, vaddr, count);
400#else 371#else
401 __ixp4xx_readsb(addr, vaddr, count); 372 __indirect_readsb(addr, vaddr, count);
402#endif 373#endif
403} 374}
404 375
405static inline unsigned int 376#define ioread16(p) ioread16(p)
406__ixp4xx_ioread16(const void __iomem *addr) 377static inline unsigned int ioread16(const void __iomem *addr)
407{ 378{
408 unsigned long port = (unsigned long __force)addr; 379 unsigned long port = (unsigned long __force)addr;
409 if (__is_io_address(port)) 380 if (__is_io_address(port))
410 return (unsigned int)__ixp4xx_inw(port & PIO_MASK); 381 return (unsigned int)inw(port & PIO_MASK);
411 else 382 else
412#ifndef CONFIG_IXP4XX_INDIRECT_PCI 383#ifndef CONFIG_IXP4XX_INDIRECT_PCI
413 return le16_to_cpu(__raw_readw((u32)port)); 384 return le16_to_cpu(__raw_readw((u32)port));
414#else 385#else
415 return (unsigned int)__ixp4xx_readw(addr); 386 return (unsigned int)__indirect_readw(addr);
416#endif 387#endif
417} 388}
418 389
419static inline void 390#define ioread16_rep(p, v, c) ioread16_rep(p, v, c)
420__ixp4xx_ioread16_rep(const void __iomem *addr, void *vaddr, u32 count) 391static inline void ioread16_rep(const void __iomem *addr, void *vaddr,
392 u32 count)
421{ 393{
422 unsigned long port = (unsigned long __force)addr; 394 unsigned long port = (unsigned long __force)addr;
423 if (__is_io_address(port)) 395 if (__is_io_address(port))
424 __ixp4xx_insw(port & PIO_MASK, vaddr, count); 396 insw(port & PIO_MASK, vaddr, count);
425 else 397 else
426#ifndef CONFIG_IXP4XX_INDIRECT_PCI 398#ifndef CONFIG_IXP4XX_INDIRECT_PCI
427 __raw_readsw(addr, vaddr, count); 399 __raw_readsw(addr, vaddr, count);
428#else 400#else
429 __ixp4xx_readsw(addr, vaddr, count); 401 __indirect_readsw(addr, vaddr, count);
430#endif 402#endif
431} 403}
432 404
433static inline unsigned int 405#define ioread32(p) ioread32(p)
434__ixp4xx_ioread32(const void __iomem *addr) 406static inline unsigned int ioread32(const void __iomem *addr)
435{ 407{
436 unsigned long port = (unsigned long __force)addr; 408 unsigned long port = (unsigned long __force)addr;
437 if (__is_io_address(port)) 409 if (__is_io_address(port))
438 return (unsigned int)__ixp4xx_inl(port & PIO_MASK); 410 return (unsigned int)inl(port & PIO_MASK);
439 else { 411 else {
440#ifndef CONFIG_IXP4XX_INDIRECT_PCI 412#ifndef CONFIG_IXP4XX_INDIRECT_PCI
441 return le32_to_cpu((__force __le32)__raw_readl(addr)); 413 return le32_to_cpu((__force __le32)__raw_readl(addr));
442#else 414#else
443 return (unsigned int)__ixp4xx_readl(addr); 415 return (unsigned int)__indirect_readl(addr);
444#endif 416#endif
445 } 417 }
446} 418}
447 419
448static inline void 420#define ioread32_rep(p, v, c) ioread32_rep(p, v, c)
449__ixp4xx_ioread32_rep(const void __iomem *addr, void *vaddr, u32 count) 421static inline void ioread32_rep(const void __iomem *addr, void *vaddr,
422 u32 count)
450{ 423{
451 unsigned long port = (unsigned long __force)addr; 424 unsigned long port = (unsigned long __force)addr;
452 if (__is_io_address(port)) 425 if (__is_io_address(port))
453 __ixp4xx_insl(port & PIO_MASK, vaddr, count); 426 insl(port & PIO_MASK, vaddr, count);
454 else 427 else
455#ifndef CONFIG_IXP4XX_INDIRECT_PCI 428#ifndef CONFIG_IXP4XX_INDIRECT_PCI
456 __raw_readsl(addr, vaddr, count); 429 __raw_readsl(addr, vaddr, count);
457#else 430#else
458 __ixp4xx_readsl(addr, vaddr, count); 431 __indirect_readsl(addr, vaddr, count);
459#endif 432#endif
460} 433}
461 434
462static inline void 435#define iowrite8(v, p) iowrite8(v, p)
463__ixp4xx_iowrite8(u8 value, void __iomem *addr) 436static inline void iowrite8(u8 value, void __iomem *addr)
464{ 437{
465 unsigned long port = (unsigned long __force)addr; 438 unsigned long port = (unsigned long __force)addr;
466 if (__is_io_address(port)) 439 if (__is_io_address(port))
467 __ixp4xx_outb(value, port & PIO_MASK); 440 outb(value, port & PIO_MASK);
468 else 441 else
469#ifndef CONFIG_IXP4XX_INDIRECT_PCI 442#ifndef CONFIG_IXP4XX_INDIRECT_PCI
470 __raw_writeb(value, port); 443 __raw_writeb(value, port);
471#else 444#else
472 __ixp4xx_writeb(value, addr); 445 __indirect_writeb(value, addr);
473#endif 446#endif
474} 447}
475 448
476static inline void 449#define iowrite8_rep(p, v, c) iowrite8_rep(p, v, c)
477__ixp4xx_iowrite8_rep(void __iomem *addr, const void *vaddr, u32 count) 450static inline void iowrite8_rep(void __iomem *addr, const void *vaddr,
451 u32 count)
478{ 452{
479 unsigned long port = (unsigned long __force)addr; 453 unsigned long port = (unsigned long __force)addr;
480 if (__is_io_address(port)) 454 if (__is_io_address(port))
481 __ixp4xx_outsb(port & PIO_MASK, vaddr, count); 455 outsb(port & PIO_MASK, vaddr, count);
482 else 456 else
483#ifndef CONFIG_IXP4XX_INDIRECT_PCI 457#ifndef CONFIG_IXP4XX_INDIRECT_PCI
484 __raw_writesb(addr, vaddr, count); 458 __raw_writesb(addr, vaddr, count);
485#else 459#else
486 __ixp4xx_writesb(addr, vaddr, count); 460 __indirect_writesb(addr, vaddr, count);
487#endif 461#endif
488} 462}
489 463
490static inline void 464#define iowrite16(v, p) iowrite16(v, p)
491__ixp4xx_iowrite16(u16 value, void __iomem *addr) 465static inline void iowrite16(u16 value, void __iomem *addr)
492{ 466{
493 unsigned long port = (unsigned long __force)addr; 467 unsigned long port = (unsigned long __force)addr;
494 if (__is_io_address(port)) 468 if (__is_io_address(port))
495 __ixp4xx_outw(value, port & PIO_MASK); 469 outw(value, port & PIO_MASK);
496 else 470 else
497#ifndef CONFIG_IXP4XX_INDIRECT_PCI 471#ifndef CONFIG_IXP4XX_INDIRECT_PCI
498 __raw_writew(cpu_to_le16(value), addr); 472 __raw_writew(cpu_to_le16(value), addr);
499#else 473#else
500 __ixp4xx_writew(value, addr); 474 __indirect_writew(value, addr);
501#endif 475#endif
502} 476}
503 477
504static inline void 478#define iowrite16_rep(p, v, c) iowrite16_rep(p, v, c)
505__ixp4xx_iowrite16_rep(void __iomem *addr, const void *vaddr, u32 count) 479static inline void iowrite16_rep(void __iomem *addr, const void *vaddr,
480 u32 count)
506{ 481{
507 unsigned long port = (unsigned long __force)addr; 482 unsigned long port = (unsigned long __force)addr;
508 if (__is_io_address(port)) 483 if (__is_io_address(port))
509 __ixp4xx_outsw(port & PIO_MASK, vaddr, count); 484 outsw(port & PIO_MASK, vaddr, count);
510 else 485 else
511#ifndef CONFIG_IXP4XX_INDIRECT_PCI 486#ifndef CONFIG_IXP4XX_INDIRECT_PCI
512 __raw_writesw(addr, vaddr, count); 487 __raw_writesw(addr, vaddr, count);
513#else 488#else
514 __ixp4xx_writesw(addr, vaddr, count); 489 __indirect_writesw(addr, vaddr, count);
515#endif 490#endif
516} 491}
517 492
518static inline void 493#define iowrite32(v, p) iowrite32(v, p)
519__ixp4xx_iowrite32(u32 value, void __iomem *addr) 494static inline void iowrite32(u32 value, void __iomem *addr)
520{ 495{
521 unsigned long port = (unsigned long __force)addr; 496 unsigned long port = (unsigned long __force)addr;
522 if (__is_io_address(port)) 497 if (__is_io_address(port))
523 __ixp4xx_outl(value, port & PIO_MASK); 498 outl(value, port & PIO_MASK);
524 else 499 else
525#ifndef CONFIG_IXP4XX_INDIRECT_PCI 500#ifndef CONFIG_IXP4XX_INDIRECT_PCI
526 __raw_writel((u32 __force)cpu_to_le32(value), addr); 501 __raw_writel((u32 __force)cpu_to_le32(value), addr);
527#else 502#else
528 __ixp4xx_writel(value, addr); 503 __indirect_writel(value, addr);
529#endif 504#endif
530} 505}
531 506
532static inline void 507#define iowrite32_rep(p, v, c) iowrite32_rep(p, v, c)
533__ixp4xx_iowrite32_rep(void __iomem *addr, const void *vaddr, u32 count) 508static inline void iowrite32_rep(void __iomem *addr, const void *vaddr,
509 u32 count)
534{ 510{
535 unsigned long port = (unsigned long __force)addr; 511 unsigned long port = (unsigned long __force)addr;
536 if (__is_io_address(port)) 512 if (__is_io_address(port))
537 __ixp4xx_outsl(port & PIO_MASK, vaddr, count); 513 outsl(port & PIO_MASK, vaddr, count);
538 else 514 else
539#ifndef CONFIG_IXP4XX_INDIRECT_PCI 515#ifndef CONFIG_IXP4XX_INDIRECT_PCI
540 __raw_writesl(addr, vaddr, count); 516 __raw_writesl(addr, vaddr, count);
541#else 517#else
542 __ixp4xx_writesl(addr, vaddr, count); 518 __indirect_writesl(addr, vaddr, count);
543#endif 519#endif
544} 520}
545 521
546#define ioread8(p) __ixp4xx_ioread8(p)
547#define ioread16(p) __ixp4xx_ioread16(p)
548#define ioread32(p) __ixp4xx_ioread32(p)
549
550#define ioread8_rep(p, v, c) __ixp4xx_ioread8_rep(p, v, c)
551#define ioread16_rep(p, v, c) __ixp4xx_ioread16_rep(p, v, c)
552#define ioread32_rep(p, v, c) __ixp4xx_ioread32_rep(p, v, c)
553
554#define iowrite8(v,p) __ixp4xx_iowrite8(v,p)
555#define iowrite16(v,p) __ixp4xx_iowrite16(v,p)
556#define iowrite32(v,p) __ixp4xx_iowrite32(v,p)
557
558#define iowrite8_rep(p, v, c) __ixp4xx_iowrite8_rep(p, v, c)
559#define iowrite16_rep(p, v, c) __ixp4xx_iowrite16_rep(p, v, c)
560#define iowrite32_rep(p, v, c) __ixp4xx_iowrite32_rep(p, v, c)
561
562#define ioport_map(port, nr) ((void __iomem*)(port + PIO_OFFSET)) 522#define ioport_map(port, nr) ((void __iomem*)(port + PIO_OFFSET))
563#define ioport_unmap(addr) 523#define ioport_unmap(addr)
564#endif // !CONFIG_PCI 524#endif /* CONFIG_PCI */
565
566#endif // __ASM_ARM_ARCH_IO_H
567 525
526#endif /* __ASM_ARM_ARCH_IO_H */