mcucfg.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /*
  2. * Copyright (c) 2021, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MCUCFG_H
  7. #define MCUCFG_H
  8. #ifndef __ASSEMBLER__
  9. #include <stdint.h>
  10. #endif /* __ASSEMBLER__ */
  11. #include <platform_def.h>
  12. #define MCUCFG_REG(ofs) (uint32_t)(MCUCFG_BASE + (ofs))
  13. #define MP2_MISC_CONFIG_BOOT_ADDR_L(cpu) (MCUCFG_REG(0x2290) + ((cpu) * 8))
  14. #define MP2_MISC_CONFIG_BOOT_ADDR_H(cpu) (MCUCFG_REG(0x2294) + ((cpu) * 8))
  15. #define MP2_CPUCFG MCUCFG_REG(0x2208)
  16. #define MP2_CPU0_STANDBYWFE BIT(4)
  17. #define MP2_CPU1_STANDBYWFE BIT(5)
  18. #define MP0_CPUTOP_SPMC_CTL MCUCFG_REG(0x788)
  19. #define MP1_CPUTOP_SPMC_CTL MCUCFG_REG(0x78C)
  20. #define MP1_CPUTOP_SPMC_SRAM_CTL MCUCFG_REG(0x790)
  21. #define sw_spark_en BIT(0)
  22. #define sw_no_wait_for_q_channel BIT(1)
  23. #define sw_fsm_override BIT(2)
  24. #define sw_logic_pre1_pdb BIT(3)
  25. #define sw_logic_pre2_pdb BIT(4)
  26. #define sw_logic_pdb BIT(5)
  27. #define sw_iso BIT(6)
  28. #define sw_sram_sleepb (U(0x3F) << 7)
  29. #define sw_sram_isointb BIT(13)
  30. #define sw_clk_dis BIT(14)
  31. #define sw_ckiso BIT(15)
  32. #define sw_pd (U(0x3F) << 16)
  33. #define sw_hot_plug_reset BIT(22)
  34. #define sw_pwr_on_override_en BIT(23)
  35. #define sw_pwr_on BIT(24)
  36. #define sw_coq_dis BIT(25)
  37. #define logic_pdbo_all_off_ack BIT(26)
  38. #define logic_pdbo_all_on_ack BIT(27)
  39. #define logic_pre2_pdbo_all_on_ack BIT(28)
  40. #define logic_pre1_pdbo_all_on_ack BIT(29)
  41. #define CPUSYSx_CPUx_SPMC_CTL(cluster, cpu) \
  42. (MCUCFG_REG(0x1c30) + cluster * 0x2000 + cpu * 4)
  43. #define CPUSYS0_CPU0_SPMC_CTL MCUCFG_REG(0x1c30)
  44. #define CPUSYS0_CPU1_SPMC_CTL MCUCFG_REG(0x1c34)
  45. #define CPUSYS0_CPU2_SPMC_CTL MCUCFG_REG(0x1c38)
  46. #define CPUSYS0_CPU3_SPMC_CTL MCUCFG_REG(0x1c3C)
  47. #define CPUSYS1_CPU0_SPMC_CTL MCUCFG_REG(0x3c30)
  48. #define CPUSYS1_CPU1_SPMC_CTL MCUCFG_REG(0x3c34)
  49. #define CPUSYS1_CPU2_SPMC_CTL MCUCFG_REG(0x3c38)
  50. #define CPUSYS1_CPU3_SPMC_CTL MCUCFG_REG(0x3c3C)
  51. #define cpu_sw_spark_en BIT(0)
  52. #define cpu_sw_no_wait_for_q_channel BIT(1)
  53. #define cpu_sw_fsm_override BIT(2)
  54. #define cpu_sw_logic_pre1_pdb BIT(3)
  55. #define cpu_sw_logic_pre2_pdb BIT(4)
  56. #define cpu_sw_logic_pdb BIT(5)
  57. #define cpu_sw_iso BIT(6)
  58. #define cpu_sw_sram_sleepb BIT(7)
  59. #define cpu_sw_sram_isointb BIT(8)
  60. #define cpu_sw_clk_dis BIT(9)
  61. #define cpu_sw_ckiso BIT(10)
  62. #define cpu_sw_pd (U(0x1F) << 11)
  63. #define cpu_sw_hot_plug_reset BIT(16)
  64. #define cpu_sw_powr_on_override_en BIT(17)
  65. #define cpu_sw_pwr_on BIT(18)
  66. #define cpu_spark2ldo_allswoff BIT(19)
  67. #define cpu_pdbo_all_on_ack BIT(20)
  68. #define cpu_pre2_pdbo_allon_ack BIT(21)
  69. #define cpu_pre1_pdbo_allon_ack BIT(22)
  70. /* CPC related registers */
  71. #define CPC_MCUSYS_CPC_OFF_THRES MCUCFG_REG(0xa714)
  72. #define CPC_MCUSYS_PWR_CTRL MCUCFG_REG(0xa804)
  73. #define CPC_MCUSYS_CPC_FLOW_CTRL_CFG MCUCFG_REG(0xa814)
  74. #define CPC_MCUSYS_LAST_CORE_REQ MCUCFG_REG(0xa818)
  75. #define CPC_MCUSYS_MP_LAST_CORE_RESP MCUCFG_REG(0xa81c)
  76. #define CPC_MCUSYS_LAST_CORE_RESP MCUCFG_REG(0xa824)
  77. #define CPC_MCUSYS_PWR_ON_MASK MCUCFG_REG(0xa828)
  78. #define CPC_MCUSYS_CPU_ON_SW_HINT_SET MCUCFG_REG(0xa8a8)
  79. #define CPC_MCUSYS_CPU_ON_SW_HINT_CLR MCUCFG_REG(0xa8ac)
  80. #define CPC_MCUSYS_CPC_DBG_SETTING MCUCFG_REG(0xab00)
  81. #define CPC_MCUSYS_CPC_KERNEL_TIME_L_BASE MCUCFG_REG(0xab04)
  82. #define CPC_MCUSYS_CPC_KERNEL_TIME_H_BASE MCUCFG_REG(0xab08)
  83. #define CPC_MCUSYS_CPC_SYSTEM_TIME_L_BASE MCUCFG_REG(0xab0c)
  84. #define CPC_MCUSYS_CPC_SYSTEM_TIME_H_BASE MCUCFG_REG(0xab10)
  85. #define CPC_MCUSYS_TRACE_SEL MCUCFG_REG(0xab14)
  86. #define CPC_MCUSYS_TRACE_DATA MCUCFG_REG(0xab20)
  87. #define CPC_MCUSYS_CLUSTER_COUNTER MCUCFG_REG(0xab70)
  88. #define CPC_MCUSYS_CLUSTER_COUNTER_CLR MCUCFG_REG(0xab74)
  89. #define SPARK2LDO MCUCFG_REG(0x2700)
  90. /* APB module mcucfg */
  91. #define MP0_CA7_CACHE_CONFIG MCUCFG_REG(0x000)
  92. #define MP0_AXI_CONFIG MCUCFG_REG(0x02C)
  93. #define MP0_MISC_CONFIG0 MCUCFG_REG(0x030)
  94. #define MP0_MISC_CONFIG1 MCUCFG_REG(0x034)
  95. #define MP0_MISC_CONFIG2 MCUCFG_REG(0x038)
  96. #define MP0_MISC_CONFIG_BOOT_ADDR(cpu) (MP0_MISC_CONFIG2 + ((cpu) * 8))
  97. #define MP0_MISC_CONFIG3 MCUCFG_REG(0x03C)
  98. #define MP0_MISC_CONFIG9 MCUCFG_REG(0x054)
  99. #define MP0_CA7_MISC_CONFIG MCUCFG_REG(0x064)
  100. #define MP0_RW_RSVD0 MCUCFG_REG(0x06C)
  101. #define MP1_CA7_CACHE_CONFIG MCUCFG_REG(0x200)
  102. #define MP1_AXI_CONFIG MCUCFG_REG(0x22C)
  103. #define MP1_MISC_CONFIG0 MCUCFG_REG(0x230)
  104. #define MP1_MISC_CONFIG1 MCUCFG_REG(0x234)
  105. #define MP1_MISC_CONFIG2 MCUCFG_REG(0x238)
  106. #define MP1_MISC_CONFIG_BOOT_ADDR(cpu) (MP1_MISC_CONFIG2 + ((cpu) * 8))
  107. #define MP1_MISC_CONFIG3 MCUCFG_REG(0x23C)
  108. #define MP1_MISC_CONFIG9 MCUCFG_REG(0x254)
  109. #define MP1_CA7_MISC_CONFIG MCUCFG_REG(0x264)
  110. #define CCI_ADB400_DCM_CONFIG MCUCFG_REG(0x740)
  111. #define SYNC_DCM_CONFIG MCUCFG_REG(0x744)
  112. #define MP0_CLUSTER_CFG0 MCUCFG_REG(0xC8D0)
  113. #define MP0_SPMC MCUCFG_REG(0x788)
  114. #define MP1_SPMC MCUCFG_REG(0x78C)
  115. #define MP2_AXI_CONFIG MCUCFG_REG(0x220C)
  116. #define MP2_AXI_CONFIG_ACINACTM BIT(0)
  117. #define MP2_AXI_CONFIG_AINACTS BIT(4)
  118. #define MPx_AXI_CONFIG_ACINACTM BIT(4)
  119. #define MPx_AXI_CONFIG_AINACTS BIT(5)
  120. #define MPx_CA7_MISC_CONFIG_standbywfil2 BIT(28)
  121. #define MP0_CPU0_STANDBYWFE BIT(20)
  122. #define MP0_CPU1_STANDBYWFE BIT(21)
  123. #define MP0_CPU2_STANDBYWFE BIT(22)
  124. #define MP0_CPU3_STANDBYWFE BIT(23)
  125. #define MP1_CPU0_STANDBYWFE BIT(20)
  126. #define MP1_CPU1_STANDBYWFE BIT(21)
  127. #define MP1_CPU2_STANDBYWFE BIT(22)
  128. #define MP1_CPU3_STANDBYWFE BIT(23)
  129. #define CPUSYS0_SPARKVRETCNTRL MCUCFG_REG(0x1c00)
  130. #define CPUSYS0_SPARKEN MCUCFG_REG(0x1c04)
  131. #define CPUSYS0_AMUXSEL MCUCFG_REG(0x1c08)
  132. #define CPUSYS1_SPARKVRETCNTRL MCUCFG_REG(0x3c00)
  133. #define CPUSYS1_SPARKEN MCUCFG_REG(0x3c04)
  134. #define CPUSYS1_AMUXSEL MCUCFG_REG(0x3c08)
  135. #define MP2_PWR_RST_CTL MCUCFG_REG(0x2008)
  136. #define MP2_PTP3_CPUTOP_SPMC0 MCUCFG_REG(0x22A0)
  137. #define MP2_PTP3_CPUTOP_SPMC1 MCUCFG_REG(0x22A4)
  138. #define MP2_COQ MCUCFG_REG(0x22BC)
  139. #define MP2_COQ_SW_DIS BIT(0)
  140. #define MP2_CA15M_MON_SEL MCUCFG_REG(0x2400)
  141. #define MP2_CA15M_MON_L MCUCFG_REG(0x2404)
  142. #define CPUSYS2_CPU0_SPMC_CTL MCUCFG_REG(0x2430)
  143. #define CPUSYS2_CPU1_SPMC_CTL MCUCFG_REG(0x2438)
  144. #define CPUSYS2_CPU0_SPMC_STA MCUCFG_REG(0x2434)
  145. #define CPUSYS2_CPU1_SPMC_STA MCUCFG_REG(0x243C)
  146. #define MP0_CA7L_DBG_PWR_CTRL MCUCFG_REG(0x068)
  147. #define MP1_CA7L_DBG_PWR_CTRL MCUCFG_REG(0x268)
  148. #define BIG_DBG_PWR_CTRL MCUCFG_REG(0x75C)
  149. #define MP2_SW_RST_B BIT(0)
  150. #define MP2_TOPAON_APB_MASK BIT(1)
  151. #define B_SW_HOT_PLUG_RESET BIT(30)
  152. #define B_SW_PD_OFFSET (18U)
  153. #define B_SW_PD (U(0x3f) << B_SW_PD_OFFSET)
  154. #define B_SW_SRAM_SLEEPB_OFFSET (12U)
  155. #define B_SW_SRAM_SLEEPB (U(0x3f) << B_SW_SRAM_SLEEPB_OFFSET)
  156. #define B_SW_SRAM_ISOINTB BIT(9)
  157. #define B_SW_ISO BIT(8)
  158. #define B_SW_LOGIC_PDB BIT(7)
  159. #define B_SW_LOGIC_PRE2_PDB BIT(6)
  160. #define B_SW_LOGIC_PRE1_PDB BIT(5)
  161. #define B_SW_FSM_OVERRIDE BIT(4)
  162. #define B_SW_PWR_ON BIT(3)
  163. #define B_SW_PWR_ON_OVERRIDE_EN BIT(2)
  164. #define B_FSM_STATE_OUT_OFFSET (6U)
  165. #define B_FSM_STATE_OUT_MASK (U(0x1f) << B_FSM_STATE_OUT_OFFSET)
  166. #define B_SW_LOGIC_PDBO_ALL_OFF_ACK BIT(5)
  167. #define B_SW_LOGIC_PDBO_ALL_ON_ACK BIT(4)
  168. #define B_SW_LOGIC_PRE2_PDBO_ALL_ON_ACK BIT(3)
  169. #define B_SW_LOGIC_PRE1_PDBO_ALL_ON_ACK BIT(2)
  170. #define B_FSM_OFF (0U << B_FSM_STATE_OUT_OFFSET)
  171. #define B_FSM_ON (1U << B_FSM_STATE_OUT_OFFSET)
  172. #define B_FSM_RET (2U << B_FSM_STATE_OUT_OFFSET)
  173. #ifndef __ASSEMBLER__
  174. /* cpu boot mode */
  175. enum {
  176. MP0_CPUCFG_64BIT_SHIFT = 12U,
  177. MP1_CPUCFG_64BIT_SHIFT = 28U,
  178. MP0_CPUCFG_64BIT = U(0xf) << MP0_CPUCFG_64BIT_SHIFT,
  179. MP1_CPUCFG_64BIT = U(0xf) << MP1_CPUCFG_64BIT_SHIFT
  180. };
  181. enum {
  182. MP1_DIS_RGU0_WAIT_PD_CPUS_L1_ACK_SHIFT = 0U,
  183. MP1_DIS_RGU1_WAIT_PD_CPUS_L1_ACK_SHIFT = 4U,
  184. MP1_DIS_RGU2_WAIT_PD_CPUS_L1_ACK_SHIFT = 8U,
  185. MP1_DIS_RGU3_WAIT_PD_CPUS_L1_ACK_SHIFT = 12U,
  186. MP1_DIS_RGU_NOCPU_WAIT_PD_CPUS_L1_ACK_SHIFT = 16U,
  187. MP1_DIS_RGU0_WAIT_PD_CPUS_L1_ACK =
  188. U(0xf) << MP1_DIS_RGU0_WAIT_PD_CPUS_L1_ACK_SHIFT,
  189. MP1_DIS_RGU1_WAIT_PD_CPUS_L1_ACK =
  190. U(0xf) << MP1_DIS_RGU1_WAIT_PD_CPUS_L1_ACK_SHIFT,
  191. MP1_DIS_RGU2_WAIT_PD_CPUS_L1_ACK =
  192. U(0xf) << MP1_DIS_RGU2_WAIT_PD_CPUS_L1_ACK_SHIFT,
  193. MP1_DIS_RGU3_WAIT_PD_CPUS_L1_ACK =
  194. U(0xf) << MP1_DIS_RGU3_WAIT_PD_CPUS_L1_ACK_SHIFT,
  195. MP1_DIS_RGU_NOCPU_WAIT_PD_CPUS_L1_ACK =
  196. U(0xf) << MP1_DIS_RGU_NOCPU_WAIT_PD_CPUS_L1_ACK_SHIFT
  197. };
  198. enum {
  199. MP1_AINACTS_SHIFT = 4U,
  200. MP1_AINACTS = 1U << MP1_AINACTS_SHIFT
  201. };
  202. enum {
  203. MP1_SW_CG_GEN_SHIFT = 12U,
  204. MP1_SW_CG_GEN = 1U << MP1_SW_CG_GEN_SHIFT
  205. };
  206. enum {
  207. MP1_L2RSTDISABLE_SHIFT = 14U,
  208. MP1_L2RSTDISABLE = 1U << MP1_L2RSTDISABLE_SHIFT
  209. };
  210. #endif /* __ASSEMBLER__ */
  211. #endif /* MCUCFG_H */