btcd.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. * Copyright 2010 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 _BTCD_H_
  25. #define _BTCD_H_
  26. /* pm registers */
  27. #define GENERAL_PWRMGT 0x63c
  28. # define GLOBAL_PWRMGT_EN (1 << 0)
  29. # define STATIC_PM_EN (1 << 1)
  30. # define THERMAL_PROTECTION_DIS (1 << 2)
  31. # define THERMAL_PROTECTION_TYPE (1 << 3)
  32. # define ENABLE_GEN2PCIE (1 << 4)
  33. # define ENABLE_GEN2XSP (1 << 5)
  34. # define SW_SMIO_INDEX(x) ((x) << 6)
  35. # define SW_SMIO_INDEX_MASK (3 << 6)
  36. # define SW_SMIO_INDEX_SHIFT 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 << 18)
  41. # define BACKBIAS_VALUE (1 << 19)
  42. # define DYN_SPREAD_SPECTRUM_EN (1 << 23)
  43. # define AC_DC_SW (1 << 24)
  44. #define TARGET_AND_CURRENT_PROFILE_INDEX 0x66c
  45. # define CURRENT_PROFILE_INDEX_MASK (0xf << 4)
  46. # define CURRENT_PROFILE_INDEX_SHIFT 4
  47. #define CG_BIF_REQ_AND_RSP 0x7f4
  48. #define CG_CLIENT_REQ(x) ((x) << 0)
  49. #define CG_CLIENT_REQ_MASK (0xff << 0)
  50. #define CG_CLIENT_REQ_SHIFT 0
  51. #define CG_CLIENT_RESP(x) ((x) << 8)
  52. #define CG_CLIENT_RESP_MASK (0xff << 8)
  53. #define CG_CLIENT_RESP_SHIFT 8
  54. #define CLIENT_CG_REQ(x) ((x) << 16)
  55. #define CLIENT_CG_REQ_MASK (0xff << 16)
  56. #define CLIENT_CG_REQ_SHIFT 16
  57. #define CLIENT_CG_RESP(x) ((x) << 24)
  58. #define CLIENT_CG_RESP_MASK (0xff << 24)
  59. #define CLIENT_CG_RESP_SHIFT 24
  60. #define SCLK_PSKIP_CNTL 0x8c0
  61. #define PSKIP_ON_ALLOW_STOP_HI(x) ((x) << 16)
  62. #define PSKIP_ON_ALLOW_STOP_HI_MASK (0xff << 16)
  63. #define PSKIP_ON_ALLOW_STOP_HI_SHIFT 16
  64. #define CG_ULV_CONTROL 0x8c8
  65. #define CG_ULV_PARAMETER 0x8cc
  66. #define MC_ARB_DRAM_TIMING 0x2774
  67. #define MC_ARB_DRAM_TIMING2 0x2778
  68. #define MC_ARB_RFSH_RATE 0x27b0
  69. #define POWERMODE0(x) ((x) << 0)
  70. #define POWERMODE0_MASK (0xff << 0)
  71. #define POWERMODE0_SHIFT 0
  72. #define POWERMODE1(x) ((x) << 8)
  73. #define POWERMODE1_MASK (0xff << 8)
  74. #define POWERMODE1_SHIFT 8
  75. #define POWERMODE2(x) ((x) << 16)
  76. #define POWERMODE2_MASK (0xff << 16)
  77. #define POWERMODE2_SHIFT 16
  78. #define POWERMODE3(x) ((x) << 24)
  79. #define POWERMODE3_MASK (0xff << 24)
  80. #define POWERMODE3_SHIFT 24
  81. #define MC_ARB_BURST_TIME 0x2808
  82. #define STATE0(x) ((x) << 0)
  83. #define STATE0_MASK (0x1f << 0)
  84. #define STATE0_SHIFT 0
  85. #define STATE1(x) ((x) << 5)
  86. #define STATE1_MASK (0x1f << 5)
  87. #define STATE1_SHIFT 5
  88. #define STATE2(x) ((x) << 10)
  89. #define STATE2_MASK (0x1f << 10)
  90. #define STATE2_SHIFT 10
  91. #define STATE3(x) ((x) << 15)
  92. #define STATE3_MASK (0x1f << 15)
  93. #define STATE3_SHIFT 15
  94. #define MC_SEQ_RAS_TIMING 0x28a0
  95. #define MC_SEQ_CAS_TIMING 0x28a4
  96. #define MC_SEQ_MISC_TIMING 0x28a8
  97. #define MC_SEQ_MISC_TIMING2 0x28ac
  98. #define MC_SEQ_RD_CTL_D0 0x28b4
  99. #define MC_SEQ_RD_CTL_D1 0x28b8
  100. #define MC_SEQ_WR_CTL_D0 0x28bc
  101. #define MC_SEQ_WR_CTL_D1 0x28c0
  102. #define MC_PMG_AUTO_CFG 0x28d4
  103. #define MC_SEQ_STATUS_M 0x29f4
  104. # define PMG_PWRSTATE (1 << 16)
  105. #define MC_SEQ_MISC0 0x2a00
  106. #define MC_SEQ_MISC0_GDDR5_SHIFT 28
  107. #define MC_SEQ_MISC0_GDDR5_MASK 0xf0000000
  108. #define MC_SEQ_MISC0_GDDR5_VALUE 5
  109. #define MC_SEQ_MISC1 0x2a04
  110. #define MC_SEQ_RESERVE_M 0x2a08
  111. #define MC_PMG_CMD_EMRS 0x2a0c
  112. #define MC_SEQ_MISC3 0x2a2c
  113. #define MC_SEQ_MISC5 0x2a54
  114. #define MC_SEQ_MISC6 0x2a58
  115. #define MC_SEQ_MISC7 0x2a64
  116. #define MC_SEQ_CG 0x2a68
  117. #define CG_SEQ_REQ(x) ((x) << 0)
  118. #define CG_SEQ_REQ_MASK (0xff << 0)
  119. #define CG_SEQ_REQ_SHIFT 0
  120. #define CG_SEQ_RESP(x) ((x) << 8)
  121. #define CG_SEQ_RESP_MASK (0xff << 8)
  122. #define CG_SEQ_RESP_SHIFT 8
  123. #define SEQ_CG_REQ(x) ((x) << 16)
  124. #define SEQ_CG_REQ_MASK (0xff << 16)
  125. #define SEQ_CG_REQ_SHIFT 16
  126. #define SEQ_CG_RESP(x) ((x) << 24)
  127. #define SEQ_CG_RESP_MASK (0xff << 24)
  128. #define SEQ_CG_RESP_SHIFT 24
  129. #define MC_SEQ_RAS_TIMING_LP 0x2a6c
  130. #define MC_SEQ_CAS_TIMING_LP 0x2a70
  131. #define MC_SEQ_MISC_TIMING_LP 0x2a74
  132. #define MC_SEQ_MISC_TIMING2_LP 0x2a78
  133. #define MC_SEQ_WR_CTL_D0_LP 0x2a7c
  134. #define MC_SEQ_WR_CTL_D1_LP 0x2a80
  135. #define MC_SEQ_PMG_CMD_EMRS_LP 0x2a84
  136. #define MC_SEQ_PMG_CMD_MRS_LP 0x2a88
  137. #define MC_PMG_CMD_MRS 0x2aac
  138. #define MC_SEQ_RD_CTL_D0_LP 0x2b1c
  139. #define MC_SEQ_RD_CTL_D1_LP 0x2b20
  140. #define MC_PMG_CMD_MRS1 0x2b44
  141. #define MC_SEQ_PMG_CMD_MRS1_LP 0x2b48
  142. #define LB_SYNC_RESET_SEL 0x6b28
  143. #define LB_SYNC_RESET_SEL_MASK (3 << 0)
  144. #define LB_SYNC_RESET_SEL_SHIFT 0
  145. /* PCIE link stuff */
  146. #define PCIE_LC_SPEED_CNTL 0xa4 /* PCIE_P */
  147. # define LC_GEN2_EN_STRAP (1 << 0)
  148. # define LC_TARGET_LINK_SPEED_OVERRIDE_EN (1 << 1)
  149. # define LC_FORCE_EN_HW_SPEED_CHANGE (1 << 5)
  150. # define LC_FORCE_DIS_HW_SPEED_CHANGE (1 << 6)
  151. # define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_MASK (0x3 << 8)
  152. # define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_SHIFT 3
  153. # define LC_CURRENT_DATA_RATE (1 << 11)
  154. # define LC_HW_VOLTAGE_IF_CONTROL(x) ((x) << 12)
  155. # define LC_HW_VOLTAGE_IF_CONTROL_MASK (3 << 12)
  156. # define LC_HW_VOLTAGE_IF_CONTROL_SHIFT 12
  157. # define LC_VOLTAGE_TIMER_SEL_MASK (0xf << 14)
  158. # define LC_CLR_FAILED_SPD_CHANGE_CNT (1 << 21)
  159. # define LC_OTHER_SIDE_EVER_SENT_GEN2 (1 << 23)
  160. # define LC_OTHER_SIDE_SUPPORTS_GEN2 (1 << 24)
  161. #endif