platform_def.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /*
  2. * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
  3. * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: BSD-3-Clause
  6. */
  7. #ifndef PLATFORM_DEF_H
  8. #define PLATFORM_DEF_H
  9. /* Enable the dynamic translation tables library. */
  10. #define PLAT_XLAT_TABLES_DYNAMIC 1
  11. #include <common_def.h>
  12. #include <qti_board_def.h>
  13. #include <qtiseclib_defs_plat.h>
  14. /*----------------------------------------------------------------------------*/
  15. /*----------------------------------------------------------------------------*/
  16. /*
  17. * MPIDR_PRIMARY_CPU
  18. * You just need to have the correct core_affinity_val i.e. [7:0]
  19. * and cluster_affinity_val i.e. [15:8]
  20. * the other bits will be ignored
  21. */
  22. /*----------------------------------------------------------------------------*/
  23. #define MPIDR_PRIMARY_CPU 0x0000
  24. /*----------------------------------------------------------------------------*/
  25. #define QTI_PWR_LVL0 MPIDR_AFFLVL0
  26. #define QTI_PWR_LVL1 MPIDR_AFFLVL1
  27. #define QTI_PWR_LVL2 MPIDR_AFFLVL2
  28. #define QTI_PWR_LVL3 MPIDR_AFFLVL3
  29. /*
  30. * Macros for local power states encoded by State-ID field
  31. * within the power-state parameter.
  32. */
  33. /* Local power state for power domains in Run state. */
  34. #define QTI_LOCAL_STATE_RUN 0
  35. /*
  36. * Local power state for clock-gating. Valid only for CPU and not cluster power
  37. * domains
  38. */
  39. #define QTI_LOCAL_STATE_STB 1
  40. /*
  41. * Local power state for retention. Valid for CPU and cluster power
  42. * domains
  43. */
  44. #define QTI_LOCAL_STATE_RET 2
  45. /*
  46. * Local power state for OFF/power down. Valid for CPU, cluster, RSC and PDC
  47. * power domains
  48. */
  49. #define QTI_LOCAL_STATE_OFF 3
  50. /*
  51. * Local power state for DEEPOFF/power rail down. Valid for CPU, cluster and RSC
  52. * power domains
  53. */
  54. #define QTI_LOCAL_STATE_DEEPOFF 4
  55. /*
  56. * This macro defines the deepest retention state possible. A higher state
  57. * id will represent an invalid or a power down state.
  58. */
  59. #define PLAT_MAX_RET_STATE QTI_LOCAL_STATE_RET
  60. /*
  61. * This macro defines the deepest power down states possible. Any state ID
  62. * higher than this is invalid.
  63. */
  64. #define PLAT_MAX_OFF_STATE QTI_LOCAL_STATE_DEEPOFF
  65. /******************************************************************************
  66. * Required platform porting definitions common to all ARM standard platforms
  67. *****************************************************************************/
  68. /*
  69. * Platform specific page table and MMU setup constants.
  70. */
  71. #define MAX_MMAP_REGIONS (PLAT_QTI_MMAP_ENTRIES)
  72. #define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 36)
  73. #define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 36)
  74. #define ARM_CACHE_WRITEBACK_SHIFT 6
  75. /*
  76. * Some data must be aligned on the biggest cache line size in the platform.
  77. * This is known only to the platform as it might have a combination of
  78. * integrated and external caches.
  79. */
  80. #define CACHE_WRITEBACK_GRANULE (1 << ARM_CACHE_WRITEBACK_SHIFT)
  81. /*
  82. * One cache line needed for bakery locks on ARM platforms
  83. */
  84. #define PLAT_PERCPU_BAKERY_LOCK_SIZE (1 * CACHE_WRITEBACK_GRANULE)
  85. /*----------------------------------------------------------------------------*/
  86. /* PSCI power domain topology definitions */
  87. /*----------------------------------------------------------------------------*/
  88. /* One domain each to represent RSC and PDC level */
  89. #define PLAT_PDC_COUNT 1
  90. #define PLAT_RSC_COUNT 1
  91. /* There is one top-level FCM cluster */
  92. #define PLAT_CLUSTER_COUNT 1
  93. /* No. of cores in the FCM cluster */
  94. #define PLAT_CLUSTER0_CORE_COUNT 8
  95. #define PLATFORM_CORE_COUNT (PLAT_CLUSTER0_CORE_COUNT)
  96. #define PLAT_NUM_PWR_DOMAINS (PLAT_PDC_COUNT +\
  97. PLAT_RSC_COUNT +\
  98. PLAT_CLUSTER_COUNT +\
  99. PLATFORM_CORE_COUNT)
  100. #define PLAT_MAX_PWR_LVL 3
  101. /*****************************************************************************/
  102. /* Memory mapped Generic timer interfaces */
  103. /*****************************************************************************/
  104. /*----------------------------------------------------------------------------*/
  105. /* GIC-600 constants */
  106. /*----------------------------------------------------------------------------*/
  107. #define BASE_GICD_BASE 0x17A00000
  108. #define BASE_GICR_BASE 0x17A60000
  109. #define BASE_GICC_BASE 0x0
  110. #define BASE_GICH_BASE 0x0
  111. #define BASE_GICV_BASE 0x0
  112. #define QTI_GICD_BASE BASE_GICD_BASE
  113. #define QTI_GICR_BASE BASE_GICR_BASE
  114. #define QTI_GICC_BASE BASE_GICC_BASE
  115. /*----------------------------------------------------------------------------*/
  116. /*----------------------------------------------------------------------------*/
  117. /* UART related constants. */
  118. /*----------------------------------------------------------------------------*/
  119. /* BASE ADDRESS OF DIFFERENT REGISTER SPACES IN HW */
  120. #define GENI4_CFG 0x0
  121. #define GENI4_IMAGE_REGS 0x100
  122. #define GENI4_DATA 0x600
  123. /* COMMON STATUS/CONFIGURATION REGISTERS AND MASKS */
  124. #define GENI_STATUS_REG (GENI4_CFG + 0x00000040)
  125. #define GENI_STATUS_M_GENI_CMD_ACTIVE_MASK (0x1)
  126. #define UART_TX_TRANS_LEN_REG (GENI4_IMAGE_REGS + 0x00000170)
  127. /* MASTER/TX ENGINE REGISTERS */
  128. #define GENI_M_CMD0_REG (GENI4_DATA + 0x00000000)
  129. /* FIFO, STATUS REGISTERS AND MASKS */
  130. #define GENI_TX_FIFOn_REG (GENI4_DATA + 0x00000100)
  131. #define GENI_M_CMD_TX (0x08000000)
  132. /*----------------------------------------------------------------------------*/
  133. /* Device address space for mapping. Excluding starting 4K */
  134. /*----------------------------------------------------------------------------*/
  135. #define QTI_DEVICE_BASE 0x1000
  136. #define QTI_DEVICE_SIZE (0x80000000 - QTI_DEVICE_BASE)
  137. /*******************************************************************************
  138. * BL31 specific defines.
  139. ******************************************************************************/
  140. /*
  141. * Put BL31 at DDR as per memory map. BL31_BASE is calculated using the
  142. * current BL31 debug size plus a little space for growth.
  143. */
  144. #define BL31_LIMIT (BL31_BASE + BL31_SIZE)
  145. /*----------------------------------------------------------------------------*/
  146. /* AOSS registers */
  147. /*----------------------------------------------------------------------------*/
  148. #define QTI_PS_HOLD_REG 0x0C264000
  149. /*----------------------------------------------------------------------------*/
  150. /* AOP CMD DB address space for mapping */
  151. /*----------------------------------------------------------------------------*/
  152. #define QTI_AOP_CMD_DB_BASE 0x80820000
  153. #define QTI_AOP_CMD_DB_SIZE 0x00020000
  154. /*----------------------------------------------------------------------------*/
  155. /* SOC hw version register */
  156. /*----------------------------------------------------------------------------*/
  157. #define QTI_SOC_VERSION_MASK U(0xFFFF)
  158. #define QTI_SOC_REVISION_REG 0x1FC8000
  159. #define QTI_SOC_REVISION_MASK U(0xFFFF)
  160. /*----------------------------------------------------------------------------*/
  161. /* LC PON register offsets */
  162. /*----------------------------------------------------------------------------*/
  163. #define PON_PS_HOLD_RESET_CTL 0x85a
  164. #define PON_PS_HOLD_RESET_CTL2 0x85b
  165. /*----------------------------------------------------------------------------*/
  166. #endif /* PLATFORM_DEF_H */