pmu.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. /*
  2. * Copyright (c) 2023, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef __PMU_H__
  7. #define __PMU_H__
  8. #define PMU_VERSION 0x0000
  9. #define PMU_PWR_CON 0x0004
  10. #define PMU_MAIN_PWR_STATE 0x0008
  11. #define PMU_INT_MASK_CON 0x000C
  12. #define PMU_WAKEUP_INT_CON 0x0010
  13. #define PMU_WAKEUP_INT_ST 0x0014
  14. #define PMU_WAKEUP_EDGE_CON 0x0018
  15. #define PMU_WAKEUP_EDGE_ST 0x001C
  16. #define PMU_BUS_IDLE_CON0 0x0040
  17. #define PMU_BUS_IDLE_CON1 0x0044
  18. #define PMU_BUS_IDLE_SFTCON0 0x0050
  19. #define PMU_BUS_IDLE_SFTCON1 0x0054
  20. #define PMU_BUS_IDLE_ACK 0x0060
  21. #define PMU_BUS_IDLE_ST 0x0068
  22. #define PMU_NOC_AUTO_CON0 0x0070
  23. #define PMU_NOC_AUTO_CON1 0x0074
  24. #define PMU_DDR_PWR_CON 0x0080
  25. #define PMU_DDR_PWR_SFTCON 0x0084
  26. #define PMU_DDR_PWR_STATE 0x0088
  27. #define PMU_DDR_PWR_ST 0x008C
  28. #define PMU_PWR_GATE_CON 0x0090
  29. #define PMU_PWR_GATE_STATE 0x0094
  30. #define PMU_PWR_DWN_ST 0x0098
  31. #define PMU_PWR_GATE_SFTCON 0x00A0
  32. #define PMU_VOL_GATE_SFTCON 0x00A8
  33. #define PMU_CRU_PWR_CON 0x00B0
  34. #define PMU_CRU_PWR_SFTCON 0x00B4
  35. #define PMU_CRU_PWR_STATE 0x00B8
  36. #define PMU_PLLPD_CON 0x00C0
  37. #define PMU_PLLPD_SFTCON 0x00C4
  38. #define PMU_INFO_TX_CON 0x00D0
  39. #define PMU_DSU_STABLE_CNT 0x0100
  40. #define PMU_PMIC_STABLE_CNT 0x0104
  41. #define PMU_OSC_STABLE_CNT 0x0108
  42. #define PMU_WAKEUP_RSTCLR_CNT 0x010C
  43. #define PMU_PLL_LOCK_CNT 0x0110
  44. #define PMU_DSU_PWRUP_CNT 0x0118
  45. #define PMU_DSU_PWRDN_CNT 0x011C
  46. #define PMU_GPU_VOLUP_CNT 0x0120
  47. #define PMU_GPU_VOLDN_CNT 0x0124
  48. #define PMU_WAKEUP_TIMEOUT_CNT 0x0128
  49. #define PMU_PWM_SWITCH_CNT 0x012C
  50. #define PMU_DBG_RST_CNT 0x0130
  51. #define PMU_SYS_REG0 0x0180
  52. #define PMU_SYS_REG1 0x0184
  53. #define PMU_SYS_REG2 0x0188
  54. #define PMU_SYS_REG3 0x018C
  55. #define PMU_SYS_REG4 0x0190
  56. #define PMU_SYS_REG5 0x0194
  57. #define PMU_SYS_REG6 0x0198
  58. #define PMU_SYS_REG7 0x019C
  59. #define PMU_DSU_PWR_CON 0x0300
  60. #define PMU_DSU_PWR_SFTCON 0x0304
  61. #define PMU_DSU_AUTO_CON 0x0308
  62. #define PMU_DSU_PWR_STATE 0x030C
  63. #define PMU_CPU_AUTO_PWR_CON0 0x0310
  64. #define PMU_CPU_AUTO_PWR_CON1 0x0314
  65. #define PMU_CPU_PWR_SFTCON 0x0318
  66. #define PMU_CLUSTER_PWR_ST 0x031C
  67. #define PMU_CLUSTER_IDLE_CON 0x0320
  68. #define PMU_CLUSTER_IDLE_SFTCON 0x0324
  69. #define PMU_CLUSTER_IDLE_ACK 0x0328
  70. #define PMU_CLUSTER_IDLE_ST 0x032C
  71. #define PMU_DBG_PWR_CON 0x0330
  72. /* PMU_SGRF */
  73. #define PMU_SGRF_SOC_CON1 0x0004
  74. #define PMU_SGRF_FAST_BOOT_ADDR 0x0180
  75. /* sys grf */
  76. #define GRF_CPU_STATUS0 0x0420
  77. #define CRU_SOFTRST_CON00 0x0400
  78. #define CORES_PM_DISABLE 0x0
  79. #define PD_CHECK_LOOP 500
  80. #define WFEI_CHECK_LOOP 500
  81. #define PMUSGRF_SOC_CON(i) ((i) * 0x4)
  82. /* Needed aligned 16 bytes for sp stack top */
  83. #define PSRAM_SP_TOP ((PMUSRAM_BASE + PMUSRAM_RSIZE) & ~0xf)
  84. #define PMU_CPUAPM_CON(cpu) (0x0310 + (cpu) * 0x4)
  85. #define PMIC_SLEEP_FUN 0x07000100
  86. #define PMIC_SLEEP_GPIO 0x07000000
  87. #define GPIO_SWPORT_DR_L 0x0000
  88. #define GPIO_SWPORT_DR_H 0x0004
  89. #define GPIO_SWPORT_DDR_L 0x0008
  90. #define GPIO_SWPORT_DDR_H 0x000C
  91. #define PMIC_SLEEP_HIGH_LEVEL 0x00040004
  92. #define PMIC_SLEEP_LOW_LEVEL 0x00040000
  93. #define PMIC_SLEEP_OUT 0x00040004
  94. #define CPUS_BYPASS 0x007e4f7e
  95. #define CLB_INT_DISABLE 0x00010001
  96. #define WRITE_MASK_SET(value) ((value << 16) | value)
  97. #define WRITE_MASK_CLR(value) ((value << 16))
  98. enum pmu_cores_pm_by_wfi {
  99. core_pm_en = 0,
  100. core_pm_int_wakeup_en,
  101. core_pm_int_wakeup_glb_msk,
  102. core_pm_sft_wakeup_en,
  103. };
  104. /* The ways of cores power domain contorlling */
  105. enum cores_pm_ctr_mode {
  106. core_pwr_pd = 0,
  107. core_pwr_wfi = 1,
  108. core_pwr_wfi_int = 2
  109. };
  110. /* PMU_PWR_DWN_ST */
  111. enum pmu_pdid {
  112. PD_GPU,
  113. PD_NPU,
  114. PD_VPU,
  115. PD_RKVENC,
  116. PD_RKVDEC,
  117. PD_RGA,
  118. PD_VI,
  119. PD_VO,
  120. PD_PIPE,
  121. PD_CENTER,
  122. PD_END
  123. };
  124. /* PMU_PWR_CON */
  125. enum pmu_pwr_con {
  126. POWRMODE_EN,
  127. DSU_BYPASS,
  128. BUS_BYPASS = 4,
  129. DDR_BYPASS,
  130. PWRDN_BYPASS,
  131. CRU_BYPASS,
  132. CPU0_BYPASS,
  133. CPU1_BYPASS,
  134. CPU2_BYPASS,
  135. CPU3_BYPASS,
  136. PMU_SLEEP_LOW = 15,
  137. };
  138. /* PMU_CRU_PWR_CON */
  139. enum pmu_cru_pwr_con {
  140. ALIVE_32K_ENA,
  141. OSC_DIS_ENA,
  142. WAKEUP_RST_ENA,
  143. INPUT_CLAMP_ENA,
  144. ALIVE_OSC_ENA,
  145. POWER_OFF_ENA,
  146. PWM_SWITCH_ENA,
  147. PWM_GPIO_IOE_ENA,
  148. PWM_SWITCH_IOUT,
  149. PD_BUS_CLK_SRC_GATE_ENA,
  150. PD_PERI_CLK_SRC_GATE_ENA,
  151. PD_PMU_CLK_SRC_GATE_ENA,
  152. PMUMEM_CLK_SRC_GATE_ENA,
  153. PWR_CON_END
  154. };
  155. /* PMU_PLLPD_CON */
  156. enum pmu_pllpd_con {
  157. APLL_PD_ENA,
  158. DPLL_PD_ENA,
  159. CPLL_PD_ENA,
  160. GPLL_PD_ENA,
  161. MPLL_PD_ENA,
  162. NPLL_PD_ENA,
  163. HPLL_PD_ENA,
  164. PPLL_PD_ENA,
  165. VPLL_PD_ENA,
  166. PLL_PD_END
  167. };
  168. /* PMU_DSU_PWR_CON */
  169. enum pmu_dsu_pwr_con {
  170. DSU_PWRDN_ENA = 2,
  171. DSU_PWROFF_ENA,
  172. DSU_RET_ENA = 6,
  173. CLUSTER_CLK_SRC_GATE_ENA,
  174. DSU_PWR_CON_END
  175. };
  176. enum cpu_power_state {
  177. CPU_POWER_ON,
  178. CPU_POWER_OFF,
  179. CPU_EMULATION_OFF,
  180. CPU_RETENTION,
  181. CPU_DEBUG
  182. };
  183. enum dsu_power_state {
  184. DSU_POWER_ON,
  185. CLUSTER_TRANSFER_IDLE,
  186. DSU_POWER_DOWN,
  187. DSU_OFF,
  188. DSU_WAKEUP,
  189. DSU_POWER_UP,
  190. CLUSTER_TRANSFER_RESUME,
  191. DSU_FUNCTION_RETENTION
  192. };
  193. enum pmu_wakeup_int_con {
  194. WAKEUP_CPU0_INT_EN,
  195. WAKEUP_CPU1_INT_EN,
  196. WAKEUP_CPU2_INT_EN,
  197. WAKEUP_CPU3_INT_EN,
  198. WAKEUP_GPIO0_INT_EN,
  199. WAKEUP_UART0_EN,
  200. WAKEUP_SDMMC0_EN,
  201. WAKEUP_SDMMC1_EN,
  202. WAKEUP_SDMMC2_EN,
  203. WAKEUP_USB_EN,
  204. WAKEUP_PCIE_EN,
  205. WAKEUP_VAD_EN,
  206. WAKEUP_TIMER_EN,
  207. WAKEUP_PWM0_EN,
  208. WAKEUP_TIMEROUT_EN,
  209. WAKEUP_MCU_SFT_EN,
  210. };
  211. enum pmu_wakeup_int_st {
  212. WAKEUP_CPU0_INT_ST,
  213. WAKEUP_CPU1_INT_ST,
  214. WAKEUP_CPU2_INT_ST,
  215. WAKEUP_CPU3_INT_ST,
  216. WAKEUP_GPIO0_INT_ST,
  217. WAKEUP_UART0_ST,
  218. WAKEUP_SDMMC0_ST,
  219. WAKEUP_SDMMC1_ST,
  220. WAKEUP_SDMMC2_ST,
  221. WAKEUP_USB_ST,
  222. WAKEUP_PCIE_ST,
  223. WAKEUP_VAD_ST,
  224. WAKEUP_TIMER_ST,
  225. WAKEUP_PWM0_ST,
  226. WAKEUP_TIMEOUT_ST,
  227. WAKEUP_SYS_INT_ST,
  228. };
  229. enum pmu_bus_idle_con0 {
  230. IDLE_REQ_MSCH,
  231. IDLE_REQ_GPU,
  232. IDLE_REQ_NPU,
  233. IDLE_REQ_VI,
  234. IDLE_REQ_VO,
  235. IDLE_REQ_RGA,
  236. IDLE_REQ_VPU,
  237. IDLE_REQ_RKVENC,
  238. IDLE_REQ_RKVDEC,
  239. IDLE_REQ_GIC_AUDIO,
  240. IDLE_REQ_PHP,
  241. IDLE_REQ_PIPE,
  242. IDLE_REQ_SECURE_FLASH,
  243. IDLE_REQ_PERIMID,
  244. IDLE_REQ_USB,
  245. IDLE_REQ_BUS,
  246. };
  247. enum pmu_bus_idle_con1 {
  248. IDLE_REQ_TOP1,
  249. IDLE_REQ_TOP2,
  250. IDLE_REQ_PMU,
  251. };
  252. enum pmu_pwr_gate_con {
  253. PD_GPU_DWN_ENA,
  254. PD_NPU_DWN_ENA,
  255. PD_VPU_DWN_ENA,
  256. PD_RKVENC_DWN_ENA,
  257. PD_RKVDEC_DWN_ENA,
  258. PD_RGA_DWN_ENA,
  259. PD_VI_DWN_ENA,
  260. PD_VO_DWN_ENA,
  261. PD_PIPE_DWN_ENA,
  262. PD_CENTER_DWN_ENA,
  263. };
  264. enum pmu_ddr_pwr_con {
  265. DDR_SREF_ENA,
  266. DDRIO_RET_ENTER_ENA,
  267. DDRIO_RET_EXIT_ENA = 2,
  268. DDRPHY_AUTO_GATING_ENA = 4,
  269. };
  270. enum pmu_vol_gate_soft_con {
  271. VD_GPU_ENA,
  272. VD_NPU_ENA,
  273. };
  274. #endif /* __PMU_H__ */