xref: /openbmc/linux/drivers/gpu/drm/radeon/btcd.h (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
16596afd4SAlex Deucher /*
26596afd4SAlex Deucher  * Copyright 2010 Advanced Micro Devices, Inc.
36596afd4SAlex Deucher  *
46596afd4SAlex Deucher  * Permission is hereby granted, free of charge, to any person obtaining a
56596afd4SAlex Deucher  * copy of this software and associated documentation files (the "Software"),
66596afd4SAlex Deucher  * to deal in the Software without restriction, including without limitation
76596afd4SAlex Deucher  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
86596afd4SAlex Deucher  * and/or sell copies of the Software, and to permit persons to whom the
96596afd4SAlex Deucher  * Software is furnished to do so, subject to the following conditions:
106596afd4SAlex Deucher  *
116596afd4SAlex Deucher  * The above copyright notice and this permission notice shall be included in
126596afd4SAlex Deucher  * all copies or substantial portions of the Software.
136596afd4SAlex Deucher  *
146596afd4SAlex Deucher  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
156596afd4SAlex Deucher  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
166596afd4SAlex Deucher  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
176596afd4SAlex Deucher  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
186596afd4SAlex Deucher  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
196596afd4SAlex Deucher  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
206596afd4SAlex Deucher  * OTHER DEALINGS IN THE SOFTWARE.
216596afd4SAlex Deucher  *
226596afd4SAlex Deucher  * Authors: Alex Deucher
236596afd4SAlex Deucher  */
246596afd4SAlex Deucher #ifndef _BTCD_H_
256596afd4SAlex Deucher #define _BTCD_H_
266596afd4SAlex Deucher 
276596afd4SAlex Deucher /* pm registers */
286596afd4SAlex Deucher 
296596afd4SAlex Deucher #define GENERAL_PWRMGT                                  0x63c
306596afd4SAlex Deucher #       define GLOBAL_PWRMGT_EN                         (1 << 0)
316596afd4SAlex Deucher #       define STATIC_PM_EN                             (1 << 1)
326596afd4SAlex Deucher #       define THERMAL_PROTECTION_DIS                   (1 << 2)
336596afd4SAlex Deucher #       define THERMAL_PROTECTION_TYPE                  (1 << 3)
346596afd4SAlex Deucher #       define ENABLE_GEN2PCIE                          (1 << 4)
356596afd4SAlex Deucher #       define ENABLE_GEN2XSP                           (1 << 5)
366596afd4SAlex Deucher #       define SW_SMIO_INDEX(x)                         ((x) << 6)
376596afd4SAlex Deucher #       define SW_SMIO_INDEX_MASK                       (3 << 6)
386596afd4SAlex Deucher #       define SW_SMIO_INDEX_SHIFT                      6
396596afd4SAlex Deucher #       define LOW_VOLT_D2_ACPI                         (1 << 8)
406596afd4SAlex Deucher #       define LOW_VOLT_D3_ACPI                         (1 << 9)
416596afd4SAlex Deucher #       define VOLT_PWRMGT_EN                           (1 << 10)
426596afd4SAlex Deucher #       define BACKBIAS_PAD_EN                          (1 << 18)
436596afd4SAlex Deucher #       define BACKBIAS_VALUE                           (1 << 19)
446596afd4SAlex Deucher #       define DYN_SPREAD_SPECTRUM_EN                   (1 << 23)
456596afd4SAlex Deucher #       define AC_DC_SW                                 (1 << 24)
466596afd4SAlex Deucher 
47*9f3f63f2SAlex Deucher #define TARGET_AND_CURRENT_PROFILE_INDEX                  0x66c
48*9f3f63f2SAlex Deucher #       define CURRENT_PROFILE_INDEX_MASK                 (0xf << 4)
49*9f3f63f2SAlex Deucher #       define CURRENT_PROFILE_INDEX_SHIFT                4
50*9f3f63f2SAlex Deucher 
516596afd4SAlex Deucher #define	CG_BIF_REQ_AND_RSP				0x7f4
526596afd4SAlex Deucher #define		CG_CLIENT_REQ(x)			((x) << 0)
536596afd4SAlex Deucher #define		CG_CLIENT_REQ_MASK			(0xff << 0)
546596afd4SAlex Deucher #define		CG_CLIENT_REQ_SHIFT			0
556596afd4SAlex Deucher #define		CG_CLIENT_RESP(x)			((x) << 8)
566596afd4SAlex Deucher #define		CG_CLIENT_RESP_MASK			(0xff << 8)
576596afd4SAlex Deucher #define		CG_CLIENT_RESP_SHIFT			8
586596afd4SAlex Deucher #define		CLIENT_CG_REQ(x)			((x) << 16)
596596afd4SAlex Deucher #define		CLIENT_CG_REQ_MASK			(0xff << 16)
606596afd4SAlex Deucher #define		CLIENT_CG_REQ_SHIFT			16
616596afd4SAlex Deucher #define		CLIENT_CG_RESP(x)			((x) << 24)
626596afd4SAlex Deucher #define		CLIENT_CG_RESP_MASK			(0xff << 24)
636596afd4SAlex Deucher #define		CLIENT_CG_RESP_SHIFT			24
646596afd4SAlex Deucher 
656596afd4SAlex Deucher #define	SCLK_PSKIP_CNTL					0x8c0
666596afd4SAlex Deucher #define		PSKIP_ON_ALLOW_STOP_HI(x)		((x) << 16)
676596afd4SAlex Deucher #define		PSKIP_ON_ALLOW_STOP_HI_MASK		(0xff << 16)
686596afd4SAlex Deucher #define		PSKIP_ON_ALLOW_STOP_HI_SHIFT		16
696596afd4SAlex Deucher 
706596afd4SAlex Deucher #define	CG_ULV_CONTROL					0x8c8
716596afd4SAlex Deucher #define	CG_ULV_PARAMETER				0x8cc
726596afd4SAlex Deucher 
736596afd4SAlex Deucher #define	MC_ARB_DRAM_TIMING				0x2774
746596afd4SAlex Deucher #define	MC_ARB_DRAM_TIMING2				0x2778
756596afd4SAlex Deucher 
766596afd4SAlex Deucher #define	MC_ARB_RFSH_RATE				0x27b0
776596afd4SAlex Deucher #define		POWERMODE0(x)				((x) << 0)
786596afd4SAlex Deucher #define		POWERMODE0_MASK				(0xff << 0)
796596afd4SAlex Deucher #define		POWERMODE0_SHIFT			0
806596afd4SAlex Deucher #define		POWERMODE1(x)				((x) << 8)
816596afd4SAlex Deucher #define		POWERMODE1_MASK				(0xff << 8)
826596afd4SAlex Deucher #define		POWERMODE1_SHIFT			8
836596afd4SAlex Deucher #define		POWERMODE2(x)				((x) << 16)
846596afd4SAlex Deucher #define		POWERMODE2_MASK				(0xff << 16)
856596afd4SAlex Deucher #define		POWERMODE2_SHIFT			16
866596afd4SAlex Deucher #define		POWERMODE3(x)				((x) << 24)
876596afd4SAlex Deucher #define		POWERMODE3_MASK				(0xff << 24)
886596afd4SAlex Deucher #define		POWERMODE3_SHIFT			24
896596afd4SAlex Deucher 
906596afd4SAlex Deucher #define MC_ARB_BURST_TIME                               0x2808
916596afd4SAlex Deucher #define		STATE0(x)				((x) << 0)
926596afd4SAlex Deucher #define		STATE0_MASK				(0x1f << 0)
936596afd4SAlex Deucher #define		STATE0_SHIFT				0
946596afd4SAlex Deucher #define		STATE1(x)				((x) << 5)
956596afd4SAlex Deucher #define		STATE1_MASK				(0x1f << 5)
966596afd4SAlex Deucher #define		STATE1_SHIFT				5
976596afd4SAlex Deucher #define		STATE2(x)				((x) << 10)
986596afd4SAlex Deucher #define		STATE2_MASK				(0x1f << 10)
996596afd4SAlex Deucher #define		STATE2_SHIFT				10
1006596afd4SAlex Deucher #define		STATE3(x)				((x) << 15)
1016596afd4SAlex Deucher #define		STATE3_MASK				(0x1f << 15)
1026596afd4SAlex Deucher #define		STATE3_SHIFT				15
1036596afd4SAlex Deucher 
1046596afd4SAlex Deucher #define MC_SEQ_RAS_TIMING                               0x28a0
1056596afd4SAlex Deucher #define MC_SEQ_CAS_TIMING                               0x28a4
1066596afd4SAlex Deucher #define MC_SEQ_MISC_TIMING                              0x28a8
1076596afd4SAlex Deucher #define MC_SEQ_MISC_TIMING2                             0x28ac
1086596afd4SAlex Deucher 
1096596afd4SAlex Deucher #define MC_SEQ_RD_CTL_D0                                0x28b4
1106596afd4SAlex Deucher #define MC_SEQ_RD_CTL_D1                                0x28b8
1116596afd4SAlex Deucher #define MC_SEQ_WR_CTL_D0                                0x28bc
1126596afd4SAlex Deucher #define MC_SEQ_WR_CTL_D1                                0x28c0
1136596afd4SAlex Deucher 
1146596afd4SAlex Deucher #define MC_PMG_AUTO_CFG                                 0x28d4
1156596afd4SAlex Deucher 
1166596afd4SAlex Deucher #define MC_SEQ_STATUS_M                                 0x29f4
1176596afd4SAlex Deucher #       define PMG_PWRSTATE                             (1 << 16)
1186596afd4SAlex Deucher 
1196596afd4SAlex Deucher #define MC_SEQ_MISC0                                    0x2a00
1206596afd4SAlex Deucher #define         MC_SEQ_MISC0_GDDR5_SHIFT                28
1216596afd4SAlex Deucher #define         MC_SEQ_MISC0_GDDR5_MASK                 0xf0000000
1226596afd4SAlex Deucher #define         MC_SEQ_MISC0_GDDR5_VALUE                5
1236596afd4SAlex Deucher #define MC_SEQ_MISC1                                    0x2a04
1246596afd4SAlex Deucher #define MC_SEQ_RESERVE_M                                0x2a08
1256596afd4SAlex Deucher #define MC_PMG_CMD_EMRS                                 0x2a0c
1266596afd4SAlex Deucher 
1276596afd4SAlex Deucher #define MC_SEQ_MISC3                                    0x2a2c
1286596afd4SAlex Deucher 
1296596afd4SAlex Deucher #define MC_SEQ_MISC5                                    0x2a54
1306596afd4SAlex Deucher #define MC_SEQ_MISC6                                    0x2a58
1316596afd4SAlex Deucher 
1326596afd4SAlex Deucher #define MC_SEQ_MISC7                                    0x2a64
1336596afd4SAlex Deucher 
1346596afd4SAlex Deucher #define MC_SEQ_CG                                       0x2a68
1356596afd4SAlex Deucher #define		CG_SEQ_REQ(x)				((x) << 0)
1366596afd4SAlex Deucher #define		CG_SEQ_REQ_MASK				(0xff << 0)
1376596afd4SAlex Deucher #define		CG_SEQ_REQ_SHIFT			0
1386596afd4SAlex Deucher #define		CG_SEQ_RESP(x)				((x) << 8)
1396596afd4SAlex Deucher #define		CG_SEQ_RESP_MASK			(0xff << 8)
1406596afd4SAlex Deucher #define		CG_SEQ_RESP_SHIFT			8
1416596afd4SAlex Deucher #define		SEQ_CG_REQ(x)				((x) << 16)
1426596afd4SAlex Deucher #define		SEQ_CG_REQ_MASK				(0xff << 16)
1436596afd4SAlex Deucher #define		SEQ_CG_REQ_SHIFT			16
1446596afd4SAlex Deucher #define		SEQ_CG_RESP(x)				((x) << 24)
1456596afd4SAlex Deucher #define		SEQ_CG_RESP_MASK			(0xff << 24)
1466596afd4SAlex Deucher #define		SEQ_CG_RESP_SHIFT			24
1476596afd4SAlex Deucher #define MC_SEQ_RAS_TIMING_LP                            0x2a6c
1486596afd4SAlex Deucher #define MC_SEQ_CAS_TIMING_LP                            0x2a70
1496596afd4SAlex Deucher #define MC_SEQ_MISC_TIMING_LP                           0x2a74
1506596afd4SAlex Deucher #define MC_SEQ_MISC_TIMING2_LP                          0x2a78
1516596afd4SAlex Deucher #define MC_SEQ_WR_CTL_D0_LP                             0x2a7c
1526596afd4SAlex Deucher #define MC_SEQ_WR_CTL_D1_LP                             0x2a80
1536596afd4SAlex Deucher #define MC_SEQ_PMG_CMD_EMRS_LP                          0x2a84
1546596afd4SAlex Deucher #define MC_SEQ_PMG_CMD_MRS_LP                           0x2a88
1556596afd4SAlex Deucher 
1566596afd4SAlex Deucher #define MC_PMG_CMD_MRS                                  0x2aac
1576596afd4SAlex Deucher 
1586596afd4SAlex Deucher #define MC_SEQ_RD_CTL_D0_LP                             0x2b1c
1596596afd4SAlex Deucher #define MC_SEQ_RD_CTL_D1_LP                             0x2b20
1606596afd4SAlex Deucher 
1616596afd4SAlex Deucher #define MC_PMG_CMD_MRS1                                 0x2b44
1626596afd4SAlex Deucher #define MC_SEQ_PMG_CMD_MRS1_LP                          0x2b48
1636596afd4SAlex Deucher 
1646596afd4SAlex Deucher #define	LB_SYNC_RESET_SEL				0x6b28
1656596afd4SAlex Deucher #define		LB_SYNC_RESET_SEL_MASK			(3 << 0)
1666596afd4SAlex Deucher #define		LB_SYNC_RESET_SEL_SHIFT			0
1676596afd4SAlex Deucher 
1686596afd4SAlex Deucher /* PCIE link stuff */
1696596afd4SAlex Deucher #define PCIE_LC_SPEED_CNTL                                0xa4 /* PCIE_P */
1706596afd4SAlex Deucher #       define LC_GEN2_EN_STRAP                           (1 << 0)
1716596afd4SAlex Deucher #       define LC_TARGET_LINK_SPEED_OVERRIDE_EN           (1 << 1)
1726596afd4SAlex Deucher #       define LC_FORCE_EN_HW_SPEED_CHANGE                (1 << 5)
1736596afd4SAlex Deucher #       define LC_FORCE_DIS_HW_SPEED_CHANGE               (1 << 6)
1746596afd4SAlex Deucher #       define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_MASK      (0x3 << 8)
1756596afd4SAlex Deucher #       define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_SHIFT     3
1766596afd4SAlex Deucher #       define LC_CURRENT_DATA_RATE                       (1 << 11)
1776596afd4SAlex Deucher #       define LC_HW_VOLTAGE_IF_CONTROL(x)                ((x) << 12)
1786596afd4SAlex Deucher #       define LC_HW_VOLTAGE_IF_CONTROL_MASK              (3 << 12)
1796596afd4SAlex Deucher #       define LC_HW_VOLTAGE_IF_CONTROL_SHIFT             12
1806596afd4SAlex Deucher #       define LC_VOLTAGE_TIMER_SEL_MASK                  (0xf << 14)
1816596afd4SAlex Deucher #       define LC_CLR_FAILED_SPD_CHANGE_CNT               (1 << 21)
1826596afd4SAlex Deucher #       define LC_OTHER_SIDE_EVER_SENT_GEN2               (1 << 23)
1836596afd4SAlex Deucher #       define LC_OTHER_SIDE_SUPPORTS_GEN2                (1 << 24)
1846596afd4SAlex Deucher 
1856596afd4SAlex Deucher #endif
186