iomap.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * Copyright (C) 2010 Google, Inc.
  3. *
  4. * Author:
  5. * Colin Cross <ccross@google.com>
  6. * Erik Gilling <konkers@google.com>
  7. *
  8. * This software is licensed under the terms of the GNU General Public
  9. * License version 2, as published by the Free Software Foundation, and
  10. * may be copied, distributed, and modified under those terms.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. */
  18. #ifndef __MACH_TEGRA_IOMAP_H
  19. #define __MACH_TEGRA_IOMAP_H
  20. #include <asm/pgtable.h>
  21. #include <asm/sizes.h>
  22. #define TEGRA_IRAM_BASE 0x40000000
  23. #define TEGRA_IRAM_SIZE SZ_256K
  24. #define TEGRA_ARM_PERIF_BASE 0x50040000
  25. #define TEGRA_ARM_PERIF_SIZE SZ_8K
  26. #define TEGRA_ARM_INT_DIST_BASE 0x50041000
  27. #define TEGRA_ARM_INT_DIST_SIZE SZ_4K
  28. #define TEGRA_PRIMARY_ICTLR_BASE 0x60004000
  29. #define TEGRA_PRIMARY_ICTLR_SIZE SZ_64
  30. #define TEGRA_SECONDARY_ICTLR_BASE 0x60004100
  31. #define TEGRA_SECONDARY_ICTLR_SIZE SZ_64
  32. #define TEGRA_TERTIARY_ICTLR_BASE 0x60004200
  33. #define TEGRA_TERTIARY_ICTLR_SIZE SZ_64
  34. #define TEGRA_QUATERNARY_ICTLR_BASE 0x60004300
  35. #define TEGRA_QUATERNARY_ICTLR_SIZE SZ_64
  36. #define TEGRA_QUINARY_ICTLR_BASE 0x60004400
  37. #define TEGRA_QUINARY_ICTLR_SIZE SZ_64
  38. #define TEGRA_TMR1_BASE 0x60005000
  39. #define TEGRA_TMR1_SIZE SZ_8
  40. #define TEGRA_TMR2_BASE 0x60005008
  41. #define TEGRA_TMR2_SIZE SZ_8
  42. #define TEGRA_TMRUS_BASE 0x60005010
  43. #define TEGRA_TMRUS_SIZE SZ_64
  44. #define TEGRA_TMR3_BASE 0x60005050
  45. #define TEGRA_TMR3_SIZE SZ_8
  46. #define TEGRA_TMR4_BASE 0x60005058
  47. #define TEGRA_TMR4_SIZE SZ_8
  48. #define TEGRA_CLK_RESET_BASE 0x60006000
  49. #define TEGRA_CLK_RESET_SIZE SZ_4K
  50. #define TEGRA_FLOW_CTRL_BASE 0x60007000
  51. #define TEGRA_FLOW_CTRL_SIZE 20
  52. #define TEGRA_SB_BASE 0x6000C200
  53. #define TEGRA_SB_SIZE 256
  54. #define TEGRA_EXCEPTION_VECTORS_BASE 0x6000F000
  55. #define TEGRA_EXCEPTION_VECTORS_SIZE SZ_4K
  56. #define TEGRA_APB_MISC_BASE 0x70000000
  57. #define TEGRA_APB_MISC_SIZE SZ_4K
  58. #define TEGRA_UARTA_BASE 0x70006000
  59. #define TEGRA_UARTA_SIZE SZ_64
  60. #define TEGRA_UARTB_BASE 0x70006040
  61. #define TEGRA_UARTB_SIZE SZ_64
  62. #define TEGRA_UARTC_BASE 0x70006200
  63. #define TEGRA_UARTC_SIZE SZ_256
  64. #define TEGRA_UARTD_BASE 0x70006300
  65. #define TEGRA_UARTD_SIZE SZ_256
  66. #define TEGRA_UARTE_BASE 0x70006400
  67. #define TEGRA_UARTE_SIZE SZ_256
  68. #define TEGRA_PMC_BASE 0x7000E400
  69. #define TEGRA_PMC_SIZE SZ_256
  70. #define TEGRA_EMC_BASE 0x7000F400
  71. #define TEGRA_EMC_SIZE SZ_1K
  72. #define TEGRA_FUSE_BASE 0x7000F800
  73. #define TEGRA_FUSE_SIZE SZ_1K
  74. #define TEGRA_EMC0_BASE 0x7001A000
  75. #define TEGRA_EMC0_SIZE SZ_2K
  76. #define TEGRA_EMC1_BASE 0x7001A800
  77. #define TEGRA_EMC1_SIZE SZ_2K
  78. #define TEGRA124_EMC_BASE 0x7001B000
  79. #define TEGRA124_EMC_SIZE SZ_2K
  80. #define TEGRA_CSITE_BASE 0x70040000
  81. #define TEGRA_CSITE_SIZE SZ_256K
  82. /* On TEGRA, many peripherals are very closely packed in
  83. * two 256MB io windows (that actually only use about 64KB
  84. * at the start of each).
  85. *
  86. * We will just map the first MMU section of each window (to minimize
  87. * pt entries needed) and provide a macro to transform physical
  88. * io addresses to an appropriate void __iomem *.
  89. */
  90. #define IO_IRAM_PHYS 0x40000000
  91. #define IO_IRAM_VIRT IOMEM(0xFE400000)
  92. #define IO_IRAM_SIZE SZ_256K
  93. #define IO_CPU_PHYS 0x50040000
  94. #define IO_CPU_VIRT IOMEM(0xFE440000)
  95. #define IO_CPU_SIZE SZ_16K
  96. #define IO_PPSB_PHYS 0x60000000
  97. #define IO_PPSB_VIRT IOMEM(0xFE200000)
  98. #define IO_PPSB_SIZE SECTION_SIZE
  99. #define IO_APB_PHYS 0x70000000
  100. #define IO_APB_VIRT IOMEM(0xFE000000)
  101. #define IO_APB_SIZE SECTION_SIZE
  102. #define IO_TO_VIRT_BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz)))
  103. #define IO_TO_VIRT_XLATE(p, pst, vst) (((p) - (pst) + (vst)))
  104. #define IO_TO_VIRT(n) ( \
  105. IO_TO_VIRT_BETWEEN((n), IO_PPSB_PHYS, IO_PPSB_SIZE) ? \
  106. IO_TO_VIRT_XLATE((n), IO_PPSB_PHYS, IO_PPSB_VIRT) : \
  107. IO_TO_VIRT_BETWEEN((n), IO_APB_PHYS, IO_APB_SIZE) ? \
  108. IO_TO_VIRT_XLATE((n), IO_APB_PHYS, IO_APB_VIRT) : \
  109. IO_TO_VIRT_BETWEEN((n), IO_CPU_PHYS, IO_CPU_SIZE) ? \
  110. IO_TO_VIRT_XLATE((n), IO_CPU_PHYS, IO_CPU_VIRT) : \
  111. IO_TO_VIRT_BETWEEN((n), IO_IRAM_PHYS, IO_IRAM_SIZE) ? \
  112. IO_TO_VIRT_XLATE((n), IO_IRAM_PHYS, IO_IRAM_VIRT) : \
  113. NULL)
  114. #define IO_ADDRESS(n) (IO_TO_VIRT(n))
  115. #endif