sumod.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. /*
  2. * Copyright 2012 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. * Authors: Alex Deucher
  23. */
  24. #ifndef _SUMOD_H_
  25. #define _SUMOD_H_
  26. /* pm registers */
  27. /* rcu */
  28. #define RCU_FW_VERSION 0x30c
  29. #define RCU_PWR_GATING_SEQ0 0x408
  30. #define RCU_PWR_GATING_SEQ1 0x40c
  31. #define RCU_PWR_GATING_CNTL 0x410
  32. # define PWR_GATING_EN (1 << 0)
  33. # define RSVD_MASK (0x3 << 1)
  34. # define PCV(x) ((x) << 3)
  35. # define PCV_MASK (0x1f << 3)
  36. # define PCV_SHIFT 3
  37. # define PCP(x) ((x) << 8)
  38. # define PCP_MASK (0xf << 8)
  39. # define PCP_SHIFT 8
  40. # define RPW(x) ((x) << 16)
  41. # define RPW_MASK (0xf << 16)
  42. # define RPW_SHIFT 16
  43. # define ID(x) ((x) << 24)
  44. # define ID_MASK (0xf << 24)
  45. # define ID_SHIFT 24
  46. # define PGS(x) ((x) << 28)
  47. # define PGS_MASK (0xf << 28)
  48. # define PGS_SHIFT 28
  49. #define RCU_ALTVDDNB_NOTIFY 0x430
  50. #define RCU_LCLK_SCALING_CNTL 0x434
  51. # define LCLK_SCALING_EN (1 << 0)
  52. # define LCLK_SCALING_TYPE (1 << 1)
  53. # define LCLK_SCALING_TIMER_PRESCALER(x) ((x) << 4)
  54. # define LCLK_SCALING_TIMER_PRESCALER_MASK (0xf << 4)
  55. # define LCLK_SCALING_TIMER_PRESCALER_SHIFT 4
  56. # define LCLK_SCALING_TIMER_PERIOD(x) ((x) << 16)
  57. # define LCLK_SCALING_TIMER_PERIOD_MASK (0xf << 16)
  58. # define LCLK_SCALING_TIMER_PERIOD_SHIFT 16
  59. #define RCU_PWR_GATING_CNTL_2 0x4a0
  60. # define MPPU(x) ((x) << 0)
  61. # define MPPU_MASK (0xffff << 0)
  62. # define MPPU_SHIFT 0
  63. # define MPPD(x) ((x) << 16)
  64. # define MPPD_MASK (0xffff << 16)
  65. # define MPPD_SHIFT 16
  66. #define RCU_PWR_GATING_CNTL_3 0x4a4
  67. # define DPPU(x) ((x) << 0)
  68. # define DPPU_MASK (0xffff << 0)
  69. # define DPPU_SHIFT 0
  70. # define DPPD(x) ((x) << 16)
  71. # define DPPD_MASK (0xffff << 16)
  72. # define DPPD_SHIFT 16
  73. #define RCU_PWR_GATING_CNTL_4 0x4a8
  74. # define RT(x) ((x) << 0)
  75. # define RT_MASK (0xffff << 0)
  76. # define RT_SHIFT 0
  77. # define IT(x) ((x) << 16)
  78. # define IT_MASK (0xffff << 16)
  79. # define IT_SHIFT 16
  80. /* yes these two have the same address */
  81. #define RCU_PWR_GATING_CNTL_5 0x504
  82. #define RCU_GPU_BOOST_DISABLE 0x508
  83. #define MCU_M3ARB_INDEX 0x504
  84. #define MCU_M3ARB_PARAMS 0x508
  85. #define RCU_GNB_PWR_REP_TIMER_CNTL 0x50C
  86. #define RCU_SclkDpmTdpLimit01 0x514
  87. #define RCU_SclkDpmTdpLimit23 0x518
  88. #define RCU_SclkDpmTdpLimit47 0x51C
  89. #define RCU_SclkDpmTdpLimitPG 0x520
  90. #define GNB_TDP_LIMIT 0x540
  91. #define RCU_BOOST_MARGIN 0x544
  92. #define RCU_THROTTLE_MARGIN 0x548
  93. #define SMU_PCIE_PG_ARGS 0x58C
  94. #define SMU_PCIE_PG_ARGS_2 0x598
  95. #define SMU_PCIE_PG_ARGS_3 0x59C
  96. /* mmio */
  97. #define RCU_STATUS 0x11c
  98. # define GMC_PWR_GATER_BUSY (1 << 8)
  99. # define GFX_PWR_GATER_BUSY (1 << 9)
  100. # define UVD_PWR_GATER_BUSY (1 << 10)
  101. # define PCIE_PWR_GATER_BUSY (1 << 11)
  102. # define GMC_PWR_GATER_STATE (1 << 12)
  103. # define GFX_PWR_GATER_STATE (1 << 13)
  104. # define UVD_PWR_GATER_STATE (1 << 14)
  105. # define PCIE_PWR_GATER_STATE (1 << 15)
  106. # define GFX1_PWR_GATER_BUSY (1 << 16)
  107. # define GFX2_PWR_GATER_BUSY (1 << 17)
  108. # define GFX1_PWR_GATER_STATE (1 << 18)
  109. # define GFX2_PWR_GATER_STATE (1 << 19)
  110. #define GFX_INT_REQ 0x120
  111. # define INT_REQ (1 << 0)
  112. # define SERV_INDEX(x) ((x) << 1)
  113. # define SERV_INDEX_MASK (0xff << 1)
  114. # define SERV_INDEX_SHIFT 1
  115. #define GFX_INT_STATUS 0x124
  116. # define INT_ACK (1 << 0)
  117. # define INT_DONE (1 << 1)
  118. #define CG_SCLK_CNTL 0x600
  119. # define SCLK_DIVIDER(x) ((x) << 0)
  120. # define SCLK_DIVIDER_MASK (0x7f << 0)
  121. # define SCLK_DIVIDER_SHIFT 0
  122. #define CG_SCLK_STATUS 0x604
  123. # define SCLK_OVERCLK_DETECT (1 << 2)
  124. #define CG_DCLK_CNTL 0x610
  125. # define DCLK_DIVIDER_MASK 0x7f
  126. # define DCLK_DIR_CNTL_EN (1 << 8)
  127. #define CG_DCLK_STATUS 0x614
  128. # define DCLK_STATUS (1 << 0)
  129. #define CG_VCLK_CNTL 0x618
  130. # define VCLK_DIVIDER_MASK 0x7f
  131. # define VCLK_DIR_CNTL_EN (1 << 8)
  132. #define CG_VCLK_STATUS 0x61c
  133. #define GENERAL_PWRMGT 0x63c
  134. # define STATIC_PM_EN (1 << 1)
  135. #define SCLK_PWRMGT_CNTL 0x644
  136. # define SCLK_PWRMGT_OFF (1 << 0)
  137. # define SCLK_LOW_D1 (1 << 1)
  138. # define FIR_RESET (1 << 4)
  139. # define FIR_FORCE_TREND_SEL (1 << 5)
  140. # define FIR_TREND_MODE (1 << 6)
  141. # define DYN_GFX_CLK_OFF_EN (1 << 7)
  142. # define GFX_CLK_FORCE_ON (1 << 8)
  143. # define GFX_CLK_REQUEST_OFF (1 << 9)
  144. # define GFX_CLK_FORCE_OFF (1 << 10)
  145. # define GFX_CLK_OFF_ACPI_D1 (1 << 11)
  146. # define GFX_CLK_OFF_ACPI_D2 (1 << 12)
  147. # define GFX_CLK_OFF_ACPI_D3 (1 << 13)
  148. # define GFX_VOLTAGE_CHANGE_EN (1 << 16)
  149. # define GFX_VOLTAGE_CHANGE_MODE (1 << 17)
  150. #define TARGET_AND_CURRENT_PROFILE_INDEX 0x66c
  151. # define TARG_SCLK_INDEX(x) ((x) << 6)
  152. # define TARG_SCLK_INDEX_MASK (0x7 << 6)
  153. # define TARG_SCLK_INDEX_SHIFT 6
  154. # define CURR_SCLK_INDEX(x) ((x) << 9)
  155. # define CURR_SCLK_INDEX_MASK (0x7 << 9)
  156. # define CURR_SCLK_INDEX_SHIFT 9
  157. # define TARG_INDEX(x) ((x) << 12)
  158. # define TARG_INDEX_MASK (0x7 << 12)
  159. # define TARG_INDEX_SHIFT 12
  160. # define CURR_INDEX(x) ((x) << 15)
  161. # define CURR_INDEX_MASK (0x7 << 15)
  162. # define CURR_INDEX_SHIFT 15
  163. #define CG_SCLK_DPM_CTRL 0x684
  164. # define SCLK_FSTATE_0_DIV(x) ((x) << 0)
  165. # define SCLK_FSTATE_0_DIV_MASK (0x7f << 0)
  166. # define SCLK_FSTATE_0_DIV_SHIFT 0
  167. # define SCLK_FSTATE_0_VLD (1 << 7)
  168. # define SCLK_FSTATE_1_DIV(x) ((x) << 8)
  169. # define SCLK_FSTATE_1_DIV_MASK (0x7f << 8)
  170. # define SCLK_FSTATE_1_DIV_SHIFT 8
  171. # define SCLK_FSTATE_1_VLD (1 << 15)
  172. # define SCLK_FSTATE_2_DIV(x) ((x) << 16)
  173. # define SCLK_FSTATE_2_DIV_MASK (0x7f << 16)
  174. # define SCLK_FSTATE_2_DIV_SHIFT 16
  175. # define SCLK_FSTATE_2_VLD (1 << 23)
  176. # define SCLK_FSTATE_3_DIV(x) ((x) << 24)
  177. # define SCLK_FSTATE_3_DIV_MASK (0x7f << 24)
  178. # define SCLK_FSTATE_3_DIV_SHIFT 24
  179. # define SCLK_FSTATE_3_VLD (1 << 31)
  180. #define CG_SCLK_DPM_CTRL_2 0x688
  181. #define CG_GCOOR 0x68c
  182. # define PHC(x) ((x) << 0)
  183. # define PHC_MASK (0x1f << 0)
  184. # define PHC_SHIFT 0
  185. # define SDC(x) ((x) << 9)
  186. # define SDC_MASK (0x3ff << 9)
  187. # define SDC_SHIFT 9
  188. # define SU(x) ((x) << 23)
  189. # define SU_MASK (0xf << 23)
  190. # define SU_SHIFT 23
  191. # define DIV_ID(x) ((x) << 28)
  192. # define DIV_ID_MASK (0x7 << 28)
  193. # define DIV_ID_SHIFT 28
  194. #define CG_FTV 0x690
  195. #define CG_FFCT_0 0x694
  196. # define UTC_0(x) ((x) << 0)
  197. # define UTC_0_MASK (0x3ff << 0)
  198. # define UTC_0_SHIFT 0
  199. # define DTC_0(x) ((x) << 10)
  200. # define DTC_0_MASK (0x3ff << 10)
  201. # define DTC_0_SHIFT 10
  202. #define CG_GIT 0x6d8
  203. # define CG_GICST(x) ((x) << 0)
  204. # define CG_GICST_MASK (0xffff << 0)
  205. # define CG_GICST_SHIFT 0
  206. # define CG_GIPOT(x) ((x) << 16)
  207. # define CG_GIPOT_MASK (0xffff << 16)
  208. # define CG_GIPOT_SHIFT 16
  209. #define CG_SCLK_DPM_CTRL_3 0x6e0
  210. # define FORCE_SCLK_STATE(x) ((x) << 0)
  211. # define FORCE_SCLK_STATE_MASK (0x7 << 0)
  212. # define FORCE_SCLK_STATE_SHIFT 0
  213. # define FORCE_SCLK_STATE_EN (1 << 3)
  214. # define GNB_TT(x) ((x) << 8)
  215. # define GNB_TT_MASK (0xff << 8)
  216. # define GNB_TT_SHIFT 8
  217. # define GNB_THERMTHRO_MASK (1 << 16)
  218. # define CNB_THERMTHRO_MASK_SCLK (1 << 17)
  219. # define DPM_SCLK_ENABLE (1 << 18)
  220. # define GNB_SLOW_FSTATE_0_MASK (1 << 23)
  221. # define GNB_SLOW_FSTATE_0_SHIFT 23
  222. # define FORCE_NB_PSTATE_1 (1 << 31)
  223. #define CG_SSP 0x6e8
  224. # define SST(x) ((x) << 0)
  225. # define SST_MASK (0xffff << 0)
  226. # define SST_SHIFT 0
  227. # define SSTU(x) ((x) << 16)
  228. # define SSTU_MASK (0xffff << 16)
  229. # define SSTU_SHIFT 16
  230. #define CG_ACPI_CNTL 0x70c
  231. # define SCLK_ACPI_DIV(x) ((x) << 0)
  232. # define SCLK_ACPI_DIV_MASK (0x7f << 0)
  233. # define SCLK_ACPI_DIV_SHIFT 0
  234. #define CG_SCLK_DPM_CTRL_4 0x71c
  235. # define DC_HDC(x) ((x) << 14)
  236. # define DC_HDC_MASK (0x3fff << 14)
  237. # define DC_HDC_SHIFT 14
  238. # define DC_HU(x) ((x) << 28)
  239. # define DC_HU_MASK (0xf << 28)
  240. # define DC_HU_SHIFT 28
  241. #define CG_SCLK_DPM_CTRL_5 0x720
  242. # define SCLK_FSTATE_BOOTUP(x) ((x) << 0)
  243. # define SCLK_FSTATE_BOOTUP_MASK (0x7 << 0)
  244. # define SCLK_FSTATE_BOOTUP_SHIFT 0
  245. # define TT_TP(x) ((x) << 3)
  246. # define TT_TP_MASK (0xffff << 3)
  247. # define TT_TP_SHIFT 3
  248. # define TT_TU(x) ((x) << 19)
  249. # define TT_TU_MASK (0xff << 19)
  250. # define TT_TU_SHIFT 19
  251. #define CG_SCLK_DPM_CTRL_6 0x724
  252. #define CG_AT_0 0x728
  253. # define CG_R(x) ((x) << 0)
  254. # define CG_R_MASK (0xffff << 0)
  255. # define CG_R_SHIFT 0
  256. # define CG_L(x) ((x) << 16)
  257. # define CG_L_MASK (0xffff << 16)
  258. # define CG_L_SHIFT 16
  259. #define CG_AT_1 0x72c
  260. #define CG_AT_2 0x730
  261. #define CG_THERMAL_INT 0x734
  262. #define DIG_THERM_INTH(x) ((x) << 8)
  263. #define DIG_THERM_INTH_MASK 0x0000FF00
  264. #define DIG_THERM_INTH_SHIFT 8
  265. #define DIG_THERM_INTL(x) ((x) << 16)
  266. #define DIG_THERM_INTL_MASK 0x00FF0000
  267. #define DIG_THERM_INTL_SHIFT 16
  268. #define THERM_INT_MASK_HIGH (1 << 24)
  269. #define THERM_INT_MASK_LOW (1 << 25)
  270. #define CG_AT_3 0x738
  271. #define CG_AT_4 0x73c
  272. #define CG_AT_5 0x740
  273. #define CG_AT_6 0x744
  274. #define CG_AT_7 0x748
  275. #define CG_BSP_0 0x750
  276. # define BSP(x) ((x) << 0)
  277. # define BSP_MASK (0xffff << 0)
  278. # define BSP_SHIFT 0
  279. # define BSU(x) ((x) << 16)
  280. # define BSU_MASK (0xf << 16)
  281. # define BSU_SHIFT 16
  282. #define CG_CG_VOLTAGE_CNTL 0x770
  283. # define REQ (1 << 0)
  284. # define LEVEL(x) ((x) << 1)
  285. # define LEVEL_MASK (0x3 << 1)
  286. # define LEVEL_SHIFT 1
  287. # define CG_VOLTAGE_EN (1 << 3)
  288. # define FORCE (1 << 4)
  289. # define PERIOD(x) ((x) << 8)
  290. # define PERIOD_MASK (0xffff << 8)
  291. # define PERIOD_SHIFT 8
  292. # define UNIT(x) ((x) << 24)
  293. # define UNIT_MASK (0xf << 24)
  294. # define UNIT_SHIFT 24
  295. #define CG_ACPI_VOLTAGE_CNTL 0x780
  296. # define ACPI_VOLTAGE_EN (1 << 8)
  297. #define CG_DPM_VOLTAGE_CNTL 0x788
  298. # define DPM_STATE0_LEVEL_MASK (0x3 << 0)
  299. # define DPM_STATE0_LEVEL_SHIFT 0
  300. # define DPM_VOLTAGE_EN (1 << 16)
  301. #define CG_PWR_GATING_CNTL 0x7ac
  302. # define DYN_PWR_DOWN_EN (1 << 0)
  303. # define ACPI_PWR_DOWN_EN (1 << 1)
  304. # define GFX_CLK_OFF_PWR_DOWN_EN (1 << 2)
  305. # define IOC_DISGPU_PWR_DOWN_EN (1 << 3)
  306. # define FORCE_POWR_ON (1 << 4)
  307. # define PGP(x) ((x) << 8)
  308. # define PGP_MASK (0xffff << 8)
  309. # define PGP_SHIFT 8
  310. # define PGU(x) ((x) << 24)
  311. # define PGU_MASK (0xf << 24)
  312. # define PGU_SHIFT 24
  313. #define CG_CGTT_LOCAL_0 0x7d0
  314. #define CG_CGTT_LOCAL_1 0x7d4
  315. #define DEEP_SLEEP_CNTL 0x818
  316. # define R_DIS (1 << 3)
  317. # define HS(x) ((x) << 4)
  318. # define HS_MASK (0xfff << 4)
  319. # define HS_SHIFT 4
  320. # define ENABLE_DS (1 << 31)
  321. #define DEEP_SLEEP_CNTL2 0x81c
  322. # define LB_UFP_EN (1 << 0)
  323. # define INOUT_C(x) ((x) << 4)
  324. # define INOUT_C_MASK (0xff << 4)
  325. # define INOUT_C_SHIFT 4
  326. #define CG_SCRATCH2 0x824
  327. #define CG_SCLK_DPM_CTRL_11 0x830
  328. #define HW_REV 0x5564
  329. # define ATI_REV_ID_MASK (0xf << 28)
  330. # define ATI_REV_ID_SHIFT 28
  331. /* 0 = A0, 1 = A1, 2 = B0, 3 = C0, etc. */
  332. #define DOUT_SCRATCH3 0x611c
  333. #define GB_ADDR_CONFIG 0x98f8
  334. #endif