Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * (C) COPYRIGHT 2016 ARM Limited. All rights reserved.
0004  * Author: Liviu Dudau <Liviu.Dudau@arm.com>
0005  *
0006  * ARM Mali DP500/DP550/DP650 registers definition.
0007  */
0008 
0009 #ifndef __MALIDP_REGS_H__
0010 #define __MALIDP_REGS_H__
0011 
0012 /*
0013  * abbreviations used:
0014  *    - DC - display core (general settings)
0015  *    - DE - display engine
0016  *    - SE - scaling engine
0017  */
0018 
0019 /* interrupt bit masks */
0020 #define MALIDP_DE_IRQ_UNDERRUN          (1 << 0)
0021 
0022 #define MALIDP500_DE_IRQ_AXI_ERR        (1 << 4)
0023 #define MALIDP500_DE_IRQ_VSYNC          (1 << 5)
0024 #define MALIDP500_DE_IRQ_PROG_LINE      (1 << 6)
0025 #define MALIDP500_DE_IRQ_SATURATION     (1 << 7)
0026 #define MALIDP500_DE_IRQ_CONF_VALID     (1 << 8)
0027 #define MALIDP500_DE_IRQ_CONF_MODE      (1 << 11)
0028 #define MALIDP500_DE_IRQ_CONF_ACTIVE        (1 << 17)
0029 #define MALIDP500_DE_IRQ_PM_ACTIVE      (1 << 18)
0030 #define MALIDP500_DE_IRQ_TESTMODE_ACTIVE    (1 << 19)
0031 #define MALIDP500_DE_IRQ_FORCE_BLNK_ACTIVE  (1 << 24)
0032 #define MALIDP500_DE_IRQ_AXI_BUSY       (1 << 28)
0033 #define MALIDP500_DE_IRQ_GLOBAL         (1 << 31)
0034 #define MALIDP500_SE_IRQ_CONF_MODE      (1 << 0)
0035 #define MALIDP500_SE_IRQ_CONF_VALID     (1 << 4)
0036 #define MALIDP500_SE_IRQ_INIT_BUSY      (1 << 5)
0037 #define MALIDP500_SE_IRQ_AXI_ERROR      (1 << 8)
0038 #define MALIDP500_SE_IRQ_OVERRUN        (1 << 9)
0039 #define MALIDP500_SE_IRQ_PROG_LINE1     (1 << 12)
0040 #define MALIDP500_SE_IRQ_PROG_LINE2     (1 << 13)
0041 #define MALIDP500_SE_IRQ_CONF_ACTIVE        (1 << 17)
0042 #define MALIDP500_SE_IRQ_PM_ACTIVE      (1 << 18)
0043 #define MALIDP500_SE_IRQ_AXI_BUSY       (1 << 28)
0044 #define MALIDP500_SE_IRQ_GLOBAL         (1 << 31)
0045 
0046 #define MALIDP550_DE_IRQ_SATURATION     (1 << 8)
0047 #define MALIDP550_DE_IRQ_VSYNC          (1 << 12)
0048 #define MALIDP550_DE_IRQ_PROG_LINE      (1 << 13)
0049 #define MALIDP550_DE_IRQ_AXI_ERR        (1 << 16)
0050 #define MALIDP550_SE_IRQ_EOW            (1 << 0)
0051 #define MALIDP550_SE_IRQ_AXI_ERR        (1 << 16)
0052 #define MALIDP550_SE_IRQ_OVR            (1 << 17)
0053 #define MALIDP550_SE_IRQ_IBSY           (1 << 18)
0054 #define MALIDP550_DC_IRQ_CONF_VALID     (1 << 0)
0055 #define MALIDP550_DC_IRQ_CONF_MODE      (1 << 4)
0056 #define MALIDP550_DC_IRQ_CONF_ACTIVE        (1 << 16)
0057 #define MALIDP550_DC_IRQ_DE         (1 << 20)
0058 #define MALIDP550_DC_IRQ_SE         (1 << 24)
0059 
0060 #define MALIDP650_DE_IRQ_DRIFT          (1 << 4)
0061 #define MALIDP650_DE_IRQ_ACEV1          (1 << 17)
0062 #define MALIDP650_DE_IRQ_ACEV2          (1 << 18)
0063 #define MALIDP650_DE_IRQ_ACEG           (1 << 19)
0064 #define MALIDP650_DE_IRQ_AXIEP          (1 << 28)
0065 
0066 /* bit masks that are common between products */
0067 #define   MALIDP_CFG_VALID      (1 << 0)
0068 #define   MALIDP_DISP_FUNC_GAMMA    (1 << 0)
0069 #define   MALIDP_DISP_FUNC_CADJ     (1 << 4)
0070 #define   MALIDP_DISP_FUNC_ILACED   (1 << 8)
0071 #define   MALIDP_SCALE_ENGINE_EN    (1 << 16)
0072 #define   MALIDP_SE_MEMWRITE_EN     (2 << 5)
0073 
0074 /* register offsets for IRQ management */
0075 #define MALIDP_REG_STATUS       0x00000
0076 #define MALIDP_REG_SETIRQ       0x00004
0077 #define MALIDP_REG_MASKIRQ      0x00008
0078 #define MALIDP_REG_CLEARIRQ     0x0000c
0079 
0080 /* register offsets */
0081 #define MALIDP_DE_CORE_ID       0x00018
0082 #define MALIDP_DE_DISPLAY_FUNC      0x00020
0083 
0084 /* these offsets are relative to MALIDP5x0_TIMINGS_BASE */
0085 #define MALIDP_DE_H_TIMINGS     0x0
0086 #define MALIDP_DE_V_TIMINGS     0x4
0087 #define MALIDP_DE_SYNC_WIDTH        0x8
0088 #define MALIDP_DE_HV_ACTIVE     0xc
0089 
0090 /* Stride register offsets relative to Lx_BASE */
0091 #define MALIDP_DE_LG_STRIDE     0x18
0092 #define MALIDP_DE_LV_STRIDE0        0x18
0093 #define MALIDP550_DE_LS_R1_STRIDE   0x28
0094 
0095 /* macros to set values into registers */
0096 #define MALIDP_DE_H_FRONTPORCH(x)   (((x) & 0xfff) << 0)
0097 #define MALIDP_DE_H_BACKPORCH(x)    (((x) & 0x3ff) << 16)
0098 #define MALIDP500_DE_V_FRONTPORCH(x)    (((x) & 0xff) << 0)
0099 #define MALIDP550_DE_V_FRONTPORCH(x)    (((x) & 0xfff) << 0)
0100 #define MALIDP_DE_V_BACKPORCH(x)    (((x) & 0xff) << 16)
0101 #define MALIDP_DE_H_SYNCWIDTH(x)    (((x) & 0x3ff) << 0)
0102 #define MALIDP_DE_V_SYNCWIDTH(x)    (((x) & 0xff) << 16)
0103 #define MALIDP_DE_H_ACTIVE(x)       (((x) & 0x1fff) << 0)
0104 #define MALIDP_DE_V_ACTIVE(x)       (((x) & 0x1fff) << 16)
0105 
0106 #define MALIDP_PRODUCT_ID(__core_id) ((u32)(__core_id) >> 16)
0107 
0108 /* register offsets relative to MALIDP5x0_COEFFS_BASE */
0109 #define MALIDP_COLOR_ADJ_COEF       0x00000
0110 #define MALIDP_COEF_TABLE_ADDR      0x00030
0111 #define MALIDP_COEF_TABLE_DATA      0x00034
0112 
0113 /* Scaling engine registers and masks. */
0114 #define   MALIDP_SE_SCALING_EN          (1 << 0)
0115 #define   MALIDP_SE_ALPHA_EN            (1 << 1)
0116 #define   MALIDP_SE_ENH_MASK            3
0117 #define   MALIDP_SE_ENH(x)          (((x) & MALIDP_SE_ENH_MASK) << 2)
0118 #define   MALIDP_SE_RGBO_IF_EN          (1 << 4)
0119 #define   MALIDP550_SE_CTL_SEL_MASK     7
0120 #define   MALIDP550_SE_CTL_VCSEL(x) \
0121         (((x) & MALIDP550_SE_CTL_SEL_MASK) << 20)
0122 #define   MALIDP550_SE_CTL_HCSEL(x) \
0123         (((x) & MALIDP550_SE_CTL_SEL_MASK) << 16)
0124 
0125 /* Blocks with offsets from SE_CONTROL register. */
0126 #define MALIDP_SE_LAYER_CONTROL         0x14
0127 #define   MALIDP_SE_L0_IN_SIZE          0x00
0128 #define   MALIDP_SE_L0_OUT_SIZE         0x04
0129 #define   MALIDP_SE_SET_V_SIZE(x)       (((x) & 0x1fff) << 16)
0130 #define   MALIDP_SE_SET_H_SIZE(x)       (((x) & 0x1fff) << 0)
0131 #define MALIDP_SE_SCALING_CONTROL       0x24
0132 #define   MALIDP_SE_H_INIT_PH           0x00
0133 #define   MALIDP_SE_H_DELTA_PH          0x04
0134 #define   MALIDP_SE_V_INIT_PH           0x08
0135 #define   MALIDP_SE_V_DELTA_PH          0x0c
0136 #define   MALIDP_SE_COEFFTAB_ADDR       0x10
0137 #define     MALIDP_SE_COEFFTAB_ADDR_MASK    0x7f
0138 #define     MALIDP_SE_V_COEFFTAB        (1 << 8)
0139 #define     MALIDP_SE_H_COEFFTAB        (1 << 9)
0140 #define     MALIDP_SE_SET_V_COEFFTAB_ADDR(x) \
0141         (MALIDP_SE_V_COEFFTAB | ((x) & MALIDP_SE_COEFFTAB_ADDR_MASK))
0142 #define     MALIDP_SE_SET_H_COEFFTAB_ADDR(x) \
0143         (MALIDP_SE_H_COEFFTAB | ((x) & MALIDP_SE_COEFFTAB_ADDR_MASK))
0144 #define   MALIDP_SE_COEFFTAB_DATA       0x14
0145 #define     MALIDP_SE_COEFFTAB_DATA_MASK    0x3fff
0146 #define     MALIDP_SE_SET_COEFFTAB_DATA(x) \
0147         ((x) & MALIDP_SE_COEFFTAB_DATA_MASK)
0148 /* Enhance coeffents reigster offset */
0149 #define MALIDP_SE_IMAGE_ENH         0x3C
0150 /* ENH_LIMITS offset 0x0 */
0151 #define     MALIDP_SE_ENH_LOW_LEVEL     24
0152 #define     MALIDP_SE_ENH_HIGH_LEVEL        63
0153 #define     MALIDP_SE_ENH_LIMIT_MASK        0xfff
0154 #define     MALIDP_SE_SET_ENH_LIMIT_LOW(x) \
0155         ((x) & MALIDP_SE_ENH_LIMIT_MASK)
0156 #define     MALIDP_SE_SET_ENH_LIMIT_HIGH(x) \
0157         (((x) & MALIDP_SE_ENH_LIMIT_MASK) << 16)
0158 #define   MALIDP_SE_ENH_COEFF0          0x04
0159 
0160 
0161 /* register offsets relative to MALIDP5x0_SE_MEMWRITE_BASE */
0162 #define MALIDP_MW_FORMAT        0x00000
0163 #define MALIDP_MW_P1_STRIDE     0x00004
0164 #define MALIDP_MW_P2_STRIDE     0x00008
0165 #define MALIDP_MW_P1_PTR_LOW        0x0000c
0166 #define MALIDP_MW_P1_PTR_HIGH       0x00010
0167 #define MALIDP_MW_P2_PTR_LOW        0x0002c
0168 #define MALIDP_MW_P2_PTR_HIGH       0x00030
0169 
0170 /* register offsets and bits specific to DP500 */
0171 #define MALIDP500_ADDR_SPACE_SIZE   0x01000
0172 #define MALIDP500_DC_BASE       0x00000
0173 #define MALIDP500_DC_CONTROL        0x0000c
0174 #define   MALIDP500_DC_CONFIG_REQ   (1 << 17)
0175 #define   MALIDP500_HSYNCPOL        (1 << 20)
0176 #define   MALIDP500_VSYNCPOL        (1 << 21)
0177 #define   MALIDP500_DC_CLEAR_MASK   0x300fff
0178 #define MALIDP500_DE_LINE_COUNTER   0x00010
0179 #define MALIDP500_DE_AXI_CONTROL    0x00014
0180 #define MALIDP500_DE_SECURE_CTRL    0x0001c
0181 #define MALIDP500_DE_CHROMA_KEY     0x00024
0182 #define MALIDP500_TIMINGS_BASE      0x00028
0183 
0184 #define MALIDP500_CONFIG_3D     0x00038
0185 #define MALIDP500_BGND_COLOR        0x0003c
0186 #define MALIDP500_OUTPUT_DEPTH      0x00044
0187 #define MALIDP500_COEFFS_BASE       0x00078
0188 
0189 /*
0190  * The YUV2RGB coefficients on the DP500 are not in the video layer's register
0191  * block. They belong in a separate block above the layer's registers, hence
0192  * the negative offset.
0193  */
0194 #define MALIDP500_LV_YUV2RGB        ((s16)(-0xB8))
0195 #define MALIDP500_DE_LV_BASE        0x00100
0196 #define MALIDP500_DE_LV_PTR_BASE    0x00124
0197 #define MALIDP500_DE_LV_AD_CTRL     0x00400
0198 #define MALIDP500_DE_LG1_BASE       0x00200
0199 #define MALIDP500_DE_LG1_PTR_BASE   0x0021c
0200 #define MALIDP500_DE_LG1_AD_CTRL    0x0040c
0201 #define MALIDP500_DE_LG2_BASE       0x00300
0202 #define MALIDP500_DE_LG2_PTR_BASE   0x0031c
0203 #define MALIDP500_DE_LG2_AD_CTRL    0x00418
0204 #define MALIDP500_SE_BASE       0x00c00
0205 #define MALIDP500_SE_CONTROL        0x00c0c
0206 #define MALIDP500_SE_MEMWRITE_OUT_SIZE  0x00c2c
0207 #define MALIDP500_SE_RGB_YUV_COEFFS 0x00C74
0208 #define MALIDP500_SE_MEMWRITE_BASE  0x00e00
0209 #define MALIDP500_DC_IRQ_BASE       0x00f00
0210 #define MALIDP500_CONFIG_VALID      0x00f00
0211 #define MALIDP500_CONFIG_ID     0x00fd4
0212 
0213 /*
0214  * The quality of service (QoS) register on the DP500. RQOS register values
0215  * are driven by the ARQOS signal, using AXI transacations, dependent on the
0216  * FIFO input level.
0217  * The RQOS register can also set QoS levels for:
0218  *    - RED_ARQOS   @ A 4-bit signal value for close to underflow conditions
0219  *    - GREEN_ARQOS @ A 4-bit signal value for normal conditions
0220  */
0221 #define MALIDP500_RQOS_QUALITY          0x00500
0222 
0223 /* register offsets and bits specific to DP550/DP650 */
0224 #define MALIDP550_ADDR_SPACE_SIZE   0x10000
0225 #define MALIDP550_DE_CONTROL        0x00010
0226 #define MALIDP550_DE_LINE_COUNTER   0x00014
0227 #define MALIDP550_DE_AXI_CONTROL    0x00018
0228 #define MALIDP550_DE_QOS        0x0001c
0229 #define MALIDP550_TIMINGS_BASE      0x00030
0230 #define MALIDP550_HSYNCPOL      (1 << 12)
0231 #define MALIDP550_VSYNCPOL      (1 << 28)
0232 
0233 #define MALIDP550_DE_DISP_SIDEBAND  0x00040
0234 #define MALIDP550_DE_BGND_COLOR     0x00044
0235 #define MALIDP550_DE_OUTPUT_DEPTH   0x0004c
0236 #define MALIDP550_COEFFS_BASE       0x00050
0237 #define MALIDP550_LV_YUV2RGB        0x00084
0238 #define MALIDP550_DE_LV1_BASE       0x00100
0239 #define MALIDP550_DE_LV1_PTR_BASE   0x00124
0240 #define MALIDP550_DE_LV1_AD_CTRL    0x001B8
0241 #define MALIDP550_DE_LV2_BASE       0x00200
0242 #define MALIDP550_DE_LV2_PTR_BASE   0x00224
0243 #define MALIDP550_DE_LV2_AD_CTRL    0x002B8
0244 #define MALIDP550_DE_LG_BASE        0x00300
0245 #define MALIDP550_DE_LG_PTR_BASE    0x0031c
0246 #define MALIDP550_DE_LG_AD_CTRL     0x00330
0247 #define MALIDP550_DE_LS_BASE        0x00400
0248 #define MALIDP550_DE_LS_PTR_BASE    0x0042c
0249 #define MALIDP550_DE_PERF_BASE      0x00500
0250 #define MALIDP550_SE_BASE       0x08000
0251 #define MALIDP550_SE_CONTROL        0x08010
0252 #define   MALIDP550_SE_MEMWRITE_ONESHOT (1 << 7)
0253 #define MALIDP550_SE_MEMWRITE_OUT_SIZE  0x08030
0254 #define MALIDP550_SE_RGB_YUV_COEFFS 0x08078
0255 #define MALIDP550_SE_MEMWRITE_BASE  0x08100
0256 #define MALIDP550_DC_BASE       0x0c000
0257 #define MALIDP550_DC_CONTROL        0x0c010
0258 #define   MALIDP550_DC_CONFIG_REQ   (1 << 16)
0259 #define MALIDP550_CONFIG_VALID      0x0c014
0260 #define MALIDP550_CONFIG_ID     0x0ffd4
0261 
0262 /* register offsets specific to DP650 */
0263 #define MALIDP650_DE_LV_MMU_CTRL    0x000D0
0264 #define MALIDP650_DE_LG_MMU_CTRL    0x00048
0265 #define MALIDP650_DE_LS_MMU_CTRL    0x00078
0266 
0267 /* bit masks to set the MMU control register */
0268 #define MALIDP_MMU_CTRL_EN      (1 << 0)
0269 #define MALIDP_MMU_CTRL_MODE        (1 << 4)
0270 #define MALIDP_MMU_CTRL_PX_PS(x)    (1 << (8 + (x)))
0271 #define MALIDP_MMU_CTRL_PP_NUM_REQ(x)   (((x) & 0x7f) << 12)
0272 
0273 /* AFBC register offsets relative to MALIDPXXX_DE_LX_AD_CTRL */
0274 /* The following register offsets are common for DP500, DP550 and DP650 */
0275 #define MALIDP_AD_CROP_H                0x4
0276 #define MALIDP_AD_CROP_V                0x8
0277 #define MALIDP_AD_END_PTR_LOW           0xc
0278 #define MALIDP_AD_END_PTR_HIGH          0x10
0279 
0280 /* AFBC decoder Registers */
0281 #define MALIDP_AD_EN                    BIT(0)
0282 #define MALIDP_AD_YTR                   BIT(4)
0283 #define MALIDP_AD_BS                    BIT(8)
0284 #define MALIDP_AD_CROP_RIGHT_OFFSET     16
0285 #define MALIDP_AD_CROP_BOTTOM_OFFSET    16
0286 
0287 /*
0288  * Starting with DP550 the register map blocks has been standardised to the
0289  * following layout:
0290  *
0291  *   Offset            Block registers
0292  *  0x00000            Display Engine
0293  *  0x08000            Scaling Engine
0294  *  0x0c000            Display Core
0295  *  0x10000            Secure control
0296  *
0297  * The old DP500 IP mixes some DC with the DE registers, hence the need
0298  * for a mapping structure.
0299  */
0300 
0301 #endif /* __MALIDP_REGS_H__ */