18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2008 Advanced Micro Devices, Inc.
38c2ecf20Sopenharmony_ci * Copyright 2008 Red Hat Inc.
48c2ecf20Sopenharmony_ci * Copyright 2009 Jerome Glisse.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
78c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
88c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
98c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
108c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
118c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
148c2ecf20Sopenharmony_ci * all copies or substantial portions of the Software.
158c2ecf20Sopenharmony_ci *
168c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
178c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
188c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
198c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
208c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
218c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
228c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * Authors: Dave Airlie
258c2ecf20Sopenharmony_ci *          Alex Deucher
268c2ecf20Sopenharmony_ci *          Jerome Glisse
278c2ecf20Sopenharmony_ci */
288c2ecf20Sopenharmony_ci#ifndef __R600_REG_H__
298c2ecf20Sopenharmony_ci#define __R600_REG_H__
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define R600_PCIE_PORT_INDEX                0x0038
328c2ecf20Sopenharmony_ci#define R600_PCIE_PORT_DATA                 0x003c
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define R600_RCU_INDEX                      0x0100
358c2ecf20Sopenharmony_ci#define R600_RCU_DATA                       0x0104
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define R600_UVD_CTX_INDEX                  0xf4a0
388c2ecf20Sopenharmony_ci#define R600_UVD_CTX_DATA                   0xf4a4
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define R600_MC_VM_FB_LOCATION			0x2180
418c2ecf20Sopenharmony_ci#define		R600_MC_FB_BASE_MASK			0x0000FFFF
428c2ecf20Sopenharmony_ci#define		R600_MC_FB_BASE_SHIFT			0
438c2ecf20Sopenharmony_ci#define		R600_MC_FB_TOP_MASK			0xFFFF0000
448c2ecf20Sopenharmony_ci#define		R600_MC_FB_TOP_SHIFT			16
458c2ecf20Sopenharmony_ci#define R600_MC_VM_AGP_TOP			0x2184
468c2ecf20Sopenharmony_ci#define		R600_MC_AGP_TOP_MASK			0x0003FFFF
478c2ecf20Sopenharmony_ci#define		R600_MC_AGP_TOP_SHIFT			0
488c2ecf20Sopenharmony_ci#define R600_MC_VM_AGP_BOT			0x2188
498c2ecf20Sopenharmony_ci#define		R600_MC_AGP_BOT_MASK			0x0003FFFF
508c2ecf20Sopenharmony_ci#define		R600_MC_AGP_BOT_SHIFT			0
518c2ecf20Sopenharmony_ci#define R600_MC_VM_AGP_BASE			0x218c
528c2ecf20Sopenharmony_ci#define R600_MC_VM_SYSTEM_APERTURE_LOW_ADDR	0x2190
538c2ecf20Sopenharmony_ci#define		R600_LOGICAL_PAGE_NUMBER_MASK		0x000FFFFF
548c2ecf20Sopenharmony_ci#define		R600_LOGICAL_PAGE_NUMBER_SHIFT		0
558c2ecf20Sopenharmony_ci#define R600_MC_VM_SYSTEM_APERTURE_HIGH_ADDR	0x2194
568c2ecf20Sopenharmony_ci#define R600_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR	0x2198
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#define R700_MC_VM_FB_LOCATION			0x2024
598c2ecf20Sopenharmony_ci#define		R700_MC_FB_BASE_MASK			0x0000FFFF
608c2ecf20Sopenharmony_ci#define		R700_MC_FB_BASE_SHIFT			0
618c2ecf20Sopenharmony_ci#define		R700_MC_FB_TOP_MASK			0xFFFF0000
628c2ecf20Sopenharmony_ci#define		R700_MC_FB_TOP_SHIFT			16
638c2ecf20Sopenharmony_ci#define R700_MC_VM_AGP_TOP			0x2028
648c2ecf20Sopenharmony_ci#define		R700_MC_AGP_TOP_MASK			0x0003FFFF
658c2ecf20Sopenharmony_ci#define		R700_MC_AGP_TOP_SHIFT			0
668c2ecf20Sopenharmony_ci#define R700_MC_VM_AGP_BOT			0x202c
678c2ecf20Sopenharmony_ci#define		R700_MC_AGP_BOT_MASK			0x0003FFFF
688c2ecf20Sopenharmony_ci#define		R700_MC_AGP_BOT_SHIFT			0
698c2ecf20Sopenharmony_ci#define R700_MC_VM_AGP_BASE			0x2030
708c2ecf20Sopenharmony_ci#define R700_MC_VM_SYSTEM_APERTURE_LOW_ADDR	0x2034
718c2ecf20Sopenharmony_ci#define		R700_LOGICAL_PAGE_NUMBER_MASK		0x000FFFFF
728c2ecf20Sopenharmony_ci#define		R700_LOGICAL_PAGE_NUMBER_SHIFT		0
738c2ecf20Sopenharmony_ci#define R700_MC_VM_SYSTEM_APERTURE_HIGH_ADDR	0x2038
748c2ecf20Sopenharmony_ci#define R700_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR	0x203c
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#define R600_RAMCFG				       0x2408
778c2ecf20Sopenharmony_ci#       define R600_CHANSIZE                           (1 << 7)
788c2ecf20Sopenharmony_ci#       define R600_CHANSIZE_OVERRIDE                  (1 << 10)
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#define R600_GENERAL_PWRMGT                                        0x618
828c2ecf20Sopenharmony_ci#	define R600_OPEN_DRAIN_PADS				   (1 << 11)
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#define R600_LOWER_GPIO_ENABLE                                     0x710
858c2ecf20Sopenharmony_ci#define R600_CTXSW_VID_LOWER_GPIO_CNTL                             0x718
868c2ecf20Sopenharmony_ci#define R600_HIGH_VID_LOWER_GPIO_CNTL                              0x71c
878c2ecf20Sopenharmony_ci#define R600_MEDIUM_VID_LOWER_GPIO_CNTL                            0x720
888c2ecf20Sopenharmony_ci#define R600_LOW_VID_LOWER_GPIO_CNTL                               0x724
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#define R600_D1GRPH_SWAP_CONTROL                     0x610C
918c2ecf20Sopenharmony_ci#       define R600_D1GRPH_ENDIAN_SWAP(x)            (((x) & 0x3) << 0)
928c2ecf20Sopenharmony_ci#       define R600_D1GRPH_SWAP_ENDIAN_NONE          0
938c2ecf20Sopenharmony_ci#       define R600_D1GRPH_SWAP_ENDIAN_16BIT         1
948c2ecf20Sopenharmony_ci#       define R600_D1GRPH_SWAP_ENDIAN_32BIT         2
958c2ecf20Sopenharmony_ci#       define R600_D1GRPH_SWAP_ENDIAN_64BIT         3
968c2ecf20Sopenharmony_ci#       define R600_D1GRPH_RED_CROSSBAR(x)           (((x) & 0x3) << 4)
978c2ecf20Sopenharmony_ci#       define R600_D1GRPH_RED_SEL_R                 0
988c2ecf20Sopenharmony_ci#       define R600_D1GRPH_RED_SEL_G                 1
998c2ecf20Sopenharmony_ci#       define R600_D1GRPH_RED_SEL_B                 2
1008c2ecf20Sopenharmony_ci#       define R600_D1GRPH_RED_SEL_A                 3
1018c2ecf20Sopenharmony_ci#       define R600_D1GRPH_GREEN_CROSSBAR(x)         (((x) & 0x3) << 6)
1028c2ecf20Sopenharmony_ci#       define R600_D1GRPH_GREEN_SEL_G               0
1038c2ecf20Sopenharmony_ci#       define R600_D1GRPH_GREEN_SEL_B               1
1048c2ecf20Sopenharmony_ci#       define R600_D1GRPH_GREEN_SEL_A               2
1058c2ecf20Sopenharmony_ci#       define R600_D1GRPH_GREEN_SEL_R               3
1068c2ecf20Sopenharmony_ci#       define R600_D1GRPH_BLUE_CROSSBAR(x)          (((x) & 0x3) << 8)
1078c2ecf20Sopenharmony_ci#       define R600_D1GRPH_BLUE_SEL_B                0
1088c2ecf20Sopenharmony_ci#       define R600_D1GRPH_BLUE_SEL_A                1
1098c2ecf20Sopenharmony_ci#       define R600_D1GRPH_BLUE_SEL_R                2
1108c2ecf20Sopenharmony_ci#       define R600_D1GRPH_BLUE_SEL_G                3
1118c2ecf20Sopenharmony_ci#       define R600_D1GRPH_ALPHA_CROSSBAR(x)         (((x) & 0x3) << 10)
1128c2ecf20Sopenharmony_ci#       define R600_D1GRPH_ALPHA_SEL_A               0
1138c2ecf20Sopenharmony_ci#       define R600_D1GRPH_ALPHA_SEL_R               1
1148c2ecf20Sopenharmony_ci#       define R600_D1GRPH_ALPHA_SEL_G               2
1158c2ecf20Sopenharmony_ci#       define R600_D1GRPH_ALPHA_SEL_B               3
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci#define R600_HDP_NONSURFACE_BASE                                0x2c04
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci#define R600_BUS_CNTL                                           0x5420
1208c2ecf20Sopenharmony_ci#       define R600_BIOS_ROM_DIS                                (1 << 1)
1218c2ecf20Sopenharmony_ci#define R600_CONFIG_CNTL                                        0x5424
1228c2ecf20Sopenharmony_ci#define R600_CONFIG_MEMSIZE                                     0x5428
1238c2ecf20Sopenharmony_ci#define R600_CONFIG_F0_BASE                                     0x542C
1248c2ecf20Sopenharmony_ci#define R600_CONFIG_APER_SIZE                                   0x5430
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci#define	R600_BIF_FB_EN						0x5490
1278c2ecf20Sopenharmony_ci#define		R600_FB_READ_EN					(1 << 0)
1288c2ecf20Sopenharmony_ci#define		R600_FB_WRITE_EN				(1 << 1)
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci#define R600_CITF_CNTL           				0x200c
1318c2ecf20Sopenharmony_ci#define		R600_BLACKOUT_MASK				0x00000003
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci#define R700_MC_CITF_CNTL           				0x25c0
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci#define R600_ROM_CNTL                              0x1600
1368c2ecf20Sopenharmony_ci#       define R600_SCK_OVERWRITE                  (1 << 1)
1378c2ecf20Sopenharmony_ci#       define R600_SCK_PRESCALE_CRYSTAL_CLK_SHIFT 28
1388c2ecf20Sopenharmony_ci#       define R600_SCK_PRESCALE_CRYSTAL_CLK_MASK  (0xf << 28)
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci#define R600_CG_SPLL_FUNC_CNTL                     0x600
1418c2ecf20Sopenharmony_ci#       define R600_SPLL_BYPASS_EN                 (1 << 3)
1428c2ecf20Sopenharmony_ci#define R600_CG_SPLL_STATUS                        0x60c
1438c2ecf20Sopenharmony_ci#       define R600_SPLL_CHG_STATUS                (1 << 1)
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci#define R600_BIOS_0_SCRATCH               0x1724
1468c2ecf20Sopenharmony_ci#define R600_BIOS_1_SCRATCH               0x1728
1478c2ecf20Sopenharmony_ci#define R600_BIOS_2_SCRATCH               0x172c
1488c2ecf20Sopenharmony_ci#define R600_BIOS_3_SCRATCH               0x1730
1498c2ecf20Sopenharmony_ci#define R600_BIOS_4_SCRATCH               0x1734
1508c2ecf20Sopenharmony_ci#define R600_BIOS_5_SCRATCH               0x1738
1518c2ecf20Sopenharmony_ci#define R600_BIOS_6_SCRATCH               0x173c
1528c2ecf20Sopenharmony_ci#define R600_BIOS_7_SCRATCH               0x1740
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci/* Audio, these regs were reverse enginered,
1558c2ecf20Sopenharmony_ci * so the chance is high that the naming is wrong
1568c2ecf20Sopenharmony_ci * R6xx+ ??? */
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci/* Audio clocks */
1598c2ecf20Sopenharmony_ci#define R600_AUDIO_PLL1_MUL               0x0514
1608c2ecf20Sopenharmony_ci#define R600_AUDIO_PLL1_DIV               0x0518
1618c2ecf20Sopenharmony_ci#define R600_AUDIO_PLL2_MUL               0x0524
1628c2ecf20Sopenharmony_ci#define R600_AUDIO_PLL2_DIV               0x0528
1638c2ecf20Sopenharmony_ci#define R600_AUDIO_CLK_SRCSEL             0x0534
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/* Audio general */
1668c2ecf20Sopenharmony_ci#define R600_AUDIO_ENABLE                 0x7300
1678c2ecf20Sopenharmony_ci#define R600_AUDIO_TIMING                 0x7344
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci/* Audio params */
1708c2ecf20Sopenharmony_ci#define R600_AUDIO_VENDOR_ID              0x7380
1718c2ecf20Sopenharmony_ci#define R600_AUDIO_REVISION_ID            0x7384
1728c2ecf20Sopenharmony_ci#define R600_AUDIO_ROOT_NODE_COUNT        0x7388
1738c2ecf20Sopenharmony_ci#define R600_AUDIO_NID1_NODE_COUNT        0x738c
1748c2ecf20Sopenharmony_ci#define R600_AUDIO_NID1_TYPE              0x7390
1758c2ecf20Sopenharmony_ci#define R600_AUDIO_SUPPORTED_SIZE_RATE    0x7394
1768c2ecf20Sopenharmony_ci#define R600_AUDIO_SUPPORTED_CODEC        0x7398
1778c2ecf20Sopenharmony_ci#define R600_AUDIO_SUPPORTED_POWER_STATES 0x739c
1788c2ecf20Sopenharmony_ci#define R600_AUDIO_NID2_CAPS              0x73a0
1798c2ecf20Sopenharmony_ci#define R600_AUDIO_NID3_CAPS              0x73a4
1808c2ecf20Sopenharmony_ci#define R600_AUDIO_NID3_PIN_CAPS          0x73a8
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci/* Audio conn list */
1838c2ecf20Sopenharmony_ci#define R600_AUDIO_CONN_LIST_LEN          0x73ac
1848c2ecf20Sopenharmony_ci#define R600_AUDIO_CONN_LIST              0x73b0
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci/* Audio verbs */
1878c2ecf20Sopenharmony_ci#define R600_AUDIO_RATE_BPS_CHANNEL       0x73c0
1888c2ecf20Sopenharmony_ci#define R600_AUDIO_PLAYING                0x73c4
1898c2ecf20Sopenharmony_ci#define R600_AUDIO_IMPLEMENTATION_ID      0x73c8
1908c2ecf20Sopenharmony_ci#define R600_AUDIO_CONFIG_DEFAULT         0x73cc
1918c2ecf20Sopenharmony_ci#define R600_AUDIO_PIN_SENSE              0x73d0
1928c2ecf20Sopenharmony_ci#define R600_AUDIO_PIN_WIDGET_CNTL        0x73d4
1938c2ecf20Sopenharmony_ci#define R600_AUDIO_STATUS_BITS            0x73d8
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ci#define DCE2_HDMI_OFFSET0		(0x7400 - 0x7400)
1968c2ecf20Sopenharmony_ci#define DCE2_HDMI_OFFSET1		(0x7700 - 0x7400)
1978c2ecf20Sopenharmony_ci/* DCE3.2 second instance starts at 0x7800 */
1988c2ecf20Sopenharmony_ci#define DCE3_HDMI_OFFSET0		(0x7400 - 0x7400)
1998c2ecf20Sopenharmony_ci#define DCE3_HDMI_OFFSET1		(0x7800 - 0x7400)
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci#endif
202