162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 262306a36Sopenharmony_ci/* Copyright (C) 2020 Felix Fietkau <nbd@nbd.name> */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef __MTK_PPE_REGS_H 562306a36Sopenharmony_ci#define __MTK_PPE_REGS_H 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG 0x200 862306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_EN BIT(0) 962306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_TSID_EN BIT(1) 1062306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_IP4_L4_CS_DROP BIT(2) 1162306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_IP4_CS_DROP BIT(3) 1262306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_TTL0_DROP BIT(4) 1362306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_PPE_BSWAP BIT(5) 1462306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_PSE_HASH_OFS BIT(6) 1562306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_MCAST_TB_EN BIT(7) 1662306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_FLOW_DROP_KA BIT(8) 1762306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_FLOW_DROP_UPDATE BIT(9) 1862306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_UDP_LITE_EN BIT(10) 1962306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_UDP_LEN_DROP BIT(11) 2062306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_MCAST_ENTRIES GNEMASK(13, 12) 2162306a36Sopenharmony_ci#define MTK_PPE_GLO_CFG_BUSY BIT(31) 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG 0x204 2462306a36Sopenharmony_ci#define MTK_PPE_MD_TOAP_BYP_CRSN0 BIT(1) 2562306a36Sopenharmony_ci#define MTK_PPE_MD_TOAP_BYP_CRSN1 BIT(2) 2662306a36Sopenharmony_ci#define MTK_PPE_MD_TOAP_BYP_CRSN2 BIT(3) 2762306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_IP4_TCP_FRAG BIT(6) 2862306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_IP4_UDP_FRAG BIT(7) 2962306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_IP6_3T_ROUTE BIT(8) 3062306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_IP6_5T_ROUTE BIT(9) 3162306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_IP6_6RD BIT(10) 3262306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_IP4_NAT BIT(12) 3362306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_IP4_NAPT BIT(13) 3462306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_IP4_DSLITE BIT(14) 3562306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_L2_BRIDGE BIT(15) 3662306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_IP_PROTO_BLACKLIST BIT(16) 3762306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_IP4_NAT_FRAG BIT(17) 3862306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_IP4_HASH_FLOW_LABEL BIT(18) 3962306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_IP4_HASH_GRE_KEY BIT(19) 4062306a36Sopenharmony_ci#define MTK_PPE_FLOW_CFG_IP6_HASH_GRE_KEY BIT(20) 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci#define MTK_PPE_IP_PROTO_CHK 0x208 4362306a36Sopenharmony_ci#define MTK_PPE_IP_PROTO_CHK_IPV4 GENMASK(15, 0) 4462306a36Sopenharmony_ci#define MTK_PPE_IP_PROTO_CHK_IPV6 GENMASK(31, 16) 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci#define MTK_PPE_TB_CFG 0x21c 4762306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_ENTRY_NUM GENMASK(2, 0) 4862306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_ENTRY_80B BIT(3) 4962306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_SEARCH_MISS GENMASK(5, 4) 5062306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_AGE_PREBIND BIT(6) 5162306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_AGE_NON_L4 BIT(7) 5262306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_AGE_UNBIND BIT(8) 5362306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_AGE_TCP BIT(9) 5462306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_AGE_UDP BIT(10) 5562306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_AGE_TCP_FIN BIT(11) 5662306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_KEEPALIVE GENMASK(13, 12) 5762306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_HASH_MODE GENMASK(15, 14) 5862306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_SCAN_MODE GENMASK(17, 16) 5962306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_HASH_DEBUG GENMASK(19, 18) 6062306a36Sopenharmony_ci#define MTK_PPE_TB_CFG_INFO_SEL BIT(20) 6162306a36Sopenharmony_ci#define MTK_PPE_TB_TICK_SEL BIT(24) 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci#define MTK_PPE_BIND_LMT1 0x230 6462306a36Sopenharmony_ci#define MTK_PPE_NTU_KEEPALIVE GENMASK(23, 16) 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci#define MTK_PPE_KEEPALIVE 0x234 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_cienum { 6962306a36Sopenharmony_ci MTK_PPE_SCAN_MODE_DISABLED, 7062306a36Sopenharmony_ci MTK_PPE_SCAN_MODE_CHECK_AGE, 7162306a36Sopenharmony_ci MTK_PPE_SCAN_MODE_KEEPALIVE_AGE, 7262306a36Sopenharmony_ci}; 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_cienum { 7562306a36Sopenharmony_ci MTK_PPE_KEEPALIVE_DISABLE, 7662306a36Sopenharmony_ci MTK_PPE_KEEPALIVE_UNICAST_CPU, 7762306a36Sopenharmony_ci MTK_PPE_KEEPALIVE_DUP_CPU = 3, 7862306a36Sopenharmony_ci}; 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_cienum { 8162306a36Sopenharmony_ci MTK_PPE_SEARCH_MISS_ACTION_DROP, 8262306a36Sopenharmony_ci MTK_PPE_SEARCH_MISS_ACTION_FORWARD = 2, 8362306a36Sopenharmony_ci MTK_PPE_SEARCH_MISS_ACTION_FORWARD_BUILD = 3, 8462306a36Sopenharmony_ci}; 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci#define MTK_PPE_TB_BASE 0x220 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci#define MTK_PPE_TB_USED 0x224 8962306a36Sopenharmony_ci#define MTK_PPE_TB_USED_NUM GENMASK(13, 0) 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci#define MTK_PPE_BIND_RATE 0x228 9262306a36Sopenharmony_ci#define MTK_PPE_BIND_RATE_BIND GENMASK(15, 0) 9362306a36Sopenharmony_ci#define MTK_PPE_BIND_RATE_PREBIND GENMASK(31, 16) 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci#define MTK_PPE_BIND_LIMIT0 0x22c 9662306a36Sopenharmony_ci#define MTK_PPE_BIND_LIMIT0_QUARTER GENMASK(13, 0) 9762306a36Sopenharmony_ci#define MTK_PPE_BIND_LIMIT0_HALF GENMASK(29, 16) 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci#define MTK_PPE_BIND_LIMIT1 0x230 10062306a36Sopenharmony_ci#define MTK_PPE_BIND_LIMIT1_FULL GENMASK(13, 0) 10162306a36Sopenharmony_ci#define MTK_PPE_BIND_LIMIT1_NON_L4 GENMASK(23, 16) 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci#define MTK_PPE_KEEPALIVE 0x234 10462306a36Sopenharmony_ci#define MTK_PPE_KEEPALIVE_TIME GENMASK(15, 0) 10562306a36Sopenharmony_ci#define MTK_PPE_KEEPALIVE_TIME_TCP GENMASK(23, 16) 10662306a36Sopenharmony_ci#define MTK_PPE_KEEPALIVE_TIME_UDP GENMASK(31, 24) 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci#define MTK_PPE_UNBIND_AGE 0x238 10962306a36Sopenharmony_ci#define MTK_PPE_UNBIND_AGE_MIN_PACKETS GENMASK(31, 16) 11062306a36Sopenharmony_ci#define MTK_PPE_UNBIND_AGE_DELTA GENMASK(7, 0) 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci#define MTK_PPE_BIND_AGE0 0x23c 11362306a36Sopenharmony_ci#define MTK_PPE_BIND_AGE0_DELTA_NON_L4 GENMASK(30, 16) 11462306a36Sopenharmony_ci#define MTK_PPE_BIND_AGE0_DELTA_UDP GENMASK(14, 0) 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci#define MTK_PPE_BIND_AGE1 0x240 11762306a36Sopenharmony_ci#define MTK_PPE_BIND_AGE1_DELTA_TCP_FIN GENMASK(30, 16) 11862306a36Sopenharmony_ci#define MTK_PPE_BIND_AGE1_DELTA_TCP GENMASK(14, 0) 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci#define MTK_PPE_HASH_SEED 0x244 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci#define MTK_PPE_DEFAULT_CPU_PORT 0x248 12362306a36Sopenharmony_ci#define MTK_PPE_DEFAULT_CPU_PORT_MASK(_n) (GENMASK(2, 0) << ((_n) * 4)) 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci#define MTK_PPE_DEFAULT_CPU_PORT1 0x24c 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci#define MTK_PPE_MTU_DROP 0x308 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci#define MTK_PPE_VLAN_MTU0 0x30c 13062306a36Sopenharmony_ci#define MTK_PPE_VLAN_MTU0_NONE GENMASK(13, 0) 13162306a36Sopenharmony_ci#define MTK_PPE_VLAN_MTU0_1TAG GENMASK(29, 16) 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_ci#define MTK_PPE_VLAN_MTU1 0x310 13462306a36Sopenharmony_ci#define MTK_PPE_VLAN_MTU1_2TAG GENMASK(13, 0) 13562306a36Sopenharmony_ci#define MTK_PPE_VLAN_MTU1_3TAG GENMASK(29, 16) 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ci#define MTK_PPE_VPM_TPID 0x318 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ci#define MTK_PPE_CACHE_CTL 0x320 14062306a36Sopenharmony_ci#define MTK_PPE_CACHE_CTL_EN BIT(0) 14162306a36Sopenharmony_ci#define MTK_PPE_CACHE_CTL_LOCK_CLR BIT(4) 14262306a36Sopenharmony_ci#define MTK_PPE_CACHE_CTL_REQ BIT(8) 14362306a36Sopenharmony_ci#define MTK_PPE_CACHE_CTL_CLEAR BIT(9) 14462306a36Sopenharmony_ci#define MTK_PPE_CACHE_CTL_CMD GENMASK(13, 12) 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci#define MTK_PPE_MIB_CFG 0x334 14762306a36Sopenharmony_ci#define MTK_PPE_MIB_CFG_EN BIT(0) 14862306a36Sopenharmony_ci#define MTK_PPE_MIB_CFG_RD_CLR BIT(1) 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci#define MTK_PPE_MIB_TB_BASE 0x338 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci#define MTK_PPE_MIB_SER_CR 0x33C 15362306a36Sopenharmony_ci#define MTK_PPE_MIB_SER_CR_ST BIT(16) 15462306a36Sopenharmony_ci#define MTK_PPE_MIB_SER_CR_ADDR GENMASK(13, 0) 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci#define MTK_PPE_MIB_SER_R0 0x340 15762306a36Sopenharmony_ci#define MTK_PPE_MIB_SER_R0_BYTE_CNT_LOW GENMASK(31, 0) 15862306a36Sopenharmony_ci 15962306a36Sopenharmony_ci#define MTK_PPE_MIB_SER_R1 0x344 16062306a36Sopenharmony_ci#define MTK_PPE_MIB_SER_R1_PKT_CNT_LOW GENMASK(31, 16) 16162306a36Sopenharmony_ci#define MTK_PPE_MIB_SER_R1_BYTE_CNT_HIGH GENMASK(15, 0) 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_ci#define MTK_PPE_MIB_SER_R2 0x348 16462306a36Sopenharmony_ci#define MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH GENMASK(23, 0) 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci#define MTK_PPE_MIB_SER_R3 0x34c 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci#define MTK_PPE_MIB_CACHE_CTL 0x350 16962306a36Sopenharmony_ci#define MTK_PPE_MIB_CACHE_CTL_EN BIT(0) 17062306a36Sopenharmony_ci#define MTK_PPE_MIB_CACHE_CTL_FLUSH BIT(2) 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci#define MTK_PPE_SBW_CTRL 0x374 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci#endif 175