mcucfg.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*
  2. * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MCUCFG_H
  7. #define MCUCFG_H
  8. #include <stdint.h>
  9. #include <mt8173_def.h>
  10. struct mt8173_mcucfg_regs {
  11. uint32_t mp0_ca7l_cache_config;
  12. struct {
  13. uint32_t mem_delsel0;
  14. uint32_t mem_delsel1;
  15. } mp0_cpu[4];
  16. uint32_t mp0_cache_mem_delsel0;
  17. uint32_t mp0_cache_mem_delsel1;
  18. uint32_t mp0_axi_config;
  19. uint32_t mp0_misc_config[2];
  20. struct {
  21. uint32_t rv_addr_lw;
  22. uint32_t rv_addr_hw;
  23. } mp0_rv_addr[4];
  24. uint32_t mp0_ca7l_cfg_dis;
  25. uint32_t mp0_ca7l_clken_ctrl;
  26. uint32_t mp0_ca7l_rst_ctrl;
  27. uint32_t mp0_ca7l_misc_config;
  28. uint32_t mp0_ca7l_dbg_pwr_ctrl;
  29. uint32_t mp0_rw_rsvd0;
  30. uint32_t mp0_rw_rsvd1;
  31. uint32_t mp0_ro_rsvd;
  32. uint32_t reserved0_0[100];
  33. uint32_t mp1_cpucfg;
  34. uint32_t mp1_miscdbg;
  35. uint32_t reserved0_1[13];
  36. uint32_t mp1_rst_ctl;
  37. uint32_t mp1_clkenm_div;
  38. uint32_t reserved0_2[7];
  39. uint32_t mp1_config_res;
  40. uint32_t reserved0_3[13];
  41. struct {
  42. uint32_t rv_addr_lw;
  43. uint32_t rv_addr_hw;
  44. } mp1_rv_addr[2];
  45. uint32_t reserved0_4[84];
  46. uint32_t mp0_rst_status; /* 0x400 */
  47. uint32_t mp0_dbg_ctrl;
  48. uint32_t mp0_dbg_flag;
  49. uint32_t mp0_ca7l_ir_mon;
  50. struct {
  51. uint32_t pc_lw;
  52. uint32_t pc_hw;
  53. uint32_t fp_arch32;
  54. uint32_t sp_arch32;
  55. uint32_t fp_arch64_lw;
  56. uint32_t fp_arch64_hw;
  57. uint32_t sp_arch64_lw;
  58. uint32_t sp_arch64_hw;
  59. } mp0_dbg_core[4];
  60. uint32_t dfd_ctrl;
  61. uint32_t dfd_cnt_l;
  62. uint32_t dfd_cnt_h;
  63. uint32_t misccfg_mp0_rw_rsvd;
  64. uint32_t misccfg_sec_vio_status0;
  65. uint32_t misccfg_sec_vio_status1;
  66. uint32_t reserved1[22];
  67. uint32_t misccfg_rw_rsvd; /* 0x500 */
  68. uint32_t mcusys_dbg_mon_sel_a;
  69. uint32_t mcusys_dbg_mon;
  70. uint32_t reserved2[61];
  71. uint32_t mcusys_config_a; /* 0x600 */
  72. uint32_t mcusys_config1_a;
  73. uint32_t mcusys_gic_peribase_a;
  74. uint32_t reserved3;
  75. uint32_t sec_range0_start; /* 0x610 */
  76. uint32_t sec_range0_end;
  77. uint32_t sec_range_enable;
  78. uint32_t reserved4;
  79. uint32_t int_pol_ctl[8]; /* 0x620 */
  80. uint32_t aclken_div; /* 0x640 */
  81. uint32_t pclken_div;
  82. uint32_t l2c_sram_ctrl;
  83. uint32_t armpll_jit_ctrl;
  84. uint32_t cci_addrmap; /* 0x650 */
  85. uint32_t cci_config;
  86. uint32_t cci_periphbase;
  87. uint32_t cci_nevntcntovfl;
  88. uint32_t cci_clk_ctrl; /* 0x660 */
  89. uint32_t cci_acel_s1_ctrl;
  90. uint32_t bus_fabric_dcm_ctrl;
  91. uint32_t reserved5;
  92. uint32_t xgpt_ctl; /* 0x670 */
  93. uint32_t xgpt_idx;
  94. uint32_t ptpod2_ctl0;
  95. uint32_t ptpod2_ctl1;
  96. uint32_t mcusys_revid;
  97. uint32_t mcusys_rw_rsvd0;
  98. uint32_t mcusys_rw_rsvd1;
  99. };
  100. static struct mt8173_mcucfg_regs *const mt8173_mcucfg = (void *)MCUCFG_BASE;
  101. /* cpu boot mode */
  102. #define MP0_CPUCFG_64BIT_SHIFT 12
  103. #define MP1_CPUCFG_64BIT_SHIFT 28
  104. #define MP0_CPUCFG_64BIT (U(0xf) << MP0_CPUCFG_64BIT_SHIFT)
  105. #define MP1_CPUCFG_64BIT (U(0xf) << MP1_CPUCFG_64BIT_SHIFT)
  106. /* scu related */
  107. enum {
  108. MP0_ACINACTM_SHIFT = 4,
  109. MP1_ACINACTM_SHIFT = 0,
  110. MP0_ACINACTM = 1 << MP0_ACINACTM_SHIFT,
  111. MP1_ACINACTM = 1 << MP1_ACINACTM_SHIFT
  112. };
  113. enum {
  114. MP1_DIS_RGU0_WAIT_PD_CPUS_L1_ACK_SHIFT = 0,
  115. MP1_DIS_RGU1_WAIT_PD_CPUS_L1_ACK_SHIFT = 4,
  116. MP1_DIS_RGU2_WAIT_PD_CPUS_L1_ACK_SHIFT = 8,
  117. MP1_DIS_RGU3_WAIT_PD_CPUS_L1_ACK_SHIFT = 12,
  118. MP1_DIS_RGU_NOCPU_WAIT_PD_CPUS_L1_ACK_SHIFT = 16,
  119. MP1_DIS_RGU0_WAIT_PD_CPUS_L1_ACK =
  120. 0xf << MP1_DIS_RGU0_WAIT_PD_CPUS_L1_ACK_SHIFT,
  121. MP1_DIS_RGU1_WAIT_PD_CPUS_L1_ACK =
  122. 0xf << MP1_DIS_RGU1_WAIT_PD_CPUS_L1_ACK_SHIFT,
  123. MP1_DIS_RGU2_WAIT_PD_CPUS_L1_ACK =
  124. 0xf << MP1_DIS_RGU2_WAIT_PD_CPUS_L1_ACK_SHIFT,
  125. MP1_DIS_RGU3_WAIT_PD_CPUS_L1_ACK =
  126. 0xf << MP1_DIS_RGU3_WAIT_PD_CPUS_L1_ACK_SHIFT,
  127. MP1_DIS_RGU_NOCPU_WAIT_PD_CPUS_L1_ACK =
  128. 0xf << MP1_DIS_RGU_NOCPU_WAIT_PD_CPUS_L1_ACK_SHIFT
  129. };
  130. enum {
  131. MP1_AINACTS_SHIFT = 4,
  132. MP1_AINACTS = 1 << MP1_AINACTS_SHIFT
  133. };
  134. enum {
  135. MP1_SW_CG_GEN_SHIFT = 12,
  136. MP1_SW_CG_GEN = 1 << MP1_SW_CG_GEN_SHIFT
  137. };
  138. enum {
  139. MP1_L2RSTDISABLE_SHIFT = 14,
  140. MP1_L2RSTDISABLE = 1 << MP1_L2RSTDISABLE_SHIFT
  141. };
  142. /* cci clock control related */
  143. enum {
  144. MCU_BUS_DCM_EN = 1 << 8
  145. };
  146. /* l2c sram control related */
  147. enum {
  148. L2C_SRAM_DCM_EN = 1 << 0
  149. };
  150. /* bus fabric dcm control related */
  151. enum {
  152. PSYS_ADB400_DCM_EN = 1 << 29,
  153. GPU_ADB400_DCM_EN = 1 << 28,
  154. EMI1_ADB400_DCM_EN = 1 << 27,
  155. EMI_ADB400_DCM_EN = 1 << 26,
  156. INFRA_ADB400_DCM_EN = 1 << 25,
  157. L2C_ADB400_DCM_EN = 1 << 24,
  158. MP0_ADB400_DCM_EN = 1 << 23,
  159. CCI400_CK_ONLY_DCM_EN = 1 << 22,
  160. L2C_IDLE_DCM_EN = 1 << 21,
  161. CA15U_ADB_DYNAMIC_CG_EN = 1 << 19,
  162. CA7L_ADB_DYNAMIC_CG_EN = 1 << 18,
  163. L2C_ADB_DYNAMIC_CG_EN = 1 << 17,
  164. EMICLK_EMI1_DYNAMIC_CG_EN = 1 << 12,
  165. INFRACLK_PSYS_DYNAMIC_CG_EN = 1 << 11,
  166. EMICLK_GPU_DYNAMIC_CG_EN = 1 << 10,
  167. EMICLK_EMI_DYNAMIC_CG_EN = 1 << 8,
  168. CCI400_SLV_RW_DCM_EN = 1 << 7,
  169. CCI400_SLV_DCM_EN = 1 << 5,
  170. ACLK_PSYS_DYNAMIC_CG_EN = 1 << 3,
  171. ACLK_GPU_DYNAMIC_CG_EN = 1 << 2,
  172. ACLK_EMI_DYNAMIC_CG_EN = 1 << 1,
  173. ACLK_INFRA_DYNAMIC_CG_EN = 1 << 0,
  174. /* adb400 related */
  175. ADB400_GRP_DCM_EN = PSYS_ADB400_DCM_EN | GPU_ADB400_DCM_EN |
  176. EMI1_ADB400_DCM_EN | EMI_ADB400_DCM_EN |
  177. INFRA_ADB400_DCM_EN | L2C_ADB400_DCM_EN |
  178. MP0_ADB400_DCM_EN,
  179. /* cci400 related */
  180. CCI400_GRP_DCM_EN = CCI400_CK_ONLY_DCM_EN | CCI400_SLV_RW_DCM_EN |
  181. CCI400_SLV_DCM_EN,
  182. /* adb clock related */
  183. ADBCLK_GRP_DCM_EN = CA15U_ADB_DYNAMIC_CG_EN | CA7L_ADB_DYNAMIC_CG_EN |
  184. L2C_ADB_DYNAMIC_CG_EN,
  185. /* emi clock related */
  186. EMICLK_GRP_DCM_EN = EMICLK_EMI1_DYNAMIC_CG_EN |
  187. EMICLK_GPU_DYNAMIC_CG_EN |
  188. EMICLK_EMI_DYNAMIC_CG_EN,
  189. /* bus clock related */
  190. ACLK_GRP_DCM_EN = ACLK_PSYS_DYNAMIC_CG_EN | ACLK_GPU_DYNAMIC_CG_EN |
  191. ACLK_EMI_DYNAMIC_CG_EN | ACLK_INFRA_DYNAMIC_CG_EN,
  192. };
  193. #endif /* MCUCFG_H */