1ba37b7caSFelix Fietkau // SPDX-License-Identifier: GPL-2.0-only 2ba37b7caSFelix Fietkau /* Copyright (C) 2020 Felix Fietkau <nbd@nbd.name> */ 3ba37b7caSFelix Fietkau 4ba37b7caSFelix Fietkau #ifndef __MTK_PPE_REGS_H 5ba37b7caSFelix Fietkau #define __MTK_PPE_REGS_H 6ba37b7caSFelix Fietkau 7ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG 0x200 8ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_EN BIT(0) 9ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_TSID_EN BIT(1) 10ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_IP4_L4_CS_DROP BIT(2) 11ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_IP4_CS_DROP BIT(3) 12ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_TTL0_DROP BIT(4) 13ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_PPE_BSWAP BIT(5) 14ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_PSE_HASH_OFS BIT(6) 15ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_MCAST_TB_EN BIT(7) 16ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_FLOW_DROP_KA BIT(8) 17ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_FLOW_DROP_UPDATE BIT(9) 18ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_UDP_LITE_EN BIT(10) 19ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_UDP_LEN_DROP BIT(11) 20ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_MCAST_ENTRIES GNEMASK(13, 12) 21ba37b7caSFelix Fietkau #define MTK_PPE_GLO_CFG_BUSY BIT(31) 22ba37b7caSFelix Fietkau 23ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG 0x204 2403a3180eSLorenzo Bianconi #define MTK_PPE_MD_TOAP_BYP_CRSN0 BIT(1) 2503a3180eSLorenzo Bianconi #define MTK_PPE_MD_TOAP_BYP_CRSN1 BIT(2) 2603a3180eSLorenzo Bianconi #define MTK_PPE_MD_TOAP_BYP_CRSN2 BIT(3) 27ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_IP4_TCP_FRAG BIT(6) 28ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_IP4_UDP_FRAG BIT(7) 29ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_IP6_3T_ROUTE BIT(8) 30ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_IP6_5T_ROUTE BIT(9) 31ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_IP6_6RD BIT(10) 32ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_IP4_NAT BIT(12) 33ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_IP4_NAPT BIT(13) 34ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_IP4_DSLITE BIT(14) 35ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_L2_BRIDGE BIT(15) 36ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_IP_PROTO_BLACKLIST BIT(16) 37ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_IP4_NAT_FRAG BIT(17) 38ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_IP4_HASH_FLOW_LABEL BIT(18) 39ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_IP4_HASH_GRE_KEY BIT(19) 40ba37b7caSFelix Fietkau #define MTK_PPE_FLOW_CFG_IP6_HASH_GRE_KEY BIT(20) 41ba37b7caSFelix Fietkau 42ba37b7caSFelix Fietkau #define MTK_PPE_IP_PROTO_CHK 0x208 43ba37b7caSFelix Fietkau #define MTK_PPE_IP_PROTO_CHK_IPV4 GENMASK(15, 0) 44ba37b7caSFelix Fietkau #define MTK_PPE_IP_PROTO_CHK_IPV6 GENMASK(31, 16) 45ba37b7caSFelix Fietkau 46ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG 0x21c 47ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG_ENTRY_NUM GENMASK(2, 0) 48ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG_ENTRY_80B BIT(3) 49ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG_SEARCH_MISS GENMASK(5, 4) 50ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG_AGE_PREBIND BIT(6) 51ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG_AGE_NON_L4 BIT(7) 52ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG_AGE_UNBIND BIT(8) 53ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG_AGE_TCP BIT(9) 54ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG_AGE_UDP BIT(10) 55ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG_AGE_TCP_FIN BIT(11) 56ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG_KEEPALIVE GENMASK(13, 12) 57ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG_HASH_MODE GENMASK(15, 14) 58ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG_SCAN_MODE GENMASK(17, 16) 59ba37b7caSFelix Fietkau #define MTK_PPE_TB_CFG_HASH_DEBUG GENMASK(19, 18) 6003a3180eSLorenzo Bianconi #define MTK_PPE_TB_CFG_INFO_SEL BIT(20) 6106127504SLorenzo Bianconi #define MTK_PPE_TB_TICK_SEL BIT(24) 6206127504SLorenzo Bianconi 6306127504SLorenzo Bianconi #define MTK_PPE_BIND_LMT1 0x230 6406127504SLorenzo Bianconi #define MTK_PPE_NTU_KEEPALIVE GENMASK(23, 16) 6506127504SLorenzo Bianconi 6606127504SLorenzo Bianconi #define MTK_PPE_KEEPALIVE 0x234 67ba37b7caSFelix Fietkau 68ba37b7caSFelix Fietkau enum { 69ba37b7caSFelix Fietkau MTK_PPE_SCAN_MODE_DISABLED, 70ba37b7caSFelix Fietkau MTK_PPE_SCAN_MODE_CHECK_AGE, 71ba37b7caSFelix Fietkau MTK_PPE_SCAN_MODE_KEEPALIVE_AGE, 72ba37b7caSFelix Fietkau }; 73ba37b7caSFelix Fietkau 74ba37b7caSFelix Fietkau enum { 75ba37b7caSFelix Fietkau MTK_PPE_KEEPALIVE_DISABLE, 76ba37b7caSFelix Fietkau MTK_PPE_KEEPALIVE_UNICAST_CPU, 77ba37b7caSFelix Fietkau MTK_PPE_KEEPALIVE_DUP_CPU = 3, 78ba37b7caSFelix Fietkau }; 79ba37b7caSFelix Fietkau 80ba37b7caSFelix Fietkau enum { 81ba37b7caSFelix Fietkau MTK_PPE_SEARCH_MISS_ACTION_DROP, 82ba37b7caSFelix Fietkau MTK_PPE_SEARCH_MISS_ACTION_FORWARD = 2, 83ba37b7caSFelix Fietkau MTK_PPE_SEARCH_MISS_ACTION_FORWARD_BUILD = 3, 84ba37b7caSFelix Fietkau }; 85ba37b7caSFelix Fietkau 86ba37b7caSFelix Fietkau #define MTK_PPE_TB_BASE 0x220 87ba37b7caSFelix Fietkau 88ba37b7caSFelix Fietkau #define MTK_PPE_TB_USED 0x224 89ba37b7caSFelix Fietkau #define MTK_PPE_TB_USED_NUM GENMASK(13, 0) 90ba37b7caSFelix Fietkau 91ba37b7caSFelix Fietkau #define MTK_PPE_BIND_RATE 0x228 92ba37b7caSFelix Fietkau #define MTK_PPE_BIND_RATE_BIND GENMASK(15, 0) 93ba37b7caSFelix Fietkau #define MTK_PPE_BIND_RATE_PREBIND GENMASK(31, 16) 94ba37b7caSFelix Fietkau 95ba37b7caSFelix Fietkau #define MTK_PPE_BIND_LIMIT0 0x22c 96ba37b7caSFelix Fietkau #define MTK_PPE_BIND_LIMIT0_QUARTER GENMASK(13, 0) 97ba37b7caSFelix Fietkau #define MTK_PPE_BIND_LIMIT0_HALF GENMASK(29, 16) 98ba37b7caSFelix Fietkau 99ba37b7caSFelix Fietkau #define MTK_PPE_BIND_LIMIT1 0x230 100ba37b7caSFelix Fietkau #define MTK_PPE_BIND_LIMIT1_FULL GENMASK(13, 0) 101ba37b7caSFelix Fietkau #define MTK_PPE_BIND_LIMIT1_NON_L4 GENMASK(23, 16) 102ba37b7caSFelix Fietkau 103ba37b7caSFelix Fietkau #define MTK_PPE_KEEPALIVE 0x234 104ba37b7caSFelix Fietkau #define MTK_PPE_KEEPALIVE_TIME GENMASK(15, 0) 105ba37b7caSFelix Fietkau #define MTK_PPE_KEEPALIVE_TIME_TCP GENMASK(23, 16) 106ba37b7caSFelix Fietkau #define MTK_PPE_KEEPALIVE_TIME_UDP GENMASK(31, 24) 107ba37b7caSFelix Fietkau 108ba37b7caSFelix Fietkau #define MTK_PPE_UNBIND_AGE 0x238 109ba37b7caSFelix Fietkau #define MTK_PPE_UNBIND_AGE_MIN_PACKETS GENMASK(31, 16) 110ba37b7caSFelix Fietkau #define MTK_PPE_UNBIND_AGE_DELTA GENMASK(7, 0) 111ba37b7caSFelix Fietkau 112ba37b7caSFelix Fietkau #define MTK_PPE_BIND_AGE0 0x23c 113ba37b7caSFelix Fietkau #define MTK_PPE_BIND_AGE0_DELTA_NON_L4 GENMASK(30, 16) 114ba37b7caSFelix Fietkau #define MTK_PPE_BIND_AGE0_DELTA_UDP GENMASK(14, 0) 115ba37b7caSFelix Fietkau 116ba37b7caSFelix Fietkau #define MTK_PPE_BIND_AGE1 0x240 117ba37b7caSFelix Fietkau #define MTK_PPE_BIND_AGE1_DELTA_TCP_FIN GENMASK(30, 16) 118ba37b7caSFelix Fietkau #define MTK_PPE_BIND_AGE1_DELTA_TCP GENMASK(14, 0) 119ba37b7caSFelix Fietkau 120ba37b7caSFelix Fietkau #define MTK_PPE_HASH_SEED 0x244 121ba37b7caSFelix Fietkau 122ba37b7caSFelix Fietkau #define MTK_PPE_DEFAULT_CPU_PORT 0x248 123ba37b7caSFelix Fietkau #define MTK_PPE_DEFAULT_CPU_PORT_MASK(_n) (GENMASK(2, 0) << ((_n) * 4)) 124ba37b7caSFelix Fietkau 12503a3180eSLorenzo Bianconi #define MTK_PPE_DEFAULT_CPU_PORT1 0x24c 12603a3180eSLorenzo Bianconi 127ba37b7caSFelix Fietkau #define MTK_PPE_MTU_DROP 0x308 128ba37b7caSFelix Fietkau 129ba37b7caSFelix Fietkau #define MTK_PPE_VLAN_MTU0 0x30c 130ba37b7caSFelix Fietkau #define MTK_PPE_VLAN_MTU0_NONE GENMASK(13, 0) 131ba37b7caSFelix Fietkau #define MTK_PPE_VLAN_MTU0_1TAG GENMASK(29, 16) 132ba37b7caSFelix Fietkau 133ba37b7caSFelix Fietkau #define MTK_PPE_VLAN_MTU1 0x310 134ba37b7caSFelix Fietkau #define MTK_PPE_VLAN_MTU1_2TAG GENMASK(13, 0) 135ba37b7caSFelix Fietkau #define MTK_PPE_VLAN_MTU1_3TAG GENMASK(29, 16) 136ba37b7caSFelix Fietkau 137ba37b7caSFelix Fietkau #define MTK_PPE_VPM_TPID 0x318 138ba37b7caSFelix Fietkau 139ba37b7caSFelix Fietkau #define MTK_PPE_CACHE_CTL 0x320 140ba37b7caSFelix Fietkau #define MTK_PPE_CACHE_CTL_EN BIT(0) 141ba37b7caSFelix Fietkau #define MTK_PPE_CACHE_CTL_LOCK_CLR BIT(4) 142ba37b7caSFelix Fietkau #define MTK_PPE_CACHE_CTL_REQ BIT(8) 143ba37b7caSFelix Fietkau #define MTK_PPE_CACHE_CTL_CLEAR BIT(9) 144ba37b7caSFelix Fietkau #define MTK_PPE_CACHE_CTL_CMD GENMASK(13, 12) 145ba37b7caSFelix Fietkau 146ba37b7caSFelix Fietkau #define MTK_PPE_MIB_CFG 0x334 147ba37b7caSFelix Fietkau #define MTK_PPE_MIB_CFG_EN BIT(0) 148ba37b7caSFelix Fietkau #define MTK_PPE_MIB_CFG_RD_CLR BIT(1) 149ba37b7caSFelix Fietkau 150ba37b7caSFelix Fietkau #define MTK_PPE_MIB_TB_BASE 0x338 151ba37b7caSFelix Fietkau 152*3fbe4d8cSDaniel Golle #define MTK_PPE_MIB_SER_CR 0x33C 153*3fbe4d8cSDaniel Golle #define MTK_PPE_MIB_SER_CR_ST BIT(16) 154*3fbe4d8cSDaniel Golle #define MTK_PPE_MIB_SER_CR_ADDR GENMASK(13, 0) 155*3fbe4d8cSDaniel Golle 156*3fbe4d8cSDaniel Golle #define MTK_PPE_MIB_SER_R0 0x340 157*3fbe4d8cSDaniel Golle #define MTK_PPE_MIB_SER_R0_BYTE_CNT_LOW GENMASK(31, 0) 158*3fbe4d8cSDaniel Golle 159*3fbe4d8cSDaniel Golle #define MTK_PPE_MIB_SER_R1 0x344 160*3fbe4d8cSDaniel Golle #define MTK_PPE_MIB_SER_R1_PKT_CNT_LOW GENMASK(31, 16) 161*3fbe4d8cSDaniel Golle #define MTK_PPE_MIB_SER_R1_BYTE_CNT_HIGH GENMASK(15, 0) 162*3fbe4d8cSDaniel Golle 163*3fbe4d8cSDaniel Golle #define MTK_PPE_MIB_SER_R2 0x348 164*3fbe4d8cSDaniel Golle #define MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH GENMASK(23, 0) 165*3fbe4d8cSDaniel Golle 166ba37b7caSFelix Fietkau #define MTK_PPE_MIB_CACHE_CTL 0x350 167ba37b7caSFelix Fietkau #define MTK_PPE_MIB_CACHE_CTL_EN BIT(0) 168ba37b7caSFelix Fietkau #define MTK_PPE_MIB_CACHE_CTL_FLUSH BIT(2) 169ba37b7caSFelix Fietkau 17003a3180eSLorenzo Bianconi #define MTK_PPE_SBW_CTRL 0x374 17103a3180eSLorenzo Bianconi 172ba37b7caSFelix Fietkau #endif 173