162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright 2011 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 */
2362306a36Sopenharmony_ci#ifndef RV6XXD_H
2462306a36Sopenharmony_ci#define RV6XXD_H
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/* RV6xx power management */
2762306a36Sopenharmony_ci#define SPLL_CNTL_MODE                                    0x60c
2862306a36Sopenharmony_ci#       define SPLL_DIV_SYNC                              (1 << 5)
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define GENERAL_PWRMGT                                    0x618
3162306a36Sopenharmony_ci#       define GLOBAL_PWRMGT_EN                           (1 << 0)
3262306a36Sopenharmony_ci#       define STATIC_PM_EN                               (1 << 1)
3362306a36Sopenharmony_ci#       define MOBILE_SU                                  (1 << 2)
3462306a36Sopenharmony_ci#       define THERMAL_PROTECTION_DIS                     (1 << 3)
3562306a36Sopenharmony_ci#       define THERMAL_PROTECTION_TYPE                    (1 << 4)
3662306a36Sopenharmony_ci#       define ENABLE_GEN2PCIE                            (1 << 5)
3762306a36Sopenharmony_ci#       define SW_GPIO_INDEX(x)                           ((x) << 6)
3862306a36Sopenharmony_ci#       define SW_GPIO_INDEX_MASK                         (3 << 6)
3962306a36Sopenharmony_ci#       define LOW_VOLT_D2_ACPI                           (1 << 8)
4062306a36Sopenharmony_ci#       define LOW_VOLT_D3_ACPI                           (1 << 9)
4162306a36Sopenharmony_ci#       define VOLT_PWRMGT_EN                             (1 << 10)
4262306a36Sopenharmony_ci#       define BACKBIAS_PAD_EN                            (1 << 16)
4362306a36Sopenharmony_ci#       define BACKBIAS_VALUE                             (1 << 17)
4462306a36Sopenharmony_ci#       define BACKBIAS_DPM_CNTL                          (1 << 18)
4562306a36Sopenharmony_ci#       define DYN_SPREAD_SPECTRUM_EN                     (1 << 21)
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define MCLK_PWRMGT_CNTL                                  0x624
4862306a36Sopenharmony_ci#       define MPLL_PWRMGT_OFF                            (1 << 0)
4962306a36Sopenharmony_ci#       define YCLK_TURNOFF                               (1 << 1)
5062306a36Sopenharmony_ci#       define MPLL_TURNOFF                               (1 << 2)
5162306a36Sopenharmony_ci#       define SU_MCLK_USE_BCLK                           (1 << 3)
5262306a36Sopenharmony_ci#       define DLL_READY                                  (1 << 4)
5362306a36Sopenharmony_ci#       define MC_BUSY                                    (1 << 5)
5462306a36Sopenharmony_ci#       define MC_INT_CNTL                                (1 << 7)
5562306a36Sopenharmony_ci#       define MRDCKA_SLEEP                               (1 << 8)
5662306a36Sopenharmony_ci#       define MRDCKB_SLEEP                               (1 << 9)
5762306a36Sopenharmony_ci#       define MRDCKC_SLEEP                               (1 << 10)
5862306a36Sopenharmony_ci#       define MRDCKD_SLEEP                               (1 << 11)
5962306a36Sopenharmony_ci#       define MRDCKE_SLEEP                               (1 << 12)
6062306a36Sopenharmony_ci#       define MRDCKF_SLEEP                               (1 << 13)
6162306a36Sopenharmony_ci#       define MRDCKG_SLEEP                               (1 << 14)
6262306a36Sopenharmony_ci#       define MRDCKH_SLEEP                               (1 << 15)
6362306a36Sopenharmony_ci#       define MRDCKA_RESET                               (1 << 16)
6462306a36Sopenharmony_ci#       define MRDCKB_RESET                               (1 << 17)
6562306a36Sopenharmony_ci#       define MRDCKC_RESET                               (1 << 18)
6662306a36Sopenharmony_ci#       define MRDCKD_RESET                               (1 << 19)
6762306a36Sopenharmony_ci#       define MRDCKE_RESET                               (1 << 20)
6862306a36Sopenharmony_ci#       define MRDCKF_RESET                               (1 << 21)
6962306a36Sopenharmony_ci#       define MRDCKG_RESET                               (1 << 22)
7062306a36Sopenharmony_ci#       define MRDCKH_RESET                               (1 << 23)
7162306a36Sopenharmony_ci#       define DLL_READY_READ                             (1 << 24)
7262306a36Sopenharmony_ci#       define USE_DISPLAY_GAP                            (1 << 25)
7362306a36Sopenharmony_ci#       define USE_DISPLAY_URGENT_NORMAL                  (1 << 26)
7462306a36Sopenharmony_ci#       define USE_DISPLAY_GAP_CTXSW                      (1 << 27)
7562306a36Sopenharmony_ci#       define MPLL_TURNOFF_D2                            (1 << 28)
7662306a36Sopenharmony_ci#       define USE_DISPLAY_URGENT_CTXSW                   (1 << 29)
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#define MPLL_FREQ_LEVEL_0                                 0x6e8
7962306a36Sopenharmony_ci#       define LEVEL0_MPLL_POST_DIV(x)                    ((x) << 0)
8062306a36Sopenharmony_ci#       define LEVEL0_MPLL_POST_DIV_MASK                  (0xff << 0)
8162306a36Sopenharmony_ci#       define LEVEL0_MPLL_FB_DIV(x)                      ((x) << 8)
8262306a36Sopenharmony_ci#       define LEVEL0_MPLL_FB_DIV_MASK                    (0xfff << 8)
8362306a36Sopenharmony_ci#       define LEVEL0_MPLL_REF_DIV(x)                     ((x) << 20)
8462306a36Sopenharmony_ci#       define LEVEL0_MPLL_REF_DIV_MASK                   (0x3f << 20)
8562306a36Sopenharmony_ci#       define LEVEL0_MPLL_DIV_EN                         (1 << 28)
8662306a36Sopenharmony_ci#       define LEVEL0_DLL_BYPASS                          (1 << 29)
8762306a36Sopenharmony_ci#       define LEVEL0_DLL_RESET                           (1 << 30)
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci#define VID_RT                                            0x6f8
9062306a36Sopenharmony_ci#       define VID_CRT(x)                                 ((x) << 0)
9162306a36Sopenharmony_ci#       define VID_CRT_MASK                               (0x1fff << 0)
9262306a36Sopenharmony_ci#       define VID_CRTU(x)                                ((x) << 13)
9362306a36Sopenharmony_ci#       define VID_CRTU_MASK                              (7 << 13)
9462306a36Sopenharmony_ci#       define SSTU(x)                                    ((x) << 16)
9562306a36Sopenharmony_ci#       define SSTU_MASK                                  (7 << 16)
9662306a36Sopenharmony_ci#       define VID_SWT(x)                                 ((x) << 19)
9762306a36Sopenharmony_ci#       define VID_SWT_MASK                               (0x1f << 19)
9862306a36Sopenharmony_ci#       define BRT(x)                                     ((x) << 24)
9962306a36Sopenharmony_ci#       define BRT_MASK                                   (0xff << 24)
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci#define TARGET_AND_CURRENT_PROFILE_INDEX                  0x70c
10262306a36Sopenharmony_ci#       define TARGET_PROFILE_INDEX_MASK                  (3 << 0)
10362306a36Sopenharmony_ci#       define TARGET_PROFILE_INDEX_SHIFT                 0
10462306a36Sopenharmony_ci#       define CURRENT_PROFILE_INDEX_MASK                 (3 << 2)
10562306a36Sopenharmony_ci#       define CURRENT_PROFILE_INDEX_SHIFT                2
10662306a36Sopenharmony_ci#       define DYN_PWR_ENTER_INDEX(x)                     ((x) << 4)
10762306a36Sopenharmony_ci#       define DYN_PWR_ENTER_INDEX_MASK                   (3 << 4)
10862306a36Sopenharmony_ci#       define DYN_PWR_ENTER_INDEX_SHIFT                  4
10962306a36Sopenharmony_ci#       define CURR_MCLK_INDEX_MASK                       (3 << 6)
11062306a36Sopenharmony_ci#       define CURR_MCLK_INDEX_SHIFT                      6
11162306a36Sopenharmony_ci#       define CURR_SCLK_INDEX_MASK                       (0x1f << 8)
11262306a36Sopenharmony_ci#       define CURR_SCLK_INDEX_SHIFT                      8
11362306a36Sopenharmony_ci#       define CURR_VID_INDEX_MASK                        (3 << 13)
11462306a36Sopenharmony_ci#       define CURR_VID_INDEX_SHIFT                       13
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci#define VID_UPPER_GPIO_CNTL                               0x740
11762306a36Sopenharmony_ci#       define CTXSW_UPPER_GPIO_VALUES(x)                 ((x) << 0)
11862306a36Sopenharmony_ci#       define CTXSW_UPPER_GPIO_VALUES_MASK               (7 << 0)
11962306a36Sopenharmony_ci#       define HIGH_UPPER_GPIO_VALUES(x)                  ((x) << 3)
12062306a36Sopenharmony_ci#       define HIGH_UPPER_GPIO_VALUES_MASK                (7 << 3)
12162306a36Sopenharmony_ci#       define MEDIUM_UPPER_GPIO_VALUES(x)                ((x) << 6)
12262306a36Sopenharmony_ci#       define MEDIUM_UPPER_GPIO_VALUES_MASK              (7 << 6)
12362306a36Sopenharmony_ci#       define LOW_UPPER_GPIO_VALUES(x)                   ((x) << 9)
12462306a36Sopenharmony_ci#       define LOW_UPPER_GPIO_VALUES_MASK                 (7 << 9)
12562306a36Sopenharmony_ci#       define CTXSW_BACKBIAS_VALUE                       (1 << 12)
12662306a36Sopenharmony_ci#       define HIGH_BACKBIAS_VALUE                        (1 << 13)
12762306a36Sopenharmony_ci#       define MEDIUM_BACKBIAS_VALUE                      (1 << 14)
12862306a36Sopenharmony_ci#       define LOW_BACKBIAS_VALUE                         (1 << 15)
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci#define CG_DISPLAY_GAP_CNTL                               0x7dc
13162306a36Sopenharmony_ci#       define DISP1_GAP(x)                               ((x) << 0)
13262306a36Sopenharmony_ci#       define DISP1_GAP_MASK                             (3 << 0)
13362306a36Sopenharmony_ci#       define DISP2_GAP(x)                               ((x) << 2)
13462306a36Sopenharmony_ci#       define DISP2_GAP_MASK                             (3 << 2)
13562306a36Sopenharmony_ci#       define VBI_TIMER_COUNT(x)                         ((x) << 4)
13662306a36Sopenharmony_ci#       define VBI_TIMER_COUNT_MASK                       (0x3fff << 4)
13762306a36Sopenharmony_ci#       define VBI_TIMER_UNIT(x)                          ((x) << 20)
13862306a36Sopenharmony_ci#       define VBI_TIMER_UNIT_MASK                        (7 << 20)
13962306a36Sopenharmony_ci#       define DISP1_GAP_MCHG(x)                          ((x) << 24)
14062306a36Sopenharmony_ci#       define DISP1_GAP_MCHG_MASK                        (3 << 24)
14162306a36Sopenharmony_ci#       define DISP2_GAP_MCHG(x)                          ((x) << 26)
14262306a36Sopenharmony_ci#       define DISP2_GAP_MCHG_MASK                        (3 << 26)
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci#define CG_THERMAL_CTRL                                   0x7f0
14562306a36Sopenharmony_ci#       define DPM_EVENT_SRC(x)                           ((x) << 0)
14662306a36Sopenharmony_ci#       define DPM_EVENT_SRC_MASK                         (7 << 0)
14762306a36Sopenharmony_ci#       define THERM_INC_CLK                              (1 << 3)
14862306a36Sopenharmony_ci#       define TOFFSET(x)                                 ((x) << 4)
14962306a36Sopenharmony_ci#       define TOFFSET_MASK                               (0xff << 4)
15062306a36Sopenharmony_ci#       define DIG_THERM_DPM(x)                           ((x) << 12)
15162306a36Sopenharmony_ci#       define DIG_THERM_DPM_MASK                         (0xff << 12)
15262306a36Sopenharmony_ci#       define CTF_SEL(x)                                 ((x) << 20)
15362306a36Sopenharmony_ci#       define CTF_SEL_MASK                               (7 << 20)
15462306a36Sopenharmony_ci#       define CTF_PAD_POLARITY                           (1 << 23)
15562306a36Sopenharmony_ci#       define CTF_PAD_EN                                 (1 << 24)
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci#define CG_SPLL_SPREAD_SPECTRUM_LOW                       0x820
15862306a36Sopenharmony_ci#       define SSEN                                       (1 << 0)
15962306a36Sopenharmony_ci#       define CLKS(x)                                    ((x) << 3)
16062306a36Sopenharmony_ci#       define CLKS_MASK                                  (0xff << 3)
16162306a36Sopenharmony_ci#       define CLKS_SHIFT                                 3
16262306a36Sopenharmony_ci#       define CLKV(x)                                    ((x) << 11)
16362306a36Sopenharmony_ci#       define CLKV_MASK                                  (0x7ff << 11)
16462306a36Sopenharmony_ci#       define CLKV_SHIFT                                 11
16562306a36Sopenharmony_ci#define CG_MPLL_SPREAD_SPECTRUM                           0x830
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci#define CITF_CNTL					0x200c
16862306a36Sopenharmony_ci#       define BLACKOUT_RD                              (1 << 0)
16962306a36Sopenharmony_ci#       define BLACKOUT_WR                              (1 << 1)
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci#define RAMCFG						0x2408
17262306a36Sopenharmony_ci#define		NOOFBANK_SHIFT					0
17362306a36Sopenharmony_ci#define		NOOFBANK_MASK					0x00000001
17462306a36Sopenharmony_ci#define		NOOFRANK_SHIFT					1
17562306a36Sopenharmony_ci#define		NOOFRANK_MASK					0x00000002
17662306a36Sopenharmony_ci#define		NOOFROWS_SHIFT					2
17762306a36Sopenharmony_ci#define		NOOFROWS_MASK					0x0000001C
17862306a36Sopenharmony_ci#define		NOOFCOLS_SHIFT					5
17962306a36Sopenharmony_ci#define		NOOFCOLS_MASK					0x00000060
18062306a36Sopenharmony_ci#define		CHANSIZE_SHIFT					7
18162306a36Sopenharmony_ci#define		CHANSIZE_MASK					0x00000080
18262306a36Sopenharmony_ci#define		BURSTLENGTH_SHIFT				8
18362306a36Sopenharmony_ci#define		BURSTLENGTH_MASK				0x00000100
18462306a36Sopenharmony_ci#define		CHANSIZE_OVERRIDE				(1 << 10)
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ci#define SQM_RATIO					0x2424
18762306a36Sopenharmony_ci#       define STATE0(x)                                ((x) << 0)
18862306a36Sopenharmony_ci#       define STATE0_MASK                              (0xff << 0)
18962306a36Sopenharmony_ci#       define STATE1(x)                                ((x) << 8)
19062306a36Sopenharmony_ci#       define STATE1_MASK                              (0xff << 8)
19162306a36Sopenharmony_ci#       define STATE2(x)                                ((x) << 16)
19262306a36Sopenharmony_ci#       define STATE2_MASK                              (0xff << 16)
19362306a36Sopenharmony_ci#       define STATE3(x)                                ((x) << 24)
19462306a36Sopenharmony_ci#       define STATE3_MASK                              (0xff << 24)
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ci#define ARB_RFSH_CNTL					0x2460
19762306a36Sopenharmony_ci#       define ENABLE                                   (1 << 0)
19862306a36Sopenharmony_ci#define ARB_RFSH_RATE					0x2464
19962306a36Sopenharmony_ci#       define POWERMODE0(x)                            ((x) << 0)
20062306a36Sopenharmony_ci#       define POWERMODE0_MASK                          (0xff << 0)
20162306a36Sopenharmony_ci#       define POWERMODE1(x)                            ((x) << 8)
20262306a36Sopenharmony_ci#       define POWERMODE1_MASK                          (0xff << 8)
20362306a36Sopenharmony_ci#       define POWERMODE2(x)                            ((x) << 16)
20462306a36Sopenharmony_ci#       define POWERMODE2_MASK                          (0xff << 16)
20562306a36Sopenharmony_ci#       define POWERMODE3(x)                            ((x) << 24)
20662306a36Sopenharmony_ci#       define POWERMODE3_MASK                          (0xff << 24)
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci#define MC_SEQ_DRAM					0x2608
20962306a36Sopenharmony_ci#       define CKE_DYN                                  (1 << 12)
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci#define MC_SEQ_CMD					0x26c4
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_ci#define MC_SEQ_RESERVE_S				0x2890
21462306a36Sopenharmony_ci#define MC_SEQ_RESERVE_M				0x2894
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci#define LVTMA_DATA_SYNCHRONIZATION                      0x7adc
21762306a36Sopenharmony_ci#       define LVTMA_PFREQCHG                           (1 << 8)
21862306a36Sopenharmony_ci#define DCE3_LVTMA_DATA_SYNCHRONIZATION                 0x7f98
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci/* PCIE indirect regs */
22162306a36Sopenharmony_ci#define PCIE_P_CNTL                                       0x40
22262306a36Sopenharmony_ci#       define P_PLL_PWRDN_IN_L1L23                       (1 << 3)
22362306a36Sopenharmony_ci#       define P_PLL_BUF_PDNB                             (1 << 4)
22462306a36Sopenharmony_ci#       define P_PLL_PDNB                                 (1 << 9)
22562306a36Sopenharmony_ci#       define P_ALLOW_PRX_FRONTEND_SHUTOFF               (1 << 12)
22662306a36Sopenharmony_ci/* PCIE PORT indirect regs */
22762306a36Sopenharmony_ci#define PCIE_LC_CNTL                                      0xa0
22862306a36Sopenharmony_ci#       define LC_L0S_INACTIVITY(x)                       ((x) << 8)
22962306a36Sopenharmony_ci#       define LC_L0S_INACTIVITY_MASK                     (0xf << 8)
23062306a36Sopenharmony_ci#       define LC_L0S_INACTIVITY_SHIFT                    8
23162306a36Sopenharmony_ci#       define LC_L1_INACTIVITY(x)                        ((x) << 12)
23262306a36Sopenharmony_ci#       define LC_L1_INACTIVITY_MASK                      (0xf << 12)
23362306a36Sopenharmony_ci#       define LC_L1_INACTIVITY_SHIFT                     12
23462306a36Sopenharmony_ci#       define LC_PMI_TO_L1_DIS                           (1 << 16)
23562306a36Sopenharmony_ci#       define LC_ASPM_TO_L1_DIS                          (1 << 24)
23662306a36Sopenharmony_ci#define PCIE_LC_SPEED_CNTL                                0xa4
23762306a36Sopenharmony_ci#       define LC_GEN2_EN                                 (1 << 0)
23862306a36Sopenharmony_ci#       define LC_INITIATE_LINK_SPEED_CHANGE              (1 << 7)
23962306a36Sopenharmony_ci#       define LC_CURRENT_DATA_RATE                       (1 << 11)
24062306a36Sopenharmony_ci#       define LC_HW_VOLTAGE_IF_CONTROL(x)                ((x) << 12)
24162306a36Sopenharmony_ci#       define LC_HW_VOLTAGE_IF_CONTROL_MASK              (3 << 12)
24262306a36Sopenharmony_ci#       define LC_HW_VOLTAGE_IF_CONTROL_SHIFT             12
24362306a36Sopenharmony_ci#       define LC_OTHER_SIDE_EVER_SENT_GEN2               (1 << 23)
24462306a36Sopenharmony_ci#       define LC_OTHER_SIDE_SUPPORTS_GEN2                (1 << 24)
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci#endif
247