]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/arm/plat-omap/include/mach/memory.h
[ARM] remove a common set of __virt_to_bus definitions
[net-next-2.6.git] / arch / arm / plat-omap / include / mach / memory.h
CommitLineData
1da177e4 1/*
a09e64fb 2 * arch/arm/plat-omap/include/mach/memory.h
1da177e4
LT
3 *
4 * Memory map for OMAP-1510 and 1610
5 *
6 * Copyright (C) 2000 RidgeRun, Inc.
7 * Author: Greg Lonnon <glonnon@ridgerun.com>
8 *
a09e64fb 9 * This file was derived from arch/arm/mach-intergrator/include/mach/memory.h
1da177e4
LT
10 * Copyright (C) 1999 ARM Limited
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32
33#ifndef __ASM_ARCH_MEMORY_H
34#define __ASM_ARCH_MEMORY_H
35
36/*
37 * Physical DRAM offset.
38 */
9839c6b8 39#if defined(CONFIG_ARCH_OMAP1)
f09b9979 40#define PHYS_OFFSET UL(0x10000000)
cc26b3b0 41#elif defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
f09b9979 42#define PHYS_OFFSET UL(0x80000000)
9839c6b8 43#endif
1da177e4 44
1da177e4
LT
45/*
46 * Bus address is physical address, except for OMAP-1510 Local Bus.
1da177e4
LT
47 * OMAP-1510 bus address is translated into a Local Bus address if the
48 * OMAP bus type is lbus. We do the address translation based on the
49 * device overriding the defaults used in the dma-mapping API.
50 * Note that the is_lbus_device() test is not very efficient on 1510
51 * because of the strncmp().
52 */
9ad5897c 53#ifdef CONFIG_ARCH_OMAP15XX
1da177e4 54
9839c6b8
TL
55/*
56 * OMAP-1510 Local Bus address offset
57 */
f09b9979 58#define OMAP1510_LB_OFFSET UL(0x30000000)
9839c6b8 59
1da177e4
LT
60#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET)
61#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
99c658a6 62#define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev->bus_id, "ohci", 4) == 0))
1da177e4
LT
63
64#define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \
65 (dma_addr_t)virt_to_lbus(page_address(page)) : \
b5ee9002 66 (dma_addr_t)__virt_to_phys(page_address(page));})
1da177e4 67
98ed7d4b
RK
68#define __arch_dma_to_virt(dev, addr) ({ (void *) (is_lbus_device(dev) ? \
69 lbus_to_virt(addr) : \
b5ee9002 70 __phys_to_virt(addr)); })
98ed7d4b
RK
71
72#define __arch_virt_to_dma(dev, addr) ({ unsigned long __addr = (unsigned long)(addr); \
73 (dma_addr_t) (is_lbus_device(dev) ? \
74 virt_to_lbus(__addr) : \
b5ee9002 75 __virt_to_phys(__addr)); })
1da177e4 76
9ad5897c 77#endif /* CONFIG_ARCH_OMAP15XX */
1da177e4 78
f4e4c324
TL
79/* Override the ARM default */
80#ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
81
82#if (CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE == 0)
83#undef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
84#define CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE 2
85#endif
86
87#define CONSISTENT_DMA_SIZE \
88 (((CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE + 1) & ~1) * 1024 * 1024)
89
90#endif
91
1da177e4
LT
92#endif
93