apupwr_clkctl_def.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. /*
  2. * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef APUPWR_CLKCTL_DEF_H
  7. #define APUPWR_CLKCTL_DEF_H
  8. #include <lib/mmio.h>
  9. enum dvfs_voltage_domain {
  10. V_VPU0 = 0,
  11. V_VPU1 = 1,
  12. V_MDLA0 = 2,
  13. V_MDLA1 = 3,
  14. V_APU_CONN = 4,
  15. V_TOP_IOMMU = 5,
  16. V_VCORE = 6,
  17. APUSYS_BUCK_DOMAIN_NUM = 7,
  18. };
  19. enum dvfs_freq {
  20. DVFS_FREQ_NOT_SUPPORT = 0,
  21. DVFS_FREQ_ACC_26M = 1,
  22. DVFS_FREQ_ACC_PARKING = 2,
  23. DVFS_FREQ_ACC_SOC = 3,
  24. DVFS_FREQ_ACC_APUPLL = 4,
  25. DVFS_FREQ_00_026000_F = 26000,
  26. DVFS_FREQ_00_208000_F = 208000,
  27. DVFS_FREQ_00_238000_F = 238000,
  28. DVFS_FREQ_00_273000_F = 273000,
  29. DVFS_FREQ_00_312000_F = 312000,
  30. DVFS_FREQ_00_358000_F = 358000,
  31. DVFS_FREQ_00_385000_F = 385000,
  32. DVFS_FREQ_00_499200_F = 499200,
  33. DVFS_FREQ_00_500000_F = 500000,
  34. DVFS_FREQ_00_525000_F = 525000,
  35. DVFS_FREQ_00_546000_F = 546000,
  36. DVFS_FREQ_00_594000_F = 594000,
  37. DVFS_FREQ_00_624000_F = 624000,
  38. DVFS_FREQ_00_688000_F = 688000,
  39. DVFS_FREQ_00_687500_F = 687500,
  40. DVFS_FREQ_00_728000_F = 728000,
  41. DVFS_FREQ_00_800000_F = 800000,
  42. DVFS_FREQ_00_832000_F = 832000,
  43. DVFS_FREQ_00_960000_F = 960000,
  44. DVFS_FREQ_00_1100000_F = 1100000,
  45. };
  46. #define DVFS_FREQ_MAX (DVFS_FREQ_00_1100000_F)
  47. enum pll_set_rate_mode {
  48. CON0_PCW = 0,
  49. FHCTL_SW = 1,
  50. FHCTL_HW = 2,
  51. PLL_SET_RATE_MODE_MAX = 3,
  52. };
  53. enum apupll {
  54. APUPLL = 0,
  55. NPUPLL = 1,
  56. APUPLL1 = 2,
  57. APUPLL2 = 3,
  58. APUPLL_MAX = 4,
  59. };
  60. #define BUCK_VVPU_DOMAIN_DEFAULT_FREQ (DVFS_FREQ_00_273000_F)
  61. #define BUCK_VMDLA_DOMAIN_DEFAULT_FREQ (DVFS_FREQ_00_312000_F)
  62. #define BUCK_VCONN_DOMAIN_DEFAULT_FREQ (DVFS_FREQ_00_208000_F)
  63. #define apupwr_writel(VAL, REG) mmio_write_32((uintptr_t)REG, VAL)
  64. #define apupwr_writel_relax(VAL, REG) mmio_write_32_relax((uintptr_t)REG, VAL)
  65. #define apupwr_readl(REG) mmio_read_32((uintptr_t)REG)
  66. #define apupwr_clrbits(VAL, REG) mmio_clrbits_32((uintptr_t)REG, VAL)
  67. #define apupwr_setbits(VAL, REG) mmio_setbits_32((uintptr_t)REG, VAL)
  68. #define apupwr_clrsetbits(CLR_VAL, SET_VAL, REG) \
  69. mmio_clrsetbits_32((uintptr_t)REG, CLR_VAL, SET_VAL)
  70. /* PLL and related register */
  71. #define APU_PLL_BASE (APUSYS_APU_PLL_BASE)
  72. #define APU_PLL4H_PLL1_CON0 (APU_PLL_BASE + 0x008)
  73. #define APU_PLL4H_PLL1_CON1 (APU_PLL_BASE + 0x00C)
  74. #define APU_PLL4H_PLL1_CON3 (APU_PLL_BASE + 0x014)
  75. #define APU_PLL4H_PLL2_CON0 (APU_PLL_BASE + 0x018)
  76. #define APU_PLL4H_PLL2_CON1 (APU_PLL_BASE + 0x01C)
  77. #define APU_PLL4H_PLL2_CON3 (APU_PLL_BASE + 0x024)
  78. #define APU_PLL4H_PLL3_CON0 (APU_PLL_BASE + 0x028)
  79. #define APU_PLL4H_PLL3_CON1 (APU_PLL_BASE + 0x02C)
  80. #define APU_PLL4H_PLL3_CON3 (APU_PLL_BASE + 0x034)
  81. #define APU_PLL4H_PLL4_CON0 (APU_PLL_BASE + 0x038)
  82. #define APU_PLL4H_PLL4_CON1 (APU_PLL_BASE + 0x03C)
  83. #define APU_PLL4H_PLL4_CON3 (APU_PLL_BASE + 0x044)
  84. #define APU_PLL4H_FHCTL_HP_EN (APU_PLL_BASE + 0x0E00)
  85. #define APU_PLL4H_FHCTL_UNITSLOPE_EN (APU_PLL_BASE + 0x0E04)
  86. #define APU_PLL4H_FHCTL_CLK_CON (APU_PLL_BASE + 0x0E08)
  87. #define APU_PLL4H_FHCTL_RST_CON (APU_PLL_BASE + 0x0E0C)
  88. #define APU_PLL4H_FHCTL_SLOPE0 (APU_PLL_BASE + 0x0E10)
  89. #define APU_PLL4H_FHCTL_SLOPE1 (APU_PLL_BASE + 0x0E14)
  90. #define APU_PLL4H_FHCTL_DSSC_CFG (APU_PLL_BASE + 0x0E18)
  91. #define APU_PLL4H_FHCTL_DSSC0_CON (APU_PLL_BASE + 0x0E1C)
  92. #define APU_PLL4H_FHCTL_DSSC1_CON (APU_PLL_BASE + 0x0E20)
  93. #define APU_PLL4H_FHCTL_DSSC2_CON (APU_PLL_BASE + 0x0E24)
  94. #define APU_PLL4H_FHCTL_DSSC3_CON (APU_PLL_BASE + 0x0E28)
  95. #define APU_PLL4H_FHCTL_DSSC4_CON (APU_PLL_BASE + 0x0E2C)
  96. #define APU_PLL4H_FHCTL_DSSC5_CON (APU_PLL_BASE + 0x0E30)
  97. #define APU_PLL4H_FHCTL_DSSC6_CON (APU_PLL_BASE + 0x0E34)
  98. #define APU_PLL4H_FHCTL_DSSC7_CON (APU_PLL_BASE + 0x0E38)
  99. #define APU_PLL4H_FHCTL0_CFG (APU_PLL_BASE + 0x0E3C)
  100. #define APU_PLL4H_FHCTL0_UPDNLMT (APU_PLL_BASE + 0x0E40)
  101. #define APU_PLL4H_FHCTL0_DDS (APU_PLL_BASE + 0x0E44)
  102. #define APU_PLL4H_FHCTL0_DVFS (APU_PLL_BASE + 0x0E48)
  103. #define APU_PLL4H_FHCTL0_MON (APU_PLL_BASE + 0x0E4C)
  104. #define APU_PLL4H_FHCTL1_CFG (APU_PLL_BASE + 0x0E50)
  105. #define APU_PLL4H_FHCTL1_UPDNLMT (APU_PLL_BASE + 0x0E54)
  106. #define APU_PLL4H_FHCTL1_DDS (APU_PLL_BASE + 0x0E58)
  107. #define APU_PLL4H_FHCTL1_DVFS (APU_PLL_BASE + 0x0E5C)
  108. #define APU_PLL4H_FHCTL1_MON (APU_PLL_BASE + 0x0E60)
  109. #define APU_PLL4H_FHCTL2_CFG (APU_PLL_BASE + 0x0E64)
  110. #define APU_PLL4H_FHCTL2_UPDNLMT (APU_PLL_BASE + 0x0E68)
  111. #define APU_PLL4H_FHCTL2_DDS (APU_PLL_BASE + 0x0E6C)
  112. #define APU_PLL4H_FHCTL2_DVFS (APU_PLL_BASE + 0x0E70)
  113. #define APU_PLL4H_FHCTL2_MON (APU_PLL_BASE + 0x0E74)
  114. #define APU_PLL4H_FHCTL3_CFG (APU_PLL_BASE + 0x0E78)
  115. #define APU_PLL4H_FHCTL3_UPDNLMT (APU_PLL_BASE + 0x0E7C)
  116. #define APU_PLL4H_FHCTL3_DDS (APU_PLL_BASE + 0x0E80)
  117. #define APU_PLL4H_FHCTL3_DVFS (APU_PLL_BASE + 0x0E84)
  118. #define APU_PLL4H_FHCTL3_MON (APU_PLL_BASE + 0x0E88)
  119. /* PLL4H_PLLx_CON0 */
  120. #define RG_PLL_EN BIT(0)
  121. /* PLL4H_PLLx_CON1 */
  122. #define RG_PLL_SDM_PCW_CHG BIT(31)
  123. #define POSDIV_SHIFT (24U)
  124. #define POSDIV_MASK (0x7)
  125. /* PLL4H_PLLx_CON3 */
  126. #define DA_PLL_SDM_PWR_ON BIT(0)
  127. #define DA_PLL_SDM_ISO_EN BIT(1)
  128. /* FHCTLx_DDS */
  129. #define DDS_MASK GENMASK_32(21, 0)
  130. #define PCW_FRACTIONAL_SHIFT 14U
  131. #define PLL_TGL_ORG BIT(31)
  132. #define PLL_READY_TIME_20US (20U)
  133. #define PLL_CMD_READY_TIME_1US (1U)
  134. #define FREQ_VCO_MIN (1500U) /* 1500MHz*/
  135. #define FREQ_FIN (26U) /* 26M*/
  136. /* ACC and related register */
  137. #define APU_ACC_BASE (APUSYS_APU_ACC_BASE)
  138. #define APU_ACC_CONFG_SET0 (APU_ACC_BASE + 0x000)
  139. #define APU_ACC_CONFG_SET1 (APU_ACC_BASE + 0x004)
  140. #define APU_ACC_CONFG_SET2 (APU_ACC_BASE + 0x008)
  141. #define APU_ACC_CONFG_SET4 (APU_ACC_BASE + 0x010)
  142. #define APU_ACC_CONFG_SET5 (APU_ACC_BASE + 0x014)
  143. #define APU_ACC_CONFG_SET7 (APU_ACC_BASE + 0x01C)
  144. #define APU_ACC_CONFG_CLR0 (APU_ACC_BASE + 0x040)
  145. #define APU_ACC_CONFG_CLR1 (APU_ACC_BASE + 0x044)
  146. #define APU_ACC_CONFG_CLR2 (APU_ACC_BASE + 0x048)
  147. #define APU_ACC_CONFG_CLR4 (APU_ACC_BASE + 0x050)
  148. #define APU_ACC_CONFG_CLR5 (APU_ACC_BASE + 0x054)
  149. #define APU_ACC_CONFG_CLR7 (APU_ACC_BASE + 0x05C)
  150. #define APU_ACC_FM_CONFG_SET (APU_ACC_BASE + 0x0C0)
  151. #define APU_ACC_FM_CONFG_CLR (APU_ACC_BASE + 0x0C4)
  152. #define APU_ACC_FM_SEL (APU_ACC_BASE + 0x0C8)
  153. #define APU_ACC_FM_CNT (APU_ACC_BASE + 0x0CC)
  154. /* APU AO control */
  155. #define APU_AO_CTRL_BASE (APUSYS_APU_S_S_4_BASE)
  156. #define APU_CSR_DUMMY_0 (APU_AO_CTRL_BASE + 0x24)
  157. #define AO_MD32_MNOC_MASK (BIT(1) | BIT(0))
  158. #define BIT_CGEN_F26M (0)
  159. #define BIT_CGEN_PARK (1)
  160. #define BIT_CGEN_SOC (2)
  161. #define BIT_CGEN_APU (3)
  162. #define BIT_CGEN_OUT (4)
  163. #define BIT_SEL_PARK (8)
  164. #define BIT_SEL_F26M (9)
  165. #define BIT_SEL_APU_DIV2 (10)
  166. #define BIT_SEL_APU (11)
  167. #define BIT_SEL_PARK_SRC_OUT (12)
  168. #define BIT_INVEN_OUT (15)
  169. #endif /* APUPWR_CLKCTL_DEF_H*/