xref: /linux/drivers/gpu/drm/v3d/v3d_regs.h (revision 26a4dc29b74a137f45665089f6d3d633fcc9b662)
157692c94SEric Anholt // SPDX-License-Identifier: GPL-2.0+
257692c94SEric Anholt /* Copyright (C) 2017-2018 Broadcom */
357692c94SEric Anholt 
457692c94SEric Anholt #ifndef V3D_REGS_H
557692c94SEric Anholt #define V3D_REGS_H
657692c94SEric Anholt 
757692c94SEric Anholt #include <linux/bitops.h>
857692c94SEric Anholt 
957692c94SEric Anholt #define V3D_MASK(high, low) ((u32)GENMASK(high, low))
1057692c94SEric Anholt /* Using the GNU statement expression extension */
1157692c94SEric Anholt #define V3D_SET_FIELD(value, field)					\
1257692c94SEric Anholt 	({								\
1357692c94SEric Anholt 		u32 fieldval = (value) << field##_SHIFT;		\
1457692c94SEric Anholt 		WARN_ON((fieldval & ~field##_MASK) != 0);		\
1557692c94SEric Anholt 		fieldval & field##_MASK;				\
1657692c94SEric Anholt 	 })
1757692c94SEric Anholt 
1857692c94SEric Anholt #define V3D_GET_FIELD(word, field) (((word) & field##_MASK) >>		\
1957692c94SEric Anholt 				    field##_SHIFT)
2057692c94SEric Anholt 
2157692c94SEric Anholt /* Hub registers for shared hardware between V3D cores. */
2257692c94SEric Anholt 
2357692c94SEric Anholt #define V3D_HUB_AXICFG                                 0x00000
2457692c94SEric Anholt # define V3D_HUB_AXICFG_MAX_LEN_MASK                   V3D_MASK(3, 0)
2557692c94SEric Anholt # define V3D_HUB_AXICFG_MAX_LEN_SHIFT                  0
2657692c94SEric Anholt #define V3D_HUB_UIFCFG                                 0x00004
2757692c94SEric Anholt #define V3D_HUB_IDENT0                                 0x00008
2857692c94SEric Anholt 
2957692c94SEric Anholt #define V3D_HUB_IDENT1                                 0x0000c
3057692c94SEric Anholt # define V3D_HUB_IDENT1_WITH_MSO                       BIT(19)
3157692c94SEric Anholt # define V3D_HUB_IDENT1_WITH_TSY                       BIT(18)
3257692c94SEric Anholt # define V3D_HUB_IDENT1_WITH_TFU                       BIT(17)
3357692c94SEric Anholt # define V3D_HUB_IDENT1_WITH_L3C                       BIT(16)
3457692c94SEric Anholt # define V3D_HUB_IDENT1_NHOSTS_MASK                    V3D_MASK(15, 12)
3557692c94SEric Anholt # define V3D_HUB_IDENT1_NHOSTS_SHIFT                   12
3657692c94SEric Anholt # define V3D_HUB_IDENT1_NCORES_MASK                    V3D_MASK(11, 8)
3757692c94SEric Anholt # define V3D_HUB_IDENT1_NCORES_SHIFT                   8
3857692c94SEric Anholt # define V3D_HUB_IDENT1_REV_MASK                       V3D_MASK(7, 4)
3957692c94SEric Anholt # define V3D_HUB_IDENT1_REV_SHIFT                      4
4057692c94SEric Anholt # define V3D_HUB_IDENT1_TVER_MASK                      V3D_MASK(3, 0)
4157692c94SEric Anholt # define V3D_HUB_IDENT1_TVER_SHIFT                     0
4257692c94SEric Anholt 
4357692c94SEric Anholt #define V3D_HUB_IDENT2                                 0x00010
4457692c94SEric Anholt # define V3D_HUB_IDENT2_WITH_MMU                       BIT(8)
4557692c94SEric Anholt # define V3D_HUB_IDENT2_L3C_NKB_MASK                   V3D_MASK(7, 0)
4657692c94SEric Anholt # define V3D_HUB_IDENT2_L3C_NKB_SHIFT                  0
4757692c94SEric Anholt 
4857692c94SEric Anholt #define V3D_HUB_IDENT3                                 0x00014
4957692c94SEric Anholt # define V3D_HUB_IDENT3_IPREV_MASK                     V3D_MASK(15, 8)
5057692c94SEric Anholt # define V3D_HUB_IDENT3_IPREV_SHIFT                    8
5157692c94SEric Anholt # define V3D_HUB_IDENT3_IPIDX_MASK                     V3D_MASK(7, 0)
5257692c94SEric Anholt # define V3D_HUB_IDENT3_IPIDX_SHIFT                    0
5357692c94SEric Anholt 
5457692c94SEric Anholt #define V3D_HUB_INT_STS                                0x00050
5557692c94SEric Anholt #define V3D_HUB_INT_SET                                0x00054
5657692c94SEric Anholt #define V3D_HUB_INT_CLR                                0x00058
5757692c94SEric Anholt #define V3D_HUB_INT_MSK_STS                            0x0005c
5857692c94SEric Anholt #define V3D_HUB_INT_MSK_SET                            0x00060
5957692c94SEric Anholt #define V3D_HUB_INT_MSK_CLR                            0x00064
6057692c94SEric Anholt # define V3D_HUB_INT_MMU_WRV                           BIT(5)
6157692c94SEric Anholt # define V3D_HUB_INT_MMU_PTI                           BIT(4)
6257692c94SEric Anholt # define V3D_HUB_INT_MMU_CAP                           BIT(3)
6357692c94SEric Anholt # define V3D_HUB_INT_MSO                               BIT(2)
6457692c94SEric Anholt # define V3D_HUB_INT_TFUC                              BIT(1)
6557692c94SEric Anholt # define V3D_HUB_INT_TFUF                              BIT(0)
6657692c94SEric Anholt 
6757692c94SEric Anholt #define V3D_GCA_CACHE_CTRL                             0x0000c
6857692c94SEric Anholt # define V3D_GCA_CACHE_CTRL_FLUSH                      BIT(0)
6957692c94SEric Anholt 
7057692c94SEric Anholt #define V3D_GCA_SAFE_SHUTDOWN                          0x000b0
7157692c94SEric Anholt # define V3D_GCA_SAFE_SHUTDOWN_EN                      BIT(0)
7257692c94SEric Anholt 
7357692c94SEric Anholt #define V3D_GCA_SAFE_SHUTDOWN_ACK                      0x000b4
7457692c94SEric Anholt # define V3D_GCA_SAFE_SHUTDOWN_ACK_ACKED               3
7557692c94SEric Anholt 
7657692c94SEric Anholt # define V3D_TOP_GR_BRIDGE_REVISION                    0x00000
7757692c94SEric Anholt # define V3D_TOP_GR_BRIDGE_MAJOR_MASK                  V3D_MASK(15, 8)
7857692c94SEric Anholt # define V3D_TOP_GR_BRIDGE_MAJOR_SHIFT                 8
7957692c94SEric Anholt # define V3D_TOP_GR_BRIDGE_MINOR_MASK                  V3D_MASK(7, 0)
8057692c94SEric Anholt # define V3D_TOP_GR_BRIDGE_MINOR_SHIFT                 0
8157692c94SEric Anholt 
8257692c94SEric Anholt /* 7268 reset reg */
8357692c94SEric Anholt # define V3D_TOP_GR_BRIDGE_SW_INIT_0                   0x00008
8457692c94SEric Anholt # define V3D_TOP_GR_BRIDGE_SW_INIT_0_V3D_CLK_108_SW_INIT BIT(0)
8557692c94SEric Anholt /* 7278 reset reg */
8657692c94SEric Anholt # define V3D_TOP_GR_BRIDGE_SW_INIT_1                   0x0000c
8757692c94SEric Anholt # define V3D_TOP_GR_BRIDGE_SW_INIT_1_V3D_CLK_108_SW_INIT BIT(0)
8857692c94SEric Anholt 
891584f16cSEric Anholt #define V3D_TFU_CS                                     0x00400
901584f16cSEric Anholt /* Stops current job, empties input fifo. */
911584f16cSEric Anholt # define V3D_TFU_CS_TFURST                             BIT(31)
921584f16cSEric Anholt # define V3D_TFU_CS_CVTCT_MASK                         V3D_MASK(23, 16)
931584f16cSEric Anholt # define V3D_TFU_CS_CVTCT_SHIFT                        16
941584f16cSEric Anholt # define V3D_TFU_CS_NFREE_MASK                         V3D_MASK(13, 8)
951584f16cSEric Anholt # define V3D_TFU_CS_NFREE_SHIFT                        8
961584f16cSEric Anholt # define V3D_TFU_CS_BUSY                               BIT(0)
971584f16cSEric Anholt 
981584f16cSEric Anholt #define V3D_TFU_SU                                     0x00404
991584f16cSEric Anholt /* Interrupt when FINTTHR input slots are free (0 = disabled) */
1001584f16cSEric Anholt # define V3D_TFU_SU_FINTTHR_MASK                       V3D_MASK(13, 8)
1011584f16cSEric Anholt # define V3D_TFU_SU_FINTTHR_SHIFT                      8
1021584f16cSEric Anholt /* Skips resetting the CRC at the start of CRC generation. */
1031584f16cSEric Anholt # define V3D_TFU_SU_CRCCHAIN                           BIT(4)
1041584f16cSEric Anholt /* skips writes, computes CRC of the image.  miplevels must be 0. */
1051584f16cSEric Anholt # define V3D_TFU_SU_CRC                                BIT(3)
1061584f16cSEric Anholt # define V3D_TFU_SU_THROTTLE_MASK                      V3D_MASK(1, 0)
1071584f16cSEric Anholt # define V3D_TFU_SU_THROTTLE_SHIFT                     0
1081584f16cSEric Anholt 
1091584f16cSEric Anholt #define V3D_TFU_ICFG                                   0x00408
1101584f16cSEric Anholt /* Interrupt when the conversion is complete. */
1111584f16cSEric Anholt # define V3D_TFU_ICFG_IOC                              BIT(0)
1121584f16cSEric Anholt 
1131584f16cSEric Anholt /* Input Image Address */
1141584f16cSEric Anholt #define V3D_TFU_IIA                                    0x0040c
1151584f16cSEric Anholt /* Input Chroma Address */
1161584f16cSEric Anholt #define V3D_TFU_ICA                                    0x00410
1171584f16cSEric Anholt /* Input Image Stride */
1181584f16cSEric Anholt #define V3D_TFU_IIS                                    0x00414
1191584f16cSEric Anholt /* Input Image U-Plane Address */
1201584f16cSEric Anholt #define V3D_TFU_IUA                                    0x00418
1211584f16cSEric Anholt /* Output Image Address */
1221584f16cSEric Anholt #define V3D_TFU_IOA                                    0x0041c
1231584f16cSEric Anholt /* Image Output Size */
1241584f16cSEric Anholt #define V3D_TFU_IOS                                    0x00420
1251584f16cSEric Anholt /* TFU YUV Coefficient 0 */
1261584f16cSEric Anholt #define V3D_TFU_COEF0                                  0x00424
1271584f16cSEric Anholt /* Use these regs instead of the defaults. */
1281584f16cSEric Anholt # define V3D_TFU_COEF0_USECOEF                         BIT(31)
1291584f16cSEric Anholt /* TFU YUV Coefficient 1 */
1301584f16cSEric Anholt #define V3D_TFU_COEF1                                  0x00428
1311584f16cSEric Anholt /* TFU YUV Coefficient 2 */
1321584f16cSEric Anholt #define V3D_TFU_COEF2                                  0x0042c
1331584f16cSEric Anholt /* TFU YUV Coefficient 3 */
1341584f16cSEric Anholt #define V3D_TFU_COEF3                                  0x00430
1351584f16cSEric Anholt 
1361584f16cSEric Anholt #define V3D_TFU_CRC                                    0x00434
1371584f16cSEric Anholt 
13857692c94SEric Anholt /* Per-MMU registers. */
13957692c94SEric Anholt 
14057692c94SEric Anholt #define V3D_MMUC_CONTROL                               0x01000
14157692c94SEric Anholt # define V3D_MMUC_CONTROL_CLEAR                        BIT(3)
14257692c94SEric Anholt # define V3D_MMUC_CONTROL_FLUSHING                     BIT(2)
14357692c94SEric Anholt # define V3D_MMUC_CONTROL_FLUSH                        BIT(1)
14457692c94SEric Anholt # define V3D_MMUC_CONTROL_ENABLE                       BIT(0)
14557692c94SEric Anholt 
14657692c94SEric Anholt #define V3D_MMU_CTL                                    0x01200
14757692c94SEric Anholt # define V3D_MMU_CTL_CAP_EXCEEDED                      BIT(27)
14857692c94SEric Anholt # define V3D_MMU_CTL_CAP_EXCEEDED_ABORT                BIT(26)
14957692c94SEric Anholt # define V3D_MMU_CTL_CAP_EXCEEDED_INT                  BIT(25)
15057692c94SEric Anholt # define V3D_MMU_CTL_CAP_EXCEEDED_EXCEPTION            BIT(24)
15157692c94SEric Anholt # define V3D_MMU_CTL_PT_INVALID                        BIT(20)
15257692c94SEric Anholt # define V3D_MMU_CTL_PT_INVALID_ABORT                  BIT(19)
15357692c94SEric Anholt # define V3D_MMU_CTL_PT_INVALID_INT                    BIT(18)
15457692c94SEric Anholt # define V3D_MMU_CTL_PT_INVALID_EXCEPTION              BIT(17)
15538c2c791SEric Anholt # define V3D_MMU_CTL_PT_INVALID_ENABLE                 BIT(16)
15638c2c791SEric Anholt # define V3D_MMU_CTL_WRITE_VIOLATION                   BIT(12)
15757692c94SEric Anholt # define V3D_MMU_CTL_WRITE_VIOLATION_ABORT             BIT(11)
15857692c94SEric Anholt # define V3D_MMU_CTL_WRITE_VIOLATION_INT               BIT(10)
15957692c94SEric Anholt # define V3D_MMU_CTL_WRITE_VIOLATION_EXCEPTION         BIT(9)
16057692c94SEric Anholt # define V3D_MMU_CTL_TLB_CLEARING                      BIT(7)
16157692c94SEric Anholt # define V3D_MMU_CTL_TLB_STATS_CLEAR                   BIT(3)
16257692c94SEric Anholt # define V3D_MMU_CTL_TLB_CLEAR                         BIT(2)
16357692c94SEric Anholt # define V3D_MMU_CTL_TLB_STATS_ENABLE                  BIT(1)
16457692c94SEric Anholt # define V3D_MMU_CTL_ENABLE                            BIT(0)
16557692c94SEric Anholt 
16657692c94SEric Anholt #define V3D_MMU_PT_PA_BASE                             0x01204
16757692c94SEric Anholt #define V3D_MMU_HIT                                    0x01208
16857692c94SEric Anholt #define V3D_MMU_MISSES                                 0x0120c
16957692c94SEric Anholt #define V3D_MMU_STALLS                                 0x01210
17057692c94SEric Anholt 
17157692c94SEric Anholt #define V3D_MMU_ADDR_CAP                               0x01214
17257692c94SEric Anholt # define V3D_MMU_ADDR_CAP_ENABLE                       BIT(31)
17357692c94SEric Anholt # define V3D_MMU_ADDR_CAP_MPAGE_MASK                   V3D_MASK(11, 0)
17457692c94SEric Anholt # define V3D_MMU_ADDR_CAP_MPAGE_SHIFT                  0
17557692c94SEric Anholt 
17657692c94SEric Anholt #define V3D_MMU_SHOOT_DOWN                             0x01218
17757692c94SEric Anholt # define V3D_MMU_SHOOT_DOWN_SHOOTING                   BIT(29)
17857692c94SEric Anholt # define V3D_MMU_SHOOT_DOWN_SHOOT                      BIT(28)
17957692c94SEric Anholt # define V3D_MMU_SHOOT_DOWN_PAGE_MASK                  V3D_MASK(27, 0)
18057692c94SEric Anholt # define V3D_MMU_SHOOT_DOWN_PAGE_SHIFT                 0
18157692c94SEric Anholt 
18257692c94SEric Anholt #define V3D_MMU_BYPASS_START                           0x0121c
18357692c94SEric Anholt #define V3D_MMU_BYPASS_END                             0x01220
18457692c94SEric Anholt 
18557692c94SEric Anholt /* AXI ID of the access that faulted */
18657692c94SEric Anholt #define V3D_MMU_VIO_ID                                 0x0122c
18757692c94SEric Anholt 
18857692c94SEric Anholt /* Address for illegal PTEs to return */
18957692c94SEric Anholt #define V3D_MMU_ILLEGAL_ADDR                           0x01230
19057692c94SEric Anholt # define V3D_MMU_ILLEGAL_ADDR_ENABLE                   BIT(31)
19157692c94SEric Anholt 
19257692c94SEric Anholt /* Address that faulted */
19357692c94SEric Anholt #define V3D_MMU_VIO_ADDR                               0x01234
19457692c94SEric Anholt 
195091d6283SEric Anholt #define V3D_MMU_DEBUG_INFO                             0x01238
196091d6283SEric Anholt # define V3D_MMU_PA_WIDTH_MASK                         V3D_MASK(11, 8)
197091d6283SEric Anholt # define V3D_MMU_PA_WIDTH_SHIFT                        8
198091d6283SEric Anholt # define V3D_MMU_VA_WIDTH_MASK                         V3D_MASK(7, 4)
199091d6283SEric Anholt # define V3D_MMU_VA_WIDTH_SHIFT                        4
200091d6283SEric Anholt # define V3D_MMU_VERSION_MASK                          V3D_MASK(3, 0)
201091d6283SEric Anholt # define V3D_MMU_VERSION_SHIFT                         0
202091d6283SEric Anholt 
20357692c94SEric Anholt /* Per-V3D-core registers */
20457692c94SEric Anholt 
20557692c94SEric Anholt #define V3D_CTL_IDENT0                                 0x00000
20657692c94SEric Anholt # define V3D_IDENT0_VER_MASK                           V3D_MASK(31, 24)
20757692c94SEric Anholt # define V3D_IDENT0_VER_SHIFT                          24
20857692c94SEric Anholt 
20957692c94SEric Anholt #define V3D_CTL_IDENT1                                 0x00004
21057692c94SEric Anholt /* Multiples of 1kb */
21157692c94SEric Anholt # define V3D_IDENT1_VPM_SIZE_MASK                      V3D_MASK(31, 28)
21257692c94SEric Anholt # define V3D_IDENT1_VPM_SIZE_SHIFT                     28
21357692c94SEric Anholt # define V3D_IDENT1_NSEM_MASK                          V3D_MASK(23, 16)
21457692c94SEric Anholt # define V3D_IDENT1_NSEM_SHIFT                         16
21557692c94SEric Anholt # define V3D_IDENT1_NTMU_MASK                          V3D_MASK(15, 12)
21657692c94SEric Anholt # define V3D_IDENT1_NTMU_SHIFT                         12
21757692c94SEric Anholt # define V3D_IDENT1_QUPS_MASK                          V3D_MASK(11, 8)
21857692c94SEric Anholt # define V3D_IDENT1_QUPS_SHIFT                         8
21957692c94SEric Anholt # define V3D_IDENT1_NSLC_MASK                          V3D_MASK(7, 4)
22057692c94SEric Anholt # define V3D_IDENT1_NSLC_SHIFT                         4
22157692c94SEric Anholt # define V3D_IDENT1_REV_MASK                           V3D_MASK(3, 0)
22257692c94SEric Anholt # define V3D_IDENT1_REV_SHIFT                          0
22357692c94SEric Anholt 
22457692c94SEric Anholt #define V3D_CTL_IDENT2                                 0x00008
22557692c94SEric Anholt # define V3D_IDENT2_BCG_INT                            BIT(28)
22657692c94SEric Anholt 
22757692c94SEric Anholt #define V3D_CTL_MISCCFG                                0x00018
228a7dde1b7SEric Anholt # define V3D_CTL_MISCCFG_QRMAXCNT_MASK                 V3D_MASK(3, 1)
229a7dde1b7SEric Anholt # define V3D_CTL_MISCCFG_QRMAXCNT_SHIFT                1
23057692c94SEric Anholt # define V3D_MISCCFG_OVRTMUOUT                         BIT(0)
23157692c94SEric Anholt 
23257692c94SEric Anholt #define V3D_CTL_L2CACTL                                0x00020
23357692c94SEric Anholt # define V3D_L2CACTL_L2CCLR                            BIT(2)
23457692c94SEric Anholt # define V3D_L2CACTL_L2CDIS                            BIT(1)
23557692c94SEric Anholt # define V3D_L2CACTL_L2CENA                            BIT(0)
23657692c94SEric Anholt 
23757692c94SEric Anholt #define V3D_CTL_SLCACTL                                0x00024
23857692c94SEric Anholt # define V3D_SLCACTL_TVCCS_MASK                        V3D_MASK(27, 24)
23957692c94SEric Anholt # define V3D_SLCACTL_TVCCS_SHIFT                       24
24057692c94SEric Anholt # define V3D_SLCACTL_TDCCS_MASK                        V3D_MASK(19, 16)
24157692c94SEric Anholt # define V3D_SLCACTL_TDCCS_SHIFT                       16
24257692c94SEric Anholt # define V3D_SLCACTL_UCC_MASK                          V3D_MASK(11, 8)
24357692c94SEric Anholt # define V3D_SLCACTL_UCC_SHIFT                         8
24457692c94SEric Anholt # define V3D_SLCACTL_ICC_MASK                          V3D_MASK(3, 0)
24557692c94SEric Anholt # define V3D_SLCACTL_ICC_SHIFT                         0
24657692c94SEric Anholt 
24757692c94SEric Anholt #define V3D_CTL_L2TCACTL                               0x00030
24857692c94SEric Anholt # define V3D_L2TCACTL_TMUWCF                           BIT(8)
24957692c94SEric Anholt # define V3D_L2TCACTL_L2T_NO_WM                        BIT(4)
250d223f98fSEric Anholt /* Invalidates cache lines. */
25157692c94SEric Anholt # define V3D_L2TCACTL_FLM_FLUSH                        0
252d223f98fSEric Anholt /* Removes cachelines without writing dirty lines back. */
25357692c94SEric Anholt # define V3D_L2TCACTL_FLM_CLEAR                        1
254d223f98fSEric Anholt /* Writes out dirty cachelines and marks them clean, but doesn't invalidate. */
25557692c94SEric Anholt # define V3D_L2TCACTL_FLM_CLEAN                        2
25657692c94SEric Anholt # define V3D_L2TCACTL_FLM_MASK                         V3D_MASK(2, 1)
25757692c94SEric Anholt # define V3D_L2TCACTL_FLM_SHIFT                        1
25857692c94SEric Anholt # define V3D_L2TCACTL_L2TFLS                           BIT(0)
25957692c94SEric Anholt #define V3D_CTL_L2TFLSTA                               0x00034
26057692c94SEric Anholt #define V3D_CTL_L2TFLEND                               0x00038
26157692c94SEric Anholt 
26257692c94SEric Anholt #define V3D_CTL_INT_STS                                0x00050
26357692c94SEric Anholt #define V3D_CTL_INT_SET                                0x00054
26457692c94SEric Anholt #define V3D_CTL_INT_CLR                                0x00058
26557692c94SEric Anholt #define V3D_CTL_INT_MSK_STS                            0x0005c
26657692c94SEric Anholt #define V3D_CTL_INT_MSK_SET                            0x00060
26757692c94SEric Anholt #define V3D_CTL_INT_MSK_CLR                            0x00064
26857692c94SEric Anholt # define V3D_INT_QPU_MASK                              V3D_MASK(27, 16)
26957692c94SEric Anholt # define V3D_INT_QPU_SHIFT                             16
270d223f98fSEric Anholt # define V3D_INT_CSDDONE                               BIT(7)
271d223f98fSEric Anholt # define V3D_INT_PCTR                                  BIT(6)
27257692c94SEric Anholt # define V3D_INT_GMPV                                  BIT(5)
27357692c94SEric Anholt # define V3D_INT_TRFB                                  BIT(4)
27457692c94SEric Anholt # define V3D_INT_SPILLUSE                              BIT(3)
27557692c94SEric Anholt # define V3D_INT_OUTOMEM                               BIT(2)
27657692c94SEric Anholt # define V3D_INT_FLDONE                                BIT(1)
27757692c94SEric Anholt # define V3D_INT_FRDONE                                BIT(0)
27857692c94SEric Anholt 
27957692c94SEric Anholt #define V3D_CLE_CT0CS                                  0x00100
28057692c94SEric Anholt #define V3D_CLE_CT1CS                                  0x00104
28157692c94SEric Anholt #define V3D_CLE_CTNCS(n) (V3D_CLE_CT0CS + 4 * n)
28257692c94SEric Anholt #define V3D_CLE_CT0EA                                  0x00108
28357692c94SEric Anholt #define V3D_CLE_CT1EA                                  0x0010c
28457692c94SEric Anholt #define V3D_CLE_CTNEA(n) (V3D_CLE_CT0EA + 4 * n)
28557692c94SEric Anholt #define V3D_CLE_CT0CA                                  0x00110
28657692c94SEric Anholt #define V3D_CLE_CT1CA                                  0x00114
28757692c94SEric Anholt #define V3D_CLE_CTNCA(n) (V3D_CLE_CT0CA + 4 * n)
28857692c94SEric Anholt #define V3D_CLE_CT0RA                                  0x00118
28957692c94SEric Anholt #define V3D_CLE_CT1RA                                  0x0011c
290624bb0c0SEric Anholt #define V3D_CLE_CTNRA(n) (V3D_CLE_CT0RA + 4 * n)
29157692c94SEric Anholt #define V3D_CLE_CT0LC                                  0x00120
29257692c94SEric Anholt #define V3D_CLE_CT1LC                                  0x00124
29357692c94SEric Anholt #define V3D_CLE_CT0PC                                  0x00128
29457692c94SEric Anholt #define V3D_CLE_CT1PC                                  0x0012c
29557692c94SEric Anholt #define V3D_CLE_PCS                                    0x00130
29657692c94SEric Anholt #define V3D_CLE_BFC                                    0x00134
29757692c94SEric Anholt #define V3D_CLE_RFC                                    0x00138
29857692c94SEric Anholt #define V3D_CLE_TFBC                                   0x0013c
29957692c94SEric Anholt #define V3D_CLE_TFIT                                   0x00140
30057692c94SEric Anholt #define V3D_CLE_CT1CFG                                 0x00144
30157692c94SEric Anholt #define V3D_CLE_CT1TILECT                              0x00148
30257692c94SEric Anholt #define V3D_CLE_CT1TSKIP                               0x0014c
30357692c94SEric Anholt #define V3D_CLE_CT1PTCT                                0x00150
30457692c94SEric Anholt #define V3D_CLE_CT0SYNC                                0x00154
30557692c94SEric Anholt #define V3D_CLE_CT1SYNC                                0x00158
30657692c94SEric Anholt #define V3D_CLE_CT0QTS                                 0x0015c
30757692c94SEric Anholt # define V3D_CLE_CT0QTS_ENABLE                         BIT(1)
30857692c94SEric Anholt #define V3D_CLE_CT0QBA                                 0x00160
30957692c94SEric Anholt #define V3D_CLE_CT1QBA                                 0x00164
31057692c94SEric Anholt #define V3D_CLE_CTNQBA(n) (V3D_CLE_CT0QBA + 4 * n)
31157692c94SEric Anholt #define V3D_CLE_CT0QEA                                 0x00168
31257692c94SEric Anholt #define V3D_CLE_CT1QEA                                 0x0016c
31357692c94SEric Anholt #define V3D_CLE_CTNQEA(n) (V3D_CLE_CT0QEA + 4 * n)
31457692c94SEric Anholt #define V3D_CLE_CT0QMA                                 0x00170
31557692c94SEric Anholt #define V3D_CLE_CT0QMS                                 0x00174
31657692c94SEric Anholt #define V3D_CLE_CT1QCFG                                0x00178
31757692c94SEric Anholt /* If set without ETPROC, entirely skip tiles with no primitives. */
31857692c94SEric Anholt # define V3D_CLE_QCFG_ETFILT                           BIT(7)
31957692c94SEric Anholt /* If set with ETFILT, just write the clear color to tiles with no
32057692c94SEric Anholt  * primitives.
32157692c94SEric Anholt  */
32257692c94SEric Anholt # define V3D_CLE_QCFG_ETPROC                           BIT(6)
32357692c94SEric Anholt # define V3D_CLE_QCFG_ETSFLUSH                         BIT(1)
32457692c94SEric Anholt # define V3D_CLE_QCFG_MCDIS                            BIT(0)
32557692c94SEric Anholt 
32657692c94SEric Anholt #define V3D_PTB_BPCA                                   0x00300
32757692c94SEric Anholt #define V3D_PTB_BPCS                                   0x00304
32857692c94SEric Anholt #define V3D_PTB_BPOA                                   0x00308
32957692c94SEric Anholt #define V3D_PTB_BPOS                                   0x0030c
33057692c94SEric Anholt 
33157692c94SEric Anholt #define V3D_PTB_BXCF                                   0x00310
33257692c94SEric Anholt # define V3D_PTB_BXCF_RWORDERDISA                      BIT(1)
33357692c94SEric Anholt # define V3D_PTB_BXCF_CLIPDISA                         BIT(0)
33457692c94SEric Anholt 
3356915c9a5SEric Anholt #define V3D_V3_PCTR_0_EN                               0x00674
3366915c9a5SEric Anholt #define V3D_V3_PCTR_0_EN_ENABLE                        BIT(31)
3376915c9a5SEric Anholt #define V3D_V4_PCTR_0_EN                               0x00650
3386915c9a5SEric Anholt /* When a bit is set, resets the counter to 0. */
3396915c9a5SEric Anholt #define V3D_V3_PCTR_0_CLR                              0x00670
3406915c9a5SEric Anholt #define V3D_V4_PCTR_0_CLR                              0x00654
3416915c9a5SEric Anholt #define V3D_PCTR_0_OVERFLOW                            0x00658
3426915c9a5SEric Anholt 
3436915c9a5SEric Anholt #define V3D_V3_PCTR_0_PCTRS0                           0x00684
3446915c9a5SEric Anholt #define V3D_V3_PCTR_0_PCTRS15                          0x00660
3456915c9a5SEric Anholt #define V3D_V3_PCTR_0_PCTRSX(x)                        (V3D_V3_PCTR_0_PCTRS0 + \
3466915c9a5SEric Anholt 							4 * (x))
3476915c9a5SEric Anholt /* Each src reg muxes four counters each. */
3486915c9a5SEric Anholt #define V3D_V4_PCTR_0_SRC_0_3                          0x00660
3496915c9a5SEric Anholt #define V3D_V4_PCTR_0_SRC_28_31                        0x0067c
350*26a4dc29SJuan A. Suarez Romero #define V3D_V4_PCTR_0_SRC_X(x)                         (V3D_V4_PCTR_0_SRC_0_3 + \
351*26a4dc29SJuan A. Suarez Romero 							4 * (x))
3526915c9a5SEric Anholt # define V3D_PCTR_S0_MASK                              V3D_MASK(6, 0)
3536915c9a5SEric Anholt # define V3D_PCTR_S0_SHIFT                             0
3546915c9a5SEric Anholt # define V3D_PCTR_S1_MASK                              V3D_MASK(14, 8)
3556915c9a5SEric Anholt # define V3D_PCTR_S1_SHIFT                             8
3566915c9a5SEric Anholt # define V3D_PCTR_S2_MASK                              V3D_MASK(22, 16)
3576915c9a5SEric Anholt # define V3D_PCTR_S2_SHIFT                             16
3586915c9a5SEric Anholt # define V3D_PCTR_S3_MASK                              V3D_MASK(30, 24)
3596915c9a5SEric Anholt # define V3D_PCTR_S3_SHIFT                             24
3606915c9a5SEric Anholt # define V3D_PCTR_CYCLE_COUNT                          32
3616915c9a5SEric Anholt 
3626915c9a5SEric Anholt /* Output values of the counters. */
3636915c9a5SEric Anholt #define V3D_PCTR_0_PCTR0                               0x00680
3646915c9a5SEric Anholt #define V3D_PCTR_0_PCTR31                              0x006fc
3656915c9a5SEric Anholt #define V3D_PCTR_0_PCTRX(x)                            (V3D_PCTR_0_PCTR0 + \
3666915c9a5SEric Anholt 							4 * (x))
36757692c94SEric Anholt #define V3D_GMP_STATUS                                 0x00800
36857692c94SEric Anholt # define V3D_GMP_STATUS_GMPRST                         BIT(31)
36957692c94SEric Anholt # define V3D_GMP_STATUS_WR_COUNT_MASK                  V3D_MASK(30, 24)
37057692c94SEric Anholt # define V3D_GMP_STATUS_WR_COUNT_SHIFT                 24
37157692c94SEric Anholt # define V3D_GMP_STATUS_RD_COUNT_MASK                  V3D_MASK(22, 16)
37257692c94SEric Anholt # define V3D_GMP_STATUS_RD_COUNT_SHIFT                 16
37357692c94SEric Anholt # define V3D_GMP_STATUS_WR_ACTIVE                      BIT(5)
37457692c94SEric Anholt # define V3D_GMP_STATUS_RD_ACTIVE                      BIT(4)
37557692c94SEric Anholt # define V3D_GMP_STATUS_CFG_BUSY                       BIT(3)
37657692c94SEric Anholt # define V3D_GMP_STATUS_CNTOVF                         BIT(2)
37757692c94SEric Anholt # define V3D_GMP_STATUS_INVPROT                        BIT(1)
37857692c94SEric Anholt # define V3D_GMP_STATUS_VIO                            BIT(0)
37957692c94SEric Anholt 
38057692c94SEric Anholt #define V3D_GMP_CFG                                    0x00804
38157692c94SEric Anholt # define V3D_GMP_CFG_LBURSTEN                          BIT(3)
38257692c94SEric Anholt # define V3D_GMP_CFG_PGCRSEN                           BIT()
38357692c94SEric Anholt # define V3D_GMP_CFG_STOP_REQ                          BIT(1)
38457692c94SEric Anholt # define V3D_GMP_CFG_PROT_ENABLE                       BIT(0)
38557692c94SEric Anholt 
38657692c94SEric Anholt #define V3D_GMP_VIO_ADDR                               0x00808
38757692c94SEric Anholt #define V3D_GMP_VIO_TYPE                               0x0080c
38857692c94SEric Anholt #define V3D_GMP_TABLE_ADDR                             0x00810
38957692c94SEric Anholt #define V3D_GMP_CLEAR_LOAD                             0x00814
39057692c94SEric Anholt #define V3D_GMP_PRESERVE_LOAD                          0x00818
39157692c94SEric Anholt #define V3D_GMP_VALID_LINES                            0x00820
39257692c94SEric Anholt 
393d223f98fSEric Anholt #define V3D_CSD_STATUS                                 0x00900
394d223f98fSEric Anholt # define V3D_CSD_STATUS_NUM_COMPLETED_MASK             V3D_MASK(11, 4)
395d223f98fSEric Anholt # define V3D_CSD_STATUS_NUM_COMPLETED_SHIFT            4
396d223f98fSEric Anholt # define V3D_CSD_STATUS_NUM_ACTIVE_MASK                V3D_MASK(3, 2)
397d223f98fSEric Anholt # define V3D_CSD_STATUS_NUM_ACTIVE_SHIFT               2
398d223f98fSEric Anholt # define V3D_CSD_STATUS_HAVE_CURRENT_DISPATCH          BIT(1)
399d223f98fSEric Anholt # define V3D_CSD_STATUS_HAVE_QUEUED_DISPATCH           BIT(0)
400d223f98fSEric Anholt 
401d223f98fSEric Anholt #define V3D_CSD_QUEUED_CFG0                            0x00904
402d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG0_NUM_WGS_X_MASK            V3D_MASK(31, 16)
403d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG0_NUM_WGS_X_SHIFT           16
404d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG0_WG_X_OFFSET_MASK          V3D_MASK(15, 0)
405d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG0_WG_X_OFFSET_SHIFT         0
406d223f98fSEric Anholt 
407d223f98fSEric Anholt #define V3D_CSD_QUEUED_CFG1                            0x00908
408d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG1_NUM_WGS_Y_MASK            V3D_MASK(31, 16)
409d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG1_NUM_WGS_Y_SHIFT           16
410d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG1_WG_Y_OFFSET_MASK          V3D_MASK(15, 0)
411d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG1_WG_Y_OFFSET_SHIFT         0
412d223f98fSEric Anholt 
413d223f98fSEric Anholt #define V3D_CSD_QUEUED_CFG2                            0x0090c
414d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG2_NUM_WGS_Z_MASK            V3D_MASK(31, 16)
415d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG2_NUM_WGS_Z_SHIFT           16
416d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG2_WG_Z_OFFSET_MASK          V3D_MASK(15, 0)
417d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG2_WG_Z_OFFSET_SHIFT         0
418d223f98fSEric Anholt 
419d223f98fSEric Anholt #define V3D_CSD_QUEUED_CFG3                            0x00910
420d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG3_OVERLAP_WITH_PREV         BIT(26)
421d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG3_MAX_SG_ID_MASK            V3D_MASK(25, 20)
422d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG3_MAX_SG_ID_SHIFT           20
423d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG3_BATCHES_PER_SG_M1_MASK    V3D_MASK(19, 12)
424d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG3_BATCHES_PER_SG_M1_SHIFT   12
425d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG3_WGS_PER_SG_MASK           V3D_MASK(11, 8)
426d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG3_WGS_PER_SG_SHIFT          8
427d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG3_WG_SIZE_MASK              V3D_MASK(7, 0)
428d223f98fSEric Anholt # define V3D_CSD_QUEUED_CFG3_WG_SIZE_SHIFT             0
429d223f98fSEric Anholt 
430d223f98fSEric Anholt /* Number of batches, minus 1 */
431d223f98fSEric Anholt #define V3D_CSD_QUEUED_CFG4                            0x00914
432d223f98fSEric Anholt 
433d223f98fSEric Anholt /* Shader address, pnan, singleseg, threading, like a shader record. */
434d223f98fSEric Anholt #define V3D_CSD_QUEUED_CFG5                            0x00918
435d223f98fSEric Anholt 
436d223f98fSEric Anholt /* Uniforms address (4 byte aligned) */
437d223f98fSEric Anholt #define V3D_CSD_QUEUED_CFG6                            0x0091c
438d223f98fSEric Anholt 
439d223f98fSEric Anholt #define V3D_CSD_CURRENT_CFG0                          0x00920
440d223f98fSEric Anholt #define V3D_CSD_CURRENT_CFG1                          0x00924
441d223f98fSEric Anholt #define V3D_CSD_CURRENT_CFG2                          0x00928
442d223f98fSEric Anholt #define V3D_CSD_CURRENT_CFG3                          0x0092c
443d223f98fSEric Anholt #define V3D_CSD_CURRENT_CFG4                          0x00930
444d223f98fSEric Anholt #define V3D_CSD_CURRENT_CFG5                          0x00934
445d223f98fSEric Anholt #define V3D_CSD_CURRENT_CFG6                          0x00938
446d223f98fSEric Anholt 
447d223f98fSEric Anholt #define V3D_CSD_CURRENT_ID0                            0x0093c
448d223f98fSEric Anholt # define V3D_CSD_CURRENT_ID0_WG_X_MASK                 V3D_MASK(31, 16)
449d223f98fSEric Anholt # define V3D_CSD_CURRENT_ID0_WG_X_SHIFT                16
450d223f98fSEric Anholt # define V3D_CSD_CURRENT_ID0_WG_IN_SG_MASK             V3D_MASK(11, 8)
451d223f98fSEric Anholt # define V3D_CSD_CURRENT_ID0_WG_IN_SG_SHIFT            8
452d223f98fSEric Anholt # define V3D_CSD_CURRENT_ID0_L_IDX_MASK                V3D_MASK(7, 0)
453d223f98fSEric Anholt # define V3D_CSD_CURRENT_ID0_L_IDX_SHIFT               0
454d223f98fSEric Anholt 
455d223f98fSEric Anholt #define V3D_CSD_CURRENT_ID1                            0x00940
456d223f98fSEric Anholt # define V3D_CSD_CURRENT_ID0_WG_Z_MASK                 V3D_MASK(31, 16)
457d223f98fSEric Anholt # define V3D_CSD_CURRENT_ID0_WG_Z_SHIFT                16
458d223f98fSEric Anholt # define V3D_CSD_CURRENT_ID0_WG_Y_MASK                 V3D_MASK(15, 0)
459d223f98fSEric Anholt # define V3D_CSD_CURRENT_ID0_WG_Y_SHIFT                0
460d223f98fSEric Anholt 
4611ba9d7cbSEric Anholt #define V3D_ERR_FDBGO                                  0x00f04
4621ba9d7cbSEric Anholt #define V3D_ERR_FDBGB                                  0x00f08
4631ba9d7cbSEric Anholt #define V3D_ERR_FDBGR                                  0x00f0c
4641ba9d7cbSEric Anholt 
4651ba9d7cbSEric Anholt #define V3D_ERR_FDBGS                                  0x00f10
4661ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_INTERPZ_IP_STALL                BIT(17)
4671ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_DEPTHO_FIFO_IP_STALL            BIT(16)
4681ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_XYNRM_IP_STALL                  BIT(14)
4691ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_EZREQ_FIFO_OP_VALID             BIT(13)
4701ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_QXYF_FIFO_OP_VALID              BIT(12)
4711ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_QXYF_FIFO_OP_LAST               BIT(11)
4721ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_EZTEST_ANYQVALID                BIT(7)
4731ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_EZTEST_PASS                     BIT(6)
4741ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_EZTEST_QREADY                   BIT(5)
4751ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_EZTEST_VLF_OKNOVALID            BIT(4)
4761ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_EZTEST_QSTALL                   BIT(3)
4771ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_EZTEST_IP_VLFSTALL              BIT(2)
4781ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_EZTEST_IP_PRSTALL               BIT(1)
4791ba9d7cbSEric Anholt # define V3D_ERR_FDBGS_EZTEST_IP_QSTALL                BIT(0)
4801ba9d7cbSEric Anholt 
4811ba9d7cbSEric Anholt #define V3D_ERR_STAT                                   0x00f20
4821ba9d7cbSEric Anholt # define V3D_ERR_L2CARE                                BIT(15)
4831ba9d7cbSEric Anholt # define V3D_ERR_VCMBE                                 BIT(14)
4841ba9d7cbSEric Anholt # define V3D_ERR_VCMRE                                 BIT(13)
4851ba9d7cbSEric Anholt # define V3D_ERR_VCDI                                  BIT(12)
4861ba9d7cbSEric Anholt # define V3D_ERR_VCDE                                  BIT(11)
4871ba9d7cbSEric Anholt # define V3D_ERR_VDWE                                  BIT(10)
4881ba9d7cbSEric Anholt # define V3D_ERR_VPMEAS                                BIT(9)
4891ba9d7cbSEric Anholt # define V3D_ERR_VPMEFNA                               BIT(8)
4901ba9d7cbSEric Anholt # define V3D_ERR_VPMEWNA                               BIT(7)
4911ba9d7cbSEric Anholt # define V3D_ERR_VPMERNA                               BIT(6)
4921ba9d7cbSEric Anholt # define V3D_ERR_VPMERR                                BIT(5)
4931ba9d7cbSEric Anholt # define V3D_ERR_VPMEWR                                BIT(4)
4941ba9d7cbSEric Anholt # define V3D_ERR_VPAERRGL                              BIT(3)
4951ba9d7cbSEric Anholt # define V3D_ERR_VPAEBRGL                              BIT(2)
4961ba9d7cbSEric Anholt # define V3D_ERR_VPAERGS                               BIT(1)
4971ba9d7cbSEric Anholt # define V3D_ERR_VPAEABB                               BIT(0)
4981ba9d7cbSEric Anholt 
49957692c94SEric Anholt #endif /* V3D_REGS_H */
500