Orion: orion -> orion5x rename
[safe/jmp/linux-2.6] / include / asm-arm / arch-orion5x / io.h
1 /*
2  * include/asm-arm/arch-orion5x/io.h
3  *
4  * Tzachi Perelstein <tzachi@marvell.com>
5  *
6  * This file is licensed under the terms of the GNU General Public
7  * License version 2.  This program is licensed "as is" without any
8  * warranty of any kind, whether express or implied.
9  */
10
11 #ifndef __ASM_ARCH_IO_H
12 #define __ASM_ARCH_IO_H
13
14 #include "orion5x.h"
15
16 #define IO_SPACE_LIMIT          0xffffffff
17 #define IO_SPACE_REMAP          ORION5X_PCI_SYS_IO_BASE
18
19 static inline void __iomem *
20 __arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype)
21 {
22         void __iomem *retval;
23
24         if (mtype == MT_DEVICE && size && paddr >= ORION5X_REGS_PHYS_BASE &&
25             paddr + size <= ORION5X_REGS_PHYS_BASE + ORION5X_REGS_SIZE) {
26                 retval = (void __iomem *)ORION5X_REGS_VIRT_BASE +
27                                 (paddr - ORION5X_REGS_PHYS_BASE);
28         } else {
29                 retval = __arm_ioremap(paddr, size, mtype);
30         }
31
32         return retval;
33 }
34
35 static inline void
36 __arch_iounmap(void __iomem *addr)
37 {
38         if (addr < (void __iomem *)ORION5X_REGS_VIRT_BASE ||
39             addr >= (void __iomem *)(ORION5X_REGS_VIRT_BASE + ORION5X_REGS_SIZE))
40                 __iounmap(addr);
41 }
42
43 static inline void __iomem *__io(unsigned long addr)
44 {
45         return (void __iomem *)addr;
46 }
47
48 #define __arch_ioremap(p, s, m) __arch_ioremap(p, s, m)
49 #define __arch_iounmap(a)       __arch_iounmap(a)
50 #define __io(a)                 __io(a)
51 #define __mem_pci(a)            (a)
52
53
54 /*****************************************************************************
55  * Helpers to access Orion registers
56  ****************************************************************************/
57 #define orion5x_read(r)         __raw_readl(r)
58 #define orion5x_write(r, val)   __raw_writel(val, r)
59
60 /*
61  * These are not preempt-safe.  Locks, if needed, must be taken
62  * care of by the caller.
63  */
64 #define orion5x_setbits(r, mask)        orion5x_write((r), orion5x_read(r) | (mask))
65 #define orion5x_clrbits(r, mask)        orion5x_write((r), orion5x_read(r) & ~(mask))
66
67
68 #endif