RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / arm / mach-tegra / include / mach / io.h
blob35edfc32ffc9d96280f43f47da841d63ff0fdc32
1 /*
2 * arch/arm/mach-tegra/include/mach/io.h
4 * Copyright (C) 2010 Google, Inc.
6 * Author:
7 * Colin Cross <ccross@google.com>
8 * Erik Gilling <konkers@google.com>
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
21 #ifndef __MACH_TEGRA_IO_H
22 #define __MACH_TEGRA_IO_H
24 #define IO_SPACE_LIMIT 0xffffffff
26 /* On TEGRA, many peripherals are very closely packed in
27 * two 256MB io windows (that actually only use about 64KB
28 * at the start of each).
30 * We will just map the first 1MB of each window (to minimize
31 * pt entries needed) and provide a macro to transform physical
32 * io addresses to an appropriate void __iomem *.
36 #define IO_CPU_PHYS 0x50040000
37 #define IO_CPU_VIRT 0xFE000000
38 #define IO_CPU_SIZE SZ_16K
40 #define IO_PPSB_PHYS 0x60000000
41 #define IO_PPSB_VIRT 0xFE200000
42 #define IO_PPSB_SIZE SZ_1M
44 #define IO_APB_PHYS 0x70000000
45 #define IO_APB_VIRT 0xFE300000
46 #define IO_APB_SIZE SZ_1M
48 #define IO_TO_VIRT_BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz)))
49 #define IO_TO_VIRT_XLATE(p, pst, vst) (((p) - (pst) + (vst)))
51 #define IO_TO_VIRT(n) ( \
52 IO_TO_VIRT_BETWEEN((n), IO_PPSB_PHYS, IO_PPSB_SIZE) ? \
53 IO_TO_VIRT_XLATE((n), IO_PPSB_PHYS, IO_PPSB_VIRT) : \
54 IO_TO_VIRT_BETWEEN((n), IO_APB_PHYS, IO_APB_SIZE) ? \
55 IO_TO_VIRT_XLATE((n), IO_APB_PHYS, IO_APB_VIRT) : \
56 IO_TO_VIRT_BETWEEN((n), IO_CPU_PHYS, IO_CPU_SIZE) ? \
57 IO_TO_VIRT_XLATE((n), IO_CPU_PHYS, IO_CPU_VIRT) : \
60 #ifndef __ASSEMBLER__
62 #define __arch_ioremap(p, s, t) tegra_ioremap(p, s, t)
63 #define __arch_iounmap(v) tegra_iounmap(v)
65 void __iomem *tegra_ioremap(unsigned long phys, size_t size, unsigned int type);
66 void tegra_iounmap(volatile void __iomem *addr);
68 #define IO_ADDRESS(n) ((void __iomem *) IO_TO_VIRT(n))
70 static inline void __iomem *__io(unsigned long addr)
72 return (void __iomem *)addr;
74 #define __io(a) __io(a)
75 #define __mem_pci(a) (a)
77 #endif
79 #endif