hardware.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  3. * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or (at your option) any later version.
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  17. * MA 02110-1301, USA.
  18. */
  19. #ifndef __ASM_ARCH_MXC_HARDWARE_H__
  20. #define __ASM_ARCH_MXC_HARDWARE_H__
  21. #include <asm/sizes.h>
  22. #ifdef __ASSEMBLER__
  23. #define IOMEM(addr) (addr)
  24. #else
  25. #define IOMEM(addr) ((void __force __iomem *)(addr))
  26. #endif
  27. #define IMX_IO_P2V_MODULE(addr, module) \
  28. (((addr) - module ## _BASE_ADDR) < module ## _SIZE ? \
  29. (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0)
  30. /*
  31. * This is rather complicated for humans and ugly to verify, but for a machine
  32. * it's OK. Still more as it is usually only applied to constants. The upsides
  33. * on using this approach are:
  34. *
  35. * - same mapping on all i.MX machines
  36. * - works for assembler, too
  37. * - no need to nurture #defines for virtual addresses
  38. *
  39. * The downside it, it's hard to verify (but I have a script for that).
  40. *
  41. * Obviously this needs to be injective for each SoC. In general it maps the
  42. * whole address space to [0xf4000000, 0xf5ffffff]. So [0xf6000000,0xfeffffff]
  43. * is free for per-machine use (e.g. KZM_ARM11_01 uses 64MiB there).
  44. *
  45. * It applies the following mappings for the different SoCs:
  46. *
  47. * mx1:
  48. * IO 0x00200000+0x100000 -> 0xf4000000+0x100000
  49. * mx21:
  50. * AIPI 0x10000000+0x100000 -> 0xf4400000+0x100000
  51. * SAHB1 0x80000000+0x100000 -> 0xf4000000+0x100000
  52. * X_MEMC 0xdf000000+0x004000 -> 0xf5f00000+0x004000
  53. * mx25:
  54. * AIPS1 0x43f00000+0x100000 -> 0xf5300000+0x100000
  55. * AIPS2 0x53f00000+0x100000 -> 0xf5700000+0x100000
  56. * AVIC 0x68000000+0x100000 -> 0xf5800000+0x100000
  57. * mx27:
  58. * AIPI 0x10000000+0x100000 -> 0xf4400000+0x100000
  59. * SAHB1 0x80000000+0x100000 -> 0xf4000000+0x100000
  60. * X_MEMC 0xd8000000+0x100000 -> 0xf5c00000+0x100000
  61. * mx31:
  62. * AIPS1 0x43f00000+0x100000 -> 0xf5300000+0x100000
  63. * AIPS2 0x53f00000+0x100000 -> 0xf5700000+0x100000
  64. * AVIC 0x68000000+0x100000 -> 0xf5800000+0x100000
  65. * X_MEMC 0xb8000000+0x010000 -> 0xf4c00000+0x010000
  66. * SPBA0 0x50000000+0x100000 -> 0xf5400000+0x100000
  67. * mx35:
  68. * AIPS1 0x43f00000+0x100000 -> 0xf5300000+0x100000
  69. * AIPS2 0x53f00000+0x100000 -> 0xf5700000+0x100000
  70. * AVIC 0x68000000+0x100000 -> 0xf5800000+0x100000
  71. * X_MEMC 0xb8000000+0x010000 -> 0xf4c00000+0x010000
  72. * SPBA0 0x50000000+0x100000 -> 0xf5400000+0x100000
  73. * mx50:
  74. * TZIC 0x0fffc000+0x004000 -> 0xf4bfc000+0x004000
  75. * SPBA0 0x50000000+0x100000 -> 0xf5400000+0x100000
  76. * AIPS1 0x53f00000+0x100000 -> 0xf5700000+0x100000
  77. * AIPS2 0x63f00000+0x100000 -> 0xf5300000+0x100000
  78. * mx51:
  79. * IRAM 0x1ffe0000+0x020000 -> 0xf4fe0000+0x020000
  80. * DEBUG 0x60000000+0x100000 -> 0xf5000000+0x100000
  81. * SPBA0 0x70000000+0x100000 -> 0xf5400000+0x100000
  82. * AIPS1 0x73f00000+0x100000 -> 0xf5700000+0x100000
  83. * AIPS2 0x83f00000+0x100000 -> 0xf4300000+0x100000
  84. * mxc91231:
  85. * L2CC 0x30000000+0x010000 -> 0xf4400000+0x010000
  86. * X_MEMC 0xb8000000+0x010000 -> 0xf4c00000+0x010000
  87. * ROMP 0x60000000+0x010000 -> 0xf5000000+0x010000
  88. * AVIC 0x68000000+0x010000 -> 0xf5800000+0x010000
  89. * AIPS1 0x43f00000+0x100000 -> 0xf5300000+0x100000
  90. * SPBA0 0x50000000+0x100000 -> 0xf5400000+0x100000
  91. * SPBA1 0x52000000+0x100000 -> 0xf5600000+0x100000
  92. * AIPS2 0x53f00000+0x100000 -> 0xf5700000+0x100000
  93. */
  94. #define IMX_IO_P2V(x) ( \
  95. 0xf4000000 + \
  96. (((x) & 0x50000000) >> 6) + \
  97. (((x) & 0x0b000000) >> 4) + \
  98. (((x) & 0x000fffff)))
  99. #define IMX_IO_ADDRESS(x) IOMEM(IMX_IO_P2V(x))
  100. #ifdef CONFIG_ARCH_MX5
  101. #include <mach/mx50.h>
  102. #include <mach/mx51.h>
  103. #include <mach/mx53.h>
  104. #endif
  105. #ifdef CONFIG_ARCH_MX3
  106. #include <mach/mx3x.h>
  107. #include <mach/mx31.h>
  108. #include <mach/mx35.h>
  109. #endif
  110. #ifdef CONFIG_ARCH_MX2
  111. # include <mach/mx2x.h>
  112. # ifdef CONFIG_MACH_MX21
  113. # include <mach/mx21.h>
  114. # endif
  115. # ifdef CONFIG_MACH_MX27
  116. # include <mach/mx27.h>
  117. # endif
  118. #endif
  119. #ifdef CONFIG_ARCH_MX1
  120. # include <mach/mx1.h>
  121. #endif
  122. #ifdef CONFIG_ARCH_MX25
  123. # include <mach/mx25.h>
  124. #endif
  125. #ifdef CONFIG_ARCH_MXC91231
  126. # include <mach/mxc91231.h>
  127. #endif
  128. #include <mach/mxc.h>
  129. #define imx_map_entry(soc, name, _type) { \
  130. .virtual = soc ## _IO_P2V(soc ## _ ## name ## _BASE_ADDR), \
  131. .pfn = __phys_to_pfn(soc ## _ ## name ## _BASE_ADDR), \
  132. .length = soc ## _ ## name ## _SIZE, \
  133. .type = _type, \
  134. }
  135. #endif /* __ASM_ARCH_MXC_HARDWARE_H__ */