hi3660_crg.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef HI3660_CRG_H
  7. #define HI3660_CRG_H
  8. #define CRG_REG_BASE 0xFFF35000
  9. #define CRG_PEREN0_REG (CRG_REG_BASE + 0x000)
  10. #define CRG_PERDIS0_REG (CRG_REG_BASE + 0x004)
  11. #define CRG_PERSTAT0_REG (CRG_REG_BASE + 0x008)
  12. #define PEREN0_GT_CLK_AOMM (1U << 31)
  13. #define CRG_PEREN1_REG (CRG_REG_BASE + 0x010)
  14. #define CRG_PERDIS1_REG (CRG_REG_BASE + 0x014)
  15. #define CRG_PERSTAT1_REG (CRG_REG_BASE + 0x018)
  16. #define CRG_PEREN2_REG (CRG_REG_BASE + 0x020)
  17. #define CRG_PERDIS2_REG (CRG_REG_BASE + 0x024)
  18. #define CRG_PERSTAT2_REG (CRG_REG_BASE + 0x028)
  19. #define PEREN2_HKADCSSI (1 << 24)
  20. #define CRG_PEREN3_REG (CRG_REG_BASE + 0x030)
  21. #define CRG_PERDIS3_REG (CRG_REG_BASE + 0x034)
  22. #define CRG_PEREN4_REG (CRG_REG_BASE + 0x040)
  23. #define CRG_PERDIS4_REG (CRG_REG_BASE + 0x044)
  24. #define CRG_PERCLKEN4_REG (CRG_REG_BASE + 0x048)
  25. #define CRG_PERSTAT4_REG (CRG_REG_BASE + 0x04C)
  26. #define GT_ACLK_USB3OTG (1 << 1)
  27. #define GT_CLK_USB3OTG_REF (1 << 0)
  28. #define CRG_PEREN5_REG (CRG_REG_BASE + 0x050)
  29. #define CRG_PERDIS5_REG (CRG_REG_BASE + 0x054)
  30. #define CRG_PERSTAT5_REG (CRG_REG_BASE + 0x058)
  31. #define CRG_PERRSTEN0_REG (CRG_REG_BASE + 0x060)
  32. #define CRG_PERRSTDIS0_REG (CRG_REG_BASE + 0x064)
  33. #define CRG_PERRSTSTAT0_REG (CRG_REG_BASE + 0x068)
  34. #define CRG_PERRSTEN1_REG (CRG_REG_BASE + 0x06C)
  35. #define CRG_PERRSTDIS1_REG (CRG_REG_BASE + 0x070)
  36. #define CRG_PERRSTSTAT1_REG (CRG_REG_BASE + 0x074)
  37. #define CRG_PERRSTEN2_REG (CRG_REG_BASE + 0x078)
  38. #define CRG_PERRSTDIS2_REG (CRG_REG_BASE + 0x07C)
  39. #define CRG_PERRSTSTAT2_REG (CRG_REG_BASE + 0x080)
  40. #define PERRSTEN2_HKADCSSI (1 << 24)
  41. #define CRG_PERRSTEN3_REG (CRG_REG_BASE + 0x084)
  42. #define CRG_PERRSTDIS3_REG (CRG_REG_BASE + 0x088)
  43. #define CRG_PERRSTSTAT3_REG (CRG_REG_BASE + 0x08C)
  44. #define CRG_PERRSTEN4_REG (CRG_REG_BASE + 0x090)
  45. #define CRG_PERRSTDIS4_REG (CRG_REG_BASE + 0x094)
  46. #define CRG_PERRSTSTAT4_REG (CRG_REG_BASE + 0x098)
  47. #define IP_RST_USB3OTG_MUX (1 << 8)
  48. #define IP_RST_USB3OTG_AHBIF (1 << 7)
  49. #define IP_RST_USB3OTG_32K (1 << 6)
  50. #define IP_RST_USB3OTG (1 << 5)
  51. #define IP_RST_USB3OTGPHY_POR (1 << 3)
  52. #define CRG_PERRSTEN5_REG (CRG_REG_BASE + 0x09C)
  53. #define CRG_PERRSTDIS5_REG (CRG_REG_BASE + 0x0A0)
  54. #define CRG_PERRSTSTAT5_REG (CRG_REG_BASE + 0x0A4)
  55. /* bit fields in CRG_PERI */
  56. #define PERI_PCLK_PCTRL_BIT (1U << 31)
  57. #define PERI_TIMER12_BIT (1 << 25)
  58. #define PERI_TIMER11_BIT (1 << 24)
  59. #define PERI_TIMER10_BIT (1 << 23)
  60. #define PERI_TIMER9_BIT (1 << 22)
  61. #define PERI_UART5_BIT (1 << 15)
  62. #define PERI_UFS_BIT (1 << 12)
  63. #define PERI_ARST_UFS_BIT (1 << 7)
  64. #define PERI_PPLL2_EN_CPU (1 << 3)
  65. #define PERI_PWM_BIT (1 << 0)
  66. #define PERI_DDRC_BIT (1 << 0)
  67. #define PERI_DDRC_D_BIT (1 << 4)
  68. #define PERI_DDRC_C_BIT (1 << 3)
  69. #define PERI_DDRC_B_BIT (1 << 2)
  70. #define PERI_DDRC_A_BIT (1 << 1)
  71. #define PERI_DDRC_DMUX_BIT (1 << 0)
  72. #define CRG_CLKDIV0_REG (CRG_REG_BASE + 0x0A0)
  73. #define SC_DIV_LPMCU_MASK ((0x1F << 5) << 16)
  74. #define SC_DIV_LPMCU(x) (((x) & 0x1F) << 5)
  75. #define CRG_CLKDIV1_REG (CRG_REG_BASE + 0x0B0)
  76. #define SEL_LPMCU_PLL_MASK ((1 << 1) << 16)
  77. #define SEL_SYSBUS_MASK ((1 << 0) << 16)
  78. #define SEL_LPMCU_PLL1 (1 << 1)
  79. #define SEL_LPMCU_PLL0 (0 << 1)
  80. #define SEL_SYSBUS_PLL0 (1 << 0)
  81. #define SEL_SYSBUS_PLL1 (0 << 0)
  82. #define CRG_CLKDIV3_REG (CRG_REG_BASE + 0x0B4)
  83. #define CRG_CLKDIV5_REG (CRG_REG_BASE + 0x0BC)
  84. #define CRG_CLKDIV8_REG (CRG_REG_BASE + 0x0C8)
  85. #define CRG_CLKDIV12_REG (CRG_REG_BASE + 0x0D8)
  86. #define SC_DIV_A53HPM_MASK (0x7 << 13)
  87. #define SC_DIV_A53HPM(x) (((x) & 0x7) << 13)
  88. #define CRG_CLKDIV16_REG (CRG_REG_BASE + 0x0E8)
  89. #define DDRC_CLK_SW_REQ_CFG_MASK (0x3 << 12)
  90. #define DDRC_CLK_SW_REQ_CFG(x) (((x) & 0x3) << 12)
  91. #define SC_DIV_UFSPHY_CFG_MASK (0x3 << 9)
  92. #define SC_DIV_UFSPHY_CFG(x) (((x) & 0x3) << 9)
  93. #define DDRCPLL_SW (1 << 8)
  94. #define CRG_CLKDIV17_REG (CRG_REG_BASE + 0x0EC)
  95. #define SC_DIV_UFS_PERIBUS (1 << 14)
  96. #define CRG_CLKDIV18_REG (CRG_REG_BASE + 0x0F0)
  97. #define CRG_CLKDIV19_REG (CRG_REG_BASE + 0x0F4)
  98. #define CRG_CLKDIV20_REG (CRG_REG_BASE + 0x0F8)
  99. #define CLKDIV20_GT_CLK_AOMM (1 << 3)
  100. #define CRG_CLKDIV22_REG (CRG_REG_BASE + 0x100)
  101. #define SEL_PLL_320M_MASK (1 << 16)
  102. #define SEL_PLL2_320M (1 << 0)
  103. #define SEL_PLL0_320M (0 << 0)
  104. #define CRG_CLKDIV23_REG (CRG_REG_BASE + 0x104)
  105. #define PERI_DDRC_SW_BIT (1 << 13)
  106. #define DIV_CLK_DDRSYS_MASK (0x3 << 10)
  107. #define DIV_CLK_DDRSYS(x) (((x) & 0x3) << 10)
  108. #define GET_DIV_CLK_DDRSYS(x) (((x) & DIV_CLK_DDRSYS_MASK) >> 10)
  109. #define DIV_CLK_DDRCFG_MASK (0x6 << 5)
  110. #define DIV_CLK_DDRCFG(x) (((x) & 0x6) << 5)
  111. #define GET_DIV_CLK_DDRCFG(x) (((x) & DIV_CLK_DDRCFG_MASK) >> 5)
  112. #define DIV_CLK_DDRC_MASK 0x1F
  113. #define DIV_CLK_DDRC(x) ((x) & DIV_CLK_DDRC_MASK)
  114. #define GET_DIV_CLK_DDRC(x) ((x) & DIV_CLK_DDRC_MASK)
  115. #define CRG_CLKDIV25_REG (CRG_REG_BASE + 0x10C)
  116. #define DIV_SYSBUS_PLL_MASK (0xF << 16)
  117. #define DIV_SYSBUS_PLL(x) ((x) & 0xF)
  118. #define CRG_PERI_CTRL2_REG (CRG_REG_BASE + 0x128)
  119. #define PERI_TIME_STAMP_CLK_MASK (0x7 << 28)
  120. #define PERI_TIME_STAMP_CLK_DIV(x) (((x) & 0x7) << 22)
  121. #define CRG_ISODIS_REG (CRG_REG_BASE + 0x148)
  122. #define CRG_PERPWREN_REG (CRG_REG_BASE + 0x150)
  123. #define CRG_PEREN7_REG (CRG_REG_BASE + 0x420)
  124. #define CRG_PERDIS7_REG (CRG_REG_BASE + 0x424)
  125. #define CRG_PERSTAT7_REG (CRG_REG_BASE + 0x428)
  126. #define GT_CLK_UFSPHY_CFG (1 << 14)
  127. #define CRG_PEREN8_REG (CRG_REG_BASE + 0x430)
  128. #define CRG_PERDIS8_REG (CRG_REG_BASE + 0x434)
  129. #define CRG_PERSTAT8_REG (CRG_REG_BASE + 0x438)
  130. #define PERI_DMC_D_BIT (1 << 22)
  131. #define PERI_DMC_C_BIT (1 << 21)
  132. #define PERI_DMC_B_BIT (1 << 20)
  133. #define PERI_DMC_A_BIT (1 << 19)
  134. #define PERI_DMC_BIT (1 << 18)
  135. #define CRG_PEREN11_REG (CRG_REG_BASE + 0x460)
  136. #define PPLL1_GATE_CPU (1 << 18)
  137. #define CRG_PERSTAT11_REG (CRG_REG_BASE + 0x46C)
  138. #define PPLL3_EN_STAT (1 << 21)
  139. #define PPLL2_EN_STAT (1 << 20)
  140. #define PPLL1_EN_STAT (1 << 19)
  141. #define CRG_IVP_SEC_RSTDIS_REG (CRG_REG_BASE + 0xC04)
  142. #define CRG_ISP_SEC_RSTDIS_REG (CRG_REG_BASE + 0xC84)
  143. #define CRG_RVBAR(c, n) (0xE00 + (0x10 * c) + (0x4 * n))
  144. #define CRG_GENERAL_SEC_RSTEN_REG (CRG_REG_BASE + 0xE20)
  145. #define CRG_GENERAL_SEC_RSTDIS_REG (CRG_REG_BASE + 0xE24)
  146. #define IP_RST_GPIO0_SEC (1 << 2)
  147. #define CRG_GENERAL_SEC_CLKDIV0_REG (CRG_REG_BASE + 0xE90)
  148. #define SC_DIV_AO_HISE_MASK 3
  149. #define SC_DIV_AO_HISE(x) ((x) & 0x3)
  150. #endif /* HI3660_CRG_H */