18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Samsung S5P G2D - 2D Graphics Accelerator Driver 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2011 Samsung Electronics Co., Ltd. 68c2ecf20Sopenharmony_ci * Kamil Debski, <k.debski@samsung.com> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci/* General Registers */ 108c2ecf20Sopenharmony_ci#define SOFT_RESET_REG 0x0000 /* Software reset reg */ 118c2ecf20Sopenharmony_ci#define INTEN_REG 0x0004 /* Interrupt Enable reg */ 128c2ecf20Sopenharmony_ci#define INTC_PEND_REG 0x000C /* Interrupt Control Pending reg */ 138c2ecf20Sopenharmony_ci#define FIFO_STAT_REG 0x0010 /* Command FIFO Status reg */ 148c2ecf20Sopenharmony_ci#define AXI_ID_MODE_REG 0x0014 /* AXI Read ID Mode reg */ 158c2ecf20Sopenharmony_ci#define CACHECTL_REG 0x0018 /* Cache & Buffer clear reg */ 168c2ecf20Sopenharmony_ci#define AXI_MODE_REG 0x001C /* AXI Mode reg */ 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* Command Registers */ 198c2ecf20Sopenharmony_ci#define BITBLT_START_REG 0x0100 /* BitBLT Start reg */ 208c2ecf20Sopenharmony_ci#define BITBLT_COMMAND_REG 0x0104 /* Command reg for BitBLT */ 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* Parameter Setting Registers (Rotate & Direction) */ 238c2ecf20Sopenharmony_ci#define ROTATE_REG 0x0200 /* Rotation reg */ 248c2ecf20Sopenharmony_ci#define SRC_MSK_DIRECT_REG 0x0204 /* Src and Mask Direction reg */ 258c2ecf20Sopenharmony_ci#define DST_PAT_DIRECT_REG 0x0208 /* Dest and Pattern Direction reg */ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* Parameter Setting Registers (Src) */ 288c2ecf20Sopenharmony_ci#define SRC_SELECT_REG 0x0300 /* Src Image Selection reg */ 298c2ecf20Sopenharmony_ci#define SRC_BASE_ADDR_REG 0x0304 /* Src Image Base Address reg */ 308c2ecf20Sopenharmony_ci#define SRC_STRIDE_REG 0x0308 /* Src Stride reg */ 318c2ecf20Sopenharmony_ci#define SRC_COLOR_MODE_REG 0x030C /* Src Image Color Mode reg */ 328c2ecf20Sopenharmony_ci#define SRC_LEFT_TOP_REG 0x0310 /* Src Left Top Coordinate reg */ 338c2ecf20Sopenharmony_ci#define SRC_RIGHT_BOTTOM_REG 0x0314 /* Src Right Bottom Coordinate reg */ 348c2ecf20Sopenharmony_ci#define SRC_SCALE_CTRL_REG 0x0328 /* Src Scaling type select */ 358c2ecf20Sopenharmony_ci#define SRC_XSCALE_REG 0x032c /* Src X Scaling ratio */ 368c2ecf20Sopenharmony_ci#define SRC_YSCALE_REG 0x0330 /* Src Y Scaling ratio */ 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci/* Parameter Setting Registers (Dest) */ 398c2ecf20Sopenharmony_ci#define DST_SELECT_REG 0x0400 /* Dest Image Selection reg */ 408c2ecf20Sopenharmony_ci#define DST_BASE_ADDR_REG 0x0404 /* Dest Image Base Address reg */ 418c2ecf20Sopenharmony_ci#define DST_STRIDE_REG 0x0408 /* Dest Stride reg */ 428c2ecf20Sopenharmony_ci#define DST_COLOR_MODE_REG 0x040C /* Dest Image Color Mode reg */ 438c2ecf20Sopenharmony_ci#define DST_LEFT_TOP_REG 0x0410 /* Dest Left Top Coordinate reg */ 448c2ecf20Sopenharmony_ci#define DST_RIGHT_BOTTOM_REG 0x0414 /* Dest Right Bottom Coordinate reg */ 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci/* Parameter Setting Registers (Pattern) */ 478c2ecf20Sopenharmony_ci#define PAT_BASE_ADDR_REG 0x0500 /* Pattern Image Base Address reg */ 488c2ecf20Sopenharmony_ci#define PAT_SIZE_REG 0x0504 /* Pattern Image Size reg */ 498c2ecf20Sopenharmony_ci#define PAT_COLOR_MODE_REG 0x0508 /* Pattern Image Color Mode reg */ 508c2ecf20Sopenharmony_ci#define PAT_OFFSET_REG 0x050C /* Pattern Left Top Coordinate reg */ 518c2ecf20Sopenharmony_ci#define PAT_STRIDE_REG 0x0510 /* Pattern Stride reg */ 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci/* Parameter Setting Registers (Mask) */ 548c2ecf20Sopenharmony_ci#define MASK_BASE_ADDR_REG 0x0520 /* Mask Base Address reg */ 558c2ecf20Sopenharmony_ci#define MASK_STRIDE_REG 0x0524 /* Mask Stride reg */ 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci/* Parameter Setting Registers (Clipping Window) */ 588c2ecf20Sopenharmony_ci#define CW_LT_REG 0x0600 /* LeftTop coordinates of Clip Window */ 598c2ecf20Sopenharmony_ci#define CW_RB_REG 0x0604 /* RightBottom coordinates of Clip 608c2ecf20Sopenharmony_ci Window */ 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci/* Parameter Setting Registers (ROP & Alpha Setting) */ 638c2ecf20Sopenharmony_ci#define THIRD_OPERAND_REG 0x0610 /* Third Operand Selection reg */ 648c2ecf20Sopenharmony_ci#define ROP4_REG 0x0614 /* Raster Operation reg */ 658c2ecf20Sopenharmony_ci#define ALPHA_REG 0x0618 /* Alpha value, Fading offset value */ 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/* Parameter Setting Registers (Color) */ 688c2ecf20Sopenharmony_ci#define FG_COLOR_REG 0x0700 /* Foreground Color reg */ 698c2ecf20Sopenharmony_ci#define BG_COLOR_REG 0x0704 /* Background Color reg */ 708c2ecf20Sopenharmony_ci#define BS_COLOR_REG 0x0708 /* Blue Screen Color reg */ 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* Parameter Setting Registers (Color Key) */ 738c2ecf20Sopenharmony_ci#define SRC_COLORKEY_CTRL_REG 0x0710 /* Src Colorkey control reg */ 748c2ecf20Sopenharmony_ci#define SRC_COLORKEY_DR_MIN_REG 0x0714 /* Src Colorkey Decision Reference 758c2ecf20Sopenharmony_ci Min reg */ 768c2ecf20Sopenharmony_ci#define SRC_COLORKEY_DR_MAX_REG 0x0718 /* Src Colorkey Decision Reference 778c2ecf20Sopenharmony_ci Max reg */ 788c2ecf20Sopenharmony_ci#define DST_COLORKEY_CTRL_REG 0x071C /* Dest Colorkey control reg */ 798c2ecf20Sopenharmony_ci#define DST_COLORKEY_DR_MIN_REG 0x0720 /* Dest Colorkey Decision Reference 808c2ecf20Sopenharmony_ci Min reg */ 818c2ecf20Sopenharmony_ci#define DST_COLORKEY_DR_MAX_REG 0x0724 /* Dest Colorkey Decision Reference 828c2ecf20Sopenharmony_ci Max reg */ 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci/* Color mode values */ 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#define ORDER_XRGB 0 878c2ecf20Sopenharmony_ci#define ORDER_RGBX 1 888c2ecf20Sopenharmony_ci#define ORDER_XBGR 2 898c2ecf20Sopenharmony_ci#define ORDER_BGRX 3 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#define MODE_XRGB_8888 0 928c2ecf20Sopenharmony_ci#define MODE_ARGB_8888 1 938c2ecf20Sopenharmony_ci#define MODE_RGB_565 2 948c2ecf20Sopenharmony_ci#define MODE_XRGB_1555 3 958c2ecf20Sopenharmony_ci#define MODE_ARGB_1555 4 968c2ecf20Sopenharmony_ci#define MODE_XRGB_4444 5 978c2ecf20Sopenharmony_ci#define MODE_ARGB_4444 6 988c2ecf20Sopenharmony_ci#define MODE_PACKED_RGB_888 7 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci#define COLOR_MODE(o, m) (((o) << 4) | (m)) 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci/* ROP4 operation values */ 1038c2ecf20Sopenharmony_ci#define ROP4_COPY 0xCCCC 1048c2ecf20Sopenharmony_ci#define ROP4_INVERT 0x3333 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci/* Hardware limits */ 1078c2ecf20Sopenharmony_ci#define MAX_WIDTH 8000 1088c2ecf20Sopenharmony_ci#define MAX_HEIGHT 8000 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci#define G2D_TIMEOUT 500 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci#define DEFAULT_WIDTH 100 1138c2ecf20Sopenharmony_ci#define DEFAULT_HEIGHT 100 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci#define DEFAULT_SCALE_MODE (2 << 0) 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci/* Command mode register values */ 1188c2ecf20Sopenharmony_ci#define CMD_V3_ENABLE_STRETCH (1 << 4) 119