mtk_dcm_utils.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. /*
  2. * Copyright (c) 2022, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <lib/mmio.h>
  7. #include <lib/utils_def.h>
  8. #include <mtk_dcm_utils.h>
  9. #define MP_CPUSYS_TOP_ADB_DCM_REG0_MASK BIT(17)
  10. #define MP_CPUSYS_TOP_ADB_DCM_REG1_MASK (BIT(15) | BIT(16) | BIT(17) | \
  11. BIT(18) | BIT(21))
  12. #define MP_CPUSYS_TOP_ADB_DCM_REG2_MASK (BIT(15) | BIT(16) | BIT(17) | BIT(18))
  13. #define MP_CPUSYS_TOP_ADB_DCM_REG0_ON BIT(17)
  14. #define MP_CPUSYS_TOP_ADB_DCM_REG1_ON (BIT(15) | BIT(16) | BIT(17) | \
  15. BIT(18) | BIT(21))
  16. #define MP_CPUSYS_TOP_ADB_DCM_REG2_ON (BIT(15) | BIT(16) | BIT(17) | BIT(18))
  17. #define MP_CPUSYS_TOP_ADB_DCM_REG0_OFF (0x0 << 17)
  18. #define MP_CPUSYS_TOP_ADB_DCM_REG1_OFF ((0x0 << 15) | (0x0 << 16) | \
  19. (0x0 << 17) | (0x0 << 18) | \
  20. (0x0 << 21))
  21. #define MP_CPUSYS_TOP_ADB_DCM_REG2_OFF ((0x0 << 15) | (0x0 << 16) | \
  22. (0x0 << 17) | (0x0 << 18))
  23. bool dcm_mp_cpusys_top_adb_dcm_is_on(void)
  24. {
  25. bool ret = true;
  26. ret &= dcm_check_state(MP_CPUSYS_TOP_MP_ADB_DCM_CFG0,
  27. MP_CPUSYS_TOP_ADB_DCM_REG0_MASK,
  28. MP_CPUSYS_TOP_ADB_DCM_REG0_ON);
  29. ret &= dcm_check_state(MP_CPUSYS_TOP_MP_ADB_DCM_CFG4,
  30. MP_CPUSYS_TOP_ADB_DCM_REG1_MASK,
  31. MP_CPUSYS_TOP_ADB_DCM_REG1_ON);
  32. ret &= dcm_check_state(MP_CPUSYS_TOP_MCUSYS_DCM_CFG0,
  33. MP_CPUSYS_TOP_ADB_DCM_REG2_MASK,
  34. MP_CPUSYS_TOP_ADB_DCM_REG2_ON);
  35. return ret;
  36. }
  37. void dcm_mp_cpusys_top_adb_dcm(bool on)
  38. {
  39. if (on) {
  40. /* TINFO = "Turn ON DCM 'mp_cpusys_top_adb_dcm'" */
  41. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP_ADB_DCM_CFG0,
  42. MP_CPUSYS_TOP_ADB_DCM_REG0_MASK,
  43. MP_CPUSYS_TOP_ADB_DCM_REG0_ON);
  44. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP_ADB_DCM_CFG4,
  45. MP_CPUSYS_TOP_ADB_DCM_REG1_MASK,
  46. MP_CPUSYS_TOP_ADB_DCM_REG1_ON);
  47. mmio_clrsetbits_32(MP_CPUSYS_TOP_MCUSYS_DCM_CFG0,
  48. MP_CPUSYS_TOP_ADB_DCM_REG2_MASK,
  49. MP_CPUSYS_TOP_ADB_DCM_REG2_ON);
  50. } else {
  51. /* TINFO = "Turn OFF DCM 'mp_cpusys_top_adb_dcm'" */
  52. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP_ADB_DCM_CFG0,
  53. MP_CPUSYS_TOP_ADB_DCM_REG0_MASK,
  54. MP_CPUSYS_TOP_ADB_DCM_REG0_OFF);
  55. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP_ADB_DCM_CFG4,
  56. MP_CPUSYS_TOP_ADB_DCM_REG1_MASK,
  57. MP_CPUSYS_TOP_ADB_DCM_REG1_OFF);
  58. mmio_clrsetbits_32(MP_CPUSYS_TOP_MCUSYS_DCM_CFG0,
  59. MP_CPUSYS_TOP_ADB_DCM_REG2_MASK,
  60. MP_CPUSYS_TOP_ADB_DCM_REG2_OFF);
  61. }
  62. }
  63. #define MP_CPUSYS_TOP_APB_DCM_REG0_MASK BIT(5)
  64. #define MP_CPUSYS_TOP_APB_DCM_REG1_MASK BIT(8)
  65. #define MP_CPUSYS_TOP_APB_DCM_REG2_MASK BIT(16)
  66. #define MP_CPUSYS_TOP_APB_DCM_REG0_ON BIT(5)
  67. #define MP_CPUSYS_TOP_APB_DCM_REG1_ON BIT(8)
  68. #define MP_CPUSYS_TOP_APB_DCM_REG2_ON BIT(16)
  69. #define MP_CPUSYS_TOP_APB_DCM_REG0_OFF (0x0 << 5)
  70. #define MP_CPUSYS_TOP_APB_DCM_REG1_OFF (0x0 << 8)
  71. #define MP_CPUSYS_TOP_APB_DCM_REG2_OFF (0x0 << 16)
  72. bool dcm_mp_cpusys_top_apb_dcm_is_on(void)
  73. {
  74. bool ret = true;
  75. ret &= dcm_check_state(MP_CPUSYS_TOP_MP_MISC_DCM_CFG0,
  76. MP_CPUSYS_TOP_APB_DCM_REG0_MASK,
  77. MP_CPUSYS_TOP_APB_DCM_REG0_ON);
  78. ret &= dcm_check_state(MP_CPUSYS_TOP_MCUSYS_DCM_CFG0,
  79. MP_CPUSYS_TOP_APB_DCM_REG1_MASK,
  80. MP_CPUSYS_TOP_APB_DCM_REG1_ON);
  81. ret &= dcm_check_state(MP_CPUSYS_TOP_MP0_DCM_CFG0,
  82. MP_CPUSYS_TOP_APB_DCM_REG2_MASK,
  83. MP_CPUSYS_TOP_APB_DCM_REG2_ON);
  84. return ret;
  85. }
  86. void dcm_mp_cpusys_top_apb_dcm(bool on)
  87. {
  88. if (on) {
  89. /* TINFO = "Turn ON DCM 'mp_cpusys_top_apb_dcm'" */
  90. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP_MISC_DCM_CFG0,
  91. MP_CPUSYS_TOP_APB_DCM_REG0_MASK,
  92. MP_CPUSYS_TOP_APB_DCM_REG0_ON);
  93. mmio_clrsetbits_32(MP_CPUSYS_TOP_MCUSYS_DCM_CFG0,
  94. MP_CPUSYS_TOP_APB_DCM_REG1_MASK,
  95. MP_CPUSYS_TOP_APB_DCM_REG1_ON);
  96. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP0_DCM_CFG0,
  97. MP_CPUSYS_TOP_APB_DCM_REG2_MASK,
  98. MP_CPUSYS_TOP_APB_DCM_REG2_ON);
  99. } else {
  100. /* TINFO = "Turn OFF DCM 'mp_cpusys_top_apb_dcm'" */
  101. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP_MISC_DCM_CFG0,
  102. MP_CPUSYS_TOP_APB_DCM_REG0_MASK,
  103. MP_CPUSYS_TOP_APB_DCM_REG0_OFF);
  104. mmio_clrsetbits_32(MP_CPUSYS_TOP_MCUSYS_DCM_CFG0,
  105. MP_CPUSYS_TOP_APB_DCM_REG1_MASK,
  106. MP_CPUSYS_TOP_APB_DCM_REG1_OFF);
  107. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP0_DCM_CFG0,
  108. MP_CPUSYS_TOP_APB_DCM_REG2_MASK,
  109. MP_CPUSYS_TOP_APB_DCM_REG2_OFF);
  110. }
  111. }
  112. #define MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_MASK (BIT(11) | BIT(24) | BIT(25))
  113. #define MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_ON (BIT(11) | BIT(24) | BIT(25))
  114. #define MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_OFF ((0x0 << 11) | \
  115. (0x0 << 24) | \
  116. (0x0 << 25))
  117. bool dcm_mp_cpusys_top_bus_pll_div_dcm_is_on(void)
  118. {
  119. return dcm_check_state(MP_CPUSYS_TOP_BUS_PLLDIV_CFG,
  120. MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_MASK,
  121. MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_ON);
  122. }
  123. void dcm_mp_cpusys_top_bus_pll_div_dcm(bool on)
  124. {
  125. if (on) {
  126. /* TINFO = "Turn ON DCM 'mp_cpusys_top_bus_pll_div_dcm'" */
  127. mmio_clrsetbits_32(MP_CPUSYS_TOP_BUS_PLLDIV_CFG,
  128. MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_MASK,
  129. MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_ON);
  130. } else {
  131. /* TINFO = "Turn OFF DCM 'mp_cpusys_top_bus_pll_div_dcm'" */
  132. mmio_clrsetbits_32(MP_CPUSYS_TOP_BUS_PLLDIV_CFG,
  133. MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_MASK,
  134. MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_OFF);
  135. }
  136. }
  137. #define MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_MASK BIT(0)
  138. #define MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_ON BIT(0)
  139. #define MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_OFF (0x0 << 0)
  140. bool dcm_mp_cpusys_top_core_stall_dcm_is_on(void)
  141. {
  142. return dcm_check_state(MP_CPUSYS_TOP_MP0_DCM_CFG7,
  143. MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_MASK,
  144. MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_ON);
  145. }
  146. void dcm_mp_cpusys_top_core_stall_dcm(bool on)
  147. {
  148. if (on) {
  149. /* TINFO = "Turn ON DCM 'mp_cpusys_top_core_stall_dcm'" */
  150. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP0_DCM_CFG7,
  151. MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_MASK,
  152. MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_ON);
  153. } else {
  154. /* TINFO = "Turn OFF DCM 'mp_cpusys_top_core_stall_dcm'" */
  155. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP0_DCM_CFG7,
  156. MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_MASK,
  157. MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_OFF);
  158. }
  159. }
  160. #define MP_CPUSYS_TOP_CPUBIU_DCM_REG0_MASK (0xffff << 0)
  161. #define MP_CPUSYS_TOP_CPUBIU_DCM_REG0_ON (0xffff << 0)
  162. #define MP_CPUSYS_TOP_CPUBIU_DCM_REG0_OFF (0x0 << 0)
  163. bool dcm_mp_cpusys_top_cpubiu_dcm_is_on(void)
  164. {
  165. return dcm_check_state(MP_CPUSYS_TOP_MCSIC_DCM0,
  166. MP_CPUSYS_TOP_CPUBIU_DCM_REG0_MASK,
  167. MP_CPUSYS_TOP_CPUBIU_DCM_REG0_ON);
  168. }
  169. void dcm_mp_cpusys_top_cpubiu_dcm(bool on)
  170. {
  171. if (on) {
  172. /* TINFO = "Turn ON DCM 'mp_cpusys_top_cpubiu_dcm'" */
  173. mmio_clrsetbits_32(MP_CPUSYS_TOP_MCSIC_DCM0,
  174. MP_CPUSYS_TOP_CPUBIU_DCM_REG0_MASK,
  175. MP_CPUSYS_TOP_CPUBIU_DCM_REG0_ON);
  176. } else {
  177. /* TINFO = "Turn OFF DCM 'mp_cpusys_top_cpubiu_dcm'" */
  178. mmio_clrsetbits_32(MP_CPUSYS_TOP_MCSIC_DCM0,
  179. MP_CPUSYS_TOP_CPUBIU_DCM_REG0_MASK,
  180. MP_CPUSYS_TOP_CPUBIU_DCM_REG0_OFF);
  181. }
  182. }
  183. #define MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_MASK (BIT(24) | BIT(25))
  184. #define MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_ON (BIT(24) | BIT(25))
  185. #define MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_OFF ((0x0 << 24) | (0x0 << 25))
  186. bool dcm_mp_cpusys_top_cpu_pll_div_0_dcm_is_on(void)
  187. {
  188. return dcm_check_state(MP_CPUSYS_TOP_CPU_PLLDIV_CFG0,
  189. MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_MASK,
  190. MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_ON);
  191. }
  192. void dcm_mp_cpusys_top_cpu_pll_div_0_dcm(bool on)
  193. {
  194. if (on) {
  195. /* TINFO = "Turn ON DCM 'mp_cpusys_top_cpu_pll_div_0_dcm'" */
  196. mmio_clrsetbits_32(MP_CPUSYS_TOP_CPU_PLLDIV_CFG0,
  197. MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_MASK,
  198. MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_ON);
  199. } else {
  200. /* TINFO = "Turn OFF DCM 'mp_cpusys_top_cpu_pll_div_0_dcm'" */
  201. mmio_clrsetbits_32(MP_CPUSYS_TOP_CPU_PLLDIV_CFG0,
  202. MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_MASK,
  203. MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_OFF);
  204. }
  205. }
  206. #define MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_MASK (BIT(24) | BIT(25))
  207. #define MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_ON (BIT(24) | BIT(25))
  208. #define MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_OFF ((0x0 << 24) | (0x0 << 25))
  209. bool dcm_mp_cpusys_top_cpu_pll_div_1_dcm_is_on(void)
  210. {
  211. return dcm_check_state(MP_CPUSYS_TOP_CPU_PLLDIV_CFG1,
  212. MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_MASK,
  213. MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_ON);
  214. }
  215. void dcm_mp_cpusys_top_cpu_pll_div_1_dcm(bool on)
  216. {
  217. if (on) {
  218. /* TINFO = "Turn ON DCM 'mp_cpusys_top_cpu_pll_div_1_dcm'" */
  219. mmio_clrsetbits_32(MP_CPUSYS_TOP_CPU_PLLDIV_CFG1,
  220. MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_MASK,
  221. MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_ON);
  222. } else {
  223. /* TINFO = "Turn OFF DCM 'mp_cpusys_top_cpu_pll_div_1_dcm'" */
  224. mmio_clrsetbits_32(MP_CPUSYS_TOP_CPU_PLLDIV_CFG1,
  225. MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_MASK,
  226. MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_OFF);
  227. }
  228. }
  229. #define MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_MASK BIT(4)
  230. #define MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_ON BIT(4)
  231. #define MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_OFF (0x0 << 4)
  232. bool dcm_mp_cpusys_top_fcm_stall_dcm_is_on(void)
  233. {
  234. return dcm_check_state(MP_CPUSYS_TOP_MP0_DCM_CFG7,
  235. MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_MASK,
  236. MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_ON);
  237. }
  238. void dcm_mp_cpusys_top_fcm_stall_dcm(bool on)
  239. {
  240. if (on) {
  241. /* TINFO = "Turn ON DCM 'mp_cpusys_top_fcm_stall_dcm'" */
  242. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP0_DCM_CFG7,
  243. MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_MASK,
  244. MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_ON);
  245. } else {
  246. /* TINFO = "Turn OFF DCM 'mp_cpusys_top_fcm_stall_dcm'" */
  247. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP0_DCM_CFG7,
  248. MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_MASK,
  249. MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_OFF);
  250. }
  251. }
  252. #define MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_MASK BIT(31)
  253. #define MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_ON BIT(31)
  254. #define MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_OFF (0x0U << 31)
  255. bool dcm_mp_cpusys_top_last_cor_idle_dcm_is_on(void)
  256. {
  257. return dcm_check_state(MP_CPUSYS_TOP_BUS_PLLDIV_CFG,
  258. MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_MASK,
  259. MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_ON);
  260. }
  261. void dcm_mp_cpusys_top_last_cor_idle_dcm(bool on)
  262. {
  263. if (on) {
  264. /* TINFO = "Turn ON DCM 'mp_cpusys_top_last_cor_idle_dcm'" */
  265. mmio_clrsetbits_32(MP_CPUSYS_TOP_BUS_PLLDIV_CFG,
  266. MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_MASK,
  267. MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_ON);
  268. } else {
  269. /* TINFO = "Turn OFF DCM 'mp_cpusys_top_last_cor_idle_dcm'" */
  270. mmio_clrsetbits_32(MP_CPUSYS_TOP_BUS_PLLDIV_CFG,
  271. MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_MASK,
  272. MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_OFF);
  273. }
  274. }
  275. #define MP_CPUSYS_TOP_MISC_DCM_REG0_MASK (BIT(1) | BIT(4))
  276. #define MP_CPUSYS_TOP_MISC_DCM_REG0_ON (BIT(1) | BIT(4))
  277. #define MP_CPUSYS_TOP_MISC_DCM_REG0_OFF ((0x0 << 1) | (0x0 << 4))
  278. bool dcm_mp_cpusys_top_misc_dcm_is_on(void)
  279. {
  280. return dcm_check_state(MP_CPUSYS_TOP_MP_MISC_DCM_CFG0,
  281. MP_CPUSYS_TOP_MISC_DCM_REG0_MASK,
  282. MP_CPUSYS_TOP_MISC_DCM_REG0_ON);
  283. }
  284. void dcm_mp_cpusys_top_misc_dcm(bool on)
  285. {
  286. if (on) {
  287. /* TINFO = "Turn ON DCM 'mp_cpusys_top_misc_dcm'" */
  288. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP_MISC_DCM_CFG0,
  289. MP_CPUSYS_TOP_MISC_DCM_REG0_MASK,
  290. MP_CPUSYS_TOP_MISC_DCM_REG0_ON);
  291. } else {
  292. /* TINFO = "Turn OFF DCM 'mp_cpusys_top_misc_dcm'" */
  293. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP_MISC_DCM_CFG0,
  294. MP_CPUSYS_TOP_MISC_DCM_REG0_MASK,
  295. MP_CPUSYS_TOP_MISC_DCM_REG0_OFF);
  296. }
  297. }
  298. #define MP_CPUSYS_TOP_MP0_QDCM_REG0_MASK BIT(3)
  299. #define MP_CPUSYS_TOP_MP0_QDCM_REG1_MASK (BIT(0) | BIT(1) | BIT(2) | BIT(3))
  300. #define MP_CPUSYS_TOP_MP0_QDCM_REG0_ON BIT(3)
  301. #define MP_CPUSYS_TOP_MP0_QDCM_REG1_ON (BIT(0) | BIT(1) | BIT(2) | BIT(3))
  302. #define MP_CPUSYS_TOP_MP0_QDCM_REG0_OFF ((0x0 << 3))
  303. #define MP_CPUSYS_TOP_MP0_QDCM_REG1_OFF ((0x0 << 0) | (0x0 << 1) | \
  304. (0x0 << 2) | (0x0 << 3))
  305. bool dcm_mp_cpusys_top_mp0_qdcm_is_on(void)
  306. {
  307. bool ret = true;
  308. ret &= dcm_check_state(MP_CPUSYS_TOP_MP_MISC_DCM_CFG0,
  309. MP_CPUSYS_TOP_MP0_QDCM_REG0_MASK,
  310. MP_CPUSYS_TOP_MP0_QDCM_REG0_ON);
  311. ret &= dcm_check_state(MP_CPUSYS_TOP_MP0_DCM_CFG0,
  312. MP_CPUSYS_TOP_MP0_QDCM_REG1_MASK,
  313. MP_CPUSYS_TOP_MP0_QDCM_REG1_ON);
  314. return ret;
  315. }
  316. void dcm_mp_cpusys_top_mp0_qdcm(bool on)
  317. {
  318. if (on) {
  319. /* TINFO = "Turn ON DCM 'mp_cpusys_top_mp0_qdcm'" */
  320. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP_MISC_DCM_CFG0,
  321. MP_CPUSYS_TOP_MP0_QDCM_REG0_MASK,
  322. MP_CPUSYS_TOP_MP0_QDCM_REG0_ON);
  323. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP0_DCM_CFG0,
  324. MP_CPUSYS_TOP_MP0_QDCM_REG1_MASK,
  325. MP_CPUSYS_TOP_MP0_QDCM_REG1_ON);
  326. } else {
  327. /* TINFO = "Turn OFF DCM 'mp_cpusys_top_mp0_qdcm'" */
  328. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP_MISC_DCM_CFG0,
  329. MP_CPUSYS_TOP_MP0_QDCM_REG0_MASK,
  330. MP_CPUSYS_TOP_MP0_QDCM_REG0_OFF);
  331. mmio_clrsetbits_32(MP_CPUSYS_TOP_MP0_DCM_CFG0,
  332. MP_CPUSYS_TOP_MP0_QDCM_REG1_MASK,
  333. MP_CPUSYS_TOP_MP0_QDCM_REG1_OFF);
  334. }
  335. }
  336. #define CPCCFG_REG_EMI_WFIFO_REG0_MASK (BIT(0) | BIT(1) | BIT(2) | BIT(3))
  337. #define CPCCFG_REG_EMI_WFIFO_REG0_ON (BIT(0) | BIT(1) | BIT(2) | BIT(3))
  338. #define CPCCFG_REG_EMI_WFIFO_REG0_OFF ((0x0 << 0) | (0x0 << 1) | \
  339. (0x0 << 2) | (0x0 << 3))
  340. bool dcm_cpccfg_reg_emi_wfifo_is_on(void)
  341. {
  342. return dcm_check_state(CPCCFG_REG_EMI_WFIFO,
  343. CPCCFG_REG_EMI_WFIFO_REG0_MASK,
  344. CPCCFG_REG_EMI_WFIFO_REG0_ON);
  345. }
  346. void dcm_cpccfg_reg_emi_wfifo(bool on)
  347. {
  348. if (on) {
  349. /* TINFO = "Turn ON DCM 'cpccfg_reg_emi_wfifo'" */
  350. mmio_clrsetbits_32(CPCCFG_REG_EMI_WFIFO,
  351. CPCCFG_REG_EMI_WFIFO_REG0_MASK,
  352. CPCCFG_REG_EMI_WFIFO_REG0_ON);
  353. } else {
  354. /* TINFO = "Turn OFF DCM 'cpccfg_reg_emi_wfifo'" */
  355. mmio_clrsetbits_32(CPCCFG_REG_EMI_WFIFO,
  356. CPCCFG_REG_EMI_WFIFO_REG0_MASK,
  357. CPCCFG_REG_EMI_WFIFO_REG0_OFF);
  358. }
  359. }