memory.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * arch/arm/plat-omap/include/mach/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 arch/arm/mach-intergrator/include/mach/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. #ifndef __ASM_ARCH_MEMORY_H
  33. #define __ASM_ARCH_MEMORY_H
  34. /*
  35. * Physical DRAM offset.
  36. */
  37. #if defined(CONFIG_ARCH_OMAP1)
  38. #define PLAT_PHYS_OFFSET UL(0x10000000)
  39. #else
  40. #define PLAT_PHYS_OFFSET UL(0x80000000)
  41. #endif
  42. /*
  43. * Bus address is physical address, except for OMAP-1510 Local Bus.
  44. * OMAP-1510 bus address is translated into a Local Bus address if the
  45. * OMAP bus type is lbus. We do the address translation based on the
  46. * device overriding the defaults used in the dma-mapping API.
  47. * Note that the is_lbus_device() test is not very efficient on 1510
  48. * because of the strncmp().
  49. */
  50. #ifdef CONFIG_ARCH_OMAP15XX
  51. /*
  52. * OMAP-1510 Local Bus address offset
  53. */
  54. #define OMAP1510_LB_OFFSET UL(0x30000000)
  55. #define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET)
  56. #define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
  57. #define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev_name(dev), "ohci", 4) == 0))
  58. #define __arch_pfn_to_dma(dev, pfn) \
  59. ({ dma_addr_t __dma = __pfn_to_phys(pfn); \
  60. if (is_lbus_device(dev)) \
  61. __dma = __dma - PHYS_OFFSET + OMAP1510_LB_OFFSET; \
  62. __dma; })
  63. #define __arch_dma_to_pfn(dev, addr) \
  64. ({ dma_addr_t __dma = addr; \
  65. if (is_lbus_device(dev)) \
  66. __dma += PHYS_OFFSET - OMAP1510_LB_OFFSET; \
  67. __phys_to_pfn(__dma); \
  68. })
  69. #define __arch_dma_to_virt(dev, addr) ({ (void *) (is_lbus_device(dev) ? \
  70. lbus_to_virt(addr) : \
  71. __phys_to_virt(addr)); })
  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) : \
  75. __virt_to_phys(__addr)); })
  76. #endif /* CONFIG_ARCH_OMAP15XX */
  77. /* Override the ARM default */
  78. #ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
  79. #if (CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE == 0)
  80. #undef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
  81. #define CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE 2
  82. #endif
  83. #define CONSISTENT_DMA_SIZE \
  84. (((CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE + 1) & ~1) * 1024 * 1024)
  85. #endif
  86. #endif