mcucfg.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. /*
  2. * Copyright (c) 2022, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MCUCFG_V1_H
  7. #define MCUCFG_V1_H
  8. #ifndef __ASSEMBLER__
  9. #include <stdint.h>
  10. #endif /*__ASSEMBLER__*/
  11. #include <platform_def.h>
  12. #define MP2_MISC_CONFIG_BOOT_ADDR_L(cpu) (MCUCFG_BASE + 0x2290 + ((cpu) * 8))
  13. #define MP2_MISC_CONFIG_BOOT_ADDR_H(cpu) (MCUCFG_BASE + 0x2294 + ((cpu) * 8))
  14. #define MP2_CPUCFG (MCUCFG_BASE + 0x2208)
  15. #define MP0_CPUTOP_SPMC_CTL (MCUCFG_BASE + 0x788)
  16. #define MP1_CPUTOP_SPMC_CTL (MCUCFG_BASE + 0x78C)
  17. #define MP1_CPUTOP_SPMC_SRAM_CTL (MCUCFG_BASE + 0x790)
  18. #define CPUSYSx_CPUx_SPMC_CTL(cluster, cpu) (MCUCFG_BASE + 0x1C30 + \
  19. (cluster) * 0x2000 + (cpu) * 4)
  20. #define CPUSYS0_CPU0_SPMC_CTL (MCUCFG_BASE + 0x1C30)
  21. #define CPUSYS0_CPU1_SPMC_CTL (MCUCFG_BASE + 0x1C34)
  22. #define CPUSYS0_CPU2_SPMC_CTL (MCUCFG_BASE + 0x1C38)
  23. #define CPUSYS0_CPU3_SPMC_CTL (MCUCFG_BASE + 0x1C3C)
  24. #define CPUSYS1_CPU0_SPMC_CTL (MCUCFG_BASE + 0x3C30)
  25. #define CPUSYS1_CPU1_SPMC_CTL (MCUCFG_BASE + 0x3C34)
  26. #define CPUSYS1_CPU2_SPMC_CTL (MCUCFG_BASE + 0x3C38)
  27. #define CPUSYS1_CPU3_SPMC_CTL (MCUCFG_BASE + 0x3C3C)
  28. /* CPC related registers */
  29. #define CPC_MCUSYS_CPC_OFF_THRES (MCUCFG_BASE + 0xA714)
  30. #define CPC_MCUSYS_PWR_CTRL (MCUCFG_BASE + 0xA804)
  31. #define CPC_MCUSYS_CPC_FLOW_CTRL_CFG (MCUCFG_BASE + 0xA814)
  32. #define CPC_MCUSYS_LAST_CORE_REQ (MCUCFG_BASE + 0xA818)
  33. #define CPC_MCUSYS_MP_LAST_CORE_RESP (MCUCFG_BASE + 0xA81C)
  34. #define CPC_MCUSYS_LAST_CORE_RESP (MCUCFG_BASE + 0xA824)
  35. #define CPC_MCUSYS_PWR_ON_MASK (MCUCFG_BASE + 0xA828)
  36. #define CPC_SPMC_PWR_STATUS (MCUCFG_BASE + 0xA840)
  37. #define CPC_MCUSYS_CPU_ON_SW_HINT_SET (MCUCFG_BASE + 0xA8A8)
  38. #define CPC_MCUSYS_CPU_ON_SW_HINT_CLR (MCUCFG_BASE + 0xA8AC)
  39. #define CPC_MCUSYS_CPC_DBG_SETTING (MCUCFG_BASE + 0xAB00)
  40. #define CPC_MCUSYS_CPC_KERNEL_TIME_L_BASE (MCUCFG_BASE + 0xAB04)
  41. #define CPC_MCUSYS_CPC_KERNEL_TIME_H_BASE (MCUCFG_BASE + 0xAB08)
  42. #define CPC_MCUSYS_CPC_SYSTEM_TIME_L_BASE (MCUCFG_BASE + 0xAB0C)
  43. #define CPC_MCUSYS_CPC_SYSTEM_TIME_H_BASE (MCUCFG_BASE + 0xAB10)
  44. #define CPC_MCUSYS_TRACE_SEL (MCUCFG_BASE + 0xAB14)
  45. #define CPC_MCUSYS_TRACE_DATA (MCUCFG_BASE + 0xAB20)
  46. #define CPC_MCUSYS_CLUSTER_COUNTER (MCUCFG_BASE + 0xAB70)
  47. #define CPC_MCUSYS_CLUSTER_COUNTER_CLR (MCUCFG_BASE + 0xAB74)
  48. /* CPC_MCUSYS_CPC_FLOW_CTRL_CFG bit control */
  49. #define CPC_CTRL_ENABLE BIT(16)
  50. #define SSPM_CORE_PWR_ON_EN BIT(7) /* for cpu-hotplug */
  51. #define SSPM_ALL_PWR_CTRL_EN BIT(13) /* for cpu-hotplug */
  52. #define GIC_WAKEUP_IGNORE(cpu) BIT(21 + cpu)
  53. #define CPC_MCUSYS_CPC_RESET_ON_KEEP_ON BIT(17)
  54. #define CPC_MCUSYS_CPC_RESET_PWR_ON_EN BIT(20)
  55. /* SPMC related registers */
  56. #define SPM_MCUSYS_PWR_CON (MCUCFG_BASE + 0xD200)
  57. #define SPM_MP0_CPUTOP_PWR_CON (MCUCFG_BASE + 0xD204)
  58. #define SPM_MP0_CPU0_PWR_CON (MCUCFG_BASE + 0xD208)
  59. #define SPM_MP0_CPU1_PWR_CON (MCUCFG_BASE + 0xD20C)
  60. #define SPM_MP0_CPU2_PWR_CON (MCUCFG_BASE + 0xD210)
  61. #define SPM_MP0_CPU3_PWR_CON (MCUCFG_BASE + 0xD214)
  62. #define SPM_MP0_CPU4_PWR_CON (MCUCFG_BASE + 0xD218)
  63. #define SPM_MP0_CPU5_PWR_CON (MCUCFG_BASE + 0xD21C)
  64. #define SPM_MP0_CPU6_PWR_CON (MCUCFG_BASE + 0xD220)
  65. #define SPM_MP0_CPU7_PWR_CON (MCUCFG_BASE + 0xD224)
  66. /* bit fields of SPM_*_PWR_CON */
  67. #define PWR_ON_ACK BIT(31)
  68. #define VPROC_EXT_OFF BIT(7)
  69. #define DORMANT_EN BIT(6)
  70. #define RESETPWRON_CONFIG BIT(5)
  71. #define PWR_CLK_DIS BIT(4)
  72. #define PWR_ON BIT(2)
  73. #define PWR_RST_B BIT(0)
  74. #define SPARK2LDO (MCUCFG_BASE + 0x2700)
  75. /* APB Module mcucfg */
  76. #define MP0_CA7_CACHE_CONFIG (MCUCFG_BASE + 0x000)
  77. #define MP0_AXI_CONFIG (MCUCFG_BASE + 0x02C)
  78. #define MP0_MISC_CONFIG0 (MCUCFG_BASE + 0x030)
  79. #define MP0_MISC_CONFIG1 (MCUCFG_BASE + 0x034)
  80. #define MP0_MISC_CONFIG2 (MCUCFG_BASE + 0x038)
  81. #define MP0_MISC_CONFIG_BOOT_ADDR(cpu) (MCUCFG_BASE + 0x038 + ((cpu) * 8))
  82. #define MP0_MISC_CONFIG3 (MCUCFG_BASE + 0x03C)
  83. #define MP0_MISC_CONFIG9 (MCUCFG_BASE + 0x054)
  84. #define MP0_CA7_MISC_CONFIG (MCUCFG_BASE + 0x064)
  85. #define MP0_RW_RSVD0 (MCUCFG_BASE + 0x06C)
  86. #define MP1_CA7_CACHE_CONFIG (MCUCFG_BASE + 0x200)
  87. #define MP1_AXI_CONFIG (MCUCFG_BASE + 0x22C)
  88. #define MP1_MISC_CONFIG0 (MCUCFG_BASE + 0x230)
  89. #define MP1_MISC_CONFIG1 (MCUCFG_BASE + 0x234)
  90. #define MP1_MISC_CONFIG2 (MCUCFG_BASE + 0x238)
  91. #define MP1_MISC_CONFIG_BOOT_ADDR(cpu) (MCUCFG_BASE + 0x238 + ((cpu) * 8))
  92. #define MP1_MISC_CONFIG3 (MCUCFG_BASE + 0x23C)
  93. #define MP1_MISC_CONFIG9 (MCUCFG_BASE + 0x254)
  94. #define MP1_CA7_MISC_CONFIG (MCUCFG_BASE + 0x264)
  95. #define CCI_ADB400_DCM_CONFIG (MCUCFG_BASE + 0x740)
  96. #define SYNC_DCM_CONFIG (MCUCFG_BASE + 0x744)
  97. #define MP0_CLUSTER_CFG0 (MCUCFG_BASE + 0xC8D0)
  98. #define MP0_SPMC (MCUCFG_BASE + 0x788)
  99. #define MP1_SPMC (MCUCFG_BASE + 0x78C)
  100. #define MP2_AXI_CONFIG (MCUCFG_BASE + 0x220C)
  101. #define MP2_AXI_CONFIG_ACINACTM BIT(0)
  102. #define MP2_AXI_CONFIG_AINACTS BIT(4)
  103. #define MPx_AXI_CONFIG_ACINACTM BIT(4)
  104. #define MPx_AXI_CONFIG_AINACTS BIT(5)
  105. #define MPx_CA7_MISC_CONFIG_standbywfil2 BIT(28)
  106. #define MP0_CPU0_STANDBYWFE BIT(20)
  107. #define MP0_CPU1_STANDBYWFE BIT(21)
  108. #define MP0_CPU2_STANDBYWFE BIT(22)
  109. #define MP0_CPU3_STANDBYWFE BIT(23)
  110. #define MP1_CPU0_STANDBYWFE BIT(20)
  111. #define MP1_CPU1_STANDBYWFE BIT(21)
  112. #define MP1_CPU2_STANDBYWFE BIT(22)
  113. #define MP1_CPU3_STANDBYWFE BIT(23)
  114. #define CPUSYS0_SPARKVRETCNTRL (MCUCFG_BASE+0x1c00)
  115. #define CPUSYS0_SPARKEN (MCUCFG_BASE+0x1c04)
  116. #define CPUSYS0_AMUXSEL (MCUCFG_BASE+0x1c08)
  117. #define CPUSYS1_SPARKVRETCNTRL (MCUCFG_BASE+0x3c00)
  118. #define CPUSYS1_SPARKEN (MCUCFG_BASE+0x3c04)
  119. #define CPUSYS1_AMUXSEL (MCUCFG_BASE+0x3c08)
  120. #define MP2_PWR_RST_CTL (MCUCFG_BASE + 0x2008)
  121. #define MP2_PTP3_CPUTOP_SPMC0 (MCUCFG_BASE + 0x22A0)
  122. #define MP2_PTP3_CPUTOP_SPMC1 (MCUCFG_BASE + 0x22A4)
  123. #define MP2_COQ (MCUCFG_BASE + 0x22BC)
  124. #define MP2_COQ_SW_DIS BIT(0)
  125. #define MP2_CA15M_MON_SEL (MCUCFG_BASE + 0x2400)
  126. #define MP2_CA15M_MON_L (MCUCFG_BASE + 0x2404)
  127. #define CPUSYS2_CPU0_SPMC_CTL (MCUCFG_BASE + 0x2430)
  128. #define CPUSYS2_CPU1_SPMC_CTL (MCUCFG_BASE + 0x2438)
  129. #define CPUSYS2_CPU0_SPMC_STA (MCUCFG_BASE + 0x2434)
  130. #define CPUSYS2_CPU1_SPMC_STA (MCUCFG_BASE + 0x243C)
  131. #define MP0_CA7L_DBG_PWR_CTRL (MCUCFG_BASE + 0x068)
  132. #define MP1_CA7L_DBG_PWR_CTRL (MCUCFG_BASE + 0x268)
  133. #define BIG_DBG_PWR_CTRL (MCUCFG_BASE + 0x75C)
  134. #define MP2_SW_RST_B BIT(0)
  135. #define MP2_TOPAON_APB_MASK BIT(1)
  136. #define B_SW_HOT_PLUG_RESET BIT(30)
  137. #define B_SW_PD_OFFSET (18)
  138. #define B_SW_PD (0x3F << B_SW_PD_OFFSET)
  139. #define B_SW_SRAM_SLEEPB_OFFSET (12)
  140. #define B_SW_SRAM_SLEEPB (0x3F << B_SW_SRAM_SLEEPB_OFFSET)
  141. #define B_SW_SRAM_ISOINTB BIT(9)
  142. #define B_SW_ISO BIT(8)
  143. #define B_SW_LOGIC_PDB BIT(7)
  144. #define B_SW_LOGIC_PRE2_PDB BIT(6)
  145. #define B_SW_LOGIC_PRE1_PDB BIT(5)
  146. #define B_SW_FSM_OVERRIDE BIT(4)
  147. #define B_SW_PWR_ON BIT(3)
  148. #define B_SW_PWR_ON_OVERRIDE_EN BIT(2)
  149. #define B_FSM_STATE_OUT_OFFSET (6)
  150. #define B_FSM_STATE_OUT_MASK (0x1F << B_FSM_STATE_OUT_OFFSET)
  151. #define B_SW_LOGIC_PDBO_ALL_OFF_ACK BIT(5)
  152. #define B_SW_LOGIC_PDBO_ALL_ON_ACK BIT(4)
  153. #define B_SW_LOGIC_PRE2_PDBO_ALL_ON_ACK BIT(3)
  154. #define B_SW_LOGIC_PRE1_PDBO_ALL_ON_ACK BIT(2)
  155. #define B_FSM_OFF (0U << B_FSM_STATE_OUT_OFFSET)
  156. #define B_FSM_ON (1U << B_FSM_STATE_OUT_OFFSET)
  157. #define B_FSM_RET (2U << B_FSM_STATE_OUT_OFFSET)
  158. #ifndef __ASSEMBLER__
  159. /* cpu boot mode */
  160. enum mp0_coucfg_64bit_ctrl {
  161. MP0_CPUCFG_64BIT_SHIFT = 12,
  162. MP1_CPUCFG_64BIT_SHIFT = 28,
  163. MP0_CPUCFG_64BIT = 0xfu << MP0_CPUCFG_64BIT_SHIFT,
  164. MP1_CPUCFG_64BIT = 0xfu << MP1_CPUCFG_64BIT_SHIFT,
  165. };
  166. enum mp1_dis_rgu0_ctrl {
  167. MP1_DIS_RGU0_WAIT_PD_CPUS_L1_ACK_SHIFT = 0,
  168. MP1_DIS_RGU1_WAIT_PD_CPUS_L1_ACK_SHIFT = 4,
  169. MP1_DIS_RGU2_WAIT_PD_CPUS_L1_ACK_SHIFT = 8,
  170. MP1_DIS_RGU3_WAIT_PD_CPUS_L1_ACK_SHIFT = 12,
  171. MP1_DIS_RGU_NOCPU_WAIT_PD_CPUS_L1_ACK_SHIFT = 16,
  172. MP1_DIS_RGU0_WAIT_PD_CPUS_L1_ACK = 0xF << MP1_DIS_RGU0_WAIT_PD_CPUS_L1_ACK_SHIFT,
  173. MP1_DIS_RGU1_WAIT_PD_CPUS_L1_ACK = 0xF << MP1_DIS_RGU1_WAIT_PD_CPUS_L1_ACK_SHIFT,
  174. MP1_DIS_RGU2_WAIT_PD_CPUS_L1_ACK = 0xF << MP1_DIS_RGU2_WAIT_PD_CPUS_L1_ACK_SHIFT,
  175. MP1_DIS_RGU3_WAIT_PD_CPUS_L1_ACK = 0xF << MP1_DIS_RGU3_WAIT_PD_CPUS_L1_ACK_SHIFT,
  176. MP1_DIS_RGU_NOCPU_WAIT_PD_CPUS_L1_ACK = 0xF << MP1_DIS_RGU_NOCPU_WAIT_PD_CPUS_L1_ACK_SHIFT,
  177. };
  178. enum mp1_ainacts_ctrl {
  179. MP1_AINACTS_SHIFT = 4,
  180. MP1_AINACTS = 1U << MP1_AINACTS_SHIFT,
  181. };
  182. enum mp1_sw_cg_gen {
  183. MP1_SW_CG_GEN_SHIFT = 12,
  184. MP1_SW_CG_GEN = 1U << MP1_SW_CG_GEN_SHIFT,
  185. };
  186. enum mp1_l2rstdisable {
  187. MP1_L2RSTDISABLE_SHIFT = 14,
  188. MP1_L2RSTDISABLE = 1U << MP1_L2RSTDISABLE_SHIFT,
  189. };
  190. #endif /*__ASSEMBLER__*/
  191. #endif /* MCUCFG_V1_H */