18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2012 Advanced Micro Devices, Inc.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
128c2ecf20Sopenharmony_ci * all copies or substantial portions of the Software.
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
158c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
168c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
178c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
188c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
198c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
208c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * Authors: Alex Deucher
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_ci#ifndef _TRINITYD_H_
258c2ecf20Sopenharmony_ci#define _TRINITYD_H_
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/* pm registers */
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/* cg */
308c2ecf20Sopenharmony_ci#define CG_CGTT_LOCAL_0                                 0x0
318c2ecf20Sopenharmony_ci#define CG_CGTT_LOCAL_1                                 0x1
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/* smc */
348c2ecf20Sopenharmony_ci#define SMU_SCLK_DPM_STATE_0_CNTL_0                     0x1f000
358c2ecf20Sopenharmony_ci#       define STATE_VALID(x)                           ((x) << 0)
368c2ecf20Sopenharmony_ci#       define STATE_VALID_MASK                         (0xff << 0)
378c2ecf20Sopenharmony_ci#       define STATE_VALID_SHIFT                        0
388c2ecf20Sopenharmony_ci#       define CLK_DIVIDER(x)                           ((x) << 8)
398c2ecf20Sopenharmony_ci#       define CLK_DIVIDER_MASK                         (0xff << 8)
408c2ecf20Sopenharmony_ci#       define CLK_DIVIDER_SHIFT                        8
418c2ecf20Sopenharmony_ci#       define VID(x)                                   ((x) << 16)
428c2ecf20Sopenharmony_ci#       define VID_MASK                                 (0xff << 16)
438c2ecf20Sopenharmony_ci#       define VID_SHIFT                                16
448c2ecf20Sopenharmony_ci#       define LVRT(x)                                  ((x) << 24)
458c2ecf20Sopenharmony_ci#       define LVRT_MASK                                (0xff << 24)
468c2ecf20Sopenharmony_ci#       define LVRT_SHIFT                               24
478c2ecf20Sopenharmony_ci#define SMU_SCLK_DPM_STATE_0_CNTL_1                     0x1f004
488c2ecf20Sopenharmony_ci#       define DS_DIV(x)                                ((x) << 0)
498c2ecf20Sopenharmony_ci#       define DS_DIV_MASK                              (0xff << 0)
508c2ecf20Sopenharmony_ci#       define DS_DIV_SHIFT                             0
518c2ecf20Sopenharmony_ci#       define DS_SH_DIV(x)                             ((x) << 8)
528c2ecf20Sopenharmony_ci#       define DS_SH_DIV_MASK                           (0xff << 8)
538c2ecf20Sopenharmony_ci#       define DS_SH_DIV_SHIFT                          8
548c2ecf20Sopenharmony_ci#       define DISPLAY_WM(x)                            ((x) << 16)
558c2ecf20Sopenharmony_ci#       define DISPLAY_WM_MASK                          (0xff << 16)
568c2ecf20Sopenharmony_ci#       define DISPLAY_WM_SHIFT                         16
578c2ecf20Sopenharmony_ci#       define VCE_WM(x)                                ((x) << 24)
588c2ecf20Sopenharmony_ci#       define VCE_WM_MASK                              (0xff << 24)
598c2ecf20Sopenharmony_ci#       define VCE_WM_SHIFT                             24
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define SMU_SCLK_DPM_STATE_0_CNTL_3                     0x1f00c
628c2ecf20Sopenharmony_ci#       define GNB_SLOW(x)                              ((x) << 0)
638c2ecf20Sopenharmony_ci#       define GNB_SLOW_MASK                            (0xff << 0)
648c2ecf20Sopenharmony_ci#       define GNB_SLOW_SHIFT                           0
658c2ecf20Sopenharmony_ci#       define FORCE_NBPS1(x)                           ((x) << 8)
668c2ecf20Sopenharmony_ci#       define FORCE_NBPS1_MASK                         (0xff << 8)
678c2ecf20Sopenharmony_ci#       define FORCE_NBPS1_SHIFT                        8
688c2ecf20Sopenharmony_ci#define SMU_SCLK_DPM_STATE_0_AT                         0x1f010
698c2ecf20Sopenharmony_ci#       define AT(x)                                    ((x) << 0)
708c2ecf20Sopenharmony_ci#       define AT_MASK                                  (0xff << 0)
718c2ecf20Sopenharmony_ci#       define AT_SHIFT                                 0
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#define SMU_SCLK_DPM_STATE_0_PG_CNTL                    0x1f014
748c2ecf20Sopenharmony_ci#       define PD_SCLK_DIVIDER(x)                       ((x) << 16)
758c2ecf20Sopenharmony_ci#       define PD_SCLK_DIVIDER_MASK                     (0xff << 16)
768c2ecf20Sopenharmony_ci#       define PD_SCLK_DIVIDER_SHIFT                    16
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#define SMU_SCLK_DPM_STATE_1_CNTL_0                     0x1f020
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#define SMU_SCLK_DPM_CNTL                               0x1f100
818c2ecf20Sopenharmony_ci#       define SCLK_DPM_EN(x)                           ((x) << 0)
828c2ecf20Sopenharmony_ci#       define SCLK_DPM_EN_MASK                         (0xff << 0)
838c2ecf20Sopenharmony_ci#       define SCLK_DPM_EN_SHIFT                        0
848c2ecf20Sopenharmony_ci#       define SCLK_DPM_BOOT_STATE(x)                   ((x) << 16)
858c2ecf20Sopenharmony_ci#       define SCLK_DPM_BOOT_STATE_MASK                 (0xff << 16)
868c2ecf20Sopenharmony_ci#       define SCLK_DPM_BOOT_STATE_SHIFT                16
878c2ecf20Sopenharmony_ci#       define VOLTAGE_CHG_EN(x)                        ((x) << 24)
888c2ecf20Sopenharmony_ci#       define VOLTAGE_CHG_EN_MASK                      (0xff << 24)
898c2ecf20Sopenharmony_ci#       define VOLTAGE_CHG_EN_SHIFT                     24
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define SMU_SCLK_DPM_TT_CNTL                            0x1f108
928c2ecf20Sopenharmony_ci#       define SCLK_TT_EN(x)                            ((x) << 0)
938c2ecf20Sopenharmony_ci#       define SCLK_TT_EN_MASK                          (0xff << 0)
948c2ecf20Sopenharmony_ci#       define SCLK_TT_EN_SHIFT                         0
958c2ecf20Sopenharmony_ci#define SMU_SCLK_DPM_TTT                                0x1f10c
968c2ecf20Sopenharmony_ci#       define LT(x)                                    ((x) << 0)
978c2ecf20Sopenharmony_ci#       define LT_MASK                                  (0xffff << 0)
988c2ecf20Sopenharmony_ci#       define LT_SHIFT                                 0
998c2ecf20Sopenharmony_ci#       define HT(x)                                    ((x) << 16)
1008c2ecf20Sopenharmony_ci#       define HT_MASK                                  (0xffff << 16)
1018c2ecf20Sopenharmony_ci#       define HT_SHIFT                                 16
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#define SMU_UVD_DPM_STATES                              0x1f1a0
1048c2ecf20Sopenharmony_ci#define SMU_UVD_DPM_CNTL                                0x1f1a4
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define SMU_S_PG_CNTL                                   0x1f118
1078c2ecf20Sopenharmony_ci#       define DS_PG_EN(x)                              ((x) << 16)
1088c2ecf20Sopenharmony_ci#       define DS_PG_EN_MASK                            (0xff << 16)
1098c2ecf20Sopenharmony_ci#       define DS_PG_EN_SHIFT                           16
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci#define GFX_POWER_GATING_CNTL                           0x1f38c
1128c2ecf20Sopenharmony_ci#       define PDS_DIV(x)                               ((x) << 0)
1138c2ecf20Sopenharmony_ci#       define PDS_DIV_MASK                             (0xff << 0)
1148c2ecf20Sopenharmony_ci#       define PDS_DIV_SHIFT                            0
1158c2ecf20Sopenharmony_ci#       define SSSD(x)                                  ((x) << 8)
1168c2ecf20Sopenharmony_ci#       define SSSD_MASK                                (0xff << 8)
1178c2ecf20Sopenharmony_ci#       define SSSD_SHIFT                               8
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci#define PM_CONFIG                                       0x1f428
1208c2ecf20Sopenharmony_ci#       define SVI_Mode                                 (1 << 29)
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci#define PM_I_CNTL_1                                     0x1f464
1238c2ecf20Sopenharmony_ci#       define SCLK_DPM(x)                              ((x) << 0)
1248c2ecf20Sopenharmony_ci#       define SCLK_DPM_MASK                            (0xff << 0)
1258c2ecf20Sopenharmony_ci#       define SCLK_DPM_SHIFT                           0
1268c2ecf20Sopenharmony_ci#       define DS_PG_CNTL(x)                            ((x) << 16)
1278c2ecf20Sopenharmony_ci#       define DS_PG_CNTL_MASK                          (0xff << 16)
1288c2ecf20Sopenharmony_ci#       define DS_PG_CNTL_SHIFT                         16
1298c2ecf20Sopenharmony_ci#define PM_TP                                           0x1f468
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci#define NB_PSTATE_CONFIG                                0x1f5f8
1328c2ecf20Sopenharmony_ci#       define Dpm0PgNbPsLo(x)                          ((x) << 0)
1338c2ecf20Sopenharmony_ci#       define Dpm0PgNbPsLo_MASK                        (3 << 0)
1348c2ecf20Sopenharmony_ci#       define Dpm0PgNbPsLo_SHIFT                       0
1358c2ecf20Sopenharmony_ci#       define Dpm0PgNbPsHi(x)                          ((x) << 2)
1368c2ecf20Sopenharmony_ci#       define Dpm0PgNbPsHi_MASK                        (3 << 2)
1378c2ecf20Sopenharmony_ci#       define Dpm0PgNbPsHi_SHIFT                       2
1388c2ecf20Sopenharmony_ci#       define DpmXNbPsLo(x)                            ((x) << 4)
1398c2ecf20Sopenharmony_ci#       define DpmXNbPsLo_MASK                          (3 << 4)
1408c2ecf20Sopenharmony_ci#       define DpmXNbPsLo_SHIFT                         4
1418c2ecf20Sopenharmony_ci#       define DpmXNbPsHi(x)                            ((x) << 6)
1428c2ecf20Sopenharmony_ci#       define DpmXNbPsHi_MASK                          (3 << 6)
1438c2ecf20Sopenharmony_ci#       define DpmXNbPsHi_SHIFT                         6
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci#define DC_CAC_VALUE                                    0x1f908
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci#define GPU_CAC_AVRG_CNTL                               0x1f920
1488c2ecf20Sopenharmony_ci#       define WINDOW_SIZE(x)                           ((x) << 0)
1498c2ecf20Sopenharmony_ci#       define WINDOW_SIZE_MASK                         (0xff << 0)
1508c2ecf20Sopenharmony_ci#       define WINDOW_SIZE_SHIFT                        0
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci#define CC_SMU_MISC_FUSES                               0xe0001004
1538c2ecf20Sopenharmony_ci#       define MinSClkDid(x)                   ((x) << 2)
1548c2ecf20Sopenharmony_ci#       define MinSClkDid_MASK                 (0x7f << 2)
1558c2ecf20Sopenharmony_ci#       define MinSClkDid_SHIFT                2
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci#define CC_SMU_TST_EFUSE1_MISC                          0xe000101c
1588c2ecf20Sopenharmony_ci#       define RB_BACKEND_DISABLE(x)                    ((x) << 16)
1598c2ecf20Sopenharmony_ci#       define RB_BACKEND_DISABLE_MASK                  (3 << 16)
1608c2ecf20Sopenharmony_ci#       define RB_BACKEND_DISABLE_SHIFT                 16
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci#define SMU_SCRATCH_A                                   0xe0003024
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci#define SMU_SCRATCH0                                    0xe0003040
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci/* mmio */
1678c2ecf20Sopenharmony_ci#define SMC_INT_REQ                                     0x220
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci#define SMC_MESSAGE_0                                   0x22c
1708c2ecf20Sopenharmony_ci#define SMC_RESP_0                                      0x230
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci#define GENERAL_PWRMGT                                  0x670
1738c2ecf20Sopenharmony_ci#       define GLOBAL_PWRMGT_EN                         (1 << 0)
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci#define SCLK_PWRMGT_CNTL                                0x678
1768c2ecf20Sopenharmony_ci#       define DYN_PWR_DOWN_EN                          (1 << 2)
1778c2ecf20Sopenharmony_ci#       define RESET_BUSY_CNT                           (1 << 4)
1788c2ecf20Sopenharmony_ci#       define RESET_SCLK_CNT                           (1 << 5)
1798c2ecf20Sopenharmony_ci#       define DYN_GFX_CLK_OFF_EN                       (1 << 7)
1808c2ecf20Sopenharmony_ci#       define GFX_CLK_FORCE_ON                         (1 << 8)
1818c2ecf20Sopenharmony_ci#       define DYNAMIC_PM_EN                            (1 << 21)
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci#define TARGET_AND_CURRENT_PROFILE_INDEX                0x684
1848c2ecf20Sopenharmony_ci#       define TARGET_STATE(x)                          ((x) << 0)
1858c2ecf20Sopenharmony_ci#       define TARGET_STATE_MASK                        (0xf << 0)
1868c2ecf20Sopenharmony_ci#       define TARGET_STATE_SHIFT                       0
1878c2ecf20Sopenharmony_ci#       define CURRENT_STATE(x)                         ((x) << 4)
1888c2ecf20Sopenharmony_ci#       define CURRENT_STATE_MASK                       (0xf << 4)
1898c2ecf20Sopenharmony_ci#       define CURRENT_STATE_SHIFT                      4
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci#define CG_GIPOTS                                       0x6d8
1928c2ecf20Sopenharmony_ci#       define CG_GIPOT(x)                              ((x) << 16)
1938c2ecf20Sopenharmony_ci#       define CG_GIPOT_MASK                            (0xffff << 16)
1948c2ecf20Sopenharmony_ci#       define CG_GIPOT_SHIFT                           16
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci#define CG_PG_CTRL                                      0x6e0
1978c2ecf20Sopenharmony_ci#       define SP(x)                                    ((x) << 0)
1988c2ecf20Sopenharmony_ci#       define SP_MASK                                  (0xffff << 0)
1998c2ecf20Sopenharmony_ci#       define SP_SHIFT                                 0
2008c2ecf20Sopenharmony_ci#       define SU(x)                                    ((x) << 16)
2018c2ecf20Sopenharmony_ci#       define SU_MASK                                  (0xffff << 16)
2028c2ecf20Sopenharmony_ci#       define SU_SHIFT                                 16
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci#define CG_MISC_REG                                     0x708
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci#define CG_THERMAL_INT_CTRL                             0x738
2078c2ecf20Sopenharmony_ci#       define DIG_THERM_INTH(x)                        ((x) << 0)
2088c2ecf20Sopenharmony_ci#       define DIG_THERM_INTH_MASK                      (0xff << 0)
2098c2ecf20Sopenharmony_ci#       define DIG_THERM_INTH_SHIFT                     0
2108c2ecf20Sopenharmony_ci#       define DIG_THERM_INTL(x)                        ((x) << 8)
2118c2ecf20Sopenharmony_ci#       define DIG_THERM_INTL_MASK                      (0xff << 8)
2128c2ecf20Sopenharmony_ci#       define DIG_THERM_INTL_SHIFT                     8
2138c2ecf20Sopenharmony_ci#       define THERM_INTH_MASK                          (1 << 24)
2148c2ecf20Sopenharmony_ci#       define THERM_INTL_MASK                          (1 << 25)
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci#define CG_CG_VOLTAGE_CNTL                              0x770
2178c2ecf20Sopenharmony_ci#       define EN                                       (1 << 9)
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci#define HW_REV   					0x5564
2208c2ecf20Sopenharmony_ci#       define ATI_REV_ID_MASK                          (0xf << 28)
2218c2ecf20Sopenharmony_ci#       define ATI_REV_ID_SHIFT                         28
2228c2ecf20Sopenharmony_ci/* 0 = A0, 1 = A1, 2 = B0, 3 = C0, etc. */
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci#define CGTS_SM_CTRL_REG                                0x9150
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci#define GB_ADDR_CONFIG                                  0x98f8
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci#endif
229