1bcc1c2a1SAlex Deucher /*
2bcc1c2a1SAlex Deucher  * Copyright 2010 Advanced Micro Devices, Inc.
3bcc1c2a1SAlex Deucher  *
4bcc1c2a1SAlex Deucher  * Permission is hereby granted, free of charge, to any person obtaining a
5bcc1c2a1SAlex Deucher  * copy of this software and associated documentation files (the "Software"),
6bcc1c2a1SAlex Deucher  * to deal in the Software without restriction, including without limitation
7bcc1c2a1SAlex Deucher  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8bcc1c2a1SAlex Deucher  * and/or sell copies of the Software, and to permit persons to whom the
9bcc1c2a1SAlex Deucher  * Software is furnished to do so, subject to the following conditions:
10bcc1c2a1SAlex Deucher  *
11bcc1c2a1SAlex Deucher  * The above copyright notice and this permission notice shall be included in
12bcc1c2a1SAlex Deucher  * all copies or substantial portions of the Software.
13bcc1c2a1SAlex Deucher  *
14bcc1c2a1SAlex Deucher  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15bcc1c2a1SAlex Deucher  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16bcc1c2a1SAlex Deucher  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17bcc1c2a1SAlex Deucher  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18bcc1c2a1SAlex Deucher  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19bcc1c2a1SAlex Deucher  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20bcc1c2a1SAlex Deucher  * OTHER DEALINGS IN THE SOFTWARE.
21bcc1c2a1SAlex Deucher  *
22bcc1c2a1SAlex Deucher  * Authors: Alex Deucher
23bcc1c2a1SAlex Deucher  */
24bcc1c2a1SAlex Deucher #ifndef __EVERGREEN_REG_H__
25bcc1c2a1SAlex Deucher #define __EVERGREEN_REG_H__
26bcc1c2a1SAlex Deucher 
27bcc1c2a1SAlex Deucher /* evergreen */
28bcc1c2a1SAlex Deucher #define EVERGREEN_VGA_MEMORY_BASE_ADDRESS               0x310
29bcc1c2a1SAlex Deucher #define EVERGREEN_VGA_MEMORY_BASE_ADDRESS_HIGH          0x324
30bcc1c2a1SAlex Deucher #define EVERGREEN_D3VGA_CONTROL                         0x3e0
31bcc1c2a1SAlex Deucher #define EVERGREEN_D4VGA_CONTROL                         0x3e4
32bcc1c2a1SAlex Deucher #define EVERGREEN_D5VGA_CONTROL                         0x3e8
33bcc1c2a1SAlex Deucher #define EVERGREEN_D6VGA_CONTROL                         0x3ec
34bcc1c2a1SAlex Deucher 
35bcc1c2a1SAlex Deucher #define EVERGREEN_P1PLL_SS_CNTL                         0x414
36bcc1c2a1SAlex Deucher #define EVERGREEN_P2PLL_SS_CNTL                         0x454
37bcc1c2a1SAlex Deucher #       define EVERGREEN_PxPLL_SS_EN                    (1 << 12)
3869d2ae57SRafał Miłecki 
3969d2ae57SRafał Miłecki #define EVERGREEN_AUDIO_PLL1_MUL			0x5b0
4069d2ae57SRafał Miłecki #define EVERGREEN_AUDIO_PLL1_DIV			0x5b4
4169d2ae57SRafał Miłecki #define EVERGREEN_AUDIO_PLL1_UNK			0x5bc
4269d2ae57SRafał Miłecki 
4369d2ae57SRafał Miłecki #define EVERGREEN_AUDIO_ENABLE				0x5e78
4469d2ae57SRafał Miłecki #define EVERGREEN_AUDIO_VENDOR_ID			0x5ec0
4569d2ae57SRafał Miłecki 
46bcc1c2a1SAlex Deucher /* GRPH blocks at 0x6800, 0x7400, 0x10000, 0x10c00, 0x11800, 0x12400 */
47bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_ENABLE                           0x6800
48bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_CONTROL                          0x6804
49bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_DEPTH(x)                  (((x) & 0x3) << 0)
50bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_DEPTH_8BPP                0
51bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_DEPTH_16BPP               1
52bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_DEPTH_32BPP               2
53bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT(x)                 (((x) & 0x7) << 8)
54bcc1c2a1SAlex Deucher /* 8 BPP */
55bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_INDEXED            0
56bcc1c2a1SAlex Deucher /* 16 BPP */
57bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_ARGB1555           0
58bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_ARGB565            1
59bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_ARGB4444           2
60bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_AI88               3
61bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_MONO16             4
62bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_BGRA5551           5
63bcc1c2a1SAlex Deucher /* 32 BPP */
64bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_ARGB8888           0
65bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_ARGB2101010        1
66bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_32BPP_DIG          2
67bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_8B_ARGB2101010     3
68bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_BGRA1010102        4
69bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_8B_BGRA1010102     5
70bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_RGB111110          6
71bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_FORMAT_BGR101111          7
7297d66328SAlex Deucher #       define EVERGREEN_GRPH_ARRAY_MODE(x)             (((x) & 0x7) << 20)
7397d66328SAlex Deucher #       define EVERGREEN_GRPH_ARRAY_LINEAR_GENERAL      0
7497d66328SAlex Deucher #       define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED      1
7597d66328SAlex Deucher #       define EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1      2
7697d66328SAlex Deucher #       define EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1      4
77bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_SWAP_CONTROL                     0x680c
78bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_ENDIAN_SWAP(x)            (((x) & 0x3) << 0)
79bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_ENDIAN_NONE               0
80bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_ENDIAN_8IN16              1
81bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_ENDIAN_8IN32              2
82bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_ENDIAN_8IN64              3
83bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_RED_CROSSBAR(x)           (((x) & 0x3) << 4)
84bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_RED_SEL_R                 0
85bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_RED_SEL_G                 1
86bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_RED_SEL_B                 2
87bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_RED_SEL_A                 3
88bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_GREEN_CROSSBAR(x)         (((x) & 0x3) << 6)
89bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_GREEN_SEL_G               0
90bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_GREEN_SEL_B               1
91bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_GREEN_SEL_A               2
92bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_GREEN_SEL_R               3
93bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_BLUE_CROSSBAR(x)          (((x) & 0x3) << 8)
94bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_BLUE_SEL_B                0
95bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_BLUE_SEL_A                1
96bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_BLUE_SEL_R                2
97bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_BLUE_SEL_G                3
98bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_ALPHA_CROSSBAR(x)         (((x) & 0x3) << 10)
99bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_ALPHA_SEL_A               0
100bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_ALPHA_SEL_R               1
101bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_ALPHA_SEL_G               2
102bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_ALPHA_SEL_B               3
103bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS          0x6810
104bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS        0x6814
105bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_DFQ_ENABLE                (1 << 0)
106bcc1c2a1SAlex Deucher #       define EVERGREEN_GRPH_SURFACE_ADDRESS_MASK      0xffffff00
107bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_PITCH                            0x6818
108bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH     0x681c
109bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH   0x6820
110bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_SURFACE_OFFSET_X                 0x6824
111bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_SURFACE_OFFSET_Y                 0x6828
112bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_X_START                          0x682c
113bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_Y_START                          0x6830
114bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_X_END                            0x6834
115bcc1c2a1SAlex Deucher #define EVERGREEN_GRPH_Y_END                            0x6838
1166f34be50SAlex Deucher #define EVERGREEN_GRPH_UPDATE                           0x6844
1176f34be50SAlex Deucher #       define EVERGREEN_GRPH_SURFACE_UPDATE_PENDING    (1 << 2)
1186f34be50SAlex Deucher #       define EVERGREEN_GRPH_UPDATE_LOCK               (1 << 16)
1196f34be50SAlex Deucher #define EVERGREEN_GRPH_FLIP_CONTROL                     0x6848
1206f34be50SAlex Deucher #       define EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN (1 << 0)
121bcc1c2a1SAlex Deucher 
122bcc1c2a1SAlex Deucher /* CUR blocks at 0x6998, 0x7598, 0x10198, 0x10d98, 0x11998, 0x12598 */
123bcc1c2a1SAlex Deucher #define EVERGREEN_CUR_CONTROL                           0x6998
124bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_EN                      (1 << 0)
125bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_MODE(x)                 (((x) & 0x3) << 8)
126bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_MONO                    0
127bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_24_1                    1
128bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_24_8_PRE_MULT           2
129bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_24_8_UNPRE_MULT         3
130bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_2X_MAGNIFY              (1 << 16)
131bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_FORCE_MC_ON             (1 << 20)
132bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_URGENT_CONTROL(x)       (((x) & 0x7) << 24)
133bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_URGENT_ALWAYS           0
134bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_URGENT_1_8              1
135bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_URGENT_1_4              2
136bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_URGENT_3_8              3
137bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_URGENT_1_2              4
138bcc1c2a1SAlex Deucher #define EVERGREEN_CUR_SURFACE_ADDRESS                   0x699c
139bcc1c2a1SAlex Deucher #       define EVERGREEN_CUR_SURFACE_ADDRESS_MASK       0xfffff000
140bcc1c2a1SAlex Deucher #define EVERGREEN_CUR_SIZE                              0x69a0
141bcc1c2a1SAlex Deucher #define EVERGREEN_CUR_SURFACE_ADDRESS_HIGH              0x69a4
142bcc1c2a1SAlex Deucher #define EVERGREEN_CUR_POSITION                          0x69a8
143bcc1c2a1SAlex Deucher #define EVERGREEN_CUR_HOT_SPOT                          0x69ac
144bcc1c2a1SAlex Deucher #define EVERGREEN_CUR_COLOR1                            0x69b0
145bcc1c2a1SAlex Deucher #define EVERGREEN_CUR_COLOR2                            0x69b4
146bcc1c2a1SAlex Deucher #define EVERGREEN_CUR_UPDATE                            0x69b8
147bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_UPDATE_PENDING          (1 << 0)
148bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_UPDATE_TAKEN            (1 << 1)
149bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_UPDATE_LOCK             (1 << 16)
150bcc1c2a1SAlex Deucher #       define EVERGREEN_CURSOR_DISABLE_MULTIPLE_UPDATE (1 << 24)
151bcc1c2a1SAlex Deucher 
152bcc1c2a1SAlex Deucher /* LUT blocks at 0x69e0, 0x75e0, 0x101e0, 0x10de0, 0x119e0, 0x125e0 */
153bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_RW_MODE                        0x69e0
154bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_RW_INDEX                       0x69e4
155bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_SEQ_COLOR                      0x69e8
156bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_PWL_DATA                       0x69ec
157bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_30_COLOR                       0x69f0
158bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_VGA_ACCESS_ENABLE              0x69f4
159bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_WRITE_EN_MASK                  0x69f8
160bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_AUTOFILL                       0x69fc
161bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_CONTROL                        0x6a00
162bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_BLACK_OFFSET_BLUE              0x6a04
163bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_BLACK_OFFSET_GREEN             0x6a08
164bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_BLACK_OFFSET_RED               0x6a0c
165bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_WHITE_OFFSET_BLUE              0x6a10
166bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_WHITE_OFFSET_GREEN             0x6a14
167bcc1c2a1SAlex Deucher #define EVERGREEN_DC_LUT_WHITE_OFFSET_RED               0x6a18
168bcc1c2a1SAlex Deucher 
169bcc1c2a1SAlex Deucher #define EVERGREEN_DATA_FORMAT                           0x6b00
170bcc1c2a1SAlex Deucher #       define EVERGREEN_INTERLEAVE_EN                  (1 << 0)
171bcc1c2a1SAlex Deucher #define EVERGREEN_DESKTOP_HEIGHT                        0x6b04
172cb5fcbd5SAlex Deucher #define EVERGREEN_VLINE_START_END                       0x6b08
173cb5fcbd5SAlex Deucher #define EVERGREEN_VLINE_STATUS                          0x6bb8
174cb5fcbd5SAlex Deucher #       define EVERGREEN_VLINE_STAT                     (1 << 12)
175bcc1c2a1SAlex Deucher 
176bcc1c2a1SAlex Deucher #define EVERGREEN_VIEWPORT_START                        0x6d70
177bcc1c2a1SAlex Deucher #define EVERGREEN_VIEWPORT_SIZE                         0x6d74
178bcc1c2a1SAlex Deucher 
179bcc1c2a1SAlex Deucher /* display controller offsets used for crtc/cur/lut/grph/viewport/etc. */
180bcc1c2a1SAlex Deucher #define EVERGREEN_CRTC0_REGISTER_OFFSET                 (0x6df0 - 0x6df0)
181bcc1c2a1SAlex Deucher #define EVERGREEN_CRTC1_REGISTER_OFFSET                 (0x79f0 - 0x6df0)
182bcc1c2a1SAlex Deucher #define EVERGREEN_CRTC2_REGISTER_OFFSET                 (0x105f0 - 0x6df0)
183bcc1c2a1SAlex Deucher #define EVERGREEN_CRTC3_REGISTER_OFFSET                 (0x111f0 - 0x6df0)
184bcc1c2a1SAlex Deucher #define EVERGREEN_CRTC4_REGISTER_OFFSET                 (0x11df0 - 0x6df0)
185bcc1c2a1SAlex Deucher #define EVERGREEN_CRTC5_REGISTER_OFFSET                 (0x129f0 - 0x6df0)
186bcc1c2a1SAlex Deucher 
187bcc1c2a1SAlex Deucher /* CRTC blocks at 0x6df0, 0x79f0, 0x105f0, 0x111f0, 0x11df0, 0x129f0 */
188539d2418SAlex Deucher #define EVERGREEN_CRTC_V_BLANK_START_END                0x6e34
189bcc1c2a1SAlex Deucher #define EVERGREEN_CRTC_CONTROL                          0x6e70
190bcc1c2a1SAlex Deucher #       define EVERGREEN_CRTC_MASTER_EN                 (1 << 0)
19149e02b73SAlex Deucher #       define EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE (1 << 24)
192bae6b562SAlex Deucher #define EVERGREEN_CRTC_STATUS                           0x6e8c
193539d2418SAlex Deucher #define EVERGREEN_CRTC_STATUS_POSITION                  0x6e90
1946f34be50SAlex Deucher #define EVERGREEN_MASTER_UPDATE_MODE                    0x6ef8
195bcc1c2a1SAlex Deucher #define EVERGREEN_CRTC_UPDATE_LOCK                      0x6ed4
196bcc1c2a1SAlex Deucher 
197bcc1c2a1SAlex Deucher #define EVERGREEN_DC_GPIO_HPD_MASK                      0x64b0
198bcc1c2a1SAlex Deucher #define EVERGREEN_DC_GPIO_HPD_A                         0x64b4
199bcc1c2a1SAlex Deucher #define EVERGREEN_DC_GPIO_HPD_EN                        0x64b8
200bcc1c2a1SAlex Deucher #define EVERGREEN_DC_GPIO_HPD_Y                         0x64bc
201bcc1c2a1SAlex Deucher 
202bcc1c2a1SAlex Deucher #endif
203