Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
81dee67e SM |
2 | #ifndef ACCEL_H__ |
3 | #define ACCEL_H__ | |
4 | ||
5 | #define HW_ROP2_COPY 0xc | |
6 | #define HW_ROP2_XOR 0x6 | |
7 | ||
8 | /* notes: below address are the offset value from de_base_address (0x100000)*/ | |
9 | ||
10 | /* for sm718/750/502 de_base is at mmreg_1mb*/ | |
78376535 | 11 | #define DE_BASE_ADDR_TYPE1 0x100000 |
81dee67e SM |
12 | /* for sm712,de_base is at mmreg_32kb */ |
13 | #define DE_BASE_ADDR_TYPE2 0x8000 | |
14 | /* for sm722,de_base is at mmreg_0 */ | |
15 | #define DE_BASE_ADDR_TYPE3 0 | |
16 | ||
17 | /* type1 data port address is at mmreg_0x110000*/ | |
18 | #define DE_PORT_ADDR_TYPE1 0x110000 | |
19 | /* for sm712,data port address is at mmreg_0 */ | |
20 | #define DE_PORT_ADDR_TYPE2 0x100000 | |
21 | /* for sm722,data port address is at mmreg_1mb */ | |
22 | #define DE_PORT_ADDR_TYPE3 0x100000 | |
23 | ||
24 | #define DE_SOURCE 0x0 | |
cf6d8f0b MR |
25 | #define DE_SOURCE_WRAP BIT(31) |
26 | #define DE_SOURCE_X_K1_SHIFT 16 | |
27 | #define DE_SOURCE_X_K1_MASK (0x3fff << 16) | |
28 | #define DE_SOURCE_X_K1_MONO_MASK (0x1f << 16) | |
29 | #define DE_SOURCE_Y_K2_MASK 0xffff | |
81dee67e SM |
30 | |
31 | #define DE_DESTINATION 0x4 | |
aeaab186 MR |
32 | #define DE_DESTINATION_WRAP BIT(31) |
33 | #define DE_DESTINATION_X_SHIFT 16 | |
34 | #define DE_DESTINATION_X_MASK (0x1fff << 16) | |
35 | #define DE_DESTINATION_Y_MASK 0xffff | |
81dee67e SM |
36 | |
37 | #define DE_DIMENSION 0x8 | |
0fab34b5 MR |
38 | #define DE_DIMENSION_X_SHIFT 16 |
39 | #define DE_DIMENSION_X_MASK (0x1fff << 16) | |
40 | #define DE_DIMENSION_Y_ET_MASK 0x1fff | |
81dee67e SM |
41 | |
42 | #define DE_CONTROL 0xC | |
e2e22587 MR |
43 | #define DE_CONTROL_STATUS BIT(31) |
44 | #define DE_CONTROL_PATTERN BIT(30) | |
45 | #define DE_CONTROL_UPDATE_DESTINATION_X BIT(29) | |
46 | #define DE_CONTROL_QUICK_START BIT(28) | |
47 | #define DE_CONTROL_DIRECTION BIT(27) | |
48 | #define DE_CONTROL_MAJOR BIT(26) | |
49 | #define DE_CONTROL_STEP_X BIT(25) | |
50 | #define DE_CONTROL_STEP_Y BIT(24) | |
51 | #define DE_CONTROL_STRETCH BIT(23) | |
52 | #define DE_CONTROL_HOST BIT(22) | |
53 | #define DE_CONTROL_LAST_PIXEL BIT(21) | |
54 | #define DE_CONTROL_COMMAND_SHIFT 16 | |
55 | #define DE_CONTROL_COMMAND_MASK (0x1f << 16) | |
56 | #define DE_CONTROL_COMMAND_BITBLT (0x0 << 16) | |
57 | #define DE_CONTROL_COMMAND_RECTANGLE_FILL (0x1 << 16) | |
58 | #define DE_CONTROL_COMMAND_DE_TILE (0x2 << 16) | |
59 | #define DE_CONTROL_COMMAND_TRAPEZOID_FILL (0x3 << 16) | |
60 | #define DE_CONTROL_COMMAND_ALPHA_BLEND (0x4 << 16) | |
61 | #define DE_CONTROL_COMMAND_RLE_STRIP (0x5 << 16) | |
62 | #define DE_CONTROL_COMMAND_SHORT_STROKE (0x6 << 16) | |
63 | #define DE_CONTROL_COMMAND_LINE_DRAW (0x7 << 16) | |
64 | #define DE_CONTROL_COMMAND_HOST_WRITE (0x8 << 16) | |
65 | #define DE_CONTROL_COMMAND_HOST_READ (0x9 << 16) | |
66 | #define DE_CONTROL_COMMAND_HOST_WRITE_BOTTOM_UP (0xa << 16) | |
67 | #define DE_CONTROL_COMMAND_ROTATE (0xb << 16) | |
68 | #define DE_CONTROL_COMMAND_FONT (0xc << 16) | |
69 | #define DE_CONTROL_COMMAND_TEXTURE_LOAD (0xe << 16) | |
70 | #define DE_CONTROL_ROP_SELECT BIT(15) | |
71 | #define DE_CONTROL_ROP2_SOURCE BIT(14) | |
72 | #define DE_CONTROL_MONO_DATA_SHIFT 12 | |
73 | #define DE_CONTROL_MONO_DATA_MASK (0x3 << 12) | |
74 | #define DE_CONTROL_MONO_DATA_NOT_PACKED (0x0 << 12) | |
75 | #define DE_CONTROL_MONO_DATA_8_PACKED (0x1 << 12) | |
76 | #define DE_CONTROL_MONO_DATA_16_PACKED (0x2 << 12) | |
77 | #define DE_CONTROL_MONO_DATA_32_PACKED (0x3 << 12) | |
78 | #define DE_CONTROL_REPEAT_ROTATE BIT(11) | |
79 | #define DE_CONTROL_TRANSPARENCY_MATCH BIT(10) | |
80 | #define DE_CONTROL_TRANSPARENCY_SELECT BIT(9) | |
81 | #define DE_CONTROL_TRANSPARENCY BIT(8) | |
82 | #define DE_CONTROL_ROP_MASK 0xff | |
81dee67e | 83 | |
5ee35ea7 | 84 | /* Pseudo fields. */ |
81dee67e | 85 | |
0d5d733b MR |
86 | #define DE_CONTROL_SHORT_STROKE_DIR_MASK (0xf << 24) |
87 | #define DE_CONTROL_SHORT_STROKE_DIR_225 (0x0 << 24) | |
88 | #define DE_CONTROL_SHORT_STROKE_DIR_135 (0x1 << 24) | |
89 | #define DE_CONTROL_SHORT_STROKE_DIR_315 (0x2 << 24) | |
90 | #define DE_CONTROL_SHORT_STROKE_DIR_45 (0x3 << 24) | |
91 | #define DE_CONTROL_SHORT_STROKE_DIR_270 (0x4 << 24) | |
92 | #define DE_CONTROL_SHORT_STROKE_DIR_90 (0x5 << 24) | |
93 | #define DE_CONTROL_SHORT_STROKE_DIR_180 (0x8 << 24) | |
94 | #define DE_CONTROL_SHORT_STROKE_DIR_0 (0xa << 24) | |
95 | #define DE_CONTROL_ROTATION_MASK (0x3 << 24) | |
96 | #define DE_CONTROL_ROTATION_0 (0x0 << 24) | |
97 | #define DE_CONTROL_ROTATION_270 (0x1 << 24) | |
98 | #define DE_CONTROL_ROTATION_90 (0x2 << 24) | |
99 | #define DE_CONTROL_ROTATION_180 (0x3 << 24) | |
81dee67e SM |
100 | |
101 | #define DE_PITCH 0x000010 | |
7124080f MR |
102 | #define DE_PITCH_DESTINATION_SHIFT 16 |
103 | #define DE_PITCH_DESTINATION_MASK (0x1fff << 16) | |
104 | #define DE_PITCH_SOURCE_MASK 0x1fff | |
81dee67e SM |
105 | |
106 | #define DE_FOREGROUND 0x000014 | |
0d5d733b | 107 | #define DE_FOREGROUND_COLOR_MASK 0xffffffff |
81dee67e SM |
108 | |
109 | #define DE_BACKGROUND 0x000018 | |
0d5d733b | 110 | #define DE_BACKGROUND_COLOR_MASK 0xffffffff |
81dee67e SM |
111 | |
112 | #define DE_STRETCH_FORMAT 0x00001C | |
f7a61fde MR |
113 | #define DE_STRETCH_FORMAT_PATTERN_XY BIT(30) |
114 | #define DE_STRETCH_FORMAT_PATTERN_Y_SHIFT 27 | |
115 | #define DE_STRETCH_FORMAT_PATTERN_Y_MASK (0x7 << 27) | |
116 | #define DE_STRETCH_FORMAT_PATTERN_X_SHIFT 23 | |
117 | #define DE_STRETCH_FORMAT_PATTERN_X_MASK (0x7 << 23) | |
118 | #define DE_STRETCH_FORMAT_PIXEL_FORMAT_SHIFT 20 | |
119 | #define DE_STRETCH_FORMAT_PIXEL_FORMAT_MASK (0x3 << 20) | |
120 | #define DE_STRETCH_FORMAT_PIXEL_FORMAT_8 (0x0 << 20) | |
121 | #define DE_STRETCH_FORMAT_PIXEL_FORMAT_16 (0x1 << 20) | |
122 | #define DE_STRETCH_FORMAT_PIXEL_FORMAT_32 (0x2 << 20) | |
123 | #define DE_STRETCH_FORMAT_PIXEL_FORMAT_24 (0x3 << 20) | |
124 | #define DE_STRETCH_FORMAT_ADDRESSING_SHIFT 16 | |
125 | #define DE_STRETCH_FORMAT_ADDRESSING_MASK (0xf << 16) | |
126 | #define DE_STRETCH_FORMAT_ADDRESSING_XY (0x0 << 16) | |
127 | #define DE_STRETCH_FORMAT_ADDRESSING_LINEAR (0xf << 16) | |
128 | #define DE_STRETCH_FORMAT_SOURCE_HEIGHT_MASK 0xfff | |
81dee67e SM |
129 | |
130 | #define DE_COLOR_COMPARE 0x000020 | |
0d5d733b | 131 | #define DE_COLOR_COMPARE_COLOR_MASK 0xffffff |
81dee67e SM |
132 | |
133 | #define DE_COLOR_COMPARE_MASK 0x000024 | |
0d5d733b | 134 | #define DE_COLOR_COMPARE_MASK_MASK 0xffffff |
81dee67e SM |
135 | |
136 | #define DE_MASKS 0x000028 | |
0d5d733b MR |
137 | #define DE_MASKS_BYTE_MASK (0xffff << 16) |
138 | #define DE_MASKS_BIT_MASK 0xffff | |
81dee67e SM |
139 | |
140 | #define DE_CLIP_TL 0x00002C | |
0d5d733b | 141 | #define DE_CLIP_TL_TOP_MASK (0xffff << 16) |
10dfcb06 MR |
142 | #define DE_CLIP_TL_STATUS BIT(13) |
143 | #define DE_CLIP_TL_INHIBIT BIT(12) | |
0d5d733b | 144 | #define DE_CLIP_TL_LEFT_MASK 0xfff |
81dee67e SM |
145 | |
146 | #define DE_CLIP_BR 0x000030 | |
0d5d733b MR |
147 | #define DE_CLIP_BR_BOTTOM_MASK (0xffff << 16) |
148 | #define DE_CLIP_BR_RIGHT_MASK 0x1fff | |
81dee67e SM |
149 | |
150 | #define DE_MONO_PATTERN_LOW 0x000034 | |
0d5d733b | 151 | #define DE_MONO_PATTERN_LOW_PATTERN_MASK 0xffffffff |
81dee67e SM |
152 | |
153 | #define DE_MONO_PATTERN_HIGH 0x000038 | |
0d5d733b | 154 | #define DE_MONO_PATTERN_HIGH_PATTERN_MASK 0xffffffff |
81dee67e SM |
155 | |
156 | #define DE_WINDOW_WIDTH 0x00003C | |
8bac9c84 MR |
157 | #define DE_WINDOW_WIDTH_DST_SHIFT 16 |
158 | #define DE_WINDOW_WIDTH_DST_MASK (0x1fff << 16) | |
159 | #define DE_WINDOW_WIDTH_SRC_MASK 0x1fff | |
81dee67e SM |
160 | |
161 | #define DE_WINDOW_SOURCE_BASE 0x000040 | |
10dfcb06 MR |
162 | #define DE_WINDOW_SOURCE_BASE_EXT BIT(27) |
163 | #define DE_WINDOW_SOURCE_BASE_CS BIT(26) | |
0d5d733b | 164 | #define DE_WINDOW_SOURCE_BASE_ADDRESS_MASK 0x3ffffff |
81dee67e SM |
165 | |
166 | #define DE_WINDOW_DESTINATION_BASE 0x000044 | |
10dfcb06 MR |
167 | #define DE_WINDOW_DESTINATION_BASE_EXT BIT(27) |
168 | #define DE_WINDOW_DESTINATION_BASE_CS BIT(26) | |
0d5d733b | 169 | #define DE_WINDOW_DESTINATION_BASE_ADDRESS_MASK 0x3ffffff |
81dee67e SM |
170 | |
171 | #define DE_ALPHA 0x000048 | |
0d5d733b | 172 | #define DE_ALPHA_VALUE_MASK 0xff |
81dee67e SM |
173 | |
174 | #define DE_WRAP 0x00004C | |
0d5d733b MR |
175 | #define DE_WRAP_X_MASK (0xffff << 16) |
176 | #define DE_WRAP_Y_MASK 0xffff | |
81dee67e SM |
177 | |
178 | #define DE_STATUS 0x000050 | |
10dfcb06 MR |
179 | #define DE_STATUS_CSC BIT(1) |
180 | #define DE_STATUS_2D BIT(0) | |
81dee67e SM |
181 | |
182 | /* blt direction */ | |
183 | #define TOP_TO_BOTTOM 0 | |
184 | #define LEFT_TO_RIGHT 0 | |
185 | #define BOTTOM_TO_TOP 1 | |
186 | #define RIGHT_TO_LEFT 1 | |
187 | ||
52d0744d | 188 | void sm750_hw_set2dformat(struct lynx_accel *accel, int fmt); |
81dee67e | 189 | |
52d0744d | 190 | void sm750_hw_de_init(struct lynx_accel *accel); |
81dee67e | 191 | |
52d0744d | 192 | int sm750_hw_fillrect(struct lynx_accel *accel, |
5e935813 IA |
193 | u32 base, u32 pitch, u32 Bpp, |
194 | u32 x, u32 y, u32 width, u32 height, | |
195 | u32 color, u32 rop); | |
81dee67e | 196 | |
52d0744d | 197 | int sm750_hw_copyarea( |
eb0f4271 | 198 | struct lynx_accel *accel, |
81dee67e SM |
199 | unsigned int sBase, /* Address of source: offset in frame buffer */ |
200 | unsigned int sPitch, /* Pitch value of source surface in BYTE */ | |
201 | unsigned int sx, | |
202 | unsigned int sy, /* Starting coordinate of source surface */ | |
203 | unsigned int dBase, /* Address of destination: offset in frame buffer */ | |
204 | unsigned int dPitch, /* Pitch value of destination surface in BYTE */ | |
205 | unsigned int bpp, /* Color depth of destination surface */ | |
206 | unsigned int dx, | |
207 | unsigned int dy, /* Starting coordinate of destination surface */ | |
208 | unsigned int width, | |
209 | unsigned int height, /* width and height of rectangle in pixel value */ | |
210 | unsigned int rop2); | |
211 | ||
52d0744d | 212 | int sm750_hw_imageblit(struct lynx_accel *accel, |
7c6f3fdc GKH |
213 | const char *pSrcbuf, /* pointer to start of source buffer in system memory */ |
214 | u32 srcDelta, /* Pitch value (in bytes) of the source buffer, +ive means top down and -ive mean button up */ | |
215 | u32 startBit, /* Mono data can start at any bit in a byte, this value should be 0 to 7 */ | |
216 | u32 dBase, /* Address of destination: offset in frame buffer */ | |
217 | u32 dPitch, /* Pitch value of destination surface in BYTE */ | |
218 | u32 bytePerPixel, /* Color depth of destination surface */ | |
219 | u32 dx, | |
220 | u32 dy, /* Starting coordinate of destination surface */ | |
221 | u32 width, | |
fbb8c963 | 222 | u32 height, /* width and height of rectangle in pixel value */ |
7c6f3fdc GKH |
223 | u32 fColor, /* Foreground color (corresponding to a 1 in the monochrome data */ |
224 | u32 bColor, /* Background color (corresponding to a 0 in the monochrome data */ | |
225 | u32 rop2); | |
81dee67e | 226 | #endif |