162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright 2012 Advanced Micro Devices, Inc.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
562306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
662306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation
762306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
862306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
962306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
1262306a36Sopenharmony_ci * all copies or substantial portions of the Software.
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1562306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1662306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1762306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
1862306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1962306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2062306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * Authors: Alex Deucher
2362306a36Sopenharmony_ci */
2462306a36Sopenharmony_ci#ifndef _TRINITYD_H_
2562306a36Sopenharmony_ci#define _TRINITYD_H_
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/* pm registers */
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/* cg */
3062306a36Sopenharmony_ci#define CG_CGTT_LOCAL_0                                 0x0
3162306a36Sopenharmony_ci#define CG_CGTT_LOCAL_1                                 0x1
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci/* smc */
3462306a36Sopenharmony_ci#define SMU_SCLK_DPM_STATE_0_CNTL_0                     0x1f000
3562306a36Sopenharmony_ci#       define STATE_VALID(x)                           ((x) << 0)
3662306a36Sopenharmony_ci#       define STATE_VALID_MASK                         (0xff << 0)
3762306a36Sopenharmony_ci#       define STATE_VALID_SHIFT                        0
3862306a36Sopenharmony_ci#       define CLK_DIVIDER(x)                           ((x) << 8)
3962306a36Sopenharmony_ci#       define CLK_DIVIDER_MASK                         (0xff << 8)
4062306a36Sopenharmony_ci#       define CLK_DIVIDER_SHIFT                        8
4162306a36Sopenharmony_ci#       define VID(x)                                   ((x) << 16)
4262306a36Sopenharmony_ci#       define VID_MASK                                 (0xff << 16)
4362306a36Sopenharmony_ci#       define VID_SHIFT                                16
4462306a36Sopenharmony_ci#       define LVRT(x)                                  ((x) << 24)
4562306a36Sopenharmony_ci#       define LVRT_MASK                                (0xff << 24)
4662306a36Sopenharmony_ci#       define LVRT_SHIFT                               24
4762306a36Sopenharmony_ci#define SMU_SCLK_DPM_STATE_0_CNTL_1                     0x1f004
4862306a36Sopenharmony_ci#       define DS_DIV(x)                                ((x) << 0)
4962306a36Sopenharmony_ci#       define DS_DIV_MASK                              (0xff << 0)
5062306a36Sopenharmony_ci#       define DS_DIV_SHIFT                             0
5162306a36Sopenharmony_ci#       define DS_SH_DIV(x)                             ((x) << 8)
5262306a36Sopenharmony_ci#       define DS_SH_DIV_MASK                           (0xff << 8)
5362306a36Sopenharmony_ci#       define DS_SH_DIV_SHIFT                          8
5462306a36Sopenharmony_ci#       define DISPLAY_WM(x)                            ((x) << 16)
5562306a36Sopenharmony_ci#       define DISPLAY_WM_MASK                          (0xff << 16)
5662306a36Sopenharmony_ci#       define DISPLAY_WM_SHIFT                         16
5762306a36Sopenharmony_ci#       define VCE_WM(x)                                ((x) << 24)
5862306a36Sopenharmony_ci#       define VCE_WM_MASK                              (0xff << 24)
5962306a36Sopenharmony_ci#       define VCE_WM_SHIFT                             24
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#define SMU_SCLK_DPM_STATE_0_CNTL_3                     0x1f00c
6262306a36Sopenharmony_ci#       define GNB_SLOW(x)                              ((x) << 0)
6362306a36Sopenharmony_ci#       define GNB_SLOW_MASK                            (0xff << 0)
6462306a36Sopenharmony_ci#       define GNB_SLOW_SHIFT                           0
6562306a36Sopenharmony_ci#       define FORCE_NBPS1(x)                           ((x) << 8)
6662306a36Sopenharmony_ci#       define FORCE_NBPS1_MASK                         (0xff << 8)
6762306a36Sopenharmony_ci#       define FORCE_NBPS1_SHIFT                        8
6862306a36Sopenharmony_ci#define SMU_SCLK_DPM_STATE_0_AT                         0x1f010
6962306a36Sopenharmony_ci#       define AT(x)                                    ((x) << 0)
7062306a36Sopenharmony_ci#       define AT_MASK                                  (0xff << 0)
7162306a36Sopenharmony_ci#       define AT_SHIFT                                 0
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci#define SMU_SCLK_DPM_STATE_0_PG_CNTL                    0x1f014
7462306a36Sopenharmony_ci#       define PD_SCLK_DIVIDER(x)                       ((x) << 16)
7562306a36Sopenharmony_ci#       define PD_SCLK_DIVIDER_MASK                     (0xff << 16)
7662306a36Sopenharmony_ci#       define PD_SCLK_DIVIDER_SHIFT                    16
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#define SMU_SCLK_DPM_STATE_1_CNTL_0                     0x1f020
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci#define SMU_SCLK_DPM_CNTL                               0x1f100
8162306a36Sopenharmony_ci#       define SCLK_DPM_EN(x)                           ((x) << 0)
8262306a36Sopenharmony_ci#       define SCLK_DPM_EN_MASK                         (0xff << 0)
8362306a36Sopenharmony_ci#       define SCLK_DPM_EN_SHIFT                        0
8462306a36Sopenharmony_ci#       define SCLK_DPM_BOOT_STATE(x)                   ((x) << 16)
8562306a36Sopenharmony_ci#       define SCLK_DPM_BOOT_STATE_MASK                 (0xff << 16)
8662306a36Sopenharmony_ci#       define SCLK_DPM_BOOT_STATE_SHIFT                16
8762306a36Sopenharmony_ci#       define VOLTAGE_CHG_EN(x)                        ((x) << 24)
8862306a36Sopenharmony_ci#       define VOLTAGE_CHG_EN_MASK                      (0xff << 24)
8962306a36Sopenharmony_ci#       define VOLTAGE_CHG_EN_SHIFT                     24
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci#define SMU_SCLK_DPM_TT_CNTL                            0x1f108
9262306a36Sopenharmony_ci#       define SCLK_TT_EN(x)                            ((x) << 0)
9362306a36Sopenharmony_ci#       define SCLK_TT_EN_MASK                          (0xff << 0)
9462306a36Sopenharmony_ci#       define SCLK_TT_EN_SHIFT                         0
9562306a36Sopenharmony_ci#define SMU_SCLK_DPM_TTT                                0x1f10c
9662306a36Sopenharmony_ci#       define LT(x)                                    ((x) << 0)
9762306a36Sopenharmony_ci#       define LT_MASK                                  (0xffff << 0)
9862306a36Sopenharmony_ci#       define LT_SHIFT                                 0
9962306a36Sopenharmony_ci#       define HT(x)                                    ((x) << 16)
10062306a36Sopenharmony_ci#       define HT_MASK                                  (0xffff << 16)
10162306a36Sopenharmony_ci#       define HT_SHIFT                                 16
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci#define SMU_UVD_DPM_STATES                              0x1f1a0
10462306a36Sopenharmony_ci#define SMU_UVD_DPM_CNTL                                0x1f1a4
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci#define SMU_S_PG_CNTL                                   0x1f118
10762306a36Sopenharmony_ci#       define DS_PG_EN(x)                              ((x) << 16)
10862306a36Sopenharmony_ci#       define DS_PG_EN_MASK                            (0xff << 16)
10962306a36Sopenharmony_ci#       define DS_PG_EN_SHIFT                           16
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci#define GFX_POWER_GATING_CNTL                           0x1f38c
11262306a36Sopenharmony_ci#       define PDS_DIV(x)                               ((x) << 0)
11362306a36Sopenharmony_ci#       define PDS_DIV_MASK                             (0xff << 0)
11462306a36Sopenharmony_ci#       define PDS_DIV_SHIFT                            0
11562306a36Sopenharmony_ci#       define SSSD(x)                                  ((x) << 8)
11662306a36Sopenharmony_ci#       define SSSD_MASK                                (0xff << 8)
11762306a36Sopenharmony_ci#       define SSSD_SHIFT                               8
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci#define PM_CONFIG                                       0x1f428
12062306a36Sopenharmony_ci#       define SVI_Mode                                 (1 << 29)
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci#define PM_I_CNTL_1                                     0x1f464
12362306a36Sopenharmony_ci#       define SCLK_DPM(x)                              ((x) << 0)
12462306a36Sopenharmony_ci#       define SCLK_DPM_MASK                            (0xff << 0)
12562306a36Sopenharmony_ci#       define SCLK_DPM_SHIFT                           0
12662306a36Sopenharmony_ci#       define DS_PG_CNTL(x)                            ((x) << 16)
12762306a36Sopenharmony_ci#       define DS_PG_CNTL_MASK                          (0xff << 16)
12862306a36Sopenharmony_ci#       define DS_PG_CNTL_SHIFT                         16
12962306a36Sopenharmony_ci#define PM_TP                                           0x1f468
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci#define NB_PSTATE_CONFIG                                0x1f5f8
13262306a36Sopenharmony_ci#       define Dpm0PgNbPsLo(x)                          ((x) << 0)
13362306a36Sopenharmony_ci#       define Dpm0PgNbPsLo_MASK                        (3 << 0)
13462306a36Sopenharmony_ci#       define Dpm0PgNbPsLo_SHIFT                       0
13562306a36Sopenharmony_ci#       define Dpm0PgNbPsHi(x)                          ((x) << 2)
13662306a36Sopenharmony_ci#       define Dpm0PgNbPsHi_MASK                        (3 << 2)
13762306a36Sopenharmony_ci#       define Dpm0PgNbPsHi_SHIFT                       2
13862306a36Sopenharmony_ci#       define DpmXNbPsLo(x)                            ((x) << 4)
13962306a36Sopenharmony_ci#       define DpmXNbPsLo_MASK                          (3 << 4)
14062306a36Sopenharmony_ci#       define DpmXNbPsLo_SHIFT                         4
14162306a36Sopenharmony_ci#       define DpmXNbPsHi(x)                            ((x) << 6)
14262306a36Sopenharmony_ci#       define DpmXNbPsHi_MASK                          (3 << 6)
14362306a36Sopenharmony_ci#       define DpmXNbPsHi_SHIFT                         6
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci#define DC_CAC_VALUE                                    0x1f908
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci#define GPU_CAC_AVRG_CNTL                               0x1f920
14862306a36Sopenharmony_ci#       define WINDOW_SIZE(x)                           ((x) << 0)
14962306a36Sopenharmony_ci#       define WINDOW_SIZE_MASK                         (0xff << 0)
15062306a36Sopenharmony_ci#       define WINDOW_SIZE_SHIFT                        0
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci#define CC_SMU_MISC_FUSES                               0xe0001004
15362306a36Sopenharmony_ci#       define MinSClkDid(x)                   ((x) << 2)
15462306a36Sopenharmony_ci#       define MinSClkDid_MASK                 (0x7f << 2)
15562306a36Sopenharmony_ci#       define MinSClkDid_SHIFT                2
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci#define CC_SMU_TST_EFUSE1_MISC                          0xe000101c
15862306a36Sopenharmony_ci#       define RB_BACKEND_DISABLE(x)                    ((x) << 16)
15962306a36Sopenharmony_ci#       define RB_BACKEND_DISABLE_MASK                  (3 << 16)
16062306a36Sopenharmony_ci#       define RB_BACKEND_DISABLE_SHIFT                 16
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci#define SMU_SCRATCH_A                                   0xe0003024
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci#define SMU_SCRATCH0                                    0xe0003040
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci/* mmio */
16762306a36Sopenharmony_ci#define SMC_INT_REQ                                     0x220
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci#define SMC_MESSAGE_0                                   0x22c
17062306a36Sopenharmony_ci#define SMC_RESP_0                                      0x230
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci#define GENERAL_PWRMGT                                  0x670
17362306a36Sopenharmony_ci#       define GLOBAL_PWRMGT_EN                         (1 << 0)
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci#define SCLK_PWRMGT_CNTL                                0x678
17662306a36Sopenharmony_ci#       define DYN_PWR_DOWN_EN                          (1 << 2)
17762306a36Sopenharmony_ci#       define RESET_BUSY_CNT                           (1 << 4)
17862306a36Sopenharmony_ci#       define RESET_SCLK_CNT                           (1 << 5)
17962306a36Sopenharmony_ci#       define DYN_GFX_CLK_OFF_EN                       (1 << 7)
18062306a36Sopenharmony_ci#       define GFX_CLK_FORCE_ON                         (1 << 8)
18162306a36Sopenharmony_ci#       define DYNAMIC_PM_EN                            (1 << 21)
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci#define TARGET_AND_CURRENT_PROFILE_INDEX                0x684
18462306a36Sopenharmony_ci#       define TARGET_STATE(x)                          ((x) << 0)
18562306a36Sopenharmony_ci#       define TARGET_STATE_MASK                        (0xf << 0)
18662306a36Sopenharmony_ci#       define TARGET_STATE_SHIFT                       0
18762306a36Sopenharmony_ci#       define CURRENT_STATE(x)                         ((x) << 4)
18862306a36Sopenharmony_ci#       define CURRENT_STATE_MASK                       (0xf << 4)
18962306a36Sopenharmony_ci#       define CURRENT_STATE_SHIFT                      4
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_ci#define CG_GIPOTS                                       0x6d8
19262306a36Sopenharmony_ci#       define CG_GIPOT(x)                              ((x) << 16)
19362306a36Sopenharmony_ci#       define CG_GIPOT_MASK                            (0xffff << 16)
19462306a36Sopenharmony_ci#       define CG_GIPOT_SHIFT                           16
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ci#define CG_PG_CTRL                                      0x6e0
19762306a36Sopenharmony_ci#       define SP(x)                                    ((x) << 0)
19862306a36Sopenharmony_ci#       define SP_MASK                                  (0xffff << 0)
19962306a36Sopenharmony_ci#       define SP_SHIFT                                 0
20062306a36Sopenharmony_ci#       define SU(x)                                    ((x) << 16)
20162306a36Sopenharmony_ci#       define SU_MASK                                  (0xffff << 16)
20262306a36Sopenharmony_ci#       define SU_SHIFT                                 16
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci#define CG_MISC_REG                                     0x708
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ci#define CG_THERMAL_INT_CTRL                             0x738
20762306a36Sopenharmony_ci#       define DIG_THERM_INTH(x)                        ((x) << 0)
20862306a36Sopenharmony_ci#       define DIG_THERM_INTH_MASK                      (0xff << 0)
20962306a36Sopenharmony_ci#       define DIG_THERM_INTH_SHIFT                     0
21062306a36Sopenharmony_ci#       define DIG_THERM_INTL(x)                        ((x) << 8)
21162306a36Sopenharmony_ci#       define DIG_THERM_INTL_MASK                      (0xff << 8)
21262306a36Sopenharmony_ci#       define DIG_THERM_INTL_SHIFT                     8
21362306a36Sopenharmony_ci#       define THERM_INTH_MASK                          (1 << 24)
21462306a36Sopenharmony_ci#       define THERM_INTL_MASK                          (1 << 25)
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci#define CG_CG_VOLTAGE_CNTL                              0x770
21762306a36Sopenharmony_ci#       define EN                                       (1 << 9)
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci#define HW_REV   					0x5564
22062306a36Sopenharmony_ci#       define ATI_REV_ID_MASK                          (0xf << 28)
22162306a36Sopenharmony_ci#       define ATI_REV_ID_SHIFT                         28
22262306a36Sopenharmony_ci/* 0 = A0, 1 = A1, 2 = B0, 3 = C0, etc. */
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ci#define CGTS_SM_CTRL_REG                                0x9150
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci#define GB_ADDR_CONFIG                                  0x98f8
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_ci#endif
229