pmu.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. /*
  2. * Copyright (c) 2024, Rockchip, Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef __PMU_H__
  7. #define __PMU_H__
  8. #include <lib/mmio.h>
  9. #define PMU0_PWR_CON 0x0000
  10. #define PMU0_WAKEUP_INT_CON 0x0008
  11. #define PMU0_WAKEUP_INT_ST 0x000c
  12. #define PMU0_PMIC_STABLE_CNT_THRES 0x0010
  13. #define PMU0_WAKEUP_RST_CLR_CNT_THRES 0x0014
  14. #define PMU0_OSC_STABLE_CNT_THRES 0x0018
  15. #define PMU0_PWR_CHAIN_STABLE_CON 0x001c
  16. #define PMU0_DDR_RET_CON(i) (0x0020 + (i) * 4)
  17. #define PMU0_INFO_TX_CON 0x0030
  18. #define PMU1_VERSION_ID 0x4000
  19. #define PMU1_PWR_CON 0x4004
  20. #define PMU1_PWR_FSM 0x4008
  21. #define PMU1_INT_MASK_CON 0x400c
  22. #define PMU1_WAKEUP_INT_CON 0x4010
  23. #define PMU1_WAKEUP_INT_ST 0x4014
  24. #define PMU1_WAKEUP_EDGE_CON 0x4018
  25. #define PMU1_WAKEUP_EDGE_ST 0x401c
  26. #define PMU1_DDR_PWR_CON(i) (0x4020 + (i) * 4)
  27. #define PMU1_DDR_PWR_SFTCON(i) (0x4030 + (i) * 4)
  28. #define PMU1_DDR_PWR_FSM 0x4040
  29. #define PMU1_DDR_PWR_ST 0x4044
  30. #define PMU1_CRU_PWR_CON 0x4050
  31. #define PMU1_CRU_PWR_SFTCON 0x4054
  32. #define PMU1_CRU_PWR_FSM 0x4058
  33. #define PMU1_PLLPD_CON(i) (0x4060 + (i) * 4)
  34. #define PMU1_PLLPD_SFTCON(i) (0x4068 + (i) * 4)
  35. #define PMU1_STABLE_CNT_THRESH 0x4080
  36. #define PMU1_OSC_STABLE_CNT_THRESH 0x4084
  37. #define PMU1_WAKEUP_RST_CLR_CNT_THRESH 0x4088
  38. #define PMU1_PLL_LOCK_CNT_THRESH 0x408c
  39. #define PMU1_WAKEUP_TIMEOUT_THRESH 0x4094
  40. #define PMU1_PWM_SWITCH_CNT_THRESH 0x4098
  41. #define PMU1_SYS_REG(i) (0x4100 + (i) * 4)
  42. #define PMU2_PWR_CON1 0x8000
  43. #define PMU2_DSU_PWR_CON 0x8004
  44. #define PMU2_DSU_PWR_SFTCON 0x8008
  45. #define PMU2_DSU_AUTO_PWR_CON 0x800c
  46. #define PMU2_CPU_AUTO_PWR_CON(i) (0x8010 + (i) * 4)
  47. #define PMU2_CPU_PWR_SFTCON(i) (0x8030 + (i) * 4)
  48. #define PMU2_CORE_PWR_CON(i) (0x8050 + (i) * 4)
  49. #define PMU2_CORE_PWR_SFTCON(i) (0x8058 + (i) * 4)
  50. #define PMU2_CORE_AUTO_PWR_CON(i) (0x8060 + (i) * 4)
  51. #define PMU2_CLUSTER_NOC_AUTO_CON 0x8068
  52. #define PMU2_CLUSTER_DBG_PWR_CON 0x806c
  53. #define PMU2_CLUSTER_IDLE_CON 0x8070
  54. #define PMU2_CLUSTER_IDLE_SFTCON 0x8074
  55. #define PMU2_CLUSTER_IDLE_ACK 0x8078
  56. #define PMU2_CLUSTER_IDLE_ST 0x807c
  57. #define PMU2_CLUSTER_ST 0x8080
  58. #define PMU2_SCU_PWR_FSM_STATUS(i) (0x8084 + (i) * 4)
  59. #define PMU2_CORE_PCHANNEL_STATUS(i) (0x808c + (i) * 4)
  60. #define PMU2_CPU_PWR_CHAIN_STABLE_CON 0x8098
  61. #define PMU2_CLUSTER_MEMPWR_GATE_SFTCON 0x809c
  62. #define PMU2_DSU_STABLE_CNT_THRESH 0x80b0
  63. #define PMU2_DSU_PWRUP_CNT_THRESH 0x80b4
  64. #define PMU2_DSU_PWRDN_CNT_THRESH 0x80b8
  65. #define PMU2_CORE0_STABLE_CNT_THRESH 0x80bc
  66. #define PMU2_CORE0_PWRUP_CNT_THRESH 0x80c0
  67. #define PMU2_CORE0_PWRDN_CNT_THRESH 0x80c4
  68. #define PMU2_CORE1_STABLE_CNT_THRESH 0x80c8
  69. #define PMU2_CORE1_PWRUP_CNT_THRESH 0x80cc
  70. #define PMU2_CORE1_PWRDN_CNT_THRESH 0x80d0
  71. #define PMU2_DBG_RST_CNT_THRESH(i) (0x80d4 + (i) * 4)
  72. #define PMU2_BUS_IDLE_CON(i) (0x8100 + (i) * 4)
  73. #define PMU2_BUS_IDLE_SFTCON(i) (0x810c + (i) * 4)
  74. #define PMU2_BUS_IDLE_ACK(i) (0x8118 + (i) * 4)
  75. #define PMU2_BUS_IDLE_ST(i) (0x8120 + (i) * 4)
  76. #define PMU2_BIU_AUTO_CON(i) (0x8128 + (i) * 4)
  77. #define PMU2_PWR_GATE_CON(i) (0x8140 + (i) * 4)
  78. #define PMU2_PWR_GATE_SFTCON(i) (0x814c + (i) * 4)
  79. #define PMU2_VOL_GATE_CON(i) (0x8158 + (i) * 4)
  80. #define PMU2_PWR_UP_CHAIN_STABLE_CON(i) (0x8164 + (i) * 4)
  81. #define PMU2_PWR_DWN_CHAIN_STABLE_CON(i)(0x8170 + (i) * 4)
  82. #define PMU2_PWR_STABLE_CHAIN_CNT_THRES 0x817c
  83. #define PMU2_PWR_GATE_ST(i) (0x8180 + (i) * 4)
  84. #define PMU2_PWR_GATE_FSM 0x8188
  85. #define PMU2_VOL_GATE_FAST_CON 0x818c
  86. #define PMU2_GPU_PWRUP_CNT 0x8190
  87. #define PMU2_GPU_PWRDN_CNT 0x8194
  88. #define PMU2_NPU_PWRUP_CNT 0x8198
  89. #define PMU2_NPU_PWRDN_CNT 0x819c
  90. #define PMU2_MEMPWR_GATE_SFTCON(i) (0x81a0 + (i) * 4)
  91. #define PMU2_MEMPWR_MD_GATE_SFTCON(i) (0x81b0 + (i) * 4)
  92. #define PMU2_MEMPWR_MD_GATE_STATUS 0x81bc
  93. #define PMU2_SUBMEM_PWR_ACK_BYPASS(i) (0x81c0 + (i) * 4)
  94. #define PMU2_QCHANNEL_PWR_CON 0x81d0
  95. #define PMU2_QCHANNEL_PWR_SFTCON 0x81d4
  96. #define PMU2_QCHANNEL_STATUS 0x81d8
  97. #define PMU2_DEBUG_INFO_SEL 0x81e0
  98. #define PMU2_VOP_SUBPD_STATE 0x81e4
  99. #define PMU2_PWR_CHAIN0_ST(i) (0x81e8 + (i) * 4)
  100. #define PMU2_PWR_CHAIN1_ST(i) (0x81f0 + (i) * 4)
  101. #define PMU2_PWR_MEM_ST(i) (0x81f8 + (i) * 4)
  102. #define PMU2_BISR_CON(i) (0x8200 + (i) * 4)
  103. #define PMU2_BISR_STATUS(i) (0x8280 + (i) * 4)
  104. #define PMU2_QCH_PWR_MSK 0x7f
  105. #define PD_CTR_LOOP 500
  106. #define PD_CHECK_LOOP 500
  107. #define WFEI_CHECK_LOOP 500
  108. #define BUS_IDLE_LOOP 1000
  109. #define QCH_PWR_LOOP 5000
  110. /* PMU1SCRU */
  111. #define PMU1SCRU_GATE_CON(i) (0x800 + (i) * 4)
  112. /* PMU_GRF */
  113. #define PMU0_GRF_SOC_CON(i) ((i) * 4)
  114. #define PMU0_GRF_OS_REGS(i) (0x80 + ((i) - 8) * 4)
  115. #define PMU1_GRF_SOC_CON(i) ((i) * 4)
  116. #define PMU0_GRF_IO_RET_CON(i) (0x20 + (i) * 4)
  117. /* PMU_SGRF */
  118. #define PMU0_SGRF_SOC_CON(i) ((i) * 4)
  119. #define PMU1_SGRF_SOC_CON(i) ((i) * 4)
  120. /* sys grf */
  121. #define GRF_CPU_STATUS0 0x0420
  122. #define CORES_PM_DISABLE 0x0
  123. #define PD_CHECK_LOOP 500
  124. #define WFEI_CHECK_LOOP 500
  125. /* The ways of cores power domain contorlling */
  126. enum cores_pm_ctr_mode {
  127. core_pwr_pd = 0,
  128. core_pwr_wfi = 1,
  129. core_pwr_wfi_int = 2
  130. };
  131. /* PMU0_PWR_CON */
  132. enum pmu0_pwr_con {
  133. pmu0_powermode_en = 0,
  134. pmu0_pmu1_pwr_bypass = 1,
  135. pmu0_pmu1_bus_bypass = 2,
  136. pmu0_wkup_bypass = 3,
  137. pmu0_pmic_bypass = 4,
  138. pmu0_reset_bypass = 5,
  139. pmu0_freq_sw_bypass = 6,
  140. pmu0_osc_dis_bypass = 7,
  141. pmu0_pmu1_pwr_gt_en = 8,
  142. pmu0_pmu1_pwr_gt_sft_en = 9,
  143. pmu0_pmu1_mem_gt_sft_en = 10,
  144. pmu0_pmu1_bus_idle_en = 11,
  145. pmu0_pmu1_bus_idle_sft_en = 12,
  146. pmu0_pmu1_biu_auto_en = 13,
  147. pmu0_pwr_off_io_en = 14,
  148. };
  149. /* PMU1_PWR_CON */
  150. enum pmu1_pwr_con {
  151. powermode_en = 0,
  152. dsu_bypass = 1,
  153. bus_bypass = 4,
  154. ddr_bypass = 5,
  155. pwrdn_bypass = 6,
  156. cru_bypass = 7,
  157. qch_bypass = 8,
  158. core_bypass = 9,
  159. cpu_sleep_wfi_dis = 12,
  160. };
  161. /* PMU1_DDR_PWR_CON */
  162. enum pmu1_ddr_pwr_con {
  163. ddr_sref_en = 0,
  164. ddr_sref_a_en = 1,
  165. ddrio_ret_en = 2,
  166. ddrio_ret_exit_en = 5,
  167. ddrio_rstiov_en = 6,
  168. ddrio_rstiov_exit_en = 7,
  169. ddr_gating_a_en = 8,
  170. ddr_gating_c_en = 9,
  171. ddr_gating_p_en = 10,
  172. };
  173. /* PMU_CRU_PWR_CON */
  174. enum pmu1_cru_pwr_con {
  175. alive_32k_en = 0,
  176. osc_dis_en = 1,
  177. wakeup_rst_en = 2,
  178. input_clamp_en = 3,
  179. alive_osc_mode_en = 4,
  180. power_off_en = 5,
  181. pwm_switch_en = 6,
  182. pwm_gpio_ioe_en = 7,
  183. pwm_switch_io = 8,
  184. pd_clk_src_gate_en = 9,
  185. };
  186. /* PMU_PLLPD_CON */
  187. enum pmu1_pllpd_con {
  188. B0PLL_PD_EN,
  189. B1PLL_PD_EN,
  190. LPLL_PD_EN,
  191. D0APLL_PD_EN,
  192. D0BPLL_PD_EN,
  193. D1APLL_PD_EN,
  194. D1BPLL_PD_EN,
  195. D2APLL_PD_EN,
  196. D2BPLL_PD_EN,
  197. D3APLL_PD_EN,
  198. D3BPLL_PD_EN,
  199. V0PLL_PD_EN,
  200. AUPLL_PD_EN,
  201. GPLL_PD_EN,
  202. CPLL_PD_EN,
  203. NPLL_PD_EN,
  204. PPLL_PD_EN = 0,
  205. SPLL_PD_EN = 1,
  206. };
  207. enum pmu1_wakeup_int {
  208. WAKEUP_CPU0_INT_EN,
  209. WAKEUP_CPU1_INT_EN,
  210. WAKEUP_CPU2_INT_EN,
  211. WAKEUP_CPU3_INT_EN,
  212. WAKEUP_CPU4_INT_EN,
  213. WAKEUP_CPU5_INT_EN,
  214. WAKEUP_CPU6_INT_EN,
  215. WAKEUP_CPU7_INT_EN,
  216. WAKEUP_GPIO0_INT_EN,
  217. WAKEUP_SDMMC_EN,
  218. WAKEUP_SDIO_EN,
  219. WAKEUP_USBDEV_EN,
  220. WAKEUP_UART0_EN,
  221. WAKEUP_VAD_EN,
  222. WAKEUP_TIMER_EN,
  223. WAKEUP_SOC_INT_EN,
  224. WAKEUP_TIMEROUT_EN,
  225. WAKEUP_PMUMCU_CEC_EN = 20,
  226. };
  227. enum pmu2_dsu_auto_pwr_con {
  228. dsu_pm_en = 0,
  229. dsu_pm_int_wakeup_en = 1,
  230. dsu_pm_sft_wakeup_en = 3,
  231. };
  232. enum pmu2_cpu_auto_pwr_con {
  233. cpu_pm_en = 0,
  234. cpu_pm_int_wakeup_en = 1,
  235. cpu_pm_sft_wakeup_en = 3,
  236. };
  237. enum pmu2_core_auto_pwr_con {
  238. core_pm_en = 0,
  239. core_pm_int_wakeup_en = 1,
  240. core_pm_int_wakeup_glb_msk = 2,
  241. core_pm_sft_wakeup_en = 3,
  242. };
  243. enum pmu2_dsu_power_con {
  244. DSU_PWRDN_EN,
  245. DSU_PWROFF_EN,
  246. BIT_FULL_EN,
  247. DSU_RET_EN,
  248. CLUSTER_CLK_SRC_GT_EN,
  249. };
  250. enum pmu2_core_power_con {
  251. CORE_PWRDN_EN,
  252. CORE_PWROFF_EN,
  253. CORE_CPU_PWRDN_EN,
  254. CORE_PWR_CNT_EN,
  255. };
  256. enum pmu2_cluster_idle_con {
  257. IDLE_REQ_BIGCORE0_EN = 0,
  258. IDLE_REQ_BIGCORE1_EN = 2,
  259. IDLE_REQ_DSU_EN = 4,
  260. IDLE_REQ_LITDSU_EN = 5,
  261. IDLE_REQ_ADB400_CORE_QCH_EN = 6,
  262. };
  263. enum qos_id {
  264. QOS_ISP0_MWO = 0,
  265. QOS_ISP0_MRO = 1,
  266. QOS_ISP1_MWO = 2,
  267. QOS_ISP1_MRO = 3,
  268. QOS_VICAP_M0 = 4,
  269. QOS_VICAP_M1 = 5,
  270. QOS_FISHEYE0 = 6,
  271. QOS_FISHEYE1 = 7,
  272. QOS_VOP_M0 = 8,
  273. QOS_VOP_M1 = 9,
  274. QOS_RKVDEC0 = 10,
  275. QOS_RKVDEC1 = 11,
  276. QOS_AV1 = 12,
  277. QOS_RKVENC0_M0RO = 13,
  278. QOS_RKVENC0_M1RO = 14,
  279. QOS_RKVENC0_M2WO = 15,
  280. QOS_RKVENC1_M0RO = 16,
  281. QOS_RKVENC1_M1RO = 17,
  282. QOS_RKVENC1_M2WO = 18,
  283. QOS_DSU_M0 = 19,
  284. QOS_DSU_M1 = 20,
  285. QOS_DSU_MP = 21,
  286. QOS_DEBUG = 22,
  287. QOS_GPU_M0 = 23,
  288. QOS_GPU_M1 = 24,
  289. QOS_GPU_M2 = 25,
  290. QOS_GPU_M3 = 26,
  291. QOS_NPU1 = 27,
  292. QOS_NPU0_MRO = 28,
  293. QOS_NPU2 = 29,
  294. QOS_NPU0_MWR = 30,
  295. QOS_MCU_NPU = 31,
  296. QOS_JPEG_DEC = 32,
  297. QOS_JPEG_ENC0 = 33,
  298. QOS_JPEG_ENC1 = 34,
  299. QOS_JPEG_ENC2 = 35,
  300. QOS_JPEG_ENC3 = 36,
  301. QOS_RGA2_MRO = 37,
  302. QOS_RGA2_MWO = 38,
  303. QOS_RGA3_0 = 39,
  304. QOS_RGA3_1 = 40,
  305. QOS_VDPU = 41,
  306. QOS_IEP = 42,
  307. QOS_HDCP0 = 43,
  308. QOS_HDCP1 = 44,
  309. QOS_HDMIRX = 45,
  310. QOS_GIC600_M0 = 46,
  311. QOS_GIC600_M1 = 47,
  312. QOS_MMU600PCIE_TCU = 48,
  313. QOS_MMU600PHP_TBU = 49,
  314. QOS_MMU600PHP_TCU = 50,
  315. QOS_USB3_0 = 51,
  316. QOS_USB3_1 = 52,
  317. QOS_USBHOST_0 = 53,
  318. QOS_USBHOST_1 = 54,
  319. QOS_EMMC = 55,
  320. QOS_FSPI = 56,
  321. QOS_SDIO = 57,
  322. QOS_DECOM = 58,
  323. QOS_DMAC0 = 59,
  324. QOS_DMAC1 = 60,
  325. QOS_DMAC2 = 61,
  326. QOS_GIC600M = 62,
  327. QOS_DMA2DDR = 63,
  328. QOS_MCU_DDR = 64,
  329. QOS_VAD = 65,
  330. QOS_MCU_PMU = 66,
  331. QOS_CRYPTOS = 67,
  332. QOS_CRYPTONS = 68,
  333. QOS_DCF = 69,
  334. QOS_SDMMC = 70,
  335. };
  336. enum pmu2_pdid {
  337. PD_GPU = 0,
  338. PD_NPU = 1,
  339. PD_VCODEC = 2,
  340. PD_NPUTOP = 3,
  341. PD_NPU1 = 4,
  342. PD_NPU2 = 5,
  343. PD_VENC0 = 6,
  344. PD_VENC1 = 7,
  345. PD_RKVDEC0 = 8,
  346. PD_RKVDEC1 = 9,
  347. PD_VDPU = 10,
  348. PD_RGA30 = 11,
  349. PD_AV1 = 12,
  350. PD_VI = 13,
  351. PD_FEC = 14,
  352. PD_ISP1 = 15,
  353. PD_RGA31 = 16,
  354. PD_VOP = 17,
  355. PD_VO0 = 18,
  356. PD_VO1 = 19,
  357. PD_AUDIO = 20,
  358. PD_PHP = 21,
  359. PD_GMAC = 22,
  360. PD_PCIE = 23,
  361. PD_NVM = 24,
  362. PD_NVM0 = 25,
  363. PD_SDIO = 26,
  364. PD_USB = 27,
  365. PD_SECURE = 28,
  366. PD_SDMMC = 29,
  367. PD_CRYPTO = 30,
  368. PD_CENTER = 31,
  369. PD_DDR01 = 32,
  370. PD_DDR23 = 33,
  371. };
  372. enum pmu2_pd_repair_id {
  373. PD_RPR_PMU = 0,
  374. PD_RPR_GPU = 1,
  375. PD_RPR_NPUTOP = 2,
  376. PD_RPR_NPU1 = 3,
  377. PD_RPR_NPU2 = 4,
  378. PD_RPR_VENC0 = 5,
  379. PD_RPR_VENC1 = 6,
  380. PD_RPR_RKVDEC0 = 7,
  381. PD_RPR_RKVDEC1 = 8,
  382. PD_RPR_VDPU = 9,
  383. PD_RPR_RGA30 = 10,
  384. PD_RPR_AV1 = 11,
  385. PD_RPR_VI = 12,
  386. PD_RPR_FEC = 13,
  387. PD_RPR_ISP1 = 14,
  388. PD_RPR_RGA31 = 15,
  389. PD_RPR_VOP = 16,
  390. PD_RPR_VO0 = 17,
  391. PD_RPR_VO1 = 18,
  392. PD_RPR_AUDIO = 19,
  393. PD_RPR_PHP = 20,
  394. PD_RPR_GMAC = 21,
  395. PD_RPR_PCIE = 22,
  396. PD_RPR_NVM0 = 23,
  397. PD_RPR_SDIO = 24,
  398. PD_RPR_USB = 25,
  399. PD_RPR_SDMMC = 26,
  400. PD_RPR_CRYPTO = 27,
  401. PD_RPR_CENTER = 28,
  402. PD_RPR_DDR01 = 29,
  403. PD_RPR_DDR23 = 30,
  404. PD_RPR_BUS = 31,
  405. };
  406. enum pmu2_bus_id {
  407. BUS_ID_GPU = 0,
  408. BUS_ID_NPUTOP = 1,
  409. BUS_ID_NPU1 = 2,
  410. BUS_ID_NPU2 = 3,
  411. BUS_ID_RKVENC0 = 4,
  412. BUS_ID_RKVENC1 = 5,
  413. BUS_ID_RKVDEC0 = 6,
  414. BUS_ID_RKVDEC1 = 7,
  415. BUS_ID_VDPU = 8,
  416. BUS_ID_AV1 = 9,
  417. BUS_ID_VI = 10,
  418. BUS_ID_ISP = 11,
  419. BUS_ID_RGA31 = 12,
  420. BUS_ID_VOP = 13,
  421. BUS_ID_VOP_CHANNEL = 14,
  422. BUS_ID_VO0 = 15,
  423. BUS_ID_VO1 = 16,
  424. BUS_ID_AUDIO = 17,
  425. BUS_ID_NVM = 18,
  426. BUS_ID_SDIO = 19,
  427. BUS_ID_USB = 20,
  428. BUS_ID_PHP = 21,
  429. BUS_ID_VO1USBTOP = 22,
  430. BUS_ID_SECURE = 23,
  431. BUS_ID_SECURE_CENTER_CHANNEL = 24,
  432. BUS_ID_SECURE_VO1USB_CHANNEL = 25,
  433. BUS_ID_CENTER = 26,
  434. BUS_ID_CENTER_CHANNEL = 27,
  435. BUS_ID_MSCH0 = 28,
  436. BUS_ID_MSCH1 = 29,
  437. BUS_ID_MSCH2 = 30,
  438. BUS_ID_MSCH3 = 31,
  439. BUS_ID_MSCH = 32,
  440. BUS_ID_BUS = 33,
  441. BUS_ID_TOP = 34,
  442. };
  443. enum pmu2_mem_st {
  444. PD_NPU_TOP_MEM_ST = 11,
  445. PD_NPU1_MEM_ST = 12,
  446. PD_NPU2_MEM_ST = 13,
  447. PD_VENC0_MEM_ST = 14,
  448. PD_VENC1_MEM_ST = 15,
  449. PD_RKVDEC0_MEM_ST = 16,
  450. PD_RKVDEC1_MEM_ST = 17,
  451. PD_RGA30_MEM_ST = 19,
  452. PD_AV1_MEM_ST = 20,
  453. PD_VI_MEM_ST = 21,
  454. PD_FEC_MEM_ST = 22,
  455. PD_ISP1_MEM_ST = 23,
  456. PD_RGA31_MEM_ST = 24,
  457. PD_VOP_MEM_ST = 25,
  458. PD_VO0_MEM_ST = 26,
  459. PD_VO1_MEM_ST = 27,
  460. PD_AUDIO_MEM_ST = 28,
  461. PD_PHP_MEM_ST = 29,
  462. PD_GMAC_MEM_ST = 30,
  463. PD_PCIE_MEM_ST = 31,
  464. PD_NVM0_MEM_ST = 33,
  465. PD_SDIO_MEM_ST = 34,
  466. PD_USB_MEM_ST = 35,
  467. PD_SDMMC_MEM_ST = 37,
  468. };
  469. enum pmu2_qid {
  470. QID_PHPMMU_TBU = 0,
  471. QID_PHPMMU_TCU = 1,
  472. QID_PCIEMMU_TBU0 = 2,
  473. QID_PCIEMU_TCU = 3,
  474. QID_PHP_GICITS = 4,
  475. QID_BUS_GICITS0 = 5,
  476. QID_BUS_GICITS1 = 6,
  477. };
  478. /* PMU_DSU_PWR_CON */
  479. enum pmu_dsu_pwr_con {
  480. DSU_PWRDN_ENA = 2,
  481. DSU_PWROFF_ENA,
  482. DSU_RET_ENA = 6,
  483. CLUSTER_CLK_SRC_GATE_ENA,
  484. DSU_PWR_CON_END
  485. };
  486. enum cpu_power_state {
  487. CPU_POWER_ON,
  488. CPU_POWER_OFF,
  489. CPU_EMULATION_OFF,
  490. CPU_RETENTION,
  491. CPU_DEBUG
  492. };
  493. enum dsu_power_state {
  494. DSU_POWER_ON,
  495. CLUSTER_TRANSFER_IDLE,
  496. DSU_POWER_DOWN,
  497. DSU_OFF,
  498. DSU_WAKEUP,
  499. DSU_POWER_UP,
  500. CLUSTER_TRANSFER_RESUME,
  501. DSU_FUNCTION_RETENTION
  502. };
  503. /* PMU2_CLUSTER_STS 0x8080 */
  504. enum pmu2_cluster_sts_bits {
  505. pd_cpu0_dwn = 0,
  506. pd_cpu1_dwn,
  507. pd_cpu2_dwn,
  508. pd_cpu3_dwn,
  509. pd_cpu4_dwn,
  510. pd_cpu5_dwn,
  511. pd_cpu6_dwn,
  512. pd_cpu7_dwn,
  513. pd_core0_dwn,
  514. pd_core1_dwn
  515. };
  516. #define CLUSTER_STS_NONBOOT_CPUS_DWN 0xfe
  517. enum cpu_off_trigger {
  518. CPU_OFF_TRIGGER_WFE = 0,
  519. CPU_OFF_TRIGGER_REQ_EML,
  520. CPU_OFF_TRIGGER_REQ_WFI,
  521. CPU_OFF_TRIGGER_REQ_WFI_NBT_CPU,
  522. CPU_OFF_TRIGGER_REQ_WFI_NBT_CPU_SRAM
  523. };
  524. /*****************************************************************************
  525. * power domain on or off
  526. *****************************************************************************/
  527. enum pmu_pd_state {
  528. pmu_pd_on = 0,
  529. pmu_pd_off = 1
  530. };
  531. enum bus_state {
  532. bus_active,
  533. bus_idle,
  534. };
  535. #define RK_CPU_STATUS_OFF 0
  536. #define RK_CPU_STATUS_ON 1
  537. #define RK_CPU_STATUS_BUSY -1
  538. #define PD_CTR_LOOP 500
  539. #define MAX_WAIT_COUNT 500
  540. #define pmu_bus_idle_st(id) \
  541. (!!(mmio_read_32(PMU_BASE + PMU2_BUS_IDLE_ST((id) / 32)) & BIT((id) % 32)))
  542. #define pmu_bus_idle_ack(id) \
  543. (!!(mmio_read_32(PMU_BASE + PMU2_BUS_IDLE_ACK((id) / 32)) & BIT((id) % 32)))
  544. void pm_pll_wait_lock(uint32_t pll_base);
  545. #endif /* __PMU_H__ */