162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright 2008 Advanced Micro Devices, Inc.
362306a36Sopenharmony_ci * Copyright 2008 Red Hat Inc.
462306a36Sopenharmony_ci * Copyright 2009 Jerome Glisse.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
762306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
862306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation
962306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1062306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
1162306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
1262306a36Sopenharmony_ci *
1362306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
1462306a36Sopenharmony_ci * all copies or substantial portions of the Software.
1562306a36Sopenharmony_ci *
1662306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1762306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1862306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1962306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
2062306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
2162306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2262306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci * Authors: Dave Airlie
2562306a36Sopenharmony_ci *          Alex Deucher
2662306a36Sopenharmony_ci *          Jerome Glisse
2762306a36Sopenharmony_ci */
2862306a36Sopenharmony_ci#ifndef __R600_REG_H__
2962306a36Sopenharmony_ci#define __R600_REG_H__
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#define R600_PCIE_PORT_INDEX                0x0038
3262306a36Sopenharmony_ci#define R600_PCIE_PORT_DATA                 0x003c
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define R600_RCU_INDEX                      0x0100
3562306a36Sopenharmony_ci#define R600_RCU_DATA                       0x0104
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci#define R600_UVD_CTX_INDEX                  0xf4a0
3862306a36Sopenharmony_ci#define R600_UVD_CTX_DATA                   0xf4a4
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#define R600_MC_VM_FB_LOCATION			0x2180
4162306a36Sopenharmony_ci#define		R600_MC_FB_BASE_MASK			0x0000FFFF
4262306a36Sopenharmony_ci#define		R600_MC_FB_BASE_SHIFT			0
4362306a36Sopenharmony_ci#define		R600_MC_FB_TOP_MASK			0xFFFF0000
4462306a36Sopenharmony_ci#define		R600_MC_FB_TOP_SHIFT			16
4562306a36Sopenharmony_ci#define R600_MC_VM_AGP_TOP			0x2184
4662306a36Sopenharmony_ci#define		R600_MC_AGP_TOP_MASK			0x0003FFFF
4762306a36Sopenharmony_ci#define		R600_MC_AGP_TOP_SHIFT			0
4862306a36Sopenharmony_ci#define R600_MC_VM_AGP_BOT			0x2188
4962306a36Sopenharmony_ci#define		R600_MC_AGP_BOT_MASK			0x0003FFFF
5062306a36Sopenharmony_ci#define		R600_MC_AGP_BOT_SHIFT			0
5162306a36Sopenharmony_ci#define R600_MC_VM_AGP_BASE			0x218c
5262306a36Sopenharmony_ci#define R600_MC_VM_SYSTEM_APERTURE_LOW_ADDR	0x2190
5362306a36Sopenharmony_ci#define		R600_LOGICAL_PAGE_NUMBER_MASK		0x000FFFFF
5462306a36Sopenharmony_ci#define		R600_LOGICAL_PAGE_NUMBER_SHIFT		0
5562306a36Sopenharmony_ci#define R600_MC_VM_SYSTEM_APERTURE_HIGH_ADDR	0x2194
5662306a36Sopenharmony_ci#define R600_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR	0x2198
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#define R700_MC_VM_FB_LOCATION			0x2024
5962306a36Sopenharmony_ci#define		R700_MC_FB_BASE_MASK			0x0000FFFF
6062306a36Sopenharmony_ci#define		R700_MC_FB_BASE_SHIFT			0
6162306a36Sopenharmony_ci#define		R700_MC_FB_TOP_MASK			0xFFFF0000
6262306a36Sopenharmony_ci#define		R700_MC_FB_TOP_SHIFT			16
6362306a36Sopenharmony_ci#define R700_MC_VM_AGP_TOP			0x2028
6462306a36Sopenharmony_ci#define		R700_MC_AGP_TOP_MASK			0x0003FFFF
6562306a36Sopenharmony_ci#define		R700_MC_AGP_TOP_SHIFT			0
6662306a36Sopenharmony_ci#define R700_MC_VM_AGP_BOT			0x202c
6762306a36Sopenharmony_ci#define		R700_MC_AGP_BOT_MASK			0x0003FFFF
6862306a36Sopenharmony_ci#define		R700_MC_AGP_BOT_SHIFT			0
6962306a36Sopenharmony_ci#define R700_MC_VM_AGP_BASE			0x2030
7062306a36Sopenharmony_ci#define R700_MC_VM_SYSTEM_APERTURE_LOW_ADDR	0x2034
7162306a36Sopenharmony_ci#define		R700_LOGICAL_PAGE_NUMBER_MASK		0x000FFFFF
7262306a36Sopenharmony_ci#define		R700_LOGICAL_PAGE_NUMBER_SHIFT		0
7362306a36Sopenharmony_ci#define R700_MC_VM_SYSTEM_APERTURE_HIGH_ADDR	0x2038
7462306a36Sopenharmony_ci#define R700_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR	0x203c
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci#define R600_RAMCFG				       0x2408
7762306a36Sopenharmony_ci#       define R600_CHANSIZE                           (1 << 7)
7862306a36Sopenharmony_ci#       define R600_CHANSIZE_OVERRIDE                  (1 << 10)
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci#define R600_GENERAL_PWRMGT                                        0x618
8262306a36Sopenharmony_ci#	define R600_OPEN_DRAIN_PADS				   (1 << 11)
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci#define R600_LOWER_GPIO_ENABLE                                     0x710
8562306a36Sopenharmony_ci#define R600_CTXSW_VID_LOWER_GPIO_CNTL                             0x718
8662306a36Sopenharmony_ci#define R600_HIGH_VID_LOWER_GPIO_CNTL                              0x71c
8762306a36Sopenharmony_ci#define R600_MEDIUM_VID_LOWER_GPIO_CNTL                            0x720
8862306a36Sopenharmony_ci#define R600_LOW_VID_LOWER_GPIO_CNTL                               0x724
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci#define R600_D1GRPH_SWAP_CONTROL                     0x610C
9162306a36Sopenharmony_ci#       define R600_D1GRPH_ENDIAN_SWAP(x)            (((x) & 0x3) << 0)
9262306a36Sopenharmony_ci#       define R600_D1GRPH_SWAP_ENDIAN_NONE          0
9362306a36Sopenharmony_ci#       define R600_D1GRPH_SWAP_ENDIAN_16BIT         1
9462306a36Sopenharmony_ci#       define R600_D1GRPH_SWAP_ENDIAN_32BIT         2
9562306a36Sopenharmony_ci#       define R600_D1GRPH_SWAP_ENDIAN_64BIT         3
9662306a36Sopenharmony_ci#       define R600_D1GRPH_RED_CROSSBAR(x)           (((x) & 0x3) << 4)
9762306a36Sopenharmony_ci#       define R600_D1GRPH_RED_SEL_R                 0
9862306a36Sopenharmony_ci#       define R600_D1GRPH_RED_SEL_G                 1
9962306a36Sopenharmony_ci#       define R600_D1GRPH_RED_SEL_B                 2
10062306a36Sopenharmony_ci#       define R600_D1GRPH_RED_SEL_A                 3
10162306a36Sopenharmony_ci#       define R600_D1GRPH_GREEN_CROSSBAR(x)         (((x) & 0x3) << 6)
10262306a36Sopenharmony_ci#       define R600_D1GRPH_GREEN_SEL_G               0
10362306a36Sopenharmony_ci#       define R600_D1GRPH_GREEN_SEL_B               1
10462306a36Sopenharmony_ci#       define R600_D1GRPH_GREEN_SEL_A               2
10562306a36Sopenharmony_ci#       define R600_D1GRPH_GREEN_SEL_R               3
10662306a36Sopenharmony_ci#       define R600_D1GRPH_BLUE_CROSSBAR(x)          (((x) & 0x3) << 8)
10762306a36Sopenharmony_ci#       define R600_D1GRPH_BLUE_SEL_B                0
10862306a36Sopenharmony_ci#       define R600_D1GRPH_BLUE_SEL_A                1
10962306a36Sopenharmony_ci#       define R600_D1GRPH_BLUE_SEL_R                2
11062306a36Sopenharmony_ci#       define R600_D1GRPH_BLUE_SEL_G                3
11162306a36Sopenharmony_ci#       define R600_D1GRPH_ALPHA_CROSSBAR(x)         (((x) & 0x3) << 10)
11262306a36Sopenharmony_ci#       define R600_D1GRPH_ALPHA_SEL_A               0
11362306a36Sopenharmony_ci#       define R600_D1GRPH_ALPHA_SEL_R               1
11462306a36Sopenharmony_ci#       define R600_D1GRPH_ALPHA_SEL_G               2
11562306a36Sopenharmony_ci#       define R600_D1GRPH_ALPHA_SEL_B               3
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci#define R600_HDP_NONSURFACE_BASE                                0x2c04
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci#define R600_BUS_CNTL                                           0x5420
12062306a36Sopenharmony_ci#       define R600_BIOS_ROM_DIS                                (1 << 1)
12162306a36Sopenharmony_ci#define R600_CONFIG_CNTL                                        0x5424
12262306a36Sopenharmony_ci#define R600_CONFIG_MEMSIZE                                     0x5428
12362306a36Sopenharmony_ci#define R600_CONFIG_F0_BASE                                     0x542C
12462306a36Sopenharmony_ci#define R600_CONFIG_APER_SIZE                                   0x5430
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci#define	R600_BIF_FB_EN						0x5490
12762306a36Sopenharmony_ci#define		R600_FB_READ_EN					(1 << 0)
12862306a36Sopenharmony_ci#define		R600_FB_WRITE_EN				(1 << 1)
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci#define R600_CITF_CNTL           				0x200c
13162306a36Sopenharmony_ci#define		R600_BLACKOUT_MASK				0x00000003
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci#define R700_MC_CITF_CNTL           				0x25c0
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ci#define R600_ROM_CNTL                              0x1600
13662306a36Sopenharmony_ci#       define R600_SCK_OVERWRITE                  (1 << 1)
13762306a36Sopenharmony_ci#       define R600_SCK_PRESCALE_CRYSTAL_CLK_SHIFT 28
13862306a36Sopenharmony_ci#       define R600_SCK_PRESCALE_CRYSTAL_CLK_MASK  (0xf << 28)
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci#define R600_CG_SPLL_FUNC_CNTL                     0x600
14162306a36Sopenharmony_ci#       define R600_SPLL_BYPASS_EN                 (1 << 3)
14262306a36Sopenharmony_ci#define R600_CG_SPLL_STATUS                        0x60c
14362306a36Sopenharmony_ci#       define R600_SPLL_CHG_STATUS                (1 << 1)
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci#define R600_BIOS_0_SCRATCH               0x1724
14662306a36Sopenharmony_ci#define R600_BIOS_1_SCRATCH               0x1728
14762306a36Sopenharmony_ci#define R600_BIOS_2_SCRATCH               0x172c
14862306a36Sopenharmony_ci#define R600_BIOS_3_SCRATCH               0x1730
14962306a36Sopenharmony_ci#define R600_BIOS_4_SCRATCH               0x1734
15062306a36Sopenharmony_ci#define R600_BIOS_5_SCRATCH               0x1738
15162306a36Sopenharmony_ci#define R600_BIOS_6_SCRATCH               0x173c
15262306a36Sopenharmony_ci#define R600_BIOS_7_SCRATCH               0x1740
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci/* Audio, these regs were reverse enginered,
15562306a36Sopenharmony_ci * so the chance is high that the naming is wrong
15662306a36Sopenharmony_ci * R6xx+ ??? */
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci/* Audio clocks */
15962306a36Sopenharmony_ci#define R600_AUDIO_PLL1_MUL               0x0514
16062306a36Sopenharmony_ci#define R600_AUDIO_PLL1_DIV               0x0518
16162306a36Sopenharmony_ci#define R600_AUDIO_PLL2_MUL               0x0524
16262306a36Sopenharmony_ci#define R600_AUDIO_PLL2_DIV               0x0528
16362306a36Sopenharmony_ci#define R600_AUDIO_CLK_SRCSEL             0x0534
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci/* Audio general */
16662306a36Sopenharmony_ci#define R600_AUDIO_ENABLE                 0x7300
16762306a36Sopenharmony_ci#define R600_AUDIO_TIMING                 0x7344
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci/* Audio params */
17062306a36Sopenharmony_ci#define R600_AUDIO_VENDOR_ID              0x7380
17162306a36Sopenharmony_ci#define R600_AUDIO_REVISION_ID            0x7384
17262306a36Sopenharmony_ci#define R600_AUDIO_ROOT_NODE_COUNT        0x7388
17362306a36Sopenharmony_ci#define R600_AUDIO_NID1_NODE_COUNT        0x738c
17462306a36Sopenharmony_ci#define R600_AUDIO_NID1_TYPE              0x7390
17562306a36Sopenharmony_ci#define R600_AUDIO_SUPPORTED_SIZE_RATE    0x7394
17662306a36Sopenharmony_ci#define R600_AUDIO_SUPPORTED_CODEC        0x7398
17762306a36Sopenharmony_ci#define R600_AUDIO_SUPPORTED_POWER_STATES 0x739c
17862306a36Sopenharmony_ci#define R600_AUDIO_NID2_CAPS              0x73a0
17962306a36Sopenharmony_ci#define R600_AUDIO_NID3_CAPS              0x73a4
18062306a36Sopenharmony_ci#define R600_AUDIO_NID3_PIN_CAPS          0x73a8
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci/* Audio conn list */
18362306a36Sopenharmony_ci#define R600_AUDIO_CONN_LIST_LEN          0x73ac
18462306a36Sopenharmony_ci#define R600_AUDIO_CONN_LIST              0x73b0
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ci/* Audio verbs */
18762306a36Sopenharmony_ci#define R600_AUDIO_RATE_BPS_CHANNEL       0x73c0
18862306a36Sopenharmony_ci#define R600_AUDIO_PLAYING                0x73c4
18962306a36Sopenharmony_ci#define R600_AUDIO_IMPLEMENTATION_ID      0x73c8
19062306a36Sopenharmony_ci#define R600_AUDIO_CONFIG_DEFAULT         0x73cc
19162306a36Sopenharmony_ci#define R600_AUDIO_PIN_SENSE              0x73d0
19262306a36Sopenharmony_ci#define R600_AUDIO_PIN_WIDGET_CNTL        0x73d4
19362306a36Sopenharmony_ci#define R600_AUDIO_STATUS_BITS            0x73d8
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_ci#define DCE2_HDMI_OFFSET0		(0x7400 - 0x7400)
19662306a36Sopenharmony_ci#define DCE2_HDMI_OFFSET1		(0x7700 - 0x7400)
19762306a36Sopenharmony_ci/* DCE3.2 second instance starts at 0x7800 */
19862306a36Sopenharmony_ci#define DCE3_HDMI_OFFSET0		(0x7400 - 0x7400)
19962306a36Sopenharmony_ci#define DCE3_HDMI_OFFSET1		(0x7800 - 0x7400)
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci#endif
202