| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 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*/ |
| 11 |
#define DE_BASE_ADDR_TYPE1 0x100000 |
| 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 |
| 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 |
| 30 |
|
| 31 |
#define DE_DESTINATION 0x4 |
| 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 |
| 36 |
|
| 37 |
#define DE_DIMENSION 0x8 |
| 38 |
#define DE_DIMENSION_X_SHIFT 16 |
| 39 |
#define DE_DIMENSION_X_MASK (0x1fff << 16) |
| 40 |
#define DE_DIMENSION_Y_ET_MASK 0x1fff |
| 41 |
|
| 42 |
#define DE_CONTROL 0xC |
| 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 |
| 83 |
|
| 84 |
/* Pseudo fields. */ |
| 85 |
|
| 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) |
| 100 |
|
| 101 |
#define DE_PITCH 0x000010 |
| 102 |
#define DE_PITCH_DESTINATION_SHIFT 16 |
| 103 |
#define DE_PITCH_DESTINATION_MASK (0x1fff << 16) |
| 104 |
#define DE_PITCH_SOURCE_MASK 0x1fff |
| 105 |
|
| 106 |
#define DE_FOREGROUND 0x000014 |
| 107 |
#define DE_FOREGROUND_COLOR_MASK 0xffffffff |
| 108 |
|
| 109 |
#define DE_BACKGROUND 0x000018 |
| 110 |
#define DE_BACKGROUND_COLOR_MASK 0xffffffff |
| 111 |
|
| 112 |
#define DE_STRETCH_FORMAT 0x00001C |
| 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 |
| 129 |
|
| 130 |
#define DE_COLOR_COMPARE 0x000020 |
| 131 |
#define DE_COLOR_COMPARE_COLOR_MASK 0xffffff |
| 132 |
|
| 133 |
#define DE_COLOR_COMPARE_MASK 0x000024 |
| 134 |
#define DE_COLOR_COMPARE_MASK_MASK 0xffffff |
| 135 |
|
| 136 |
#define DE_MASKS 0x000028 |
| 137 |
#define DE_MASKS_BYTE_MASK (0xffff << 16) |
| 138 |
#define DE_MASKS_BIT_MASK 0xffff |
| 139 |
|
| 140 |
#define DE_CLIP_TL 0x00002C |
| 141 |
#define DE_CLIP_TL_TOP_MASK (0xffff << 16) |
| 142 |
#define DE_CLIP_TL_STATUS BIT(13) |
| 143 |
#define DE_CLIP_TL_INHIBIT BIT(12) |
| 144 |
#define DE_CLIP_TL_LEFT_MASK 0xfff |
| 145 |
|
| 146 |
#define DE_CLIP_BR 0x000030 |
| 147 |
#define DE_CLIP_BR_BOTTOM_MASK (0xffff << 16) |
| 148 |
#define DE_CLIP_BR_RIGHT_MASK 0x1fff |
| 149 |
|
| 150 |
#define DE_MONO_PATTERN_LOW 0x000034 |
| 151 |
#define DE_MONO_PATTERN_LOW_PATTERN_MASK 0xffffffff |
| 152 |
|
| 153 |
#define DE_MONO_PATTERN_HIGH 0x000038 |
| 154 |
#define DE_MONO_PATTERN_HIGH_PATTERN_MASK 0xffffffff |
| 155 |
|
| 156 |
#define DE_WINDOW_WIDTH 0x00003C |
| 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 |
| 160 |
|
| 161 |
#define DE_WINDOW_SOURCE_BASE 0x000040 |
| 162 |
#define DE_WINDOW_SOURCE_BASE_EXT BIT(27) |
| 163 |
#define DE_WINDOW_SOURCE_BASE_CS BIT(26) |
| 164 |
#define DE_WINDOW_SOURCE_BASE_ADDRESS_MASK 0x3ffffff |
| 165 |
|
| 166 |
#define DE_WINDOW_DESTINATION_BASE 0x000044 |
| 167 |
#define DE_WINDOW_DESTINATION_BASE_EXT BIT(27) |
| 168 |
#define DE_WINDOW_DESTINATION_BASE_CS BIT(26) |
| 169 |
#define DE_WINDOW_DESTINATION_BASE_ADDRESS_MASK 0x3ffffff |
| 170 |
|
| 171 |
#define DE_ALPHA 0x000048 |
| 172 |
#define DE_ALPHA_VALUE_MASK 0xff |
| 173 |
|
| 174 |
#define DE_WRAP 0x00004C |
| 175 |
#define DE_WRAP_X_MASK (0xffff << 16) |
| 176 |
#define DE_WRAP_Y_MASK 0xffff |
| 177 |
|
| 178 |
#define DE_STATUS 0x000050 |
| 179 |
#define DE_STATUS_CSC BIT(1) |
| 180 |
#define DE_STATUS_2D BIT(0) |
| 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 |
|
| 188 |
void sm750_hw_set2dformat(struct lynx_accel *accel, int fmt); |
| 189 |
|
| 190 |
void sm750_hw_de_init(struct lynx_accel *accel); |
| 191 |
|
| 192 |
int sm750_hw_fillrect(struct lynx_accel *accel, |
| 193 |
u32 base, u32 pitch, u32 Bpp, |
| 194 |
u32 x, u32 y, u32 width, u32 height, |
| 195 |
u32 color, u32 rop); |
| 196 |
|
| 197 |
/** |
| 198 |
* sm750_hm_copyarea |
| 199 |
* @sBase: Address of source: offset in frame buffer |
| 200 |
* @sPitch: Pitch value of source surface in BYTE |
| 201 |
* @sx: Starting x coordinate of source surface |
| 202 |
* @sy: Starting y coordinate of source surface |
| 203 |
* @dBase: Address of destination: offset in frame buffer |
| 204 |
* @dPitch: Pitch value of destination surface in BYTE |
| 205 |
* @Bpp: Color depth of destination surface |
| 206 |
* @dx: Starting x coordinate of destination surface |
| 207 |
* @dy: Starting y coordinate of destination surface |
| 208 |
* @width: width of rectangle in pixel value |
| 209 |
* @height: height of rectangle in pixel value |
| 210 |
* @rop2: ROP value |
| 211 |
*/ |
| 212 |
int sm750_hw_copyarea(struct lynx_accel *accel, |
| 213 |
unsigned int sBase, unsigned int sPitch, |
| 214 |
unsigned int sx, unsigned int sy, |
| 215 |
unsigned int dBase, unsigned int dPitch, |
| 216 |
unsigned int Bpp, unsigned int dx, unsigned int dy, |
| 217 |
unsigned int width, unsigned int height, |
| 218 |
unsigned int rop2); |
| 219 |
|
| 220 |
/** |
| 221 |
* sm750_hw_imageblit |
| 222 |
* @pSrcbuf: pointer to start of source buffer in system memory |
| 223 |
* @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top down |
| 224 |
*>----- and -ive mean button up |
| 225 |
* @startBit: Mono data can start at any bit in a byte, this value should be |
| 226 |
*>----- 0 to 7 |
| 227 |
* @dBase: Address of destination: offset in frame buffer |
| 228 |
* @dPitch: Pitch value of destination surface in BYTE |
| 229 |
* @bytePerPixel: Color depth of destination surface |
| 230 |
* @dx: Starting x coordinate of destination surface |
| 231 |
* @dy: Starting y coordinate of destination surface |
| 232 |
* @width: width of rectangle in pixel value |
| 233 |
* @height: height of rectangle in pixel value |
| 234 |
* @fColor: Foreground color (corresponding to a 1 in the monochrome data |
| 235 |
* @bColor: Background color (corresponding to a 0 in the monochrome data |
| 236 |
* @rop2: ROP value |
| 237 |
*/ |
| 238 |
int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf, |
| 239 |
u32 srcDelta, u32 startBit, u32 dBase, u32 dPitch, |
| 240 |
u32 bytePerPixel, u32 dx, u32 dy, u32 width, |
| 241 |
u32 height, u32 fColor, u32 bColor, u32 rop2); |
| 242 |
|
| 243 |
#endif |