162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0+ 262306a36Sopenharmony_ci/* Copyright (C) 2017-2018 Broadcom */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef V3D_REGS_H 562306a36Sopenharmony_ci#define V3D_REGS_H 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#include <linux/bitops.h> 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#define V3D_MASK(high, low) ((u32)GENMASK(high, low)) 1062306a36Sopenharmony_ci/* Using the GNU statement expression extension */ 1162306a36Sopenharmony_ci#define V3D_SET_FIELD(value, field) \ 1262306a36Sopenharmony_ci ({ \ 1362306a36Sopenharmony_ci u32 fieldval = (value) << field##_SHIFT; \ 1462306a36Sopenharmony_ci WARN_ON((fieldval & ~field##_MASK) != 0); \ 1562306a36Sopenharmony_ci fieldval & field##_MASK; \ 1662306a36Sopenharmony_ci }) 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#define V3D_GET_FIELD(word, field) (((word) & field##_MASK) >> \ 1962306a36Sopenharmony_ci field##_SHIFT) 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci/* Hub registers for shared hardware between V3D cores. */ 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci#define V3D_HUB_AXICFG 0x00000 2462306a36Sopenharmony_ci# define V3D_HUB_AXICFG_MAX_LEN_MASK V3D_MASK(3, 0) 2562306a36Sopenharmony_ci# define V3D_HUB_AXICFG_MAX_LEN_SHIFT 0 2662306a36Sopenharmony_ci#define V3D_HUB_UIFCFG 0x00004 2762306a36Sopenharmony_ci#define V3D_HUB_IDENT0 0x00008 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci#define V3D_HUB_IDENT1 0x0000c 3062306a36Sopenharmony_ci# define V3D_HUB_IDENT1_WITH_MSO BIT(19) 3162306a36Sopenharmony_ci# define V3D_HUB_IDENT1_WITH_TSY BIT(18) 3262306a36Sopenharmony_ci# define V3D_HUB_IDENT1_WITH_TFU BIT(17) 3362306a36Sopenharmony_ci# define V3D_HUB_IDENT1_WITH_L3C BIT(16) 3462306a36Sopenharmony_ci# define V3D_HUB_IDENT1_NHOSTS_MASK V3D_MASK(15, 12) 3562306a36Sopenharmony_ci# define V3D_HUB_IDENT1_NHOSTS_SHIFT 12 3662306a36Sopenharmony_ci# define V3D_HUB_IDENT1_NCORES_MASK V3D_MASK(11, 8) 3762306a36Sopenharmony_ci# define V3D_HUB_IDENT1_NCORES_SHIFT 8 3862306a36Sopenharmony_ci# define V3D_HUB_IDENT1_REV_MASK V3D_MASK(7, 4) 3962306a36Sopenharmony_ci# define V3D_HUB_IDENT1_REV_SHIFT 4 4062306a36Sopenharmony_ci# define V3D_HUB_IDENT1_TVER_MASK V3D_MASK(3, 0) 4162306a36Sopenharmony_ci# define V3D_HUB_IDENT1_TVER_SHIFT 0 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci#define V3D_HUB_IDENT2 0x00010 4462306a36Sopenharmony_ci# define V3D_HUB_IDENT2_WITH_MMU BIT(8) 4562306a36Sopenharmony_ci# define V3D_HUB_IDENT2_L3C_NKB_MASK V3D_MASK(7, 0) 4662306a36Sopenharmony_ci# define V3D_HUB_IDENT2_L3C_NKB_SHIFT 0 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#define V3D_HUB_IDENT3 0x00014 4962306a36Sopenharmony_ci# define V3D_HUB_IDENT3_IPREV_MASK V3D_MASK(15, 8) 5062306a36Sopenharmony_ci# define V3D_HUB_IDENT3_IPREV_SHIFT 8 5162306a36Sopenharmony_ci# define V3D_HUB_IDENT3_IPIDX_MASK V3D_MASK(7, 0) 5262306a36Sopenharmony_ci# define V3D_HUB_IDENT3_IPIDX_SHIFT 0 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci#define V3D_HUB_INT_STS 0x00050 5562306a36Sopenharmony_ci#define V3D_HUB_INT_SET 0x00054 5662306a36Sopenharmony_ci#define V3D_HUB_INT_CLR 0x00058 5762306a36Sopenharmony_ci#define V3D_HUB_INT_MSK_STS 0x0005c 5862306a36Sopenharmony_ci#define V3D_HUB_INT_MSK_SET 0x00060 5962306a36Sopenharmony_ci#define V3D_HUB_INT_MSK_CLR 0x00064 6062306a36Sopenharmony_ci# define V3D_HUB_INT_MMU_WRV BIT(5) 6162306a36Sopenharmony_ci# define V3D_HUB_INT_MMU_PTI BIT(4) 6262306a36Sopenharmony_ci# define V3D_HUB_INT_MMU_CAP BIT(3) 6362306a36Sopenharmony_ci# define V3D_HUB_INT_MSO BIT(2) 6462306a36Sopenharmony_ci# define V3D_HUB_INT_TFUC BIT(1) 6562306a36Sopenharmony_ci# define V3D_HUB_INT_TFUF BIT(0) 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci#define V3D_GCA_CACHE_CTRL 0x0000c 6862306a36Sopenharmony_ci# define V3D_GCA_CACHE_CTRL_FLUSH BIT(0) 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci#define V3D_GCA_SAFE_SHUTDOWN 0x000b0 7162306a36Sopenharmony_ci# define V3D_GCA_SAFE_SHUTDOWN_EN BIT(0) 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci#define V3D_GCA_SAFE_SHUTDOWN_ACK 0x000b4 7462306a36Sopenharmony_ci# define V3D_GCA_SAFE_SHUTDOWN_ACK_ACKED 3 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci# define V3D_TOP_GR_BRIDGE_REVISION 0x00000 7762306a36Sopenharmony_ci# define V3D_TOP_GR_BRIDGE_MAJOR_MASK V3D_MASK(15, 8) 7862306a36Sopenharmony_ci# define V3D_TOP_GR_BRIDGE_MAJOR_SHIFT 8 7962306a36Sopenharmony_ci# define V3D_TOP_GR_BRIDGE_MINOR_MASK V3D_MASK(7, 0) 8062306a36Sopenharmony_ci# define V3D_TOP_GR_BRIDGE_MINOR_SHIFT 0 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci/* 7268 reset reg */ 8362306a36Sopenharmony_ci# define V3D_TOP_GR_BRIDGE_SW_INIT_0 0x00008 8462306a36Sopenharmony_ci# define V3D_TOP_GR_BRIDGE_SW_INIT_0_V3D_CLK_108_SW_INIT BIT(0) 8562306a36Sopenharmony_ci/* 7278 reset reg */ 8662306a36Sopenharmony_ci# define V3D_TOP_GR_BRIDGE_SW_INIT_1 0x0000c 8762306a36Sopenharmony_ci# define V3D_TOP_GR_BRIDGE_SW_INIT_1_V3D_CLK_108_SW_INIT BIT(0) 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci#define V3D_TFU_CS 0x00400 9062306a36Sopenharmony_ci/* Stops current job, empties input fifo. */ 9162306a36Sopenharmony_ci# define V3D_TFU_CS_TFURST BIT(31) 9262306a36Sopenharmony_ci# define V3D_TFU_CS_CVTCT_MASK V3D_MASK(23, 16) 9362306a36Sopenharmony_ci# define V3D_TFU_CS_CVTCT_SHIFT 16 9462306a36Sopenharmony_ci# define V3D_TFU_CS_NFREE_MASK V3D_MASK(13, 8) 9562306a36Sopenharmony_ci# define V3D_TFU_CS_NFREE_SHIFT 8 9662306a36Sopenharmony_ci# define V3D_TFU_CS_BUSY BIT(0) 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci#define V3D_TFU_SU 0x00404 9962306a36Sopenharmony_ci/* Interrupt when FINTTHR input slots are free (0 = disabled) */ 10062306a36Sopenharmony_ci# define V3D_TFU_SU_FINTTHR_MASK V3D_MASK(13, 8) 10162306a36Sopenharmony_ci# define V3D_TFU_SU_FINTTHR_SHIFT 8 10262306a36Sopenharmony_ci/* Skips resetting the CRC at the start of CRC generation. */ 10362306a36Sopenharmony_ci# define V3D_TFU_SU_CRCCHAIN BIT(4) 10462306a36Sopenharmony_ci/* skips writes, computes CRC of the image. miplevels must be 0. */ 10562306a36Sopenharmony_ci# define V3D_TFU_SU_CRC BIT(3) 10662306a36Sopenharmony_ci# define V3D_TFU_SU_THROTTLE_MASK V3D_MASK(1, 0) 10762306a36Sopenharmony_ci# define V3D_TFU_SU_THROTTLE_SHIFT 0 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci#define V3D_TFU_ICFG 0x00408 11062306a36Sopenharmony_ci/* Interrupt when the conversion is complete. */ 11162306a36Sopenharmony_ci# define V3D_TFU_ICFG_IOC BIT(0) 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ci/* Input Image Address */ 11462306a36Sopenharmony_ci#define V3D_TFU_IIA 0x0040c 11562306a36Sopenharmony_ci/* Input Chroma Address */ 11662306a36Sopenharmony_ci#define V3D_TFU_ICA 0x00410 11762306a36Sopenharmony_ci/* Input Image Stride */ 11862306a36Sopenharmony_ci#define V3D_TFU_IIS 0x00414 11962306a36Sopenharmony_ci/* Input Image U-Plane Address */ 12062306a36Sopenharmony_ci#define V3D_TFU_IUA 0x00418 12162306a36Sopenharmony_ci/* Output Image Address */ 12262306a36Sopenharmony_ci#define V3D_TFU_IOA 0x0041c 12362306a36Sopenharmony_ci/* Image Output Size */ 12462306a36Sopenharmony_ci#define V3D_TFU_IOS 0x00420 12562306a36Sopenharmony_ci/* TFU YUV Coefficient 0 */ 12662306a36Sopenharmony_ci#define V3D_TFU_COEF0 0x00424 12762306a36Sopenharmony_ci/* Use these regs instead of the defaults. */ 12862306a36Sopenharmony_ci# define V3D_TFU_COEF0_USECOEF BIT(31) 12962306a36Sopenharmony_ci/* TFU YUV Coefficient 1 */ 13062306a36Sopenharmony_ci#define V3D_TFU_COEF1 0x00428 13162306a36Sopenharmony_ci/* TFU YUV Coefficient 2 */ 13262306a36Sopenharmony_ci#define V3D_TFU_COEF2 0x0042c 13362306a36Sopenharmony_ci/* TFU YUV Coefficient 3 */ 13462306a36Sopenharmony_ci#define V3D_TFU_COEF3 0x00430 13562306a36Sopenharmony_ci 13662306a36Sopenharmony_ci#define V3D_TFU_CRC 0x00434 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci/* Per-MMU registers. */ 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci#define V3D_MMUC_CONTROL 0x01000 14162306a36Sopenharmony_ci# define V3D_MMUC_CONTROL_CLEAR BIT(3) 14262306a36Sopenharmony_ci# define V3D_MMUC_CONTROL_FLUSHING BIT(2) 14362306a36Sopenharmony_ci# define V3D_MMUC_CONTROL_FLUSH BIT(1) 14462306a36Sopenharmony_ci# define V3D_MMUC_CONTROL_ENABLE BIT(0) 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci#define V3D_MMU_CTL 0x01200 14762306a36Sopenharmony_ci# define V3D_MMU_CTL_CAP_EXCEEDED BIT(27) 14862306a36Sopenharmony_ci# define V3D_MMU_CTL_CAP_EXCEEDED_ABORT BIT(26) 14962306a36Sopenharmony_ci# define V3D_MMU_CTL_CAP_EXCEEDED_INT BIT(25) 15062306a36Sopenharmony_ci# define V3D_MMU_CTL_CAP_EXCEEDED_EXCEPTION BIT(24) 15162306a36Sopenharmony_ci# define V3D_MMU_CTL_PT_INVALID BIT(20) 15262306a36Sopenharmony_ci# define V3D_MMU_CTL_PT_INVALID_ABORT BIT(19) 15362306a36Sopenharmony_ci# define V3D_MMU_CTL_PT_INVALID_INT BIT(18) 15462306a36Sopenharmony_ci# define V3D_MMU_CTL_PT_INVALID_EXCEPTION BIT(17) 15562306a36Sopenharmony_ci# define V3D_MMU_CTL_PT_INVALID_ENABLE BIT(16) 15662306a36Sopenharmony_ci# define V3D_MMU_CTL_WRITE_VIOLATION BIT(12) 15762306a36Sopenharmony_ci# define V3D_MMU_CTL_WRITE_VIOLATION_ABORT BIT(11) 15862306a36Sopenharmony_ci# define V3D_MMU_CTL_WRITE_VIOLATION_INT BIT(10) 15962306a36Sopenharmony_ci# define V3D_MMU_CTL_WRITE_VIOLATION_EXCEPTION BIT(9) 16062306a36Sopenharmony_ci# define V3D_MMU_CTL_TLB_CLEARING BIT(7) 16162306a36Sopenharmony_ci# define V3D_MMU_CTL_TLB_STATS_CLEAR BIT(3) 16262306a36Sopenharmony_ci# define V3D_MMU_CTL_TLB_CLEAR BIT(2) 16362306a36Sopenharmony_ci# define V3D_MMU_CTL_TLB_STATS_ENABLE BIT(1) 16462306a36Sopenharmony_ci# define V3D_MMU_CTL_ENABLE BIT(0) 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci#define V3D_MMU_PT_PA_BASE 0x01204 16762306a36Sopenharmony_ci#define V3D_MMU_HIT 0x01208 16862306a36Sopenharmony_ci#define V3D_MMU_MISSES 0x0120c 16962306a36Sopenharmony_ci#define V3D_MMU_STALLS 0x01210 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_ci#define V3D_MMU_ADDR_CAP 0x01214 17262306a36Sopenharmony_ci# define V3D_MMU_ADDR_CAP_ENABLE BIT(31) 17362306a36Sopenharmony_ci# define V3D_MMU_ADDR_CAP_MPAGE_MASK V3D_MASK(11, 0) 17462306a36Sopenharmony_ci# define V3D_MMU_ADDR_CAP_MPAGE_SHIFT 0 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci#define V3D_MMU_SHOOT_DOWN 0x01218 17762306a36Sopenharmony_ci# define V3D_MMU_SHOOT_DOWN_SHOOTING BIT(29) 17862306a36Sopenharmony_ci# define V3D_MMU_SHOOT_DOWN_SHOOT BIT(28) 17962306a36Sopenharmony_ci# define V3D_MMU_SHOOT_DOWN_PAGE_MASK V3D_MASK(27, 0) 18062306a36Sopenharmony_ci# define V3D_MMU_SHOOT_DOWN_PAGE_SHIFT 0 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci#define V3D_MMU_BYPASS_START 0x0121c 18362306a36Sopenharmony_ci#define V3D_MMU_BYPASS_END 0x01220 18462306a36Sopenharmony_ci 18562306a36Sopenharmony_ci/* AXI ID of the access that faulted */ 18662306a36Sopenharmony_ci#define V3D_MMU_VIO_ID 0x0122c 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ci/* Address for illegal PTEs to return */ 18962306a36Sopenharmony_ci#define V3D_MMU_ILLEGAL_ADDR 0x01230 19062306a36Sopenharmony_ci# define V3D_MMU_ILLEGAL_ADDR_ENABLE BIT(31) 19162306a36Sopenharmony_ci 19262306a36Sopenharmony_ci/* Address that faulted */ 19362306a36Sopenharmony_ci#define V3D_MMU_VIO_ADDR 0x01234 19462306a36Sopenharmony_ci 19562306a36Sopenharmony_ci#define V3D_MMU_DEBUG_INFO 0x01238 19662306a36Sopenharmony_ci# define V3D_MMU_PA_WIDTH_MASK V3D_MASK(11, 8) 19762306a36Sopenharmony_ci# define V3D_MMU_PA_WIDTH_SHIFT 8 19862306a36Sopenharmony_ci# define V3D_MMU_VA_WIDTH_MASK V3D_MASK(7, 4) 19962306a36Sopenharmony_ci# define V3D_MMU_VA_WIDTH_SHIFT 4 20062306a36Sopenharmony_ci# define V3D_MMU_VERSION_MASK V3D_MASK(3, 0) 20162306a36Sopenharmony_ci# define V3D_MMU_VERSION_SHIFT 0 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ci/* Per-V3D-core registers */ 20462306a36Sopenharmony_ci 20562306a36Sopenharmony_ci#define V3D_CTL_IDENT0 0x00000 20662306a36Sopenharmony_ci# define V3D_IDENT0_VER_MASK V3D_MASK(31, 24) 20762306a36Sopenharmony_ci# define V3D_IDENT0_VER_SHIFT 24 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci#define V3D_CTL_IDENT1 0x00004 21062306a36Sopenharmony_ci/* Multiples of 1kb */ 21162306a36Sopenharmony_ci# define V3D_IDENT1_VPM_SIZE_MASK V3D_MASK(31, 28) 21262306a36Sopenharmony_ci# define V3D_IDENT1_VPM_SIZE_SHIFT 28 21362306a36Sopenharmony_ci# define V3D_IDENT1_NSEM_MASK V3D_MASK(23, 16) 21462306a36Sopenharmony_ci# define V3D_IDENT1_NSEM_SHIFT 16 21562306a36Sopenharmony_ci# define V3D_IDENT1_NTMU_MASK V3D_MASK(15, 12) 21662306a36Sopenharmony_ci# define V3D_IDENT1_NTMU_SHIFT 12 21762306a36Sopenharmony_ci# define V3D_IDENT1_QUPS_MASK V3D_MASK(11, 8) 21862306a36Sopenharmony_ci# define V3D_IDENT1_QUPS_SHIFT 8 21962306a36Sopenharmony_ci# define V3D_IDENT1_NSLC_MASK V3D_MASK(7, 4) 22062306a36Sopenharmony_ci# define V3D_IDENT1_NSLC_SHIFT 4 22162306a36Sopenharmony_ci# define V3D_IDENT1_REV_MASK V3D_MASK(3, 0) 22262306a36Sopenharmony_ci# define V3D_IDENT1_REV_SHIFT 0 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ci#define V3D_CTL_IDENT2 0x00008 22562306a36Sopenharmony_ci# define V3D_IDENT2_BCG_INT BIT(28) 22662306a36Sopenharmony_ci 22762306a36Sopenharmony_ci#define V3D_CTL_MISCCFG 0x00018 22862306a36Sopenharmony_ci# define V3D_CTL_MISCCFG_QRMAXCNT_MASK V3D_MASK(3, 1) 22962306a36Sopenharmony_ci# define V3D_CTL_MISCCFG_QRMAXCNT_SHIFT 1 23062306a36Sopenharmony_ci# define V3D_MISCCFG_OVRTMUOUT BIT(0) 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci#define V3D_CTL_L2CACTL 0x00020 23362306a36Sopenharmony_ci# define V3D_L2CACTL_L2CCLR BIT(2) 23462306a36Sopenharmony_ci# define V3D_L2CACTL_L2CDIS BIT(1) 23562306a36Sopenharmony_ci# define V3D_L2CACTL_L2CENA BIT(0) 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_ci#define V3D_CTL_SLCACTL 0x00024 23862306a36Sopenharmony_ci# define V3D_SLCACTL_TVCCS_MASK V3D_MASK(27, 24) 23962306a36Sopenharmony_ci# define V3D_SLCACTL_TVCCS_SHIFT 24 24062306a36Sopenharmony_ci# define V3D_SLCACTL_TDCCS_MASK V3D_MASK(19, 16) 24162306a36Sopenharmony_ci# define V3D_SLCACTL_TDCCS_SHIFT 16 24262306a36Sopenharmony_ci# define V3D_SLCACTL_UCC_MASK V3D_MASK(11, 8) 24362306a36Sopenharmony_ci# define V3D_SLCACTL_UCC_SHIFT 8 24462306a36Sopenharmony_ci# define V3D_SLCACTL_ICC_MASK V3D_MASK(3, 0) 24562306a36Sopenharmony_ci# define V3D_SLCACTL_ICC_SHIFT 0 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_ci#define V3D_CTL_L2TCACTL 0x00030 24862306a36Sopenharmony_ci# define V3D_L2TCACTL_TMUWCF BIT(8) 24962306a36Sopenharmony_ci# define V3D_L2TCACTL_L2T_NO_WM BIT(4) 25062306a36Sopenharmony_ci/* Invalidates cache lines. */ 25162306a36Sopenharmony_ci# define V3D_L2TCACTL_FLM_FLUSH 0 25262306a36Sopenharmony_ci/* Removes cachelines without writing dirty lines back. */ 25362306a36Sopenharmony_ci# define V3D_L2TCACTL_FLM_CLEAR 1 25462306a36Sopenharmony_ci/* Writes out dirty cachelines and marks them clean, but doesn't invalidate. */ 25562306a36Sopenharmony_ci# define V3D_L2TCACTL_FLM_CLEAN 2 25662306a36Sopenharmony_ci# define V3D_L2TCACTL_FLM_MASK V3D_MASK(2, 1) 25762306a36Sopenharmony_ci# define V3D_L2TCACTL_FLM_SHIFT 1 25862306a36Sopenharmony_ci# define V3D_L2TCACTL_L2TFLS BIT(0) 25962306a36Sopenharmony_ci#define V3D_CTL_L2TFLSTA 0x00034 26062306a36Sopenharmony_ci#define V3D_CTL_L2TFLEND 0x00038 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ci#define V3D_CTL_INT_STS 0x00050 26362306a36Sopenharmony_ci#define V3D_CTL_INT_SET 0x00054 26462306a36Sopenharmony_ci#define V3D_CTL_INT_CLR 0x00058 26562306a36Sopenharmony_ci#define V3D_CTL_INT_MSK_STS 0x0005c 26662306a36Sopenharmony_ci#define V3D_CTL_INT_MSK_SET 0x00060 26762306a36Sopenharmony_ci#define V3D_CTL_INT_MSK_CLR 0x00064 26862306a36Sopenharmony_ci# define V3D_INT_QPU_MASK V3D_MASK(27, 16) 26962306a36Sopenharmony_ci# define V3D_INT_QPU_SHIFT 16 27062306a36Sopenharmony_ci# define V3D_INT_CSDDONE BIT(7) 27162306a36Sopenharmony_ci# define V3D_INT_PCTR BIT(6) 27262306a36Sopenharmony_ci# define V3D_INT_GMPV BIT(5) 27362306a36Sopenharmony_ci# define V3D_INT_TRFB BIT(4) 27462306a36Sopenharmony_ci# define V3D_INT_SPILLUSE BIT(3) 27562306a36Sopenharmony_ci# define V3D_INT_OUTOMEM BIT(2) 27662306a36Sopenharmony_ci# define V3D_INT_FLDONE BIT(1) 27762306a36Sopenharmony_ci# define V3D_INT_FRDONE BIT(0) 27862306a36Sopenharmony_ci 27962306a36Sopenharmony_ci#define V3D_CLE_CT0CS 0x00100 28062306a36Sopenharmony_ci#define V3D_CLE_CT1CS 0x00104 28162306a36Sopenharmony_ci#define V3D_CLE_CTNCS(n) (V3D_CLE_CT0CS + 4 * n) 28262306a36Sopenharmony_ci#define V3D_CLE_CT0EA 0x00108 28362306a36Sopenharmony_ci#define V3D_CLE_CT1EA 0x0010c 28462306a36Sopenharmony_ci#define V3D_CLE_CTNEA(n) (V3D_CLE_CT0EA + 4 * n) 28562306a36Sopenharmony_ci#define V3D_CLE_CT0CA 0x00110 28662306a36Sopenharmony_ci#define V3D_CLE_CT1CA 0x00114 28762306a36Sopenharmony_ci#define V3D_CLE_CTNCA(n) (V3D_CLE_CT0CA + 4 * n) 28862306a36Sopenharmony_ci#define V3D_CLE_CT0RA 0x00118 28962306a36Sopenharmony_ci#define V3D_CLE_CT1RA 0x0011c 29062306a36Sopenharmony_ci#define V3D_CLE_CTNRA(n) (V3D_CLE_CT0RA + 4 * n) 29162306a36Sopenharmony_ci#define V3D_CLE_CT0LC 0x00120 29262306a36Sopenharmony_ci#define V3D_CLE_CT1LC 0x00124 29362306a36Sopenharmony_ci#define V3D_CLE_CT0PC 0x00128 29462306a36Sopenharmony_ci#define V3D_CLE_CT1PC 0x0012c 29562306a36Sopenharmony_ci#define V3D_CLE_PCS 0x00130 29662306a36Sopenharmony_ci#define V3D_CLE_BFC 0x00134 29762306a36Sopenharmony_ci#define V3D_CLE_RFC 0x00138 29862306a36Sopenharmony_ci#define V3D_CLE_TFBC 0x0013c 29962306a36Sopenharmony_ci#define V3D_CLE_TFIT 0x00140 30062306a36Sopenharmony_ci#define V3D_CLE_CT1CFG 0x00144 30162306a36Sopenharmony_ci#define V3D_CLE_CT1TILECT 0x00148 30262306a36Sopenharmony_ci#define V3D_CLE_CT1TSKIP 0x0014c 30362306a36Sopenharmony_ci#define V3D_CLE_CT1PTCT 0x00150 30462306a36Sopenharmony_ci#define V3D_CLE_CT0SYNC 0x00154 30562306a36Sopenharmony_ci#define V3D_CLE_CT1SYNC 0x00158 30662306a36Sopenharmony_ci#define V3D_CLE_CT0QTS 0x0015c 30762306a36Sopenharmony_ci# define V3D_CLE_CT0QTS_ENABLE BIT(1) 30862306a36Sopenharmony_ci#define V3D_CLE_CT0QBA 0x00160 30962306a36Sopenharmony_ci#define V3D_CLE_CT1QBA 0x00164 31062306a36Sopenharmony_ci#define V3D_CLE_CTNQBA(n) (V3D_CLE_CT0QBA + 4 * n) 31162306a36Sopenharmony_ci#define V3D_CLE_CT0QEA 0x00168 31262306a36Sopenharmony_ci#define V3D_CLE_CT1QEA 0x0016c 31362306a36Sopenharmony_ci#define V3D_CLE_CTNQEA(n) (V3D_CLE_CT0QEA + 4 * n) 31462306a36Sopenharmony_ci#define V3D_CLE_CT0QMA 0x00170 31562306a36Sopenharmony_ci#define V3D_CLE_CT0QMS 0x00174 31662306a36Sopenharmony_ci#define V3D_CLE_CT1QCFG 0x00178 31762306a36Sopenharmony_ci/* If set without ETPROC, entirely skip tiles with no primitives. */ 31862306a36Sopenharmony_ci# define V3D_CLE_QCFG_ETFILT BIT(7) 31962306a36Sopenharmony_ci/* If set with ETFILT, just write the clear color to tiles with no 32062306a36Sopenharmony_ci * primitives. 32162306a36Sopenharmony_ci */ 32262306a36Sopenharmony_ci# define V3D_CLE_QCFG_ETPROC BIT(6) 32362306a36Sopenharmony_ci# define V3D_CLE_QCFG_ETSFLUSH BIT(1) 32462306a36Sopenharmony_ci# define V3D_CLE_QCFG_MCDIS BIT(0) 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_ci#define V3D_PTB_BPCA 0x00300 32762306a36Sopenharmony_ci#define V3D_PTB_BPCS 0x00304 32862306a36Sopenharmony_ci#define V3D_PTB_BPOA 0x00308 32962306a36Sopenharmony_ci#define V3D_PTB_BPOS 0x0030c 33062306a36Sopenharmony_ci 33162306a36Sopenharmony_ci#define V3D_PTB_BXCF 0x00310 33262306a36Sopenharmony_ci# define V3D_PTB_BXCF_RWORDERDISA BIT(1) 33362306a36Sopenharmony_ci# define V3D_PTB_BXCF_CLIPDISA BIT(0) 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci#define V3D_V3_PCTR_0_EN 0x00674 33662306a36Sopenharmony_ci#define V3D_V3_PCTR_0_EN_ENABLE BIT(31) 33762306a36Sopenharmony_ci#define V3D_V4_PCTR_0_EN 0x00650 33862306a36Sopenharmony_ci/* When a bit is set, resets the counter to 0. */ 33962306a36Sopenharmony_ci#define V3D_V3_PCTR_0_CLR 0x00670 34062306a36Sopenharmony_ci#define V3D_V4_PCTR_0_CLR 0x00654 34162306a36Sopenharmony_ci#define V3D_PCTR_0_OVERFLOW 0x00658 34262306a36Sopenharmony_ci 34362306a36Sopenharmony_ci#define V3D_V3_PCTR_0_PCTRS0 0x00684 34462306a36Sopenharmony_ci#define V3D_V3_PCTR_0_PCTRS15 0x00660 34562306a36Sopenharmony_ci#define V3D_V3_PCTR_0_PCTRSX(x) (V3D_V3_PCTR_0_PCTRS0 + \ 34662306a36Sopenharmony_ci 4 * (x)) 34762306a36Sopenharmony_ci/* Each src reg muxes four counters each. */ 34862306a36Sopenharmony_ci#define V3D_V4_PCTR_0_SRC_0_3 0x00660 34962306a36Sopenharmony_ci#define V3D_V4_PCTR_0_SRC_28_31 0x0067c 35062306a36Sopenharmony_ci#define V3D_V4_PCTR_0_SRC_X(x) (V3D_V4_PCTR_0_SRC_0_3 + \ 35162306a36Sopenharmony_ci 4 * (x)) 35262306a36Sopenharmony_ci# define V3D_PCTR_S0_MASK V3D_MASK(6, 0) 35362306a36Sopenharmony_ci# define V3D_PCTR_S0_SHIFT 0 35462306a36Sopenharmony_ci# define V3D_PCTR_S1_MASK V3D_MASK(14, 8) 35562306a36Sopenharmony_ci# define V3D_PCTR_S1_SHIFT 8 35662306a36Sopenharmony_ci# define V3D_PCTR_S2_MASK V3D_MASK(22, 16) 35762306a36Sopenharmony_ci# define V3D_PCTR_S2_SHIFT 16 35862306a36Sopenharmony_ci# define V3D_PCTR_S3_MASK V3D_MASK(30, 24) 35962306a36Sopenharmony_ci# define V3D_PCTR_S3_SHIFT 24 36062306a36Sopenharmony_ci# define V3D_PCTR_CYCLE_COUNT 32 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ci/* Output values of the counters. */ 36362306a36Sopenharmony_ci#define V3D_PCTR_0_PCTR0 0x00680 36462306a36Sopenharmony_ci#define V3D_PCTR_0_PCTR31 0x006fc 36562306a36Sopenharmony_ci#define V3D_PCTR_0_PCTRX(x) (V3D_PCTR_0_PCTR0 + \ 36662306a36Sopenharmony_ci 4 * (x)) 36762306a36Sopenharmony_ci#define V3D_GMP_STATUS 0x00800 36862306a36Sopenharmony_ci# define V3D_GMP_STATUS_GMPRST BIT(31) 36962306a36Sopenharmony_ci# define V3D_GMP_STATUS_WR_COUNT_MASK V3D_MASK(30, 24) 37062306a36Sopenharmony_ci# define V3D_GMP_STATUS_WR_COUNT_SHIFT 24 37162306a36Sopenharmony_ci# define V3D_GMP_STATUS_RD_COUNT_MASK V3D_MASK(22, 16) 37262306a36Sopenharmony_ci# define V3D_GMP_STATUS_RD_COUNT_SHIFT 16 37362306a36Sopenharmony_ci# define V3D_GMP_STATUS_WR_ACTIVE BIT(5) 37462306a36Sopenharmony_ci# define V3D_GMP_STATUS_RD_ACTIVE BIT(4) 37562306a36Sopenharmony_ci# define V3D_GMP_STATUS_CFG_BUSY BIT(3) 37662306a36Sopenharmony_ci# define V3D_GMP_STATUS_CNTOVF BIT(2) 37762306a36Sopenharmony_ci# define V3D_GMP_STATUS_INVPROT BIT(1) 37862306a36Sopenharmony_ci# define V3D_GMP_STATUS_VIO BIT(0) 37962306a36Sopenharmony_ci 38062306a36Sopenharmony_ci#define V3D_GMP_CFG 0x00804 38162306a36Sopenharmony_ci# define V3D_GMP_CFG_LBURSTEN BIT(3) 38262306a36Sopenharmony_ci# define V3D_GMP_CFG_PGCRSEN BIT() 38362306a36Sopenharmony_ci# define V3D_GMP_CFG_STOP_REQ BIT(1) 38462306a36Sopenharmony_ci# define V3D_GMP_CFG_PROT_ENABLE BIT(0) 38562306a36Sopenharmony_ci 38662306a36Sopenharmony_ci#define V3D_GMP_VIO_ADDR 0x00808 38762306a36Sopenharmony_ci#define V3D_GMP_VIO_TYPE 0x0080c 38862306a36Sopenharmony_ci#define V3D_GMP_TABLE_ADDR 0x00810 38962306a36Sopenharmony_ci#define V3D_GMP_CLEAR_LOAD 0x00814 39062306a36Sopenharmony_ci#define V3D_GMP_PRESERVE_LOAD 0x00818 39162306a36Sopenharmony_ci#define V3D_GMP_VALID_LINES 0x00820 39262306a36Sopenharmony_ci 39362306a36Sopenharmony_ci#define V3D_CSD_STATUS 0x00900 39462306a36Sopenharmony_ci# define V3D_CSD_STATUS_NUM_COMPLETED_MASK V3D_MASK(11, 4) 39562306a36Sopenharmony_ci# define V3D_CSD_STATUS_NUM_COMPLETED_SHIFT 4 39662306a36Sopenharmony_ci# define V3D_CSD_STATUS_NUM_ACTIVE_MASK V3D_MASK(3, 2) 39762306a36Sopenharmony_ci# define V3D_CSD_STATUS_NUM_ACTIVE_SHIFT 2 39862306a36Sopenharmony_ci# define V3D_CSD_STATUS_HAVE_CURRENT_DISPATCH BIT(1) 39962306a36Sopenharmony_ci# define V3D_CSD_STATUS_HAVE_QUEUED_DISPATCH BIT(0) 40062306a36Sopenharmony_ci 40162306a36Sopenharmony_ci#define V3D_CSD_QUEUED_CFG0 0x00904 40262306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG0_NUM_WGS_X_MASK V3D_MASK(31, 16) 40362306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG0_NUM_WGS_X_SHIFT 16 40462306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG0_WG_X_OFFSET_MASK V3D_MASK(15, 0) 40562306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG0_WG_X_OFFSET_SHIFT 0 40662306a36Sopenharmony_ci 40762306a36Sopenharmony_ci#define V3D_CSD_QUEUED_CFG1 0x00908 40862306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG1_NUM_WGS_Y_MASK V3D_MASK(31, 16) 40962306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG1_NUM_WGS_Y_SHIFT 16 41062306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG1_WG_Y_OFFSET_MASK V3D_MASK(15, 0) 41162306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG1_WG_Y_OFFSET_SHIFT 0 41262306a36Sopenharmony_ci 41362306a36Sopenharmony_ci#define V3D_CSD_QUEUED_CFG2 0x0090c 41462306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG2_NUM_WGS_Z_MASK V3D_MASK(31, 16) 41562306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG2_NUM_WGS_Z_SHIFT 16 41662306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG2_WG_Z_OFFSET_MASK V3D_MASK(15, 0) 41762306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG2_WG_Z_OFFSET_SHIFT 0 41862306a36Sopenharmony_ci 41962306a36Sopenharmony_ci#define V3D_CSD_QUEUED_CFG3 0x00910 42062306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG3_OVERLAP_WITH_PREV BIT(26) 42162306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG3_MAX_SG_ID_MASK V3D_MASK(25, 20) 42262306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG3_MAX_SG_ID_SHIFT 20 42362306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG3_BATCHES_PER_SG_M1_MASK V3D_MASK(19, 12) 42462306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG3_BATCHES_PER_SG_M1_SHIFT 12 42562306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG3_WGS_PER_SG_MASK V3D_MASK(11, 8) 42662306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG3_WGS_PER_SG_SHIFT 8 42762306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG3_WG_SIZE_MASK V3D_MASK(7, 0) 42862306a36Sopenharmony_ci# define V3D_CSD_QUEUED_CFG3_WG_SIZE_SHIFT 0 42962306a36Sopenharmony_ci 43062306a36Sopenharmony_ci/* Number of batches, minus 1 */ 43162306a36Sopenharmony_ci#define V3D_CSD_QUEUED_CFG4 0x00914 43262306a36Sopenharmony_ci 43362306a36Sopenharmony_ci/* Shader address, pnan, singleseg, threading, like a shader record. */ 43462306a36Sopenharmony_ci#define V3D_CSD_QUEUED_CFG5 0x00918 43562306a36Sopenharmony_ci 43662306a36Sopenharmony_ci/* Uniforms address (4 byte aligned) */ 43762306a36Sopenharmony_ci#define V3D_CSD_QUEUED_CFG6 0x0091c 43862306a36Sopenharmony_ci 43962306a36Sopenharmony_ci#define V3D_CSD_CURRENT_CFG0 0x00920 44062306a36Sopenharmony_ci#define V3D_CSD_CURRENT_CFG1 0x00924 44162306a36Sopenharmony_ci#define V3D_CSD_CURRENT_CFG2 0x00928 44262306a36Sopenharmony_ci#define V3D_CSD_CURRENT_CFG3 0x0092c 44362306a36Sopenharmony_ci#define V3D_CSD_CURRENT_CFG4 0x00930 44462306a36Sopenharmony_ci#define V3D_CSD_CURRENT_CFG5 0x00934 44562306a36Sopenharmony_ci#define V3D_CSD_CURRENT_CFG6 0x00938 44662306a36Sopenharmony_ci 44762306a36Sopenharmony_ci#define V3D_CSD_CURRENT_ID0 0x0093c 44862306a36Sopenharmony_ci# define V3D_CSD_CURRENT_ID0_WG_X_MASK V3D_MASK(31, 16) 44962306a36Sopenharmony_ci# define V3D_CSD_CURRENT_ID0_WG_X_SHIFT 16 45062306a36Sopenharmony_ci# define V3D_CSD_CURRENT_ID0_WG_IN_SG_MASK V3D_MASK(11, 8) 45162306a36Sopenharmony_ci# define V3D_CSD_CURRENT_ID0_WG_IN_SG_SHIFT 8 45262306a36Sopenharmony_ci# define V3D_CSD_CURRENT_ID0_L_IDX_MASK V3D_MASK(7, 0) 45362306a36Sopenharmony_ci# define V3D_CSD_CURRENT_ID0_L_IDX_SHIFT 0 45462306a36Sopenharmony_ci 45562306a36Sopenharmony_ci#define V3D_CSD_CURRENT_ID1 0x00940 45662306a36Sopenharmony_ci# define V3D_CSD_CURRENT_ID0_WG_Z_MASK V3D_MASK(31, 16) 45762306a36Sopenharmony_ci# define V3D_CSD_CURRENT_ID0_WG_Z_SHIFT 16 45862306a36Sopenharmony_ci# define V3D_CSD_CURRENT_ID0_WG_Y_MASK V3D_MASK(15, 0) 45962306a36Sopenharmony_ci# define V3D_CSD_CURRENT_ID0_WG_Y_SHIFT 0 46062306a36Sopenharmony_ci 46162306a36Sopenharmony_ci#define V3D_ERR_FDBGO 0x00f04 46262306a36Sopenharmony_ci#define V3D_ERR_FDBGB 0x00f08 46362306a36Sopenharmony_ci#define V3D_ERR_FDBGR 0x00f0c 46462306a36Sopenharmony_ci 46562306a36Sopenharmony_ci#define V3D_ERR_FDBGS 0x00f10 46662306a36Sopenharmony_ci# define V3D_ERR_FDBGS_INTERPZ_IP_STALL BIT(17) 46762306a36Sopenharmony_ci# define V3D_ERR_FDBGS_DEPTHO_FIFO_IP_STALL BIT(16) 46862306a36Sopenharmony_ci# define V3D_ERR_FDBGS_XYNRM_IP_STALL BIT(14) 46962306a36Sopenharmony_ci# define V3D_ERR_FDBGS_EZREQ_FIFO_OP_VALID BIT(13) 47062306a36Sopenharmony_ci# define V3D_ERR_FDBGS_QXYF_FIFO_OP_VALID BIT(12) 47162306a36Sopenharmony_ci# define V3D_ERR_FDBGS_QXYF_FIFO_OP_LAST BIT(11) 47262306a36Sopenharmony_ci# define V3D_ERR_FDBGS_EZTEST_ANYQVALID BIT(7) 47362306a36Sopenharmony_ci# define V3D_ERR_FDBGS_EZTEST_PASS BIT(6) 47462306a36Sopenharmony_ci# define V3D_ERR_FDBGS_EZTEST_QREADY BIT(5) 47562306a36Sopenharmony_ci# define V3D_ERR_FDBGS_EZTEST_VLF_OKNOVALID BIT(4) 47662306a36Sopenharmony_ci# define V3D_ERR_FDBGS_EZTEST_QSTALL BIT(3) 47762306a36Sopenharmony_ci# define V3D_ERR_FDBGS_EZTEST_IP_VLFSTALL BIT(2) 47862306a36Sopenharmony_ci# define V3D_ERR_FDBGS_EZTEST_IP_PRSTALL BIT(1) 47962306a36Sopenharmony_ci# define V3D_ERR_FDBGS_EZTEST_IP_QSTALL BIT(0) 48062306a36Sopenharmony_ci 48162306a36Sopenharmony_ci#define V3D_ERR_STAT 0x00f20 48262306a36Sopenharmony_ci# define V3D_ERR_L2CARE BIT(15) 48362306a36Sopenharmony_ci# define V3D_ERR_VCMBE BIT(14) 48462306a36Sopenharmony_ci# define V3D_ERR_VCMRE BIT(13) 48562306a36Sopenharmony_ci# define V3D_ERR_VCDI BIT(12) 48662306a36Sopenharmony_ci# define V3D_ERR_VCDE BIT(11) 48762306a36Sopenharmony_ci# define V3D_ERR_VDWE BIT(10) 48862306a36Sopenharmony_ci# define V3D_ERR_VPMEAS BIT(9) 48962306a36Sopenharmony_ci# define V3D_ERR_VPMEFNA BIT(8) 49062306a36Sopenharmony_ci# define V3D_ERR_VPMEWNA BIT(7) 49162306a36Sopenharmony_ci# define V3D_ERR_VPMERNA BIT(6) 49262306a36Sopenharmony_ci# define V3D_ERR_VPMERR BIT(5) 49362306a36Sopenharmony_ci# define V3D_ERR_VPMEWR BIT(4) 49462306a36Sopenharmony_ci# define V3D_ERR_VPAERRGL BIT(3) 49562306a36Sopenharmony_ci# define V3D_ERR_VPAEBRGL BIT(2) 49662306a36Sopenharmony_ci# define V3D_ERR_VPAERGS BIT(1) 49762306a36Sopenharmony_ci# define V3D_ERR_VPAEABB BIT(0) 49862306a36Sopenharmony_ci 49962306a36Sopenharmony_ci#endif /* V3D_REGS_H */ 500