]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - include/asm-arm/arch-orion5x/io.h
ARM: OMAP2: Clock: New OMAP2/3 DPLL rate rounding algorithm
[linux-2.6-omap-h63xx.git] / 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         unsigned long offs = paddr - ORION5X_REGS_PHYS_BASE;
24         if (mtype == MT_DEVICE && size && offs < ORION5X_REGS_SIZE &&
25             size <= ORION5X_REGS_SIZE && offs + size <= ORION5X_REGS_SIZE) {
26                 retval = (void __iomem *)ORION5X_REGS_VIRT_BASE + offs;
27         } else {
28                 retval = __arm_ioremap(paddr, size, mtype);
29         }
30
31         return retval;
32 }
33
34 static inline void
35 __arch_iounmap(void __iomem *addr)
36 {
37         if (addr < (void __iomem *)ORION5X_REGS_VIRT_BASE ||
38             addr >= (void __iomem *)(ORION5X_REGS_VIRT_BASE + ORION5X_REGS_SIZE))
39                 __iounmap(addr);
40 }
41
42 static inline void __iomem *__io(unsigned long addr)
43 {
44         return (void __iomem *)addr;
45 }
46
47 #define __arch_ioremap(p, s, m) __arch_ioremap(p, s, m)
48 #define __arch_iounmap(a)       __arch_iounmap(a)
49 #define __io(a)                 __io(a)
50 #define __mem_pci(a)            (a)
51
52
53 /*****************************************************************************
54  * Helpers to access Orion registers
55  ****************************************************************************/
56 #define orion5x_read(r)         __raw_readl(r)
57 #define orion5x_write(r, val)   __raw_writel(val, r)
58
59 /*
60  * These are not preempt-safe.  Locks, if needed, must be taken
61  * care of by the caller.
62  */
63 #define orion5x_setbits(r, mask)        orion5x_write((r), orion5x_read(r) | (mask))
64 #define orion5x_clrbits(r, mask)        orion5x_write((r), orion5x_read(r) & ~(mask))
65
66
67 #endif