2 * include/asm-arm/arch-orion/io.h
4 * Tzachi Perelstein <tzachi@marvell.com>
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.
11 #ifndef __ASM_ARM_ARCH_IO_H
12 #define __ASM_ARM_ARCH_IO_H
16 #define IO_SPACE_LIMIT 0xffffffff
17 #define IO_SPACE_REMAP ORION_PCI_SYS_IO_BASE
19 static inline void __iomem
*
20 __arch_ioremap(unsigned long paddr
, size_t size
, unsigned int mtype
)
24 if (mtype
== MT_DEVICE
&& size
&& paddr
>= ORION_REGS_PHYS_BASE
&&
25 paddr
+ size
<= ORION_REGS_PHYS_BASE
+ ORION_REGS_SIZE
) {
26 retval
= (void __iomem
*)ORION_REGS_VIRT_BASE
+
27 (paddr
- ORION_REGS_PHYS_BASE
);
29 retval
= __arm_ioremap(paddr
, size
, mtype
);
36 __arch_iounmap(void __iomem
*addr
)
38 if (addr
< (void __iomem
*)ORION_REGS_VIRT_BASE
||
39 addr
>= (void __iomem
*)(ORION_REGS_VIRT_BASE
+ ORION_REGS_SIZE
))
43 static inline void __iomem
*__io(unsigned long addr
)
45 return (void __iomem
*)addr
;
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)
54 /*****************************************************************************
55 * Helpers to access Orion registers
56 ****************************************************************************/
57 #define orion_read(r) __raw_readl(r)
58 #define orion_write(r, val) __raw_writel(val, r)
61 * These are not preempt-safe. Locks, if needed, must be taken
62 * care of by the caller.
64 #define orion_setbits(r, mask) orion_write((r), orion_read(r) | (mask))
65 #define orion_clrbits(r, mask) orion_write((r), orion_read(r) & ~(mask))