162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright 2010 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 _BTCD_H_ 2562306a36Sopenharmony_ci#define _BTCD_H_ 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci/* pm registers */ 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci#define GENERAL_PWRMGT 0x63c 3062306a36Sopenharmony_ci# define GLOBAL_PWRMGT_EN (1 << 0) 3162306a36Sopenharmony_ci# define STATIC_PM_EN (1 << 1) 3262306a36Sopenharmony_ci# define THERMAL_PROTECTION_DIS (1 << 2) 3362306a36Sopenharmony_ci# define THERMAL_PROTECTION_TYPE (1 << 3) 3462306a36Sopenharmony_ci# define ENABLE_GEN2PCIE (1 << 4) 3562306a36Sopenharmony_ci# define ENABLE_GEN2XSP (1 << 5) 3662306a36Sopenharmony_ci# define SW_SMIO_INDEX(x) ((x) << 6) 3762306a36Sopenharmony_ci# define SW_SMIO_INDEX_MASK (3 << 6) 3862306a36Sopenharmony_ci# define SW_SMIO_INDEX_SHIFT 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 << 18) 4362306a36Sopenharmony_ci# define BACKBIAS_VALUE (1 << 19) 4462306a36Sopenharmony_ci# define DYN_SPREAD_SPECTRUM_EN (1 << 23) 4562306a36Sopenharmony_ci# define AC_DC_SW (1 << 24) 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci#define TARGET_AND_CURRENT_PROFILE_INDEX 0x66c 4862306a36Sopenharmony_ci# define CURRENT_PROFILE_INDEX_MASK (0xf << 4) 4962306a36Sopenharmony_ci# define CURRENT_PROFILE_INDEX_SHIFT 4 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci#define CG_BIF_REQ_AND_RSP 0x7f4 5262306a36Sopenharmony_ci#define CG_CLIENT_REQ(x) ((x) << 0) 5362306a36Sopenharmony_ci#define CG_CLIENT_REQ_MASK (0xff << 0) 5462306a36Sopenharmony_ci#define CG_CLIENT_REQ_SHIFT 0 5562306a36Sopenharmony_ci#define CG_CLIENT_RESP(x) ((x) << 8) 5662306a36Sopenharmony_ci#define CG_CLIENT_RESP_MASK (0xff << 8) 5762306a36Sopenharmony_ci#define CG_CLIENT_RESP_SHIFT 8 5862306a36Sopenharmony_ci#define CLIENT_CG_REQ(x) ((x) << 16) 5962306a36Sopenharmony_ci#define CLIENT_CG_REQ_MASK (0xff << 16) 6062306a36Sopenharmony_ci#define CLIENT_CG_REQ_SHIFT 16 6162306a36Sopenharmony_ci#define CLIENT_CG_RESP(x) ((x) << 24) 6262306a36Sopenharmony_ci#define CLIENT_CG_RESP_MASK (0xff << 24) 6362306a36Sopenharmony_ci#define CLIENT_CG_RESP_SHIFT 24 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci#define SCLK_PSKIP_CNTL 0x8c0 6662306a36Sopenharmony_ci#define PSKIP_ON_ALLOW_STOP_HI(x) ((x) << 16) 6762306a36Sopenharmony_ci#define PSKIP_ON_ALLOW_STOP_HI_MASK (0xff << 16) 6862306a36Sopenharmony_ci#define PSKIP_ON_ALLOW_STOP_HI_SHIFT 16 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci#define CG_ULV_CONTROL 0x8c8 7162306a36Sopenharmony_ci#define CG_ULV_PARAMETER 0x8cc 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci#define MC_ARB_DRAM_TIMING 0x2774 7462306a36Sopenharmony_ci#define MC_ARB_DRAM_TIMING2 0x2778 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci#define MC_ARB_RFSH_RATE 0x27b0 7762306a36Sopenharmony_ci#define POWERMODE0(x) ((x) << 0) 7862306a36Sopenharmony_ci#define POWERMODE0_MASK (0xff << 0) 7962306a36Sopenharmony_ci#define POWERMODE0_SHIFT 0 8062306a36Sopenharmony_ci#define POWERMODE1(x) ((x) << 8) 8162306a36Sopenharmony_ci#define POWERMODE1_MASK (0xff << 8) 8262306a36Sopenharmony_ci#define POWERMODE1_SHIFT 8 8362306a36Sopenharmony_ci#define POWERMODE2(x) ((x) << 16) 8462306a36Sopenharmony_ci#define POWERMODE2_MASK (0xff << 16) 8562306a36Sopenharmony_ci#define POWERMODE2_SHIFT 16 8662306a36Sopenharmony_ci#define POWERMODE3(x) ((x) << 24) 8762306a36Sopenharmony_ci#define POWERMODE3_MASK (0xff << 24) 8862306a36Sopenharmony_ci#define POWERMODE3_SHIFT 24 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci#define MC_ARB_BURST_TIME 0x2808 9162306a36Sopenharmony_ci#define STATE0(x) ((x) << 0) 9262306a36Sopenharmony_ci#define STATE0_MASK (0x1f << 0) 9362306a36Sopenharmony_ci#define STATE0_SHIFT 0 9462306a36Sopenharmony_ci#define STATE1(x) ((x) << 5) 9562306a36Sopenharmony_ci#define STATE1_MASK (0x1f << 5) 9662306a36Sopenharmony_ci#define STATE1_SHIFT 5 9762306a36Sopenharmony_ci#define STATE2(x) ((x) << 10) 9862306a36Sopenharmony_ci#define STATE2_MASK (0x1f << 10) 9962306a36Sopenharmony_ci#define STATE2_SHIFT 10 10062306a36Sopenharmony_ci#define STATE3(x) ((x) << 15) 10162306a36Sopenharmony_ci#define STATE3_MASK (0x1f << 15) 10262306a36Sopenharmony_ci#define STATE3_SHIFT 15 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ci#define MC_SEQ_RAS_TIMING 0x28a0 10562306a36Sopenharmony_ci#define MC_SEQ_CAS_TIMING 0x28a4 10662306a36Sopenharmony_ci#define MC_SEQ_MISC_TIMING 0x28a8 10762306a36Sopenharmony_ci#define MC_SEQ_MISC_TIMING2 0x28ac 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci#define MC_SEQ_RD_CTL_D0 0x28b4 11062306a36Sopenharmony_ci#define MC_SEQ_RD_CTL_D1 0x28b8 11162306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_D0 0x28bc 11262306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_D1 0x28c0 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci#define MC_PMG_AUTO_CFG 0x28d4 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci#define MC_SEQ_STATUS_M 0x29f4 11762306a36Sopenharmony_ci# define PMG_PWRSTATE (1 << 16) 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci#define MC_SEQ_MISC0 0x2a00 12062306a36Sopenharmony_ci#define MC_SEQ_MISC0_GDDR5_SHIFT 28 12162306a36Sopenharmony_ci#define MC_SEQ_MISC0_GDDR5_MASK 0xf0000000 12262306a36Sopenharmony_ci#define MC_SEQ_MISC0_GDDR5_VALUE 5 12362306a36Sopenharmony_ci#define MC_SEQ_MISC1 0x2a04 12462306a36Sopenharmony_ci#define MC_SEQ_RESERVE_M 0x2a08 12562306a36Sopenharmony_ci#define MC_PMG_CMD_EMRS 0x2a0c 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci#define MC_SEQ_MISC3 0x2a2c 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci#define MC_SEQ_MISC5 0x2a54 13062306a36Sopenharmony_ci#define MC_SEQ_MISC6 0x2a58 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci#define MC_SEQ_MISC7 0x2a64 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci#define MC_SEQ_CG 0x2a68 13562306a36Sopenharmony_ci#define CG_SEQ_REQ(x) ((x) << 0) 13662306a36Sopenharmony_ci#define CG_SEQ_REQ_MASK (0xff << 0) 13762306a36Sopenharmony_ci#define CG_SEQ_REQ_SHIFT 0 13862306a36Sopenharmony_ci#define CG_SEQ_RESP(x) ((x) << 8) 13962306a36Sopenharmony_ci#define CG_SEQ_RESP_MASK (0xff << 8) 14062306a36Sopenharmony_ci#define CG_SEQ_RESP_SHIFT 8 14162306a36Sopenharmony_ci#define SEQ_CG_REQ(x) ((x) << 16) 14262306a36Sopenharmony_ci#define SEQ_CG_REQ_MASK (0xff << 16) 14362306a36Sopenharmony_ci#define SEQ_CG_REQ_SHIFT 16 14462306a36Sopenharmony_ci#define SEQ_CG_RESP(x) ((x) << 24) 14562306a36Sopenharmony_ci#define SEQ_CG_RESP_MASK (0xff << 24) 14662306a36Sopenharmony_ci#define SEQ_CG_RESP_SHIFT 24 14762306a36Sopenharmony_ci#define MC_SEQ_RAS_TIMING_LP 0x2a6c 14862306a36Sopenharmony_ci#define MC_SEQ_CAS_TIMING_LP 0x2a70 14962306a36Sopenharmony_ci#define MC_SEQ_MISC_TIMING_LP 0x2a74 15062306a36Sopenharmony_ci#define MC_SEQ_MISC_TIMING2_LP 0x2a78 15162306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_D0_LP 0x2a7c 15262306a36Sopenharmony_ci#define MC_SEQ_WR_CTL_D1_LP 0x2a80 15362306a36Sopenharmony_ci#define MC_SEQ_PMG_CMD_EMRS_LP 0x2a84 15462306a36Sopenharmony_ci#define MC_SEQ_PMG_CMD_MRS_LP 0x2a88 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci#define MC_PMG_CMD_MRS 0x2aac 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci#define MC_SEQ_RD_CTL_D0_LP 0x2b1c 15962306a36Sopenharmony_ci#define MC_SEQ_RD_CTL_D1_LP 0x2b20 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci#define MC_PMG_CMD_MRS1 0x2b44 16262306a36Sopenharmony_ci#define MC_SEQ_PMG_CMD_MRS1_LP 0x2b48 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ci#define LB_SYNC_RESET_SEL 0x6b28 16562306a36Sopenharmony_ci#define LB_SYNC_RESET_SEL_MASK (3 << 0) 16662306a36Sopenharmony_ci#define LB_SYNC_RESET_SEL_SHIFT 0 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci/* PCIE link stuff */ 16962306a36Sopenharmony_ci#define PCIE_LC_SPEED_CNTL 0xa4 /* PCIE_P */ 17062306a36Sopenharmony_ci# define LC_GEN2_EN_STRAP (1 << 0) 17162306a36Sopenharmony_ci# define LC_TARGET_LINK_SPEED_OVERRIDE_EN (1 << 1) 17262306a36Sopenharmony_ci# define LC_FORCE_EN_HW_SPEED_CHANGE (1 << 5) 17362306a36Sopenharmony_ci# define LC_FORCE_DIS_HW_SPEED_CHANGE (1 << 6) 17462306a36Sopenharmony_ci# define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_MASK (0x3 << 8) 17562306a36Sopenharmony_ci# define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_SHIFT 3 17662306a36Sopenharmony_ci# define LC_CURRENT_DATA_RATE (1 << 11) 17762306a36Sopenharmony_ci# define LC_HW_VOLTAGE_IF_CONTROL(x) ((x) << 12) 17862306a36Sopenharmony_ci# define LC_HW_VOLTAGE_IF_CONTROL_MASK (3 << 12) 17962306a36Sopenharmony_ci# define LC_HW_VOLTAGE_IF_CONTROL_SHIFT 12 18062306a36Sopenharmony_ci# define LC_VOLTAGE_TIMER_SEL_MASK (0xf << 14) 18162306a36Sopenharmony_ci# define LC_CLR_FAILED_SPD_CHANGE_CNT (1 << 21) 18262306a36Sopenharmony_ci# define LC_OTHER_SIDE_EVER_SENT_GEN2 (1 << 23) 18362306a36Sopenharmony_ci# define LC_OTHER_SIDE_SUPPORTS_GEN2 (1 << 24) 18462306a36Sopenharmony_ci 18562306a36Sopenharmony_ci#endif 186