tegra_def.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. /*
  2. * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
  3. * Copyright (c) 2020, NVIDIA Corporation. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: BSD-3-Clause
  6. */
  7. #ifndef TEGRA_DEF_H
  8. #define TEGRA_DEF_H
  9. #include <lib/utils_def.h>
  10. /*******************************************************************************
  11. * Platform BL31 specific defines.
  12. ******************************************************************************/
  13. #define BL31_SIZE U(0x40000)
  14. /*******************************************************************************
  15. * MCE apertures used by the ARI interface
  16. *
  17. * Aperture 0 - Cpu0 (ARM Cortex A-57)
  18. * Aperture 1 - Cpu1 (ARM Cortex A-57)
  19. * Aperture 2 - Cpu2 (ARM Cortex A-57)
  20. * Aperture 3 - Cpu3 (ARM Cortex A-57)
  21. * Aperture 4 - Cpu4 (Denver15)
  22. * Aperture 5 - Cpu5 (Denver15)
  23. ******************************************************************************/
  24. #define MCE_ARI_APERTURE_0_OFFSET U(0x0)
  25. #define MCE_ARI_APERTURE_1_OFFSET U(0x10000)
  26. #define MCE_ARI_APERTURE_2_OFFSET U(0x20000)
  27. #define MCE_ARI_APERTURE_3_OFFSET U(0x30000)
  28. #define MCE_ARI_APERTURE_4_OFFSET U(0x40000)
  29. #define MCE_ARI_APERTURE_5_OFFSET U(0x50000)
  30. #define MCE_ARI_APERTURE_OFFSET_MAX MCE_APERTURE_5_OFFSET
  31. /* number of apertures */
  32. #define MCE_ARI_APERTURES_MAX U(6)
  33. /* each ARI aperture is 64KB */
  34. #define MCE_ARI_APERTURE_SIZE U(0x10000)
  35. /*******************************************************************************
  36. * CPU core id macros for the MCE_ONLINE_CORE ARI
  37. ******************************************************************************/
  38. #define MCE_CORE_ID_MAX U(8)
  39. #define MCE_CORE_ID_MASK U(0x7)
  40. /*******************************************************************************
  41. * These values are used by the PSCI implementation during the `CPU_SUSPEND`
  42. * and `SYSTEM_SUSPEND` calls as the `state-id` field in the 'power state'
  43. * parameter.
  44. ******************************************************************************/
  45. #define PSTATE_ID_CORE_IDLE U(6)
  46. #define PSTATE_ID_CORE_POWERDN U(7)
  47. #define PSTATE_ID_SOC_POWERDN U(2)
  48. /*******************************************************************************
  49. * Platform power states (used by PSCI framework)
  50. *
  51. * - PLAT_MAX_RET_STATE should be less than lowest PSTATE_ID
  52. * - PLAT_MAX_OFF_STATE should be greater than the highest PSTATE_ID
  53. ******************************************************************************/
  54. #define PLAT_MAX_RET_STATE U(1)
  55. #define PLAT_MAX_OFF_STATE U(8)
  56. /*******************************************************************************
  57. * Chip specific page table and MMU setup constants
  58. ******************************************************************************/
  59. #define PLAT_PHY_ADDR_SPACE_SIZE (ULL(1) << 35)
  60. #define PLAT_VIRT_ADDR_SPACE_SIZE (ULL(1) << 35)
  61. /*******************************************************************************
  62. * Secure IRQ definitions
  63. ******************************************************************************/
  64. #define TEGRA186_TOP_WDT_IRQ U(49)
  65. #define TEGRA186_AON_WDT_IRQ U(50)
  66. #define TEGRA186_SEC_IRQ_TARGET_MASK U(0xF3) /* 4 A57 - 2 Denver */
  67. /*******************************************************************************
  68. * Clock identifier for the SE device
  69. ******************************************************************************/
  70. #define TEGRA186_CLK_SE U(103)
  71. #define TEGRA_CLK_SE TEGRA186_CLK_SE
  72. /*******************************************************************************
  73. * Tegra Miscellaneous register constants
  74. ******************************************************************************/
  75. #define TEGRA_MISC_BASE U(0x00100000)
  76. #define HARDWARE_REVISION_OFFSET U(0x4)
  77. #define MISCREG_PFCFG U(0x200C)
  78. /*******************************************************************************
  79. * Tegra TSA Controller constants
  80. ******************************************************************************/
  81. #define TEGRA_TSA_BASE U(0x02400000)
  82. /*******************************************************************************
  83. * TSA configuration registers
  84. ******************************************************************************/
  85. #define TSA_CONFIG_STATIC0_CSW_SESWR U(0x4010)
  86. #define TSA_CONFIG_STATIC0_CSW_SESWR_RESET U(0x1100)
  87. #define TSA_CONFIG_STATIC0_CSW_ETRW U(0x4038)
  88. #define TSA_CONFIG_STATIC0_CSW_ETRW_RESET U(0x1100)
  89. #define TSA_CONFIG_STATIC0_CSW_SDMMCWAB U(0x5010)
  90. #define TSA_CONFIG_STATIC0_CSW_SDMMCWAB_RESET U(0x1100)
  91. #define TSA_CONFIG_STATIC0_CSW_AXISW U(0x7008)
  92. #define TSA_CONFIG_STATIC0_CSW_AXISW_RESET U(0x1100)
  93. #define TSA_CONFIG_STATIC0_CSW_HDAW U(0xA008)
  94. #define TSA_CONFIG_STATIC0_CSW_HDAW_RESET U(0x100)
  95. #define TSA_CONFIG_STATIC0_CSW_AONDMAW U(0xB018)
  96. #define TSA_CONFIG_STATIC0_CSW_AONDMAW_RESET U(0x1100)
  97. #define TSA_CONFIG_STATIC0_CSW_SCEDMAW U(0xD018)
  98. #define TSA_CONFIG_STATIC0_CSW_SCEDMAW_RESET U(0x1100)
  99. #define TSA_CONFIG_STATIC0_CSW_BPMPDMAW U(0xD028)
  100. #define TSA_CONFIG_STATIC0_CSW_BPMPDMAW_RESET U(0x1100)
  101. #define TSA_CONFIG_STATIC0_CSW_APEDMAW U(0x12018)
  102. #define TSA_CONFIG_STATIC0_CSW_APEDMAW_RESET U(0x1100)
  103. #define TSA_CONFIG_STATIC0_CSW_UFSHCW U(0x13008)
  104. #define TSA_CONFIG_STATIC0_CSW_UFSHCW_RESET U(0x1100)
  105. #define TSA_CONFIG_STATIC0_CSW_AFIW U(0x13018)
  106. #define TSA_CONFIG_STATIC0_CSW_AFIW_RESET U(0x1100)
  107. #define TSA_CONFIG_STATIC0_CSW_SATAW U(0x13028)
  108. #define TSA_CONFIG_STATIC0_CSW_SATAW_RESET U(0x1100)
  109. #define TSA_CONFIG_STATIC0_CSW_EQOSW U(0x13038)
  110. #define TSA_CONFIG_STATIC0_CSW_EQOSW_RESET U(0x1100)
  111. #define TSA_CONFIG_STATIC0_CSW_XUSB_DEVW U(0x15008)
  112. #define TSA_CONFIG_STATIC0_CSW_XUSB_DEVW_RESET U(0x1100)
  113. #define TSA_CONFIG_STATIC0_CSW_XUSB_HOSTW U(0x15018)
  114. #define TSA_CONFIG_STATIC0_CSW_XUSB_HOSTW_RESET U(0x1100)
  115. #define TSA_CONFIG_CSW_MEMTYPE_OVERRIDE_MASK (ULL(0x3) << 11)
  116. #define TSA_CONFIG_CSW_MEMTYPE_OVERRIDE_PASTHRU (ULL(0) << 11)
  117. /*******************************************************************************
  118. * Tegra General Purpose Centralised DMA constants
  119. ******************************************************************************/
  120. #define TEGRA_GPCDMA_BASE ULL(0x2610000)
  121. /*******************************************************************************
  122. * Tegra Memory Controller constants
  123. ******************************************************************************/
  124. #define TEGRA_MC_STREAMID_BASE U(0x02C00000)
  125. #define TEGRA_MC_BASE U(0x02C10000)
  126. /* General Security Carveout register macros */
  127. #define MC_GSC_CONFIG_REGS_SIZE U(0x40)
  128. #define MC_GSC_LOCK_CFG_SETTINGS_BIT (U(1) << 1)
  129. #define MC_GSC_ENABLE_TZ_LOCK_BIT (ULL(1) << 0)
  130. #define MC_GSC_SIZE_RANGE_4KB_SHIFT U(27)
  131. #define MC_GSC_BASE_LO_SHIFT U(12)
  132. #define MC_GSC_BASE_LO_MASK U(0xFFFFF)
  133. #define MC_GSC_BASE_HI_SHIFT U(0)
  134. #define MC_GSC_BASE_HI_MASK U(3)
  135. #define MC_GSC_ENABLE_CPU_SECURE_BIT (U(1) << 31)
  136. /* TZDRAM carveout configuration registers */
  137. #define MC_SECURITY_CFG0_0 U(0x70)
  138. #define MC_SECURITY_CFG1_0 U(0x74)
  139. #define MC_SECURITY_CFG3_0 U(0x9BC)
  140. #define MC_SECURITY_BOM_MASK (U(0xFFF) << 20)
  141. #define MC_SECURITY_SIZE_MB_MASK (U(0x1FFF) << 0)
  142. #define MC_SECURITY_BOM_HI_MASK (U(0x3) << 0)
  143. /* Video Memory carveout configuration registers */
  144. #define MC_VIDEO_PROTECT_BASE_HI U(0x978)
  145. #define MC_VIDEO_PROTECT_BASE_LO U(0x648)
  146. #define MC_VIDEO_PROTECT_SIZE_MB U(0x64C)
  147. #define MC_VIDEO_PROTECT_REG_CTRL U(0x650)
  148. #define MC_VIDEO_PROTECT_WRITE_ACCESS_ENABLED U(3)
  149. /*
  150. * Carveout (MC_SECURITY_CARVEOUT24) registers used to clear the
  151. * non-overlapping Video memory region
  152. */
  153. #define MC_VIDEO_PROTECT_CLEAR_CFG U(0x25A0)
  154. #define MC_VIDEO_PROTECT_CLEAR_BASE_LO U(0x25A4)
  155. #define MC_VIDEO_PROTECT_CLEAR_BASE_HI U(0x25A8)
  156. #define MC_VIDEO_PROTECT_CLEAR_SIZE U(0x25AC)
  157. #define MC_VIDEO_PROTECT_CLEAR_ACCESS_CFG0 U(0x25B0)
  158. /* TZRAM carveout (MC_SECURITY_CARVEOUT11) configuration registers */
  159. #define MC_TZRAM_CARVEOUT_CFG U(0x2190)
  160. #define MC_TZRAM_BASE_LO U(0x2194)
  161. #define MC_TZRAM_BASE_HI U(0x2198)
  162. #define MC_TZRAM_SIZE U(0x219C)
  163. #define MC_TZRAM_CLIENT_ACCESS0_CFG0 U(0x21A0)
  164. #define MC_TZRAM_CLIENT_ACCESS1_CFG0 U(0x21A4)
  165. #define TZRAM_ALLOW_MPCORER (U(1) << 7)
  166. #define TZRAM_ALLOW_MPCOREW (U(1) << 25)
  167. /*******************************************************************************
  168. * Tegra UART Controller constants
  169. ******************************************************************************/
  170. #define TEGRA_UARTA_BASE U(0x03100000)
  171. #define TEGRA_UARTB_BASE U(0x03110000)
  172. #define TEGRA_UARTC_BASE U(0x0C280000)
  173. #define TEGRA_UARTD_BASE U(0x03130000)
  174. #define TEGRA_UARTE_BASE U(0x03140000)
  175. #define TEGRA_UARTF_BASE U(0x03150000)
  176. #define TEGRA_UARTG_BASE U(0x0C290000)
  177. /*******************************************************************************
  178. * Tegra Fuse Controller related constants
  179. ******************************************************************************/
  180. #define TEGRA_FUSE_BASE U(0x03820000)
  181. #define OPT_SUBREVISION U(0x248)
  182. #define SUBREVISION_MASK U(0xFF)
  183. /*******************************************************************************
  184. * GICv2 & interrupt handling related constants
  185. ******************************************************************************/
  186. #define TEGRA_GICD_BASE U(0x03881000)
  187. #define TEGRA_GICC_BASE U(0x03882000)
  188. /*******************************************************************************
  189. * Security Engine related constants
  190. ******************************************************************************/
  191. #define TEGRA_SE0_BASE U(0x03AC0000)
  192. #define SE_MUTEX_WATCHDOG_NS_LIMIT U(0x6C)
  193. #define TEGRA_PKA1_BASE U(0x03AD0000)
  194. #define PKA_MUTEX_WATCHDOG_NS_LIMIT U(0x8144)
  195. #define TEGRA_RNG1_BASE U(0x03AE0000)
  196. #define RNG_MUTEX_WATCHDOG_NS_LIMIT U(0xFE0)
  197. /*******************************************************************************
  198. * Tegra HSP doorbell #0 constants
  199. ******************************************************************************/
  200. #define TEGRA_HSP_DBELL_BASE U(0x03C90000)
  201. #define HSP_DBELL_1_ENABLE U(0x104)
  202. #define HSP_DBELL_3_TRIGGER U(0x300)
  203. #define HSP_DBELL_3_ENABLE U(0x304)
  204. /*******************************************************************************
  205. * Tegra Clock and Reset Controller constants
  206. ******************************************************************************/
  207. #define TEGRA_CAR_RESET_BASE U(0x05000000)
  208. #define TEGRA_GPU_RESET_REG_OFFSET U(0x30)
  209. #define TEGRA_GPU_RESET_GPU_SET_OFFSET U(0x34)
  210. #define GPU_RESET_BIT (U(1) << 0)
  211. #define GPU_SET_BIT (U(1) << 0)
  212. #define TEGRA_GPCDMA_RST_SET_REG_OFFSET U(0x6A0004)
  213. #define TEGRA_GPCDMA_RST_CLR_REG_OFFSET U(0x6A0008)
  214. /*******************************************************************************
  215. * Tegra micro-seconds timer constants
  216. ******************************************************************************/
  217. #define TEGRA_TMRUS_BASE U(0x0C2E0000)
  218. #define TEGRA_TMRUS_SIZE U(0x1000)
  219. /*******************************************************************************
  220. * Tegra Power Mgmt Controller constants
  221. ******************************************************************************/
  222. #define TEGRA_PMC_BASE U(0x0C360000)
  223. /*******************************************************************************
  224. * Tegra scratch registers constants
  225. ******************************************************************************/
  226. #define TEGRA_SCRATCH_BASE U(0x0C390000)
  227. #define SECURE_SCRATCH_RSV0_HI U(0x654)
  228. #define SECURE_SCRATCH_RSV1_LO U(0x658)
  229. #define SECURE_SCRATCH_RSV1_HI U(0x65C)
  230. #define SECURE_SCRATCH_RSV6 U(0x680)
  231. #define SECURE_SCRATCH_RSV11_LO U(0x6A8)
  232. #define SECURE_SCRATCH_RSV11_HI U(0x6AC)
  233. #define SECURE_SCRATCH_RSV53_LO U(0x7F8)
  234. #define SECURE_SCRATCH_RSV53_HI U(0x7FC)
  235. #define SECURE_SCRATCH_RSV55_LO U(0x808)
  236. #define SECURE_SCRATCH_RSV55_HI U(0x80C)
  237. #define SECURE_SCRATCH_RSV63_LO U(0x848)
  238. #define SECURE_SCRATCH_RSV63_HI U(0x84C)
  239. #define SECURE_SCRATCH_RSV64_LO U(0x850)
  240. #define SECURE_SCRATCH_RSV64_HI U(0x854)
  241. #define SECURE_SCRATCH_RSV65_LO U(0x858)
  242. #define SECURE_SCRATCH_RSV65_HI U(0x85c)
  243. #define SECURE_SCRATCH_RSV66_LO U(0x860)
  244. #define SECURE_SCRATCH_RSV66_HI U(0x864)
  245. #define SECURE_SCRATCH_RSV68_LO U(0x870)
  246. #define SCRATCH_RESET_VECTOR_LO SECURE_SCRATCH_RSV1_LO
  247. #define SCRATCH_RESET_VECTOR_HI SECURE_SCRATCH_RSV1_HI
  248. #define SCRATCH_SECURE_BOOTP_FCFG SECURE_SCRATCH_RSV6
  249. #define SCRATCH_MC_TABLE_ADDR_LO SECURE_SCRATCH_RSV11_LO
  250. #define SCRATCH_MC_TABLE_ADDR_HI SECURE_SCRATCH_RSV11_HI
  251. #define SCRATCH_BL31_PARAMS_ADDR SECURE_SCRATCH_RSV53_LO
  252. #define SCRATCH_BL31_PLAT_PARAMS_ADDR SECURE_SCRATCH_RSV53_HI
  253. #define SCRATCH_TZDRAM_ADDR_LO SECURE_SCRATCH_RSV55_LO
  254. #define SCRATCH_TZDRAM_ADDR_HI SECURE_SCRATCH_RSV55_HI
  255. /*******************************************************************************
  256. * Tegra Memory Mapped Control Register Access constants
  257. ******************************************************************************/
  258. #define TEGRA_MMCRAB_BASE U(0x0E000000)
  259. /*******************************************************************************
  260. * Tegra Memory Mapped Activity Monitor Register Access constants
  261. ******************************************************************************/
  262. #define TEGRA_ARM_ACTMON_CTR_BASE U(0x0E060000)
  263. #define TEGRA_DENVER_ACTMON_CTR_BASE U(0x0E070000)
  264. /*******************************************************************************
  265. * Tegra SMMU Controller constants
  266. ******************************************************************************/
  267. #define TEGRA_SMMU0_BASE U(0x12000000)
  268. /*******************************************************************************
  269. * Tegra TZRAM constants
  270. ******************************************************************************/
  271. #define TEGRA_TZRAM_BASE U(0x30000000)
  272. #define TEGRA_TZRAM_SIZE U(0x40000)
  273. /*******************************************************************************
  274. * Tegra CCPLEX-BPMP IPC constants
  275. ******************************************************************************/
  276. #define TEGRA_BPMP_IPC_TX_PHYS_BASE U(0x3004C000)
  277. #define TEGRA_BPMP_IPC_RX_PHYS_BASE U(0x3004D000)
  278. #define TEGRA_BPMP_IPC_CH_MAP_SIZE U(0x1000) /* 4KB */
  279. /*******************************************************************************
  280. * Tegra DRAM memory base address
  281. ******************************************************************************/
  282. #define TEGRA_DRAM_BASE ULL(0x80000000)
  283. #define TEGRA_DRAM_END ULL(0x27FFFFFFF)
  284. #endif /* TEGRA_DEF_H */