rv6xxd.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. /*
  2. * Copyright 2011 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. */
  23. #ifndef RV6XXD_H
  24. #define RV6XXD_H
  25. /* RV6xx power management */
  26. #define SPLL_CNTL_MODE 0x60c
  27. # define SPLL_DIV_SYNC (1 << 5)
  28. #define GENERAL_PWRMGT 0x618
  29. # define GLOBAL_PWRMGT_EN (1 << 0)
  30. # define STATIC_PM_EN (1 << 1)
  31. # define MOBILE_SU (1 << 2)
  32. # define THERMAL_PROTECTION_DIS (1 << 3)
  33. # define THERMAL_PROTECTION_TYPE (1 << 4)
  34. # define ENABLE_GEN2PCIE (1 << 5)
  35. # define SW_GPIO_INDEX(x) ((x) << 6)
  36. # define SW_GPIO_INDEX_MASK (3 << 6)
  37. # define LOW_VOLT_D2_ACPI (1 << 8)
  38. # define LOW_VOLT_D3_ACPI (1 << 9)
  39. # define VOLT_PWRMGT_EN (1 << 10)
  40. # define BACKBIAS_PAD_EN (1 << 16)
  41. # define BACKBIAS_VALUE (1 << 17)
  42. # define BACKBIAS_DPM_CNTL (1 << 18)
  43. # define DYN_SPREAD_SPECTRUM_EN (1 << 21)
  44. #define MCLK_PWRMGT_CNTL 0x624
  45. # define MPLL_PWRMGT_OFF (1 << 0)
  46. # define YCLK_TURNOFF (1 << 1)
  47. # define MPLL_TURNOFF (1 << 2)
  48. # define SU_MCLK_USE_BCLK (1 << 3)
  49. # define DLL_READY (1 << 4)
  50. # define MC_BUSY (1 << 5)
  51. # define MC_INT_CNTL (1 << 7)
  52. # define MRDCKA_SLEEP (1 << 8)
  53. # define MRDCKB_SLEEP (1 << 9)
  54. # define MRDCKC_SLEEP (1 << 10)
  55. # define MRDCKD_SLEEP (1 << 11)
  56. # define MRDCKE_SLEEP (1 << 12)
  57. # define MRDCKF_SLEEP (1 << 13)
  58. # define MRDCKG_SLEEP (1 << 14)
  59. # define MRDCKH_SLEEP (1 << 15)
  60. # define MRDCKA_RESET (1 << 16)
  61. # define MRDCKB_RESET (1 << 17)
  62. # define MRDCKC_RESET (1 << 18)
  63. # define MRDCKD_RESET (1 << 19)
  64. # define MRDCKE_RESET (1 << 20)
  65. # define MRDCKF_RESET (1 << 21)
  66. # define MRDCKG_RESET (1 << 22)
  67. # define MRDCKH_RESET (1 << 23)
  68. # define DLL_READY_READ (1 << 24)
  69. # define USE_DISPLAY_GAP (1 << 25)
  70. # define USE_DISPLAY_URGENT_NORMAL (1 << 26)
  71. # define USE_DISPLAY_GAP_CTXSW (1 << 27)
  72. # define MPLL_TURNOFF_D2 (1 << 28)
  73. # define USE_DISPLAY_URGENT_CTXSW (1 << 29)
  74. #define MPLL_FREQ_LEVEL_0 0x6e8
  75. # define LEVEL0_MPLL_POST_DIV(x) ((x) << 0)
  76. # define LEVEL0_MPLL_POST_DIV_MASK (0xff << 0)
  77. # define LEVEL0_MPLL_FB_DIV(x) ((x) << 8)
  78. # define LEVEL0_MPLL_FB_DIV_MASK (0xfff << 8)
  79. # define LEVEL0_MPLL_REF_DIV(x) ((x) << 20)
  80. # define LEVEL0_MPLL_REF_DIV_MASK (0x3f << 20)
  81. # define LEVEL0_MPLL_DIV_EN (1 << 28)
  82. # define LEVEL0_DLL_BYPASS (1 << 29)
  83. # define LEVEL0_DLL_RESET (1 << 30)
  84. #define VID_RT 0x6f8
  85. # define VID_CRT(x) ((x) << 0)
  86. # define VID_CRT_MASK (0x1fff << 0)
  87. # define VID_CRTU(x) ((x) << 13)
  88. # define VID_CRTU_MASK (7 << 13)
  89. # define SSTU(x) ((x) << 16)
  90. # define SSTU_MASK (7 << 16)
  91. # define VID_SWT(x) ((x) << 19)
  92. # define VID_SWT_MASK (0x1f << 19)
  93. # define BRT(x) ((x) << 24)
  94. # define BRT_MASK (0xff << 24)
  95. #define TARGET_AND_CURRENT_PROFILE_INDEX 0x70c
  96. # define TARGET_PROFILE_INDEX_MASK (3 << 0)
  97. # define TARGET_PROFILE_INDEX_SHIFT 0
  98. # define CURRENT_PROFILE_INDEX_MASK (3 << 2)
  99. # define CURRENT_PROFILE_INDEX_SHIFT 2
  100. # define DYN_PWR_ENTER_INDEX(x) ((x) << 4)
  101. # define DYN_PWR_ENTER_INDEX_MASK (3 << 4)
  102. # define DYN_PWR_ENTER_INDEX_SHIFT 4
  103. # define CURR_MCLK_INDEX_MASK (3 << 6)
  104. # define CURR_MCLK_INDEX_SHIFT 6
  105. # define CURR_SCLK_INDEX_MASK (0x1f << 8)
  106. # define CURR_SCLK_INDEX_SHIFT 8
  107. # define CURR_VID_INDEX_MASK (3 << 13)
  108. # define CURR_VID_INDEX_SHIFT 13
  109. #define VID_UPPER_GPIO_CNTL 0x740
  110. # define CTXSW_UPPER_GPIO_VALUES(x) ((x) << 0)
  111. # define CTXSW_UPPER_GPIO_VALUES_MASK (7 << 0)
  112. # define HIGH_UPPER_GPIO_VALUES(x) ((x) << 3)
  113. # define HIGH_UPPER_GPIO_VALUES_MASK (7 << 3)
  114. # define MEDIUM_UPPER_GPIO_VALUES(x) ((x) << 6)
  115. # define MEDIUM_UPPER_GPIO_VALUES_MASK (7 << 6)
  116. # define LOW_UPPER_GPIO_VALUES(x) ((x) << 9)
  117. # define LOW_UPPER_GPIO_VALUES_MASK (7 << 9)
  118. # define CTXSW_BACKBIAS_VALUE (1 << 12)
  119. # define HIGH_BACKBIAS_VALUE (1 << 13)
  120. # define MEDIUM_BACKBIAS_VALUE (1 << 14)
  121. # define LOW_BACKBIAS_VALUE (1 << 15)
  122. #define CG_DISPLAY_GAP_CNTL 0x7dc
  123. # define DISP1_GAP(x) ((x) << 0)
  124. # define DISP1_GAP_MASK (3 << 0)
  125. # define DISP2_GAP(x) ((x) << 2)
  126. # define DISP2_GAP_MASK (3 << 2)
  127. # define VBI_TIMER_COUNT(x) ((x) << 4)
  128. # define VBI_TIMER_COUNT_MASK (0x3fff << 4)
  129. # define VBI_TIMER_UNIT(x) ((x) << 20)
  130. # define VBI_TIMER_UNIT_MASK (7 << 20)
  131. # define DISP1_GAP_MCHG(x) ((x) << 24)
  132. # define DISP1_GAP_MCHG_MASK (3 << 24)
  133. # define DISP2_GAP_MCHG(x) ((x) << 26)
  134. # define DISP2_GAP_MCHG_MASK (3 << 26)
  135. #define CG_THERMAL_CTRL 0x7f0
  136. # define DPM_EVENT_SRC(x) ((x) << 0)
  137. # define DPM_EVENT_SRC_MASK (7 << 0)
  138. # define THERM_INC_CLK (1 << 3)
  139. # define TOFFSET(x) ((x) << 4)
  140. # define TOFFSET_MASK (0xff << 4)
  141. # define DIG_THERM_DPM(x) ((x) << 12)
  142. # define DIG_THERM_DPM_MASK (0xff << 12)
  143. # define CTF_SEL(x) ((x) << 20)
  144. # define CTF_SEL_MASK (7 << 20)
  145. # define CTF_PAD_POLARITY (1 << 23)
  146. # define CTF_PAD_EN (1 << 24)
  147. #define CG_SPLL_SPREAD_SPECTRUM_LOW 0x820
  148. # define SSEN (1 << 0)
  149. # define CLKS(x) ((x) << 3)
  150. # define CLKS_MASK (0xff << 3)
  151. # define CLKS_SHIFT 3
  152. # define CLKV(x) ((x) << 11)
  153. # define CLKV_MASK (0x7ff << 11)
  154. # define CLKV_SHIFT 11
  155. #define CG_MPLL_SPREAD_SPECTRUM 0x830
  156. #define CITF_CNTL 0x200c
  157. # define BLACKOUT_RD (1 << 0)
  158. # define BLACKOUT_WR (1 << 1)
  159. #define RAMCFG 0x2408
  160. #define NOOFBANK_SHIFT 0
  161. #define NOOFBANK_MASK 0x00000001
  162. #define NOOFRANK_SHIFT 1
  163. #define NOOFRANK_MASK 0x00000002
  164. #define NOOFROWS_SHIFT 2
  165. #define NOOFROWS_MASK 0x0000001C
  166. #define NOOFCOLS_SHIFT 5
  167. #define NOOFCOLS_MASK 0x00000060
  168. #define CHANSIZE_SHIFT 7
  169. #define CHANSIZE_MASK 0x00000080
  170. #define BURSTLENGTH_SHIFT 8
  171. #define BURSTLENGTH_MASK 0x00000100
  172. #define CHANSIZE_OVERRIDE (1 << 10)
  173. #define SQM_RATIO 0x2424
  174. # define STATE0(x) ((x) << 0)
  175. # define STATE0_MASK (0xff << 0)
  176. # define STATE1(x) ((x) << 8)
  177. # define STATE1_MASK (0xff << 8)
  178. # define STATE2(x) ((x) << 16)
  179. # define STATE2_MASK (0xff << 16)
  180. # define STATE3(x) ((x) << 24)
  181. # define STATE3_MASK (0xff << 24)
  182. #define ARB_RFSH_CNTL 0x2460
  183. # define ENABLE (1 << 0)
  184. #define ARB_RFSH_RATE 0x2464
  185. # define POWERMODE0(x) ((x) << 0)
  186. # define POWERMODE0_MASK (0xff << 0)
  187. # define POWERMODE1(x) ((x) << 8)
  188. # define POWERMODE1_MASK (0xff << 8)
  189. # define POWERMODE2(x) ((x) << 16)
  190. # define POWERMODE2_MASK (0xff << 16)
  191. # define POWERMODE3(x) ((x) << 24)
  192. # define POWERMODE3_MASK (0xff << 24)
  193. #define MC_SEQ_DRAM 0x2608
  194. # define CKE_DYN (1 << 12)
  195. #define MC_SEQ_CMD 0x26c4
  196. #define MC_SEQ_RESERVE_S 0x2890
  197. #define MC_SEQ_RESERVE_M 0x2894
  198. #define LVTMA_DATA_SYNCHRONIZATION 0x7adc
  199. # define LVTMA_PFREQCHG (1 << 8)
  200. #define DCE3_LVTMA_DATA_SYNCHRONIZATION 0x7f98
  201. /* PCIE indirect regs */
  202. #define PCIE_P_CNTL 0x40
  203. # define P_PLL_PWRDN_IN_L1L23 (1 << 3)
  204. # define P_PLL_BUF_PDNB (1 << 4)
  205. # define P_PLL_PDNB (1 << 9)
  206. # define P_ALLOW_PRX_FRONTEND_SHUTOFF (1 << 12)
  207. /* PCIE PORT indirect regs */
  208. #define PCIE_LC_CNTL 0xa0
  209. # define LC_L0S_INACTIVITY(x) ((x) << 8)
  210. # define LC_L0S_INACTIVITY_MASK (0xf << 8)
  211. # define LC_L0S_INACTIVITY_SHIFT 8
  212. # define LC_L1_INACTIVITY(x) ((x) << 12)
  213. # define LC_L1_INACTIVITY_MASK (0xf << 12)
  214. # define LC_L1_INACTIVITY_SHIFT 12
  215. # define LC_PMI_TO_L1_DIS (1 << 16)
  216. # define LC_ASPM_TO_L1_DIS (1 << 24)
  217. #define PCIE_LC_SPEED_CNTL 0xa4
  218. # define LC_GEN2_EN (1 << 0)
  219. # define LC_INITIATE_LINK_SPEED_CHANGE (1 << 7)
  220. # define LC_CURRENT_DATA_RATE (1 << 11)
  221. # define LC_HW_VOLTAGE_IF_CONTROL(x) ((x) << 12)
  222. # define LC_HW_VOLTAGE_IF_CONTROL_MASK (3 << 12)
  223. # define LC_HW_VOLTAGE_IF_CONTROL_SHIFT 12
  224. # define LC_OTHER_SIDE_EVER_SENT_GEN2 (1 << 23)
  225. # define LC_OTHER_SIDE_SUPPORTS_GEN2 (1 << 24)
  226. #endif