1/*
2 * Copyright 2010 Advanced Micro Devices, Inc.
3 * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
4 *                VA Linux Systems Inc., Fremont, California.
5 *
6 * All Rights Reserved.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
25 *
26 * Authors: Alex Deucher
27 *          Kevin E. Martin <martin@xfree86.org>
28 *          Rickard E. Faith <faith@valinux.com>
29 *          Alan Hourihane <alanh@fairlite.demon.co.uk>
30 *          Alexander von Gluck <kallisti5@unixzen.com>
31 */
32#ifndef __EVERGREEN_REG_H__
33#define __EVERGREEN_REG_H__
34
35
36/* Scratch Registers */
37#define	EVERGREEN_SCRATCH_REG0				0x8500
38#define	EVERGREEN_SCRATCH_REG1				0x8504
39#define	EVERGREEN_SCRATCH_REG2				0x8508
40#define	EVERGREEN_SCRATCH_REG3				0x850C
41#define	EVERGREEN_SCRATCH_REG4				0x8510
42#define	EVERGREEN_SCRATCH_REG5				0x8514
43#define	EVERGREEN_SCRATCH_REG6				0x8518
44#define	EVERGREEN_SCRATCH_REG7				0x851C
45#define	EVERGREEN_SCRATCH_UMSK				0x8540
46#define	EVERGREEN_SCRATCH_ADDR				0x8544
47
48/* CRT controler register offset */
49#define EVERGREEN_CRTC0_REGISTER_OFFSET		(0x6df0 - 0x6df0)
50#define EVERGREEN_CRTC1_REGISTER_OFFSET		(0x79f0 - 0x6df0)
51#define EVERGREEN_CRTC2_REGISTER_OFFSET		(0x105f0 - 0x6df0)
52#define EVERGREEN_CRTC3_REGISTER_OFFSET		(0x111f0 - 0x6df0)
53#define EVERGREEN_CRTC4_REGISTER_OFFSET		(0x11df0 - 0x6df0)
54#define EVERGREEN_CRTC5_REGISTER_OFFSET		(0x129f0 - 0x6df0)
55
56/* Memory Controler */
57#define	EVERGREEN_MC_ARB_RAMCFG						0x2760
58#define		EVERGREEN_NOOFBANK_SHIFT				0
59#define		EVERGREEN_NOOFBANK_MASK					0x00000003
60#define		EVERGREEN_NOOFRANK_SHIFT				2
61#define		EVERGREEN_NOOFRANK_MASK					0x00000004
62#define		EVERGREEN_NOOFROWS_SHIFT				3
63#define		EVERGREEN_NOOFROWS_MASK					0x00000038
64#define		EVERGREEN_NOOFCOLS_SHIFT				6
65#define		EVERGREEN_NOOFCOLS_MASK					0x000000C0
66#define		EVERGREEN_CHANSIZE_SHIFT				8
67#define		EVERGREEN_CHANSIZE_MASK					0x00000100
68#define		EVERGREEN_BURSTLENGTH_SHIFT				9
69#define		EVERGREEN_BURSTLENGTH_MASK				0x00000200
70#define		EVERGREEN_CHANSIZE_OVERRIDE				(1 << 11)
71#define	EVERGREEN_FUS_MC_ARB_RAMCFG					0x2768
72#define	EVERGREEN_MC_VM_AGP_TOP						0x2028
73#define	EVERGREEN_MC_VM_AGP_BOT						0x202C
74#define	EVERGREEN_MC_VM_AGP_BASE					0x2030
75#define	EVERGREEN_MC_VM_FB_LOCATION					0x2024
76#define	EVERGREEN_MC_FUS_VM_FB_OFFSET				0x2898
77#define	EVERGREEN_MC_VM_MB_L1_TLB0_CNTL				0x2234
78#define	EVERGREEN_MC_VM_MB_L1_TLB1_CNTL				0x2238
79#define	EVERGREEN_MC_VM_MB_L1_TLB2_CNTL				0x223C
80#define	EVERGREEN_MC_VM_MB_L1_TLB3_CNTL				0x2240
81#define		EVERGREEN_ENABLE_L1_TLB						(1 << 0)
82#define		EVERGREEN_ENABLE_L1_FRAGMENT_PROCESSING		(1 << 1)
83#define		EVERGREEN_SYSTEM_ACCESS_MODE_PA_ONLY		(0 << 3)
84#define		EVERGREEN_SYSTEM_ACCESS_MODE_USE_SYS_MAP	(1 << 3)
85#define		EVERGREEN_SYSTEM_ACCESS_MODE_IN_SYS			(2 << 3)
86#define		EVERGREEN_SYSTEM_ACCESS_MODE_NOT_IN_SYS		(3 << 3)
87#define		EVERGREEN_SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU (0 << 5)
88#define		EVERGREEN_EFFECTIVE_L1_TLB_SIZE(x)			((x)<<15)
89#define		EVERGREEN_EFFECTIVE_L1_QUEUE_SIZE(x)		((x)<<18)
90#define	EVERGREEN_MC_VM_MD_L1_TLB0_CNTL				0x2654
91#define	EVERGREEN_MC_VM_MD_L1_TLB1_CNTL				0x2658
92#define	EVERGREEN_MC_VM_MD_L1_TLB2_CNTL				0x265C
93
94#define	EVERGREEN_FUS_MC_VM_MD_L1_TLB0_CNTL			0x265C
95#define	EVERGREEN_FUS_MC_VM_MD_L1_TLB1_CNTL			0x2660
96#define	EVERGREEN_FUS_MC_VM_MD_L1_TLB2_CNTL			0x2664
97
98#define	EVERGREEN_MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x203C
99#define	EVERGREEN_MC_VM_SYSTEM_APERTURE_HIGH_ADDR	0x2038
100#define	EVERGREEN_MC_VM_SYSTEM_APERTURE_LOW_ADDR	0x2034
101
102/* Hot Plug Detection */
103#define EVERGREEN_HDP_HOST_PATH_CNTL				0x2C00
104#define EVERGREEN_HDP_NONSURFACE_BASE				0x2C04
105#define EVERGREEN_HDP_NONSURFACE_INFO				0x2C08
106#define EVERGREEN_HDP_NONSURFACE_SIZE				0x2C0C
107#define EVERGREEN_HDP_TILING_CONFIG					0x2F3C
108#define EVERGREEN_HDP_MEM_COHERENCY_FLUSH_CNTL		0x5480
109#define EVERGREEN_HDP_REG_COHERENCY_FLUSH_CNTL		0x54A0
110
111/* Sensors */
112#define EVERGREEN_CG_THERMAL_CTRL					0x72c
113#define		EVERGREEN_TOFFSET_MASK					0x00003FE0
114#define		EVERGREEN_TOFFSET_SHIFT					5
115#define EVERGREEN_CG_MULT_THERMAL_STATUS			0x740
116#define		EVERGREEN_ASIC_T(x)						((x) << 16)
117#define		EVERGREEN_ASIC_T_MASK					0x07FF0000
118#define     EVERGREEN_ASIC_T_SHIFT					16
119#define EVERGREEN_CG_TS0_STATUS						0x760
120#define		EVERGREEN_TS0_ADC_DOUT_MASK				0x000003FF
121#define		EVERGREEN_TS0_ADC_DOUT_SHIFT			0
122/* APU */
123#define EVERGREEN_CG_THERMAL_STATUS					0x678
124
125#define EVERGREEN_VGA_MEMORY_BASE_ADDRESS			0x310
126#define EVERGREEN_VGA_MEMORY_BASE_ADDRESS_HIGH		0x324
127#define EVERGREEN_D3VGA_CONTROL						0x3e0
128#define EVERGREEN_D4VGA_CONTROL						0x3e4
129#define EVERGREEN_D5VGA_CONTROL						0x3e8
130#define EVERGREEN_D6VGA_CONTROL						0x3ec
131#define EVERGREEN_P1PLL_SS_CNTL						0x414
132#define EVERGREEN_P2PLL_SS_CNTL						0x454
133#define 	EVERGREEN_PxPLL_SS_EN					(1 << 12)
134#define EVERGREEN_GRPH_ENABLE						0x6800
135#define EVERGREEN_GRPH_CONTROL						0x6804
136#define 	EVERGREEN_GRPH_DEPTH(x)					(((x) & 0x3) << 0)
137#define 	EVERGREEN_GRPH_DEPTH_8BPP				0
138#define 	EVERGREEN_GRPH_DEPTH_16BPP				1
139#define 	EVERGREEN_GRPH_DEPTH_32BPP				2
140#define 	EVERGREEN_GRPH_FORMAT(x)				(((x) & 0x7) << 8)
141#define 	EVERGREEN_GRPH_FORMAT_INDEXED			0
142#define 	EVERGREEN_GRPH_FORMAT_ARGB1555			0
143#define 	EVERGREEN_GRPH_FORMAT_ARGB565			1
144#define 	EVERGREEN_GRPH_FORMAT_ARGB4444			2
145#define 	EVERGREEN_GRPH_FORMAT_AI88				3
146#define 	EVERGREEN_GRPH_FORMAT_MONO16			4
147#define 	EVERGREEN_GRPH_FORMAT_BGRA5551			5
148#define 	EVERGREEN_GRPH_FORMAT_ARGB8888			0
149#define 	EVERGREEN_GRPH_FORMAT_ARGB2101010		1
150#define 	EVERGREEN_GRPH_FORMAT_32BPP_DIG			2
151#define 	EVERGREEN_GRPH_FORMAT_8B_ARGB2101010	3
152#define 	EVERGREEN_GRPH_FORMAT_BGRA1010102		4
153#define 	EVERGREEN_GRPH_FORMAT_8B_BGRA1010102	5
154#define 	EVERGREEN_GRPH_FORMAT_RGB111110			6
155#define 	EVERGREEN_GRPH_FORMAT_BGR101111			7
156#define EVERGREEN_GRPH_SWAP_CONTROL					0x680c
157#define 	EVERGREEN_GRPH_ENDIAN_SWAP(x)			(((x) & 0x3) << 0)
158#define 	EVERGREEN_GRPH_ENDIAN_NONE				0
159#define 	EVERGREEN_GRPH_ENDIAN_8IN16				1
160#define 	EVERGREEN_GRPH_ENDIAN_8IN32				2
161#define 	EVERGREEN_GRPH_ENDIAN_8IN64				3
162#define 	EVERGREEN_GRPH_RED_CROSSBAR(x)			(((x) & 0x3) << 4)
163#define 	EVERGREEN_GRPH_RED_SEL_R				0
164#define 	EVERGREEN_GRPH_RED_SEL_G				1
165#define 	EVERGREEN_GRPH_RED_SEL_B				2
166#define 	EVERGREEN_GRPH_RED_SEL_A				3
167#define 	EVERGREEN_GRPH_GREEN_CROSSBAR(x)		(((x) & 0x3) << 6)
168#define 	EVERGREEN_GRPH_GREEN_SEL_G				0
169#define 	EVERGREEN_GRPH_GREEN_SEL_B				1
170#define 	EVERGREEN_GRPH_GREEN_SEL_A				2
171#define 	EVERGREEN_GRPH_GREEN_SEL_R				3
172#define 	EVERGREEN_GRPH_BLUE_CROSSBAR(x)			(((x) & 0x3) << 8)
173#define 	EVERGREEN_GRPH_BLUE_SEL_B				0
174#define 	EVERGREEN_GRPH_BLUE_SEL_A				1
175#define 	EVERGREEN_GRPH_BLUE_SEL_R				2
176#define 	EVERGREEN_GRPH_BLUE_SEL_G				3
177#define 	EVERGREEN_GRPH_ALPHA_CROSSBAR(x)		(((x) & 0x3) << 10)
178#define 	EVERGREEN_GRPH_ALPHA_SEL_A				0
179#define 	EVERGREEN_GRPH_ALPHA_SEL_R				1
180#define 	EVERGREEN_GRPH_ALPHA_SEL_G				2
181#define 	EVERGREEN_GRPH_ALPHA_SEL_B				3
182#define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS		0x6810
183#define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS	0x6814
184#define 	EVERGREEN_GRPH_DFQ_ENABLE				(1 << 0)
185#define 	EVERGREEN_GRPH_SURFACE_ADDRESS_MASK		0xffffff00
186#define EVERGREEN_GRPH_PITCH						0x6818
187#define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH	0x681c
188#define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x6820
189#define EVERGREEN_GRPH_SURFACE_OFFSET_X				0x6824
190#define EVERGREEN_GRPH_SURFACE_OFFSET_Y				0x6828
191#define EVERGREEN_GRPH_X_START						0x682c
192#define EVERGREEN_GRPH_Y_START						0x6830
193#define EVERGREEN_GRPH_X_END						0x6834
194#define EVERGREEN_GRPH_Y_END						0x6838
195#define EVERGREEN_GRPH_FLIP_CONTROL					0x6848
196#       define EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN (1 << 0)
197#define EVERGREEN_CUR_CONTROL						0x6998
198#define 	EVERGREEN_CURSOR_EN						(1 << 0)
199#define 	EVERGREEN_CURSOR_MODE(x)				(((x) & 0x3) << 8)
200#define 	EVERGREEN_CURSOR_MONO					0
201#define 	EVERGREEN_CURSOR_24_1					1
202#define 	EVERGREEN_CURSOR_24_8_PRE_MULT			2
203#define 	EVERGREEN_CURSOR_24_8_UNPRE_MULT		3
204#define 	EVERGREEN_CURSOR_2X_MAGNIFY				(1 << 16)
205#define 	EVERGREEN_CURSOR_FORCE_MC_ON			(1 << 20)
206#define 	EVERGREEN_CURSOR_URGENT_CONTROL(x)		(((x) & 0x7) << 24)
207#define 	EVERGREEN_CURSOR_URGENT_ALWAYS			0
208#define 	EVERGREEN_CURSOR_URGENT_1_8				1
209#define 	EVERGREEN_CURSOR_URGENT_1_4				2
210#define 	EVERGREEN_CURSOR_URGENT_3_8				3
211#define 	EVERGREEN_CURSOR_URGENT_1_2				4
212#define EVERGREEN_CUR_SURFACE_ADDRESS				0x699c
213#define 	EVERGREEN_CUR_SURFACE_ADDRESS_MASK		0xfffff000
214#define EVERGREEN_CUR_SIZE							0x69a0
215#define EVERGREEN_CUR_SURFACE_ADDRESS_HIGH			0x69a4
216#define EVERGREEN_CUR_POSITION						0x69a8
217#define EVERGREEN_CUR_HOT_SPOT						0x69ac
218#define EVERGREEN_CUR_COLOR1						0x69b0
219#define EVERGREEN_CUR_COLOR2						0x69b4
220#define EVERGREEN_CUR_UPDATE						0x69b8
221#define 	EVERGREEN_CURSOR_UPDATE_PENDING			(1 << 0)
222#define 	EVERGREEN_CURSOR_UPDATE_TAKEN			(1 << 1)
223#define 	EVERGREEN_CURSOR_UPDATE_LOCK			(1 << 16)
224#define 	EVERGREEN_CURSOR_DISABLE_MULTIPLE_UPDATE (1 << 24)
225#define EVERGREEN_DC_LUT_RW_MODE					0x69e0
226#define EVERGREEN_DC_LUT_RW_INDEX					0x69e4
227#define EVERGREEN_DC_LUT_SEQ_COLOR					0x69e8
228#define EVERGREEN_DC_LUT_PWL_DATA					0x69ec
229#define EVERGREEN_DC_LUT_30_COLOR					0x69f0
230#define EVERGREEN_DC_LUT_VGA_ACCESS_ENABLE			0x69f4
231#define EVERGREEN_DC_LUT_WRITE_EN_MASK				0x69f8
232#define EVERGREEN_DC_LUT_AUTOFILL					0x69fc
233#define EVERGREEN_DC_LUT_CONTROL					0x6a00
234#define EVERGREEN_DC_LUT_BLACK_OFFSET_BLUE			0x6a04
235#define EVERGREEN_DC_LUT_BLACK_OFFSET_GREEN			0x6a08
236#define EVERGREEN_DC_LUT_BLACK_OFFSET_RED			0x6a0c
237#define EVERGREEN_DC_LUT_WHITE_OFFSET_BLUE			0x6a10
238#define EVERGREEN_DC_LUT_WHITE_OFFSET_GREEN			0x6a14
239#define EVERGREEN_DC_LUT_WHITE_OFFSET_RED			0x6a18
240#define EVERGREEN_DATA_FORMAT						0x6b00
241#define 	EVERGREEN_INTERLEAVE_EN					(1 << 0)
242#define EVERGREEN_DESKTOP_HEIGHT					0x6b04
243#define EVERGREEN_VLINE_START_END					0x6b08
244#define 	EVERGREEN_VLINE_START_SHIFT				0
245#define 	EVERGREEN_VLINE_END_SHIFT				16
246#define 	EVERGREEN_VLINE_INV						(1 << 31)
247#define EVERGREEN_VLINE_STATUS						0x6bb8
248#define 	EVERGREEN_VLINE_STAT					(1 << 12)
249#define EVERGREEN_VIEWPORT_START					0x6d70
250#define EVERGREEN_VIEWPORT_SIZE						0x6d74
251#define EVERGREEN_CRTC_CONTROL						0x6e70
252#define 	EVERGREEN_CRTC_MASTER_EN				(1 << 0)
253#define EVERGREEN_CRTC_UPDATE_LOCK					0x6ed4
254#define EVERGREEN_MASTER_UPDATE_MODE				0x6ef8
255#define EVERGREEN_DC_GPIO_HPD_MASK					0x64b0
256#define EVERGREEN_DC_GPIO_HPD_A						0x64b4
257#define EVERGREEN_DC_GPIO_HPD_EN					0x64b8
258#define EVERGREEN_DC_GPIO_HPD_Y						0x64bc
259
260
261#endif /* __EVERGREEN_REG_H__ */
262