Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * linux/include/asm-arm/arch-omap/memory.h |
| 3 | * |
| 4 | * Memory map for OMAP-1510 and 1610 |
| 5 | * |
| 6 | * Copyright (C) 2000 RidgeRun, Inc. |
| 7 | * Author: Greg Lonnon <glonnon@ridgerun.com> |
| 8 | * |
| 9 | * This file was derived from linux/include/asm-arm/arch-intergrator/memory.h |
| 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 | */ |
| 39 | #define PHYS_OFFSET (0x10000000UL) |
| 40 | |
| 41 | /* |
| 42 | * OMAP-1510 Local Bus address offset |
| 43 | */ |
| 44 | #define OMAP1510_LB_OFFSET (0x30000000UL) |
| 45 | |
| 46 | /* |
| 47 | * Conversion between SDRAM and fake PCI bus, used by USB |
| 48 | * NOTE: Physical address must be converted to Local Bus address |
| 49 | * on OMAP-1510 only |
| 50 | */ |
| 51 | |
| 52 | /* |
| 53 | * Bus address is physical address, except for OMAP-1510 Local Bus. |
| 54 | */ |
| 55 | #define __virt_to_bus(x) __virt_to_phys(x) |
| 56 | #define __bus_to_virt(x) __phys_to_virt(x) |
| 57 | |
| 58 | /* |
| 59 | * OMAP-1510 bus address is translated into a Local Bus address if the |
| 60 | * OMAP bus type is lbus. We do the address translation based on the |
| 61 | * device overriding the defaults used in the dma-mapping API. |
| 62 | * Note that the is_lbus_device() test is not very efficient on 1510 |
| 63 | * because of the strncmp(). |
| 64 | */ |
| 65 | #ifdef CONFIG_ARCH_OMAP1510 |
| 66 | |
| 67 | #define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) |
| 68 | #define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET) |
| 69 | #define is_lbus_device(dev) (cpu_is_omap1510() && dev && (strncmp(dev->bus_id, "ohci", 4) == 0)) |
| 70 | |
| 71 | #define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \ |
| 72 | (dma_addr_t)virt_to_lbus(page_address(page)) : \ |
| 73 | (dma_addr_t)__virt_to_bus(page_address(page));}) |
| 74 | |
| 75 | #define __arch_dma_to_virt(dev, addr) ({is_lbus_device(dev) ? \ |
| 76 | lbus_to_virt(addr) : \ |
| 77 | __bus_to_virt(addr);}) |
| 78 | |
| 79 | #define __arch_virt_to_dma(dev, addr) ({is_lbus_device(dev) ? \ |
| 80 | virt_to_lbus(addr) : \ |
| 81 | __virt_to_bus(addr);}) |
| 82 | |
| 83 | #endif /* CONFIG_ARCH_OMAP1510 */ |
| 84 | |
| 85 | #define PHYS_TO_NID(addr) (0) |
| 86 | #endif |
| 87 | |