162306a36Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ 262306a36Sopenharmony_ci/* Copyright (c) 2017 Microsemi Corporation 362306a36Sopenharmony_ci */ 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#ifndef _SOC_MSCC_OCELOT_H 662306a36Sopenharmony_ci#define _SOC_MSCC_OCELOT_H 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#include <linux/ptp_clock_kernel.h> 962306a36Sopenharmony_ci#include <linux/net_tstamp.h> 1062306a36Sopenharmony_ci#include <linux/if_vlan.h> 1162306a36Sopenharmony_ci#include <linux/regmap.h> 1262306a36Sopenharmony_ci#include <net/dsa.h> 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_cistruct tc_mqprio_qopt_offload; 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci/* Port Group IDs (PGID) are masks of destination ports. 1762306a36Sopenharmony_ci * 1862306a36Sopenharmony_ci * For L2 forwarding, the switch performs 3 lookups in the PGID table for each 1962306a36Sopenharmony_ci * frame, and forwards the frame to the ports that are present in the logical 2062306a36Sopenharmony_ci * AND of all 3 PGIDs. 2162306a36Sopenharmony_ci * 2262306a36Sopenharmony_ci * These PGID lookups are: 2362306a36Sopenharmony_ci * - In one of PGID[0-63]: for the destination masks. There are 2 paths by 2462306a36Sopenharmony_ci * which the switch selects a destination PGID: 2562306a36Sopenharmony_ci * - The {DMAC, VID} is present in the MAC table. In that case, the 2662306a36Sopenharmony_ci * destination PGID is given by the DEST_IDX field of the MAC table entry 2762306a36Sopenharmony_ci * that matched. 2862306a36Sopenharmony_ci * - The {DMAC, VID} is not present in the MAC table (it is unknown). The 2962306a36Sopenharmony_ci * frame is disseminated as being either unicast, multicast or broadcast, 3062306a36Sopenharmony_ci * and according to that, the destination PGID is chosen as being the 3162306a36Sopenharmony_ci * value contained by ANA_FLOODING_FLD_UNICAST, 3262306a36Sopenharmony_ci * ANA_FLOODING_FLD_MULTICAST or ANA_FLOODING_FLD_BROADCAST. 3362306a36Sopenharmony_ci * The destination PGID can be an unicast set: the first PGIDs, 0 to 3462306a36Sopenharmony_ci * ocelot->num_phys_ports - 1, or a multicast set: the PGIDs from 3562306a36Sopenharmony_ci * ocelot->num_phys_ports to 63. By convention, a unicast PGID corresponds to 3662306a36Sopenharmony_ci * a physical port and has a single bit set in the destination ports mask: 3762306a36Sopenharmony_ci * that corresponding to the port number itself. In contrast, a multicast 3862306a36Sopenharmony_ci * PGID will have potentially more than one single bit set in the destination 3962306a36Sopenharmony_ci * ports mask. 4062306a36Sopenharmony_ci * - In one of PGID[64-79]: for the aggregation mask. The switch classifier 4162306a36Sopenharmony_ci * dissects each frame and generates a 4-bit Link Aggregation Code which is 4262306a36Sopenharmony_ci * used for this second PGID table lookup. The goal of link aggregation is to 4362306a36Sopenharmony_ci * hash multiple flows within the same LAG on to different destination ports. 4462306a36Sopenharmony_ci * The first lookup will result in a PGID with all the LAG members present in 4562306a36Sopenharmony_ci * the destination ports mask, and the second lookup, by Link Aggregation 4662306a36Sopenharmony_ci * Code, will ensure that each flow gets forwarded only to a single port out 4762306a36Sopenharmony_ci * of that mask (there are no duplicates). 4862306a36Sopenharmony_ci * - In one of PGID[80-90]: for the source mask. The third time, the PGID table 4962306a36Sopenharmony_ci * is indexed with the ingress port (plus 80). These PGIDs answer the 5062306a36Sopenharmony_ci * question "is port i allowed to forward traffic to port j?" If yes, then 5162306a36Sopenharmony_ci * BIT(j) of PGID 80+i will be found set. The third PGID lookup can be used 5262306a36Sopenharmony_ci * to enforce the L2 forwarding matrix imposed by e.g. a Linux bridge. 5362306a36Sopenharmony_ci */ 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci/* Reserve some destination PGIDs at the end of the range: 5662306a36Sopenharmony_ci * PGID_BLACKHOLE: used for not forwarding the frames 5762306a36Sopenharmony_ci * PGID_CPU: used for whitelisting certain MAC addresses, such as the addresses 5862306a36Sopenharmony_ci * of the switch port net devices, towards the CPU port module. 5962306a36Sopenharmony_ci * PGID_UC: the flooding destinations for unknown unicast traffic. 6062306a36Sopenharmony_ci * PGID_MC: the flooding destinations for non-IP multicast traffic. 6162306a36Sopenharmony_ci * PGID_MCIPV4: the flooding destinations for IPv4 multicast traffic. 6262306a36Sopenharmony_ci * PGID_MCIPV6: the flooding destinations for IPv6 multicast traffic. 6362306a36Sopenharmony_ci * PGID_BC: the flooding destinations for broadcast traffic. 6462306a36Sopenharmony_ci */ 6562306a36Sopenharmony_ci#define PGID_BLACKHOLE 57 6662306a36Sopenharmony_ci#define PGID_CPU 58 6762306a36Sopenharmony_ci#define PGID_UC 59 6862306a36Sopenharmony_ci#define PGID_MC 60 6962306a36Sopenharmony_ci#define PGID_MCIPV4 61 7062306a36Sopenharmony_ci#define PGID_MCIPV6 62 7162306a36Sopenharmony_ci#define PGID_BC 63 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci#define for_each_unicast_dest_pgid(ocelot, pgid) \ 7462306a36Sopenharmony_ci for ((pgid) = 0; \ 7562306a36Sopenharmony_ci (pgid) < (ocelot)->num_phys_ports; \ 7662306a36Sopenharmony_ci (pgid)++) 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci#define for_each_nonreserved_multicast_dest_pgid(ocelot, pgid) \ 7962306a36Sopenharmony_ci for ((pgid) = (ocelot)->num_phys_ports + 1; \ 8062306a36Sopenharmony_ci (pgid) < PGID_BLACKHOLE; \ 8162306a36Sopenharmony_ci (pgid)++) 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci#define for_each_aggr_pgid(ocelot, pgid) \ 8462306a36Sopenharmony_ci for ((pgid) = PGID_AGGR; \ 8562306a36Sopenharmony_ci (pgid) < PGID_SRC; \ 8662306a36Sopenharmony_ci (pgid)++) 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci/* Aggregation PGIDs, one per Link Aggregation Code */ 8962306a36Sopenharmony_ci#define PGID_AGGR 64 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci/* Source PGIDs, one per physical port */ 9262306a36Sopenharmony_ci#define PGID_SRC 80 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ci#define OCELOT_NUM_TC 8 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci#define OCELOT_SPEED_2500 0 9762306a36Sopenharmony_ci#define OCELOT_SPEED_1000 1 9862306a36Sopenharmony_ci#define OCELOT_SPEED_100 2 9962306a36Sopenharmony_ci#define OCELOT_SPEED_10 3 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci#define OCELOT_PTP_PINS_NUM 4 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci#define TARGET_OFFSET 24 10462306a36Sopenharmony_ci#define REG_MASK GENMASK(TARGET_OFFSET - 1, 0) 10562306a36Sopenharmony_ci#define REG(reg, offset) [reg & REG_MASK] = offset 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ci#define REG_RESERVED_ADDR 0xffffffff 10862306a36Sopenharmony_ci#define REG_RESERVED(reg) REG(reg, REG_RESERVED_ADDR) 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_cienum ocelot_target { 11162306a36Sopenharmony_ci ANA = 1, 11262306a36Sopenharmony_ci QS, 11362306a36Sopenharmony_ci QSYS, 11462306a36Sopenharmony_ci REW, 11562306a36Sopenharmony_ci SYS, 11662306a36Sopenharmony_ci S0, 11762306a36Sopenharmony_ci S1, 11862306a36Sopenharmony_ci S2, 11962306a36Sopenharmony_ci HSIO, 12062306a36Sopenharmony_ci PTP, 12162306a36Sopenharmony_ci FDMA, 12262306a36Sopenharmony_ci GCB, 12362306a36Sopenharmony_ci DEV_GMII, 12462306a36Sopenharmony_ci TARGET_MAX, 12562306a36Sopenharmony_ci}; 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_cienum ocelot_reg { 12862306a36Sopenharmony_ci ANA_ADVLEARN = ANA << TARGET_OFFSET, 12962306a36Sopenharmony_ci ANA_VLANMASK, 13062306a36Sopenharmony_ci ANA_PORT_B_DOMAIN, 13162306a36Sopenharmony_ci ANA_ANAGEFIL, 13262306a36Sopenharmony_ci ANA_ANEVENTS, 13362306a36Sopenharmony_ci ANA_STORMLIMIT_BURST, 13462306a36Sopenharmony_ci ANA_STORMLIMIT_CFG, 13562306a36Sopenharmony_ci ANA_ISOLATED_PORTS, 13662306a36Sopenharmony_ci ANA_COMMUNITY_PORTS, 13762306a36Sopenharmony_ci ANA_AUTOAGE, 13862306a36Sopenharmony_ci ANA_MACTOPTIONS, 13962306a36Sopenharmony_ci ANA_LEARNDISC, 14062306a36Sopenharmony_ci ANA_AGENCTRL, 14162306a36Sopenharmony_ci ANA_MIRRORPORTS, 14262306a36Sopenharmony_ci ANA_EMIRRORPORTS, 14362306a36Sopenharmony_ci ANA_FLOODING, 14462306a36Sopenharmony_ci ANA_FLOODING_IPMC, 14562306a36Sopenharmony_ci ANA_SFLOW_CFG, 14662306a36Sopenharmony_ci ANA_PORT_MODE, 14762306a36Sopenharmony_ci ANA_CUT_THRU_CFG, 14862306a36Sopenharmony_ci ANA_PGID_PGID, 14962306a36Sopenharmony_ci ANA_TABLES_ANMOVED, 15062306a36Sopenharmony_ci ANA_TABLES_MACHDATA, 15162306a36Sopenharmony_ci ANA_TABLES_MACLDATA, 15262306a36Sopenharmony_ci ANA_TABLES_STREAMDATA, 15362306a36Sopenharmony_ci ANA_TABLES_MACACCESS, 15462306a36Sopenharmony_ci ANA_TABLES_MACTINDX, 15562306a36Sopenharmony_ci ANA_TABLES_VLANACCESS, 15662306a36Sopenharmony_ci ANA_TABLES_VLANTIDX, 15762306a36Sopenharmony_ci ANA_TABLES_ISDXACCESS, 15862306a36Sopenharmony_ci ANA_TABLES_ISDXTIDX, 15962306a36Sopenharmony_ci ANA_TABLES_ENTRYLIM, 16062306a36Sopenharmony_ci ANA_TABLES_PTP_ID_HIGH, 16162306a36Sopenharmony_ci ANA_TABLES_PTP_ID_LOW, 16262306a36Sopenharmony_ci ANA_TABLES_STREAMACCESS, 16362306a36Sopenharmony_ci ANA_TABLES_STREAMTIDX, 16462306a36Sopenharmony_ci ANA_TABLES_SEQ_HISTORY, 16562306a36Sopenharmony_ci ANA_TABLES_SEQ_MASK, 16662306a36Sopenharmony_ci ANA_TABLES_SFID_MASK, 16762306a36Sopenharmony_ci ANA_TABLES_SFIDACCESS, 16862306a36Sopenharmony_ci ANA_TABLES_SFIDTIDX, 16962306a36Sopenharmony_ci ANA_MSTI_STATE, 17062306a36Sopenharmony_ci ANA_OAM_UPM_LM_CNT, 17162306a36Sopenharmony_ci ANA_SG_ACCESS_CTRL, 17262306a36Sopenharmony_ci ANA_SG_CONFIG_REG_1, 17362306a36Sopenharmony_ci ANA_SG_CONFIG_REG_2, 17462306a36Sopenharmony_ci ANA_SG_CONFIG_REG_3, 17562306a36Sopenharmony_ci ANA_SG_CONFIG_REG_4, 17662306a36Sopenharmony_ci ANA_SG_CONFIG_REG_5, 17762306a36Sopenharmony_ci ANA_SG_GCL_GS_CONFIG, 17862306a36Sopenharmony_ci ANA_SG_GCL_TI_CONFIG, 17962306a36Sopenharmony_ci ANA_SG_STATUS_REG_1, 18062306a36Sopenharmony_ci ANA_SG_STATUS_REG_2, 18162306a36Sopenharmony_ci ANA_SG_STATUS_REG_3, 18262306a36Sopenharmony_ci ANA_PORT_VLAN_CFG, 18362306a36Sopenharmony_ci ANA_PORT_DROP_CFG, 18462306a36Sopenharmony_ci ANA_PORT_QOS_CFG, 18562306a36Sopenharmony_ci ANA_PORT_VCAP_CFG, 18662306a36Sopenharmony_ci ANA_PORT_VCAP_S1_KEY_CFG, 18762306a36Sopenharmony_ci ANA_PORT_VCAP_S2_CFG, 18862306a36Sopenharmony_ci ANA_PORT_PCP_DEI_MAP, 18962306a36Sopenharmony_ci ANA_PORT_CPU_FWD_CFG, 19062306a36Sopenharmony_ci ANA_PORT_CPU_FWD_BPDU_CFG, 19162306a36Sopenharmony_ci ANA_PORT_CPU_FWD_GARP_CFG, 19262306a36Sopenharmony_ci ANA_PORT_CPU_FWD_CCM_CFG, 19362306a36Sopenharmony_ci ANA_PORT_PORT_CFG, 19462306a36Sopenharmony_ci ANA_PORT_POL_CFG, 19562306a36Sopenharmony_ci ANA_PORT_PTP_CFG, 19662306a36Sopenharmony_ci ANA_PORT_PTP_DLY1_CFG, 19762306a36Sopenharmony_ci ANA_PORT_PTP_DLY2_CFG, 19862306a36Sopenharmony_ci ANA_PORT_SFID_CFG, 19962306a36Sopenharmony_ci ANA_PFC_PFC_CFG, 20062306a36Sopenharmony_ci ANA_PFC_PFC_TIMER, 20162306a36Sopenharmony_ci ANA_IPT_OAM_MEP_CFG, 20262306a36Sopenharmony_ci ANA_IPT_IPT, 20362306a36Sopenharmony_ci ANA_PPT_PPT, 20462306a36Sopenharmony_ci ANA_FID_MAP_FID_MAP, 20562306a36Sopenharmony_ci ANA_AGGR_CFG, 20662306a36Sopenharmony_ci ANA_CPUQ_CFG, 20762306a36Sopenharmony_ci ANA_CPUQ_CFG2, 20862306a36Sopenharmony_ci ANA_CPUQ_8021_CFG, 20962306a36Sopenharmony_ci ANA_DSCP_CFG, 21062306a36Sopenharmony_ci ANA_DSCP_REWR_CFG, 21162306a36Sopenharmony_ci ANA_VCAP_RNG_TYPE_CFG, 21262306a36Sopenharmony_ci ANA_VCAP_RNG_VAL_CFG, 21362306a36Sopenharmony_ci ANA_VRAP_CFG, 21462306a36Sopenharmony_ci ANA_VRAP_HDR_DATA, 21562306a36Sopenharmony_ci ANA_VRAP_HDR_MASK, 21662306a36Sopenharmony_ci ANA_DISCARD_CFG, 21762306a36Sopenharmony_ci ANA_FID_CFG, 21862306a36Sopenharmony_ci ANA_POL_PIR_CFG, 21962306a36Sopenharmony_ci ANA_POL_CIR_CFG, 22062306a36Sopenharmony_ci ANA_POL_MODE_CFG, 22162306a36Sopenharmony_ci ANA_POL_PIR_STATE, 22262306a36Sopenharmony_ci ANA_POL_CIR_STATE, 22362306a36Sopenharmony_ci ANA_POL_STATE, 22462306a36Sopenharmony_ci ANA_POL_FLOWC, 22562306a36Sopenharmony_ci ANA_POL_HYST, 22662306a36Sopenharmony_ci ANA_POL_MISC_CFG, 22762306a36Sopenharmony_ci QS_XTR_GRP_CFG = QS << TARGET_OFFSET, 22862306a36Sopenharmony_ci QS_XTR_RD, 22962306a36Sopenharmony_ci QS_XTR_FRM_PRUNING, 23062306a36Sopenharmony_ci QS_XTR_FLUSH, 23162306a36Sopenharmony_ci QS_XTR_DATA_PRESENT, 23262306a36Sopenharmony_ci QS_XTR_CFG, 23362306a36Sopenharmony_ci QS_INJ_GRP_CFG, 23462306a36Sopenharmony_ci QS_INJ_WR, 23562306a36Sopenharmony_ci QS_INJ_CTRL, 23662306a36Sopenharmony_ci QS_INJ_STATUS, 23762306a36Sopenharmony_ci QS_INJ_ERR, 23862306a36Sopenharmony_ci QS_INH_DBG, 23962306a36Sopenharmony_ci QSYS_PORT_MODE = QSYS << TARGET_OFFSET, 24062306a36Sopenharmony_ci QSYS_SWITCH_PORT_MODE, 24162306a36Sopenharmony_ci QSYS_STAT_CNT_CFG, 24262306a36Sopenharmony_ci QSYS_EEE_CFG, 24362306a36Sopenharmony_ci QSYS_EEE_THRES, 24462306a36Sopenharmony_ci QSYS_IGR_NO_SHARING, 24562306a36Sopenharmony_ci QSYS_EGR_NO_SHARING, 24662306a36Sopenharmony_ci QSYS_SW_STATUS, 24762306a36Sopenharmony_ci QSYS_EXT_CPU_CFG, 24862306a36Sopenharmony_ci QSYS_PAD_CFG, 24962306a36Sopenharmony_ci QSYS_CPU_GROUP_MAP, 25062306a36Sopenharmony_ci QSYS_QMAP, 25162306a36Sopenharmony_ci QSYS_ISDX_SGRP, 25262306a36Sopenharmony_ci QSYS_TIMED_FRAME_ENTRY, 25362306a36Sopenharmony_ci QSYS_TFRM_MISC, 25462306a36Sopenharmony_ci QSYS_TFRM_PORT_DLY, 25562306a36Sopenharmony_ci QSYS_TFRM_TIMER_CFG_1, 25662306a36Sopenharmony_ci QSYS_TFRM_TIMER_CFG_2, 25762306a36Sopenharmony_ci QSYS_TFRM_TIMER_CFG_3, 25862306a36Sopenharmony_ci QSYS_TFRM_TIMER_CFG_4, 25962306a36Sopenharmony_ci QSYS_TFRM_TIMER_CFG_5, 26062306a36Sopenharmony_ci QSYS_TFRM_TIMER_CFG_6, 26162306a36Sopenharmony_ci QSYS_TFRM_TIMER_CFG_7, 26262306a36Sopenharmony_ci QSYS_TFRM_TIMER_CFG_8, 26362306a36Sopenharmony_ci QSYS_RED_PROFILE, 26462306a36Sopenharmony_ci QSYS_RES_QOS_MODE, 26562306a36Sopenharmony_ci QSYS_RES_CFG, 26662306a36Sopenharmony_ci QSYS_RES_STAT, 26762306a36Sopenharmony_ci QSYS_EGR_DROP_MODE, 26862306a36Sopenharmony_ci QSYS_EQ_CTRL, 26962306a36Sopenharmony_ci QSYS_EVENTS_CORE, 27062306a36Sopenharmony_ci QSYS_QMAXSDU_CFG_0, 27162306a36Sopenharmony_ci QSYS_QMAXSDU_CFG_1, 27262306a36Sopenharmony_ci QSYS_QMAXSDU_CFG_2, 27362306a36Sopenharmony_ci QSYS_QMAXSDU_CFG_3, 27462306a36Sopenharmony_ci QSYS_QMAXSDU_CFG_4, 27562306a36Sopenharmony_ci QSYS_QMAXSDU_CFG_5, 27662306a36Sopenharmony_ci QSYS_QMAXSDU_CFG_6, 27762306a36Sopenharmony_ci QSYS_QMAXSDU_CFG_7, 27862306a36Sopenharmony_ci QSYS_PREEMPTION_CFG, 27962306a36Sopenharmony_ci QSYS_CIR_CFG, 28062306a36Sopenharmony_ci QSYS_EIR_CFG, 28162306a36Sopenharmony_ci QSYS_SE_CFG, 28262306a36Sopenharmony_ci QSYS_SE_DWRR_CFG, 28362306a36Sopenharmony_ci QSYS_SE_CONNECT, 28462306a36Sopenharmony_ci QSYS_SE_DLB_SENSE, 28562306a36Sopenharmony_ci QSYS_CIR_STATE, 28662306a36Sopenharmony_ci QSYS_EIR_STATE, 28762306a36Sopenharmony_ci QSYS_SE_STATE, 28862306a36Sopenharmony_ci QSYS_HSCH_MISC_CFG, 28962306a36Sopenharmony_ci QSYS_TAG_CONFIG, 29062306a36Sopenharmony_ci QSYS_TAS_PARAM_CFG_CTRL, 29162306a36Sopenharmony_ci QSYS_PORT_MAX_SDU, 29262306a36Sopenharmony_ci QSYS_PARAM_CFG_REG_1, 29362306a36Sopenharmony_ci QSYS_PARAM_CFG_REG_2, 29462306a36Sopenharmony_ci QSYS_PARAM_CFG_REG_3, 29562306a36Sopenharmony_ci QSYS_PARAM_CFG_REG_4, 29662306a36Sopenharmony_ci QSYS_PARAM_CFG_REG_5, 29762306a36Sopenharmony_ci QSYS_GCL_CFG_REG_1, 29862306a36Sopenharmony_ci QSYS_GCL_CFG_REG_2, 29962306a36Sopenharmony_ci QSYS_PARAM_STATUS_REG_1, 30062306a36Sopenharmony_ci QSYS_PARAM_STATUS_REG_2, 30162306a36Sopenharmony_ci QSYS_PARAM_STATUS_REG_3, 30262306a36Sopenharmony_ci QSYS_PARAM_STATUS_REG_4, 30362306a36Sopenharmony_ci QSYS_PARAM_STATUS_REG_5, 30462306a36Sopenharmony_ci QSYS_PARAM_STATUS_REG_6, 30562306a36Sopenharmony_ci QSYS_PARAM_STATUS_REG_7, 30662306a36Sopenharmony_ci QSYS_PARAM_STATUS_REG_8, 30762306a36Sopenharmony_ci QSYS_PARAM_STATUS_REG_9, 30862306a36Sopenharmony_ci QSYS_GCL_STATUS_REG_1, 30962306a36Sopenharmony_ci QSYS_GCL_STATUS_REG_2, 31062306a36Sopenharmony_ci REW_PORT_VLAN_CFG = REW << TARGET_OFFSET, 31162306a36Sopenharmony_ci REW_TAG_CFG, 31262306a36Sopenharmony_ci REW_PORT_CFG, 31362306a36Sopenharmony_ci REW_DSCP_CFG, 31462306a36Sopenharmony_ci REW_PCP_DEI_QOS_MAP_CFG, 31562306a36Sopenharmony_ci REW_PTP_CFG, 31662306a36Sopenharmony_ci REW_PTP_DLY1_CFG, 31762306a36Sopenharmony_ci REW_RED_TAG_CFG, 31862306a36Sopenharmony_ci REW_DSCP_REMAP_DP1_CFG, 31962306a36Sopenharmony_ci REW_DSCP_REMAP_CFG, 32062306a36Sopenharmony_ci REW_STAT_CFG, 32162306a36Sopenharmony_ci REW_REW_STICKY, 32262306a36Sopenharmony_ci REW_PPT, 32362306a36Sopenharmony_ci SYS_COUNT_RX_OCTETS = SYS << TARGET_OFFSET, 32462306a36Sopenharmony_ci SYS_COUNT_RX_UNICAST, 32562306a36Sopenharmony_ci SYS_COUNT_RX_MULTICAST, 32662306a36Sopenharmony_ci SYS_COUNT_RX_BROADCAST, 32762306a36Sopenharmony_ci SYS_COUNT_RX_SHORTS, 32862306a36Sopenharmony_ci SYS_COUNT_RX_FRAGMENTS, 32962306a36Sopenharmony_ci SYS_COUNT_RX_JABBERS, 33062306a36Sopenharmony_ci SYS_COUNT_RX_CRC_ALIGN_ERRS, 33162306a36Sopenharmony_ci SYS_COUNT_RX_SYM_ERRS, 33262306a36Sopenharmony_ci SYS_COUNT_RX_64, 33362306a36Sopenharmony_ci SYS_COUNT_RX_65_127, 33462306a36Sopenharmony_ci SYS_COUNT_RX_128_255, 33562306a36Sopenharmony_ci SYS_COUNT_RX_256_511, 33662306a36Sopenharmony_ci SYS_COUNT_RX_512_1023, 33762306a36Sopenharmony_ci SYS_COUNT_RX_1024_1526, 33862306a36Sopenharmony_ci SYS_COUNT_RX_1527_MAX, 33962306a36Sopenharmony_ci SYS_COUNT_RX_PAUSE, 34062306a36Sopenharmony_ci SYS_COUNT_RX_CONTROL, 34162306a36Sopenharmony_ci SYS_COUNT_RX_LONGS, 34262306a36Sopenharmony_ci SYS_COUNT_RX_CLASSIFIED_DROPS, 34362306a36Sopenharmony_ci SYS_COUNT_RX_RED_PRIO_0, 34462306a36Sopenharmony_ci SYS_COUNT_RX_RED_PRIO_1, 34562306a36Sopenharmony_ci SYS_COUNT_RX_RED_PRIO_2, 34662306a36Sopenharmony_ci SYS_COUNT_RX_RED_PRIO_3, 34762306a36Sopenharmony_ci SYS_COUNT_RX_RED_PRIO_4, 34862306a36Sopenharmony_ci SYS_COUNT_RX_RED_PRIO_5, 34962306a36Sopenharmony_ci SYS_COUNT_RX_RED_PRIO_6, 35062306a36Sopenharmony_ci SYS_COUNT_RX_RED_PRIO_7, 35162306a36Sopenharmony_ci SYS_COUNT_RX_YELLOW_PRIO_0, 35262306a36Sopenharmony_ci SYS_COUNT_RX_YELLOW_PRIO_1, 35362306a36Sopenharmony_ci SYS_COUNT_RX_YELLOW_PRIO_2, 35462306a36Sopenharmony_ci SYS_COUNT_RX_YELLOW_PRIO_3, 35562306a36Sopenharmony_ci SYS_COUNT_RX_YELLOW_PRIO_4, 35662306a36Sopenharmony_ci SYS_COUNT_RX_YELLOW_PRIO_5, 35762306a36Sopenharmony_ci SYS_COUNT_RX_YELLOW_PRIO_6, 35862306a36Sopenharmony_ci SYS_COUNT_RX_YELLOW_PRIO_7, 35962306a36Sopenharmony_ci SYS_COUNT_RX_GREEN_PRIO_0, 36062306a36Sopenharmony_ci SYS_COUNT_RX_GREEN_PRIO_1, 36162306a36Sopenharmony_ci SYS_COUNT_RX_GREEN_PRIO_2, 36262306a36Sopenharmony_ci SYS_COUNT_RX_GREEN_PRIO_3, 36362306a36Sopenharmony_ci SYS_COUNT_RX_GREEN_PRIO_4, 36462306a36Sopenharmony_ci SYS_COUNT_RX_GREEN_PRIO_5, 36562306a36Sopenharmony_ci SYS_COUNT_RX_GREEN_PRIO_6, 36662306a36Sopenharmony_ci SYS_COUNT_RX_GREEN_PRIO_7, 36762306a36Sopenharmony_ci SYS_COUNT_RX_ASSEMBLY_ERRS, 36862306a36Sopenharmony_ci SYS_COUNT_RX_SMD_ERRS, 36962306a36Sopenharmony_ci SYS_COUNT_RX_ASSEMBLY_OK, 37062306a36Sopenharmony_ci SYS_COUNT_RX_MERGE_FRAGMENTS, 37162306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_OCTETS, 37262306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_UNICAST, 37362306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_MULTICAST, 37462306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_BROADCAST, 37562306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_SHORTS, 37662306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_FRAGMENTS, 37762306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_JABBERS, 37862306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_CRC_ALIGN_ERRS, 37962306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_SYM_ERRS, 38062306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_64, 38162306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_65_127, 38262306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_128_255, 38362306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_256_511, 38462306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_512_1023, 38562306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_1024_1526, 38662306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_1527_MAX, 38762306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_PAUSE, 38862306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_CONTROL, 38962306a36Sopenharmony_ci SYS_COUNT_RX_PMAC_LONGS, 39062306a36Sopenharmony_ci SYS_COUNT_TX_OCTETS, 39162306a36Sopenharmony_ci SYS_COUNT_TX_UNICAST, 39262306a36Sopenharmony_ci SYS_COUNT_TX_MULTICAST, 39362306a36Sopenharmony_ci SYS_COUNT_TX_BROADCAST, 39462306a36Sopenharmony_ci SYS_COUNT_TX_COLLISION, 39562306a36Sopenharmony_ci SYS_COUNT_TX_DROPS, 39662306a36Sopenharmony_ci SYS_COUNT_TX_PAUSE, 39762306a36Sopenharmony_ci SYS_COUNT_TX_64, 39862306a36Sopenharmony_ci SYS_COUNT_TX_65_127, 39962306a36Sopenharmony_ci SYS_COUNT_TX_128_255, 40062306a36Sopenharmony_ci SYS_COUNT_TX_256_511, 40162306a36Sopenharmony_ci SYS_COUNT_TX_512_1023, 40262306a36Sopenharmony_ci SYS_COUNT_TX_1024_1526, 40362306a36Sopenharmony_ci SYS_COUNT_TX_1527_MAX, 40462306a36Sopenharmony_ci SYS_COUNT_TX_YELLOW_PRIO_0, 40562306a36Sopenharmony_ci SYS_COUNT_TX_YELLOW_PRIO_1, 40662306a36Sopenharmony_ci SYS_COUNT_TX_YELLOW_PRIO_2, 40762306a36Sopenharmony_ci SYS_COUNT_TX_YELLOW_PRIO_3, 40862306a36Sopenharmony_ci SYS_COUNT_TX_YELLOW_PRIO_4, 40962306a36Sopenharmony_ci SYS_COUNT_TX_YELLOW_PRIO_5, 41062306a36Sopenharmony_ci SYS_COUNT_TX_YELLOW_PRIO_6, 41162306a36Sopenharmony_ci SYS_COUNT_TX_YELLOW_PRIO_7, 41262306a36Sopenharmony_ci SYS_COUNT_TX_GREEN_PRIO_0, 41362306a36Sopenharmony_ci SYS_COUNT_TX_GREEN_PRIO_1, 41462306a36Sopenharmony_ci SYS_COUNT_TX_GREEN_PRIO_2, 41562306a36Sopenharmony_ci SYS_COUNT_TX_GREEN_PRIO_3, 41662306a36Sopenharmony_ci SYS_COUNT_TX_GREEN_PRIO_4, 41762306a36Sopenharmony_ci SYS_COUNT_TX_GREEN_PRIO_5, 41862306a36Sopenharmony_ci SYS_COUNT_TX_GREEN_PRIO_6, 41962306a36Sopenharmony_ci SYS_COUNT_TX_GREEN_PRIO_7, 42062306a36Sopenharmony_ci SYS_COUNT_TX_AGED, 42162306a36Sopenharmony_ci SYS_COUNT_TX_MM_HOLD, 42262306a36Sopenharmony_ci SYS_COUNT_TX_MERGE_FRAGMENTS, 42362306a36Sopenharmony_ci SYS_COUNT_TX_PMAC_OCTETS, 42462306a36Sopenharmony_ci SYS_COUNT_TX_PMAC_UNICAST, 42562306a36Sopenharmony_ci SYS_COUNT_TX_PMAC_MULTICAST, 42662306a36Sopenharmony_ci SYS_COUNT_TX_PMAC_BROADCAST, 42762306a36Sopenharmony_ci SYS_COUNT_TX_PMAC_PAUSE, 42862306a36Sopenharmony_ci SYS_COUNT_TX_PMAC_64, 42962306a36Sopenharmony_ci SYS_COUNT_TX_PMAC_65_127, 43062306a36Sopenharmony_ci SYS_COUNT_TX_PMAC_128_255, 43162306a36Sopenharmony_ci SYS_COUNT_TX_PMAC_256_511, 43262306a36Sopenharmony_ci SYS_COUNT_TX_PMAC_512_1023, 43362306a36Sopenharmony_ci SYS_COUNT_TX_PMAC_1024_1526, 43462306a36Sopenharmony_ci SYS_COUNT_TX_PMAC_1527_MAX, 43562306a36Sopenharmony_ci SYS_COUNT_DROP_LOCAL, 43662306a36Sopenharmony_ci SYS_COUNT_DROP_TAIL, 43762306a36Sopenharmony_ci SYS_COUNT_DROP_YELLOW_PRIO_0, 43862306a36Sopenharmony_ci SYS_COUNT_DROP_YELLOW_PRIO_1, 43962306a36Sopenharmony_ci SYS_COUNT_DROP_YELLOW_PRIO_2, 44062306a36Sopenharmony_ci SYS_COUNT_DROP_YELLOW_PRIO_3, 44162306a36Sopenharmony_ci SYS_COUNT_DROP_YELLOW_PRIO_4, 44262306a36Sopenharmony_ci SYS_COUNT_DROP_YELLOW_PRIO_5, 44362306a36Sopenharmony_ci SYS_COUNT_DROP_YELLOW_PRIO_6, 44462306a36Sopenharmony_ci SYS_COUNT_DROP_YELLOW_PRIO_7, 44562306a36Sopenharmony_ci SYS_COUNT_DROP_GREEN_PRIO_0, 44662306a36Sopenharmony_ci SYS_COUNT_DROP_GREEN_PRIO_1, 44762306a36Sopenharmony_ci SYS_COUNT_DROP_GREEN_PRIO_2, 44862306a36Sopenharmony_ci SYS_COUNT_DROP_GREEN_PRIO_3, 44962306a36Sopenharmony_ci SYS_COUNT_DROP_GREEN_PRIO_4, 45062306a36Sopenharmony_ci SYS_COUNT_DROP_GREEN_PRIO_5, 45162306a36Sopenharmony_ci SYS_COUNT_DROP_GREEN_PRIO_6, 45262306a36Sopenharmony_ci SYS_COUNT_DROP_GREEN_PRIO_7, 45362306a36Sopenharmony_ci SYS_COUNT_SF_MATCHING_FRAMES, 45462306a36Sopenharmony_ci SYS_COUNT_SF_NOT_PASSING_FRAMES, 45562306a36Sopenharmony_ci SYS_COUNT_SF_NOT_PASSING_SDU, 45662306a36Sopenharmony_ci SYS_COUNT_SF_RED_FRAMES, 45762306a36Sopenharmony_ci SYS_RESET_CFG, 45862306a36Sopenharmony_ci SYS_SR_ETYPE_CFG, 45962306a36Sopenharmony_ci SYS_VLAN_ETYPE_CFG, 46062306a36Sopenharmony_ci SYS_PORT_MODE, 46162306a36Sopenharmony_ci SYS_FRONT_PORT_MODE, 46262306a36Sopenharmony_ci SYS_FRM_AGING, 46362306a36Sopenharmony_ci SYS_STAT_CFG, 46462306a36Sopenharmony_ci SYS_SW_STATUS, 46562306a36Sopenharmony_ci SYS_MISC_CFG, 46662306a36Sopenharmony_ci SYS_REW_MAC_HIGH_CFG, 46762306a36Sopenharmony_ci SYS_REW_MAC_LOW_CFG, 46862306a36Sopenharmony_ci SYS_TIMESTAMP_OFFSET, 46962306a36Sopenharmony_ci SYS_CMID, 47062306a36Sopenharmony_ci SYS_PAUSE_CFG, 47162306a36Sopenharmony_ci SYS_PAUSE_TOT_CFG, 47262306a36Sopenharmony_ci SYS_ATOP, 47362306a36Sopenharmony_ci SYS_ATOP_TOT_CFG, 47462306a36Sopenharmony_ci SYS_MAC_FC_CFG, 47562306a36Sopenharmony_ci SYS_MMGT, 47662306a36Sopenharmony_ci SYS_MMGT_FAST, 47762306a36Sopenharmony_ci SYS_EVENTS_DIF, 47862306a36Sopenharmony_ci SYS_EVENTS_CORE, 47962306a36Sopenharmony_ci SYS_PTP_STATUS, 48062306a36Sopenharmony_ci SYS_PTP_TXSTAMP, 48162306a36Sopenharmony_ci SYS_PTP_NXT, 48262306a36Sopenharmony_ci SYS_PTP_CFG, 48362306a36Sopenharmony_ci SYS_RAM_INIT, 48462306a36Sopenharmony_ci SYS_CM_ADDR, 48562306a36Sopenharmony_ci SYS_CM_DATA_WR, 48662306a36Sopenharmony_ci SYS_CM_DATA_RD, 48762306a36Sopenharmony_ci SYS_CM_OP, 48862306a36Sopenharmony_ci SYS_CM_DATA, 48962306a36Sopenharmony_ci PTP_PIN_CFG = PTP << TARGET_OFFSET, 49062306a36Sopenharmony_ci PTP_PIN_TOD_SEC_MSB, 49162306a36Sopenharmony_ci PTP_PIN_TOD_SEC_LSB, 49262306a36Sopenharmony_ci PTP_PIN_TOD_NSEC, 49362306a36Sopenharmony_ci PTP_PIN_WF_HIGH_PERIOD, 49462306a36Sopenharmony_ci PTP_PIN_WF_LOW_PERIOD, 49562306a36Sopenharmony_ci PTP_CFG_MISC, 49662306a36Sopenharmony_ci PTP_CLK_CFG_ADJ_CFG, 49762306a36Sopenharmony_ci PTP_CLK_CFG_ADJ_FREQ, 49862306a36Sopenharmony_ci GCB_SOFT_RST = GCB << TARGET_OFFSET, 49962306a36Sopenharmony_ci GCB_MIIM_MII_STATUS, 50062306a36Sopenharmony_ci GCB_MIIM_MII_CMD, 50162306a36Sopenharmony_ci GCB_MIIM_MII_DATA, 50262306a36Sopenharmony_ci DEV_CLOCK_CFG = DEV_GMII << TARGET_OFFSET, 50362306a36Sopenharmony_ci DEV_PORT_MISC, 50462306a36Sopenharmony_ci DEV_EVENTS, 50562306a36Sopenharmony_ci DEV_EEE_CFG, 50662306a36Sopenharmony_ci DEV_RX_PATH_DELAY, 50762306a36Sopenharmony_ci DEV_TX_PATH_DELAY, 50862306a36Sopenharmony_ci DEV_PTP_PREDICT_CFG, 50962306a36Sopenharmony_ci DEV_MAC_ENA_CFG, 51062306a36Sopenharmony_ci DEV_MAC_MODE_CFG, 51162306a36Sopenharmony_ci DEV_MAC_MAXLEN_CFG, 51262306a36Sopenharmony_ci DEV_MAC_TAGS_CFG, 51362306a36Sopenharmony_ci DEV_MAC_ADV_CHK_CFG, 51462306a36Sopenharmony_ci DEV_MAC_IFG_CFG, 51562306a36Sopenharmony_ci DEV_MAC_HDX_CFG, 51662306a36Sopenharmony_ci DEV_MAC_DBG_CFG, 51762306a36Sopenharmony_ci DEV_MAC_FC_MAC_LOW_CFG, 51862306a36Sopenharmony_ci DEV_MAC_FC_MAC_HIGH_CFG, 51962306a36Sopenharmony_ci DEV_MAC_STICKY, 52062306a36Sopenharmony_ci DEV_MM_ENABLE_CONFIG, 52162306a36Sopenharmony_ci DEV_MM_VERIF_CONFIG, 52262306a36Sopenharmony_ci DEV_MM_STATUS, 52362306a36Sopenharmony_ci PCS1G_CFG, 52462306a36Sopenharmony_ci PCS1G_MODE_CFG, 52562306a36Sopenharmony_ci PCS1G_SD_CFG, 52662306a36Sopenharmony_ci PCS1G_ANEG_CFG, 52762306a36Sopenharmony_ci PCS1G_ANEG_NP_CFG, 52862306a36Sopenharmony_ci PCS1G_LB_CFG, 52962306a36Sopenharmony_ci PCS1G_DBG_CFG, 53062306a36Sopenharmony_ci PCS1G_CDET_CFG, 53162306a36Sopenharmony_ci PCS1G_ANEG_STATUS, 53262306a36Sopenharmony_ci PCS1G_ANEG_NP_STATUS, 53362306a36Sopenharmony_ci PCS1G_LINK_STATUS, 53462306a36Sopenharmony_ci PCS1G_LINK_DOWN_CNT, 53562306a36Sopenharmony_ci PCS1G_STICKY, 53662306a36Sopenharmony_ci PCS1G_DEBUG_STATUS, 53762306a36Sopenharmony_ci PCS1G_LPI_CFG, 53862306a36Sopenharmony_ci PCS1G_LPI_WAKE_ERROR_CNT, 53962306a36Sopenharmony_ci PCS1G_LPI_STATUS, 54062306a36Sopenharmony_ci PCS1G_TSTPAT_MODE_CFG, 54162306a36Sopenharmony_ci PCS1G_TSTPAT_STATUS, 54262306a36Sopenharmony_ci DEV_PCS_FX100_CFG, 54362306a36Sopenharmony_ci DEV_PCS_FX100_STATUS, 54462306a36Sopenharmony_ci}; 54562306a36Sopenharmony_ci 54662306a36Sopenharmony_cienum ocelot_regfield { 54762306a36Sopenharmony_ci ANA_ADVLEARN_VLAN_CHK, 54862306a36Sopenharmony_ci ANA_ADVLEARN_LEARN_MIRROR, 54962306a36Sopenharmony_ci ANA_ANEVENTS_FLOOD_DISCARD, 55062306a36Sopenharmony_ci ANA_ANEVENTS_MSTI_DROP, 55162306a36Sopenharmony_ci ANA_ANEVENTS_ACLKILL, 55262306a36Sopenharmony_ci ANA_ANEVENTS_ACLUSED, 55362306a36Sopenharmony_ci ANA_ANEVENTS_AUTOAGE, 55462306a36Sopenharmony_ci ANA_ANEVENTS_VS2TTL1, 55562306a36Sopenharmony_ci ANA_ANEVENTS_STORM_DROP, 55662306a36Sopenharmony_ci ANA_ANEVENTS_LEARN_DROP, 55762306a36Sopenharmony_ci ANA_ANEVENTS_AGED_ENTRY, 55862306a36Sopenharmony_ci ANA_ANEVENTS_CPU_LEARN_FAILED, 55962306a36Sopenharmony_ci ANA_ANEVENTS_AUTO_LEARN_FAILED, 56062306a36Sopenharmony_ci ANA_ANEVENTS_LEARN_REMOVE, 56162306a36Sopenharmony_ci ANA_ANEVENTS_AUTO_LEARNED, 56262306a36Sopenharmony_ci ANA_ANEVENTS_AUTO_MOVED, 56362306a36Sopenharmony_ci ANA_ANEVENTS_DROPPED, 56462306a36Sopenharmony_ci ANA_ANEVENTS_CLASSIFIED_DROP, 56562306a36Sopenharmony_ci ANA_ANEVENTS_CLASSIFIED_COPY, 56662306a36Sopenharmony_ci ANA_ANEVENTS_VLAN_DISCARD, 56762306a36Sopenharmony_ci ANA_ANEVENTS_FWD_DISCARD, 56862306a36Sopenharmony_ci ANA_ANEVENTS_MULTICAST_FLOOD, 56962306a36Sopenharmony_ci ANA_ANEVENTS_UNICAST_FLOOD, 57062306a36Sopenharmony_ci ANA_ANEVENTS_DEST_KNOWN, 57162306a36Sopenharmony_ci ANA_ANEVENTS_BUCKET3_MATCH, 57262306a36Sopenharmony_ci ANA_ANEVENTS_BUCKET2_MATCH, 57362306a36Sopenharmony_ci ANA_ANEVENTS_BUCKET1_MATCH, 57462306a36Sopenharmony_ci ANA_ANEVENTS_BUCKET0_MATCH, 57562306a36Sopenharmony_ci ANA_ANEVENTS_CPU_OPERATION, 57662306a36Sopenharmony_ci ANA_ANEVENTS_DMAC_LOOKUP, 57762306a36Sopenharmony_ci ANA_ANEVENTS_SMAC_LOOKUP, 57862306a36Sopenharmony_ci ANA_ANEVENTS_SEQ_GEN_ERR_0, 57962306a36Sopenharmony_ci ANA_ANEVENTS_SEQ_GEN_ERR_1, 58062306a36Sopenharmony_ci ANA_TABLES_MACACCESS_B_DOM, 58162306a36Sopenharmony_ci ANA_TABLES_MACTINDX_BUCKET, 58262306a36Sopenharmony_ci ANA_TABLES_MACTINDX_M_INDEX, 58362306a36Sopenharmony_ci QSYS_SWITCH_PORT_MODE_PORT_ENA, 58462306a36Sopenharmony_ci QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG, 58562306a36Sopenharmony_ci QSYS_SWITCH_PORT_MODE_YEL_RSRVD, 58662306a36Sopenharmony_ci QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE, 58762306a36Sopenharmony_ci QSYS_SWITCH_PORT_MODE_TX_PFC_ENA, 58862306a36Sopenharmony_ci QSYS_SWITCH_PORT_MODE_TX_PFC_MODE, 58962306a36Sopenharmony_ci QSYS_TIMED_FRAME_ENTRY_TFRM_VLD, 59062306a36Sopenharmony_ci QSYS_TIMED_FRAME_ENTRY_TFRM_FP, 59162306a36Sopenharmony_ci QSYS_TIMED_FRAME_ENTRY_TFRM_PORTNO, 59262306a36Sopenharmony_ci QSYS_TIMED_FRAME_ENTRY_TFRM_TM_SEL, 59362306a36Sopenharmony_ci QSYS_TIMED_FRAME_ENTRY_TFRM_TM_T, 59462306a36Sopenharmony_ci SYS_PORT_MODE_DATA_WO_TS, 59562306a36Sopenharmony_ci SYS_PORT_MODE_INCL_INJ_HDR, 59662306a36Sopenharmony_ci SYS_PORT_MODE_INCL_XTR_HDR, 59762306a36Sopenharmony_ci SYS_PORT_MODE_INCL_HDR_ERR, 59862306a36Sopenharmony_ci SYS_RESET_CFG_CORE_ENA, 59962306a36Sopenharmony_ci SYS_RESET_CFG_MEM_ENA, 60062306a36Sopenharmony_ci SYS_RESET_CFG_MEM_INIT, 60162306a36Sopenharmony_ci GCB_SOFT_RST_SWC_RST, 60262306a36Sopenharmony_ci GCB_MIIM_MII_STATUS_PENDING, 60362306a36Sopenharmony_ci GCB_MIIM_MII_STATUS_BUSY, 60462306a36Sopenharmony_ci SYS_PAUSE_CFG_PAUSE_START, 60562306a36Sopenharmony_ci SYS_PAUSE_CFG_PAUSE_STOP, 60662306a36Sopenharmony_ci SYS_PAUSE_CFG_PAUSE_ENA, 60762306a36Sopenharmony_ci REGFIELD_MAX 60862306a36Sopenharmony_ci}; 60962306a36Sopenharmony_ci 61062306a36Sopenharmony_cienum { 61162306a36Sopenharmony_ci /* VCAP_CORE_CFG */ 61262306a36Sopenharmony_ci VCAP_CORE_UPDATE_CTRL, 61362306a36Sopenharmony_ci VCAP_CORE_MV_CFG, 61462306a36Sopenharmony_ci /* VCAP_CORE_CACHE */ 61562306a36Sopenharmony_ci VCAP_CACHE_ENTRY_DAT, 61662306a36Sopenharmony_ci VCAP_CACHE_MASK_DAT, 61762306a36Sopenharmony_ci VCAP_CACHE_ACTION_DAT, 61862306a36Sopenharmony_ci VCAP_CACHE_CNT_DAT, 61962306a36Sopenharmony_ci VCAP_CACHE_TG_DAT, 62062306a36Sopenharmony_ci /* VCAP_CONST */ 62162306a36Sopenharmony_ci VCAP_CONST_VCAP_VER, 62262306a36Sopenharmony_ci VCAP_CONST_ENTRY_WIDTH, 62362306a36Sopenharmony_ci VCAP_CONST_ENTRY_CNT, 62462306a36Sopenharmony_ci VCAP_CONST_ENTRY_SWCNT, 62562306a36Sopenharmony_ci VCAP_CONST_ENTRY_TG_WIDTH, 62662306a36Sopenharmony_ci VCAP_CONST_ACTION_DEF_CNT, 62762306a36Sopenharmony_ci VCAP_CONST_ACTION_WIDTH, 62862306a36Sopenharmony_ci VCAP_CONST_CNT_WIDTH, 62962306a36Sopenharmony_ci VCAP_CONST_CORE_CNT, 63062306a36Sopenharmony_ci VCAP_CONST_IF_CNT, 63162306a36Sopenharmony_ci}; 63262306a36Sopenharmony_ci 63362306a36Sopenharmony_cienum ocelot_ptp_pins { 63462306a36Sopenharmony_ci PTP_PIN_0, 63562306a36Sopenharmony_ci PTP_PIN_1, 63662306a36Sopenharmony_ci PTP_PIN_2, 63762306a36Sopenharmony_ci PTP_PIN_3, 63862306a36Sopenharmony_ci TOD_ACC_PIN 63962306a36Sopenharmony_ci}; 64062306a36Sopenharmony_ci 64162306a36Sopenharmony_cienum ocelot_tag_prefix { 64262306a36Sopenharmony_ci OCELOT_TAG_PREFIX_DISABLED = 0, 64362306a36Sopenharmony_ci OCELOT_TAG_PREFIX_NONE, 64462306a36Sopenharmony_ci OCELOT_TAG_PREFIX_SHORT, 64562306a36Sopenharmony_ci OCELOT_TAG_PREFIX_LONG, 64662306a36Sopenharmony_ci}; 64762306a36Sopenharmony_ci 64862306a36Sopenharmony_cistruct ocelot; 64962306a36Sopenharmony_cistruct device_node; 65062306a36Sopenharmony_ci 65162306a36Sopenharmony_cistruct ocelot_ops { 65262306a36Sopenharmony_ci struct net_device *(*port_to_netdev)(struct ocelot *ocelot, int port); 65362306a36Sopenharmony_ci int (*netdev_to_port)(struct net_device *dev); 65462306a36Sopenharmony_ci int (*reset)(struct ocelot *ocelot); 65562306a36Sopenharmony_ci u16 (*wm_enc)(u16 value); 65662306a36Sopenharmony_ci u16 (*wm_dec)(u16 value); 65762306a36Sopenharmony_ci void (*wm_stat)(u32 val, u32 *inuse, u32 *maxuse); 65862306a36Sopenharmony_ci void (*psfp_init)(struct ocelot *ocelot); 65962306a36Sopenharmony_ci int (*psfp_filter_add)(struct ocelot *ocelot, int port, 66062306a36Sopenharmony_ci struct flow_cls_offload *f); 66162306a36Sopenharmony_ci int (*psfp_filter_del)(struct ocelot *ocelot, struct flow_cls_offload *f); 66262306a36Sopenharmony_ci int (*psfp_stats_get)(struct ocelot *ocelot, struct flow_cls_offload *f, 66362306a36Sopenharmony_ci struct flow_stats *stats); 66462306a36Sopenharmony_ci void (*cut_through_fwd)(struct ocelot *ocelot); 66562306a36Sopenharmony_ci void (*tas_clock_adjust)(struct ocelot *ocelot); 66662306a36Sopenharmony_ci void (*tas_guard_bands_update)(struct ocelot *ocelot, int port); 66762306a36Sopenharmony_ci void (*update_stats)(struct ocelot *ocelot); 66862306a36Sopenharmony_ci}; 66962306a36Sopenharmony_ci 67062306a36Sopenharmony_cistruct ocelot_vcap_policer { 67162306a36Sopenharmony_ci struct list_head pol_list; 67262306a36Sopenharmony_ci u16 base; 67362306a36Sopenharmony_ci u16 max; 67462306a36Sopenharmony_ci u16 base2; 67562306a36Sopenharmony_ci u16 max2; 67662306a36Sopenharmony_ci}; 67762306a36Sopenharmony_ci 67862306a36Sopenharmony_cistruct ocelot_vcap_block { 67962306a36Sopenharmony_ci struct list_head rules; 68062306a36Sopenharmony_ci int count; 68162306a36Sopenharmony_ci}; 68262306a36Sopenharmony_ci 68362306a36Sopenharmony_cistruct ocelot_bridge_vlan { 68462306a36Sopenharmony_ci u16 vid; 68562306a36Sopenharmony_ci unsigned long portmask; 68662306a36Sopenharmony_ci unsigned long untagged; 68762306a36Sopenharmony_ci struct list_head list; 68862306a36Sopenharmony_ci}; 68962306a36Sopenharmony_ci 69062306a36Sopenharmony_cienum ocelot_port_tag_config { 69162306a36Sopenharmony_ci /* all VLANs are egress-untagged */ 69262306a36Sopenharmony_ci OCELOT_PORT_TAG_DISABLED = 0, 69362306a36Sopenharmony_ci /* all VLANs except the native VLAN and VID 0 are egress-tagged */ 69462306a36Sopenharmony_ci OCELOT_PORT_TAG_NATIVE = 1, 69562306a36Sopenharmony_ci /* all VLANs except VID 0 are egress-tagged */ 69662306a36Sopenharmony_ci OCELOT_PORT_TAG_TRUNK_NO_VID0 = 2, 69762306a36Sopenharmony_ci /* all VLANs are egress-tagged */ 69862306a36Sopenharmony_ci OCELOT_PORT_TAG_TRUNK = 3, 69962306a36Sopenharmony_ci}; 70062306a36Sopenharmony_ci 70162306a36Sopenharmony_cistruct ocelot_psfp_list { 70262306a36Sopenharmony_ci struct list_head stream_list; 70362306a36Sopenharmony_ci struct list_head sfi_list; 70462306a36Sopenharmony_ci struct list_head sgi_list; 70562306a36Sopenharmony_ci /* Serialize access to the lists */ 70662306a36Sopenharmony_ci struct mutex lock; 70762306a36Sopenharmony_ci}; 70862306a36Sopenharmony_ci 70962306a36Sopenharmony_cienum ocelot_sb { 71062306a36Sopenharmony_ci OCELOT_SB_BUF, 71162306a36Sopenharmony_ci OCELOT_SB_REF, 71262306a36Sopenharmony_ci OCELOT_SB_NUM, 71362306a36Sopenharmony_ci}; 71462306a36Sopenharmony_ci 71562306a36Sopenharmony_cienum ocelot_sb_pool { 71662306a36Sopenharmony_ci OCELOT_SB_POOL_ING, 71762306a36Sopenharmony_ci OCELOT_SB_POOL_EGR, 71862306a36Sopenharmony_ci OCELOT_SB_POOL_NUM, 71962306a36Sopenharmony_ci}; 72062306a36Sopenharmony_ci 72162306a36Sopenharmony_ci/* MAC table entry types. 72262306a36Sopenharmony_ci * ENTRYTYPE_NORMAL is subject to aging. 72362306a36Sopenharmony_ci * ENTRYTYPE_LOCKED is not subject to aging. 72462306a36Sopenharmony_ci * ENTRYTYPE_MACv4 is not subject to aging. For IPv4 multicast. 72562306a36Sopenharmony_ci * ENTRYTYPE_MACv6 is not subject to aging. For IPv6 multicast. 72662306a36Sopenharmony_ci */ 72762306a36Sopenharmony_cienum macaccess_entry_type { 72862306a36Sopenharmony_ci ENTRYTYPE_NORMAL = 0, 72962306a36Sopenharmony_ci ENTRYTYPE_LOCKED, 73062306a36Sopenharmony_ci ENTRYTYPE_MACv4, 73162306a36Sopenharmony_ci ENTRYTYPE_MACv6, 73262306a36Sopenharmony_ci}; 73362306a36Sopenharmony_ci 73462306a36Sopenharmony_cienum ocelot_proto { 73562306a36Sopenharmony_ci OCELOT_PROTO_PTP_L2 = BIT(0), 73662306a36Sopenharmony_ci OCELOT_PROTO_PTP_L4 = BIT(1), 73762306a36Sopenharmony_ci}; 73862306a36Sopenharmony_ci 73962306a36Sopenharmony_ci#define OCELOT_QUIRK_PCS_PERFORMS_RATE_ADAPTATION BIT(0) 74062306a36Sopenharmony_ci#define OCELOT_QUIRK_QSGMII_PORTS_MUST_BE_UP BIT(1) 74162306a36Sopenharmony_ci 74262306a36Sopenharmony_cistruct ocelot_lag_fdb { 74362306a36Sopenharmony_ci unsigned char addr[ETH_ALEN]; 74462306a36Sopenharmony_ci u16 vid; 74562306a36Sopenharmony_ci struct net_device *bond; 74662306a36Sopenharmony_ci struct list_head list; 74762306a36Sopenharmony_ci}; 74862306a36Sopenharmony_ci 74962306a36Sopenharmony_cistruct ocelot_mirror { 75062306a36Sopenharmony_ci refcount_t refcount; 75162306a36Sopenharmony_ci int to; 75262306a36Sopenharmony_ci}; 75362306a36Sopenharmony_ci 75462306a36Sopenharmony_cistruct ocelot_mm_state { 75562306a36Sopenharmony_ci enum ethtool_mm_verify_status verify_status; 75662306a36Sopenharmony_ci bool tx_enabled; 75762306a36Sopenharmony_ci bool tx_active; 75862306a36Sopenharmony_ci u8 preemptible_tcs; 75962306a36Sopenharmony_ci u8 active_preemptible_tcs; 76062306a36Sopenharmony_ci}; 76162306a36Sopenharmony_ci 76262306a36Sopenharmony_cistruct ocelot_port; 76362306a36Sopenharmony_ci 76462306a36Sopenharmony_cistruct ocelot_port { 76562306a36Sopenharmony_ci struct ocelot *ocelot; 76662306a36Sopenharmony_ci 76762306a36Sopenharmony_ci struct regmap *target; 76862306a36Sopenharmony_ci 76962306a36Sopenharmony_ci struct net_device *bond; 77062306a36Sopenharmony_ci struct net_device *bridge; 77162306a36Sopenharmony_ci 77262306a36Sopenharmony_ci struct ocelot_port *dsa_8021q_cpu; 77362306a36Sopenharmony_ci 77462306a36Sopenharmony_ci /* VLAN that untagged frames are classified to, on ingress */ 77562306a36Sopenharmony_ci const struct ocelot_bridge_vlan *pvid_vlan; 77662306a36Sopenharmony_ci 77762306a36Sopenharmony_ci struct tc_taprio_qopt_offload *taprio; 77862306a36Sopenharmony_ci 77962306a36Sopenharmony_ci phy_interface_t phy_mode; 78062306a36Sopenharmony_ci 78162306a36Sopenharmony_ci unsigned int ptp_skbs_in_flight; 78262306a36Sopenharmony_ci struct sk_buff_head tx_skbs; 78362306a36Sopenharmony_ci 78462306a36Sopenharmony_ci unsigned int trap_proto; 78562306a36Sopenharmony_ci 78662306a36Sopenharmony_ci u16 mrp_ring_id; 78762306a36Sopenharmony_ci 78862306a36Sopenharmony_ci u8 ptp_cmd; 78962306a36Sopenharmony_ci u8 ts_id; 79062306a36Sopenharmony_ci 79162306a36Sopenharmony_ci u8 index; 79262306a36Sopenharmony_ci 79362306a36Sopenharmony_ci u8 stp_state; 79462306a36Sopenharmony_ci bool vlan_aware; 79562306a36Sopenharmony_ci bool is_dsa_8021q_cpu; 79662306a36Sopenharmony_ci bool learn_ena; 79762306a36Sopenharmony_ci 79862306a36Sopenharmony_ci bool lag_tx_active; 79962306a36Sopenharmony_ci 80062306a36Sopenharmony_ci int bridge_num; 80162306a36Sopenharmony_ci 80262306a36Sopenharmony_ci int speed; 80362306a36Sopenharmony_ci}; 80462306a36Sopenharmony_ci 80562306a36Sopenharmony_cistruct ocelot { 80662306a36Sopenharmony_ci struct device *dev; 80762306a36Sopenharmony_ci struct devlink *devlink; 80862306a36Sopenharmony_ci struct devlink_port *devlink_ports; 80962306a36Sopenharmony_ci 81062306a36Sopenharmony_ci const struct ocelot_ops *ops; 81162306a36Sopenharmony_ci struct regmap *targets[TARGET_MAX]; 81262306a36Sopenharmony_ci struct regmap_field *regfields[REGFIELD_MAX]; 81362306a36Sopenharmony_ci const u32 *const *map; 81462306a36Sopenharmony_ci struct list_head stats_regions; 81562306a36Sopenharmony_ci 81662306a36Sopenharmony_ci u32 pool_size[OCELOT_SB_NUM][OCELOT_SB_POOL_NUM]; 81762306a36Sopenharmony_ci int packet_buffer_size; 81862306a36Sopenharmony_ci int num_frame_refs; 81962306a36Sopenharmony_ci int num_mact_rows; 82062306a36Sopenharmony_ci 82162306a36Sopenharmony_ci struct ocelot_port **ports; 82262306a36Sopenharmony_ci 82362306a36Sopenharmony_ci u8 base_mac[ETH_ALEN]; 82462306a36Sopenharmony_ci 82562306a36Sopenharmony_ci struct list_head vlans; 82662306a36Sopenharmony_ci struct list_head traps; 82762306a36Sopenharmony_ci struct list_head lag_fdbs; 82862306a36Sopenharmony_ci 82962306a36Sopenharmony_ci /* Switches like VSC9959 have flooding per traffic class */ 83062306a36Sopenharmony_ci int num_flooding_pgids; 83162306a36Sopenharmony_ci 83262306a36Sopenharmony_ci /* In tables like ANA:PORT and the ANA:PGID:PGID mask, 83362306a36Sopenharmony_ci * the CPU is located after the physical ports (at the 83462306a36Sopenharmony_ci * num_phys_ports index). 83562306a36Sopenharmony_ci */ 83662306a36Sopenharmony_ci u8 num_phys_ports; 83762306a36Sopenharmony_ci 83862306a36Sopenharmony_ci int npi; 83962306a36Sopenharmony_ci 84062306a36Sopenharmony_ci enum ocelot_tag_prefix npi_inj_prefix; 84162306a36Sopenharmony_ci enum ocelot_tag_prefix npi_xtr_prefix; 84262306a36Sopenharmony_ci 84362306a36Sopenharmony_ci unsigned long bridges; 84462306a36Sopenharmony_ci 84562306a36Sopenharmony_ci struct list_head multicast; 84662306a36Sopenharmony_ci struct list_head pgids; 84762306a36Sopenharmony_ci 84862306a36Sopenharmony_ci struct list_head dummy_rules; 84962306a36Sopenharmony_ci struct ocelot_vcap_block block[3]; 85062306a36Sopenharmony_ci struct ocelot_vcap_policer vcap_pol; 85162306a36Sopenharmony_ci struct vcap_props *vcap; 85262306a36Sopenharmony_ci struct ocelot_mirror *mirror; 85362306a36Sopenharmony_ci 85462306a36Sopenharmony_ci struct ocelot_psfp_list psfp; 85562306a36Sopenharmony_ci 85662306a36Sopenharmony_ci /* Workqueue to check statistics for overflow */ 85762306a36Sopenharmony_ci struct delayed_work stats_work; 85862306a36Sopenharmony_ci struct workqueue_struct *stats_queue; 85962306a36Sopenharmony_ci /* Lock for serializing access to the statistics array */ 86062306a36Sopenharmony_ci spinlock_t stats_lock; 86162306a36Sopenharmony_ci u64 *stats; 86262306a36Sopenharmony_ci 86362306a36Sopenharmony_ci /* Lock for serializing indirect access to STAT_VIEW registers */ 86462306a36Sopenharmony_ci struct mutex stat_view_lock; 86562306a36Sopenharmony_ci /* Lock for serializing access to the MAC table */ 86662306a36Sopenharmony_ci struct mutex mact_lock; 86762306a36Sopenharmony_ci /* Lock for serializing forwarding domain changes, including the 86862306a36Sopenharmony_ci * configuration of the Time-Aware Shaper, MAC Merge layer and 86962306a36Sopenharmony_ci * cut-through forwarding, on which it depends 87062306a36Sopenharmony_ci */ 87162306a36Sopenharmony_ci struct mutex fwd_domain_lock; 87262306a36Sopenharmony_ci 87362306a36Sopenharmony_ci struct workqueue_struct *owq; 87462306a36Sopenharmony_ci 87562306a36Sopenharmony_ci u8 ptp:1; 87662306a36Sopenharmony_ci u8 mm_supported:1; 87762306a36Sopenharmony_ci struct ptp_clock *ptp_clock; 87862306a36Sopenharmony_ci struct ptp_clock_info ptp_info; 87962306a36Sopenharmony_ci unsigned int ptp_skbs_in_flight; 88062306a36Sopenharmony_ci /* Protects the 2-step TX timestamp ID logic */ 88162306a36Sopenharmony_ci spinlock_t ts_id_lock; 88262306a36Sopenharmony_ci /* Protects the PTP clock */ 88362306a36Sopenharmony_ci spinlock_t ptp_clock_lock; 88462306a36Sopenharmony_ci struct ptp_pin_desc ptp_pins[OCELOT_PTP_PINS_NUM]; 88562306a36Sopenharmony_ci 88662306a36Sopenharmony_ci struct ocelot_mm_state *mm; 88762306a36Sopenharmony_ci 88862306a36Sopenharmony_ci struct ocelot_fdma *fdma; 88962306a36Sopenharmony_ci}; 89062306a36Sopenharmony_ci 89162306a36Sopenharmony_cistruct ocelot_policer { 89262306a36Sopenharmony_ci u32 rate; /* kilobit per second */ 89362306a36Sopenharmony_ci u32 burst; /* bytes */ 89462306a36Sopenharmony_ci}; 89562306a36Sopenharmony_ci 89662306a36Sopenharmony_ci#define ocelot_bulk_read(ocelot, reg, buf, count) \ 89762306a36Sopenharmony_ci __ocelot_bulk_read_ix(ocelot, reg, 0, buf, count) 89862306a36Sopenharmony_ci 89962306a36Sopenharmony_ci#define ocelot_read_ix(ocelot, reg, gi, ri) \ 90062306a36Sopenharmony_ci __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) 90162306a36Sopenharmony_ci#define ocelot_read_gix(ocelot, reg, gi) \ 90262306a36Sopenharmony_ci __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi)) 90362306a36Sopenharmony_ci#define ocelot_read_rix(ocelot, reg, ri) \ 90462306a36Sopenharmony_ci __ocelot_read_ix(ocelot, reg, reg##_RSZ * (ri)) 90562306a36Sopenharmony_ci#define ocelot_read(ocelot, reg) \ 90662306a36Sopenharmony_ci __ocelot_read_ix(ocelot, reg, 0) 90762306a36Sopenharmony_ci 90862306a36Sopenharmony_ci#define ocelot_write_ix(ocelot, val, reg, gi, ri) \ 90962306a36Sopenharmony_ci __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) 91062306a36Sopenharmony_ci#define ocelot_write_gix(ocelot, val, reg, gi) \ 91162306a36Sopenharmony_ci __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi)) 91262306a36Sopenharmony_ci#define ocelot_write_rix(ocelot, val, reg, ri) \ 91362306a36Sopenharmony_ci __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri)) 91462306a36Sopenharmony_ci#define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0) 91562306a36Sopenharmony_ci 91662306a36Sopenharmony_ci#define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) \ 91762306a36Sopenharmony_ci __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) 91862306a36Sopenharmony_ci#define ocelot_rmw_gix(ocelot, val, m, reg, gi) \ 91962306a36Sopenharmony_ci __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi)) 92062306a36Sopenharmony_ci#define ocelot_rmw_rix(ocelot, val, m, reg, ri) \ 92162306a36Sopenharmony_ci __ocelot_rmw_ix(ocelot, val, m, reg, reg##_RSZ * (ri)) 92262306a36Sopenharmony_ci#define ocelot_rmw(ocelot, val, m, reg) __ocelot_rmw_ix(ocelot, val, m, reg, 0) 92362306a36Sopenharmony_ci 92462306a36Sopenharmony_ci#define ocelot_field_write(ocelot, reg, val) \ 92562306a36Sopenharmony_ci regmap_field_write((ocelot)->regfields[(reg)], (val)) 92662306a36Sopenharmony_ci#define ocelot_field_read(ocelot, reg, val) \ 92762306a36Sopenharmony_ci regmap_field_read((ocelot)->regfields[(reg)], (val)) 92862306a36Sopenharmony_ci#define ocelot_fields_write(ocelot, id, reg, val) \ 92962306a36Sopenharmony_ci regmap_fields_write((ocelot)->regfields[(reg)], (id), (val)) 93062306a36Sopenharmony_ci#define ocelot_fields_read(ocelot, id, reg, val) \ 93162306a36Sopenharmony_ci regmap_fields_read((ocelot)->regfields[(reg)], (id), (val)) 93262306a36Sopenharmony_ci 93362306a36Sopenharmony_ci#define ocelot_target_read_ix(ocelot, target, reg, gi, ri) \ 93462306a36Sopenharmony_ci __ocelot_target_read_ix(ocelot, target, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) 93562306a36Sopenharmony_ci#define ocelot_target_read_gix(ocelot, target, reg, gi) \ 93662306a36Sopenharmony_ci __ocelot_target_read_ix(ocelot, target, reg, reg##_GSZ * (gi)) 93762306a36Sopenharmony_ci#define ocelot_target_read_rix(ocelot, target, reg, ri) \ 93862306a36Sopenharmony_ci __ocelot_target_read_ix(ocelot, target, reg, reg##_RSZ * (ri)) 93962306a36Sopenharmony_ci#define ocelot_target_read(ocelot, target, reg) \ 94062306a36Sopenharmony_ci __ocelot_target_read_ix(ocelot, target, reg, 0) 94162306a36Sopenharmony_ci 94262306a36Sopenharmony_ci#define ocelot_target_write_ix(ocelot, target, val, reg, gi, ri) \ 94362306a36Sopenharmony_ci __ocelot_target_write_ix(ocelot, target, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) 94462306a36Sopenharmony_ci#define ocelot_target_write_gix(ocelot, target, val, reg, gi) \ 94562306a36Sopenharmony_ci __ocelot_target_write_ix(ocelot, target, val, reg, reg##_GSZ * (gi)) 94662306a36Sopenharmony_ci#define ocelot_target_write_rix(ocelot, target, val, reg, ri) \ 94762306a36Sopenharmony_ci __ocelot_target_write_ix(ocelot, target, val, reg, reg##_RSZ * (ri)) 94862306a36Sopenharmony_ci#define ocelot_target_write(ocelot, target, val, reg) \ 94962306a36Sopenharmony_ci __ocelot_target_write_ix(ocelot, target, val, reg, 0) 95062306a36Sopenharmony_ci 95162306a36Sopenharmony_ci/* I/O */ 95262306a36Sopenharmony_ciu32 ocelot_port_readl(struct ocelot_port *port, enum ocelot_reg reg); 95362306a36Sopenharmony_civoid ocelot_port_writel(struct ocelot_port *port, u32 val, enum ocelot_reg reg); 95462306a36Sopenharmony_civoid ocelot_port_rmwl(struct ocelot_port *port, u32 val, u32 mask, 95562306a36Sopenharmony_ci enum ocelot_reg reg); 95662306a36Sopenharmony_ciint __ocelot_bulk_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, 95762306a36Sopenharmony_ci u32 offset, void *buf, int count); 95862306a36Sopenharmony_ciu32 __ocelot_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, u32 offset); 95962306a36Sopenharmony_civoid __ocelot_write_ix(struct ocelot *ocelot, u32 val, enum ocelot_reg reg, 96062306a36Sopenharmony_ci u32 offset); 96162306a36Sopenharmony_civoid __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, 96262306a36Sopenharmony_ci enum ocelot_reg reg, u32 offset); 96362306a36Sopenharmony_ciu32 __ocelot_target_read_ix(struct ocelot *ocelot, enum ocelot_target target, 96462306a36Sopenharmony_ci u32 reg, u32 offset); 96562306a36Sopenharmony_civoid __ocelot_target_write_ix(struct ocelot *ocelot, enum ocelot_target target, 96662306a36Sopenharmony_ci u32 val, u32 reg, u32 offset); 96762306a36Sopenharmony_ci 96862306a36Sopenharmony_ci/* Packet I/O */ 96962306a36Sopenharmony_cibool ocelot_can_inject(struct ocelot *ocelot, int grp); 97062306a36Sopenharmony_civoid ocelot_port_inject_frame(struct ocelot *ocelot, int port, int grp, 97162306a36Sopenharmony_ci u32 rew_op, struct sk_buff *skb); 97262306a36Sopenharmony_civoid ocelot_ifh_port_set(void *ifh, int port, u32 rew_op, u32 vlan_tag); 97362306a36Sopenharmony_ciint ocelot_xtr_poll_frame(struct ocelot *ocelot, int grp, struct sk_buff **skb); 97462306a36Sopenharmony_civoid ocelot_drain_cpu_queue(struct ocelot *ocelot, int grp); 97562306a36Sopenharmony_civoid ocelot_ptp_rx_timestamp(struct ocelot *ocelot, struct sk_buff *skb, 97662306a36Sopenharmony_ci u64 timestamp); 97762306a36Sopenharmony_ci 97862306a36Sopenharmony_ci/* Hardware initialization */ 97962306a36Sopenharmony_ciint ocelot_regfields_init(struct ocelot *ocelot, 98062306a36Sopenharmony_ci const struct reg_field *const regfields); 98162306a36Sopenharmony_cistruct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res); 98262306a36Sopenharmony_ciint ocelot_reset(struct ocelot *ocelot); 98362306a36Sopenharmony_ciint ocelot_init(struct ocelot *ocelot); 98462306a36Sopenharmony_civoid ocelot_deinit(struct ocelot *ocelot); 98562306a36Sopenharmony_civoid ocelot_init_port(struct ocelot *ocelot, int port); 98662306a36Sopenharmony_civoid ocelot_deinit_port(struct ocelot *ocelot, int port); 98762306a36Sopenharmony_ci 98862306a36Sopenharmony_civoid ocelot_port_setup_dsa_8021q_cpu(struct ocelot *ocelot, int cpu); 98962306a36Sopenharmony_civoid ocelot_port_teardown_dsa_8021q_cpu(struct ocelot *ocelot, int cpu); 99062306a36Sopenharmony_civoid ocelot_port_assign_dsa_8021q_cpu(struct ocelot *ocelot, int port, int cpu); 99162306a36Sopenharmony_civoid ocelot_port_unassign_dsa_8021q_cpu(struct ocelot *ocelot, int port); 99262306a36Sopenharmony_ciu32 ocelot_port_assigned_dsa_8021q_cpu_mask(struct ocelot *ocelot, int port); 99362306a36Sopenharmony_ci 99462306a36Sopenharmony_ci/* Watermark interface */ 99562306a36Sopenharmony_ciu16 ocelot_wm_enc(u16 value); 99662306a36Sopenharmony_ciu16 ocelot_wm_dec(u16 wm); 99762306a36Sopenharmony_civoid ocelot_wm_stat(u32 val, u32 *inuse, u32 *maxuse); 99862306a36Sopenharmony_ci 99962306a36Sopenharmony_ci/* DSA callbacks */ 100062306a36Sopenharmony_civoid ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data); 100162306a36Sopenharmony_civoid ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data); 100262306a36Sopenharmony_ciint ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset); 100362306a36Sopenharmony_civoid ocelot_port_get_stats64(struct ocelot *ocelot, int port, 100462306a36Sopenharmony_ci struct rtnl_link_stats64 *stats); 100562306a36Sopenharmony_civoid ocelot_port_get_pause_stats(struct ocelot *ocelot, int port, 100662306a36Sopenharmony_ci struct ethtool_pause_stats *pause_stats); 100762306a36Sopenharmony_civoid ocelot_port_get_mm_stats(struct ocelot *ocelot, int port, 100862306a36Sopenharmony_ci struct ethtool_mm_stats *stats); 100962306a36Sopenharmony_civoid ocelot_port_get_rmon_stats(struct ocelot *ocelot, int port, 101062306a36Sopenharmony_ci struct ethtool_rmon_stats *rmon_stats, 101162306a36Sopenharmony_ci const struct ethtool_rmon_hist_range **ranges); 101262306a36Sopenharmony_civoid ocelot_port_get_eth_ctrl_stats(struct ocelot *ocelot, int port, 101362306a36Sopenharmony_ci struct ethtool_eth_ctrl_stats *ctrl_stats); 101462306a36Sopenharmony_civoid ocelot_port_get_eth_mac_stats(struct ocelot *ocelot, int port, 101562306a36Sopenharmony_ci struct ethtool_eth_mac_stats *mac_stats); 101662306a36Sopenharmony_civoid ocelot_port_get_eth_phy_stats(struct ocelot *ocelot, int port, 101762306a36Sopenharmony_ci struct ethtool_eth_phy_stats *phy_stats); 101862306a36Sopenharmony_ciint ocelot_get_ts_info(struct ocelot *ocelot, int port, 101962306a36Sopenharmony_ci struct ethtool_ts_info *info); 102062306a36Sopenharmony_civoid ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs); 102162306a36Sopenharmony_ciint ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled, 102262306a36Sopenharmony_ci struct netlink_ext_ack *extack); 102362306a36Sopenharmony_civoid ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state); 102462306a36Sopenharmony_ciu32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, int src_port); 102562306a36Sopenharmony_ciint ocelot_port_pre_bridge_flags(struct ocelot *ocelot, int port, 102662306a36Sopenharmony_ci struct switchdev_brport_flags val); 102762306a36Sopenharmony_civoid ocelot_port_bridge_flags(struct ocelot *ocelot, int port, 102862306a36Sopenharmony_ci struct switchdev_brport_flags val); 102962306a36Sopenharmony_ciint ocelot_port_get_default_prio(struct ocelot *ocelot, int port); 103062306a36Sopenharmony_ciint ocelot_port_set_default_prio(struct ocelot *ocelot, int port, u8 prio); 103162306a36Sopenharmony_ciint ocelot_port_get_dscp_prio(struct ocelot *ocelot, int port, u8 dscp); 103262306a36Sopenharmony_ciint ocelot_port_add_dscp_prio(struct ocelot *ocelot, int port, u8 dscp, u8 prio); 103362306a36Sopenharmony_ciint ocelot_port_del_dscp_prio(struct ocelot *ocelot, int port, u8 dscp, u8 prio); 103462306a36Sopenharmony_ciint ocelot_port_bridge_join(struct ocelot *ocelot, int port, 103562306a36Sopenharmony_ci struct net_device *bridge, int bridge_num, 103662306a36Sopenharmony_ci struct netlink_ext_ack *extack); 103762306a36Sopenharmony_civoid ocelot_port_bridge_leave(struct ocelot *ocelot, int port, 103862306a36Sopenharmony_ci struct net_device *bridge); 103962306a36Sopenharmony_ciint ocelot_mact_flush(struct ocelot *ocelot, int port); 104062306a36Sopenharmony_ciint ocelot_fdb_dump(struct ocelot *ocelot, int port, 104162306a36Sopenharmony_ci dsa_fdb_dump_cb_t *cb, void *data); 104262306a36Sopenharmony_ciint ocelot_fdb_add(struct ocelot *ocelot, int port, const unsigned char *addr, 104362306a36Sopenharmony_ci u16 vid, const struct net_device *bridge); 104462306a36Sopenharmony_ciint ocelot_fdb_del(struct ocelot *ocelot, int port, const unsigned char *addr, 104562306a36Sopenharmony_ci u16 vid, const struct net_device *bridge); 104662306a36Sopenharmony_ciint ocelot_lag_fdb_add(struct ocelot *ocelot, struct net_device *bond, 104762306a36Sopenharmony_ci const unsigned char *addr, u16 vid, 104862306a36Sopenharmony_ci const struct net_device *bridge); 104962306a36Sopenharmony_ciint ocelot_lag_fdb_del(struct ocelot *ocelot, struct net_device *bond, 105062306a36Sopenharmony_ci const unsigned char *addr, u16 vid, 105162306a36Sopenharmony_ci const struct net_device *bridge); 105262306a36Sopenharmony_ciint ocelot_vlan_prepare(struct ocelot *ocelot, int port, u16 vid, bool pvid, 105362306a36Sopenharmony_ci bool untagged, struct netlink_ext_ack *extack); 105462306a36Sopenharmony_ciint ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid, 105562306a36Sopenharmony_ci bool untagged); 105662306a36Sopenharmony_ciint ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid); 105762306a36Sopenharmony_ciint ocelot_hwstamp_get(struct ocelot *ocelot, int port, struct ifreq *ifr); 105862306a36Sopenharmony_ciint ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct ifreq *ifr); 105962306a36Sopenharmony_ciint ocelot_port_txtstamp_request(struct ocelot *ocelot, int port, 106062306a36Sopenharmony_ci struct sk_buff *skb, 106162306a36Sopenharmony_ci struct sk_buff **clone); 106262306a36Sopenharmony_civoid ocelot_get_txtstamp(struct ocelot *ocelot); 106362306a36Sopenharmony_civoid ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu); 106462306a36Sopenharmony_ciint ocelot_get_max_mtu(struct ocelot *ocelot, int port); 106562306a36Sopenharmony_ciint ocelot_port_policer_add(struct ocelot *ocelot, int port, 106662306a36Sopenharmony_ci struct ocelot_policer *pol); 106762306a36Sopenharmony_ciint ocelot_port_policer_del(struct ocelot *ocelot, int port); 106862306a36Sopenharmony_ciint ocelot_port_mirror_add(struct ocelot *ocelot, int from, int to, 106962306a36Sopenharmony_ci bool ingress, struct netlink_ext_ack *extack); 107062306a36Sopenharmony_civoid ocelot_port_mirror_del(struct ocelot *ocelot, int from, bool ingress); 107162306a36Sopenharmony_ciint ocelot_cls_flower_replace(struct ocelot *ocelot, int port, 107262306a36Sopenharmony_ci struct flow_cls_offload *f, bool ingress); 107362306a36Sopenharmony_ciint ocelot_cls_flower_destroy(struct ocelot *ocelot, int port, 107462306a36Sopenharmony_ci struct flow_cls_offload *f, bool ingress); 107562306a36Sopenharmony_ciint ocelot_cls_flower_stats(struct ocelot *ocelot, int port, 107662306a36Sopenharmony_ci struct flow_cls_offload *f, bool ingress); 107762306a36Sopenharmony_ciint ocelot_port_mdb_add(struct ocelot *ocelot, int port, 107862306a36Sopenharmony_ci const struct switchdev_obj_port_mdb *mdb, 107962306a36Sopenharmony_ci const struct net_device *bridge); 108062306a36Sopenharmony_ciint ocelot_port_mdb_del(struct ocelot *ocelot, int port, 108162306a36Sopenharmony_ci const struct switchdev_obj_port_mdb *mdb, 108262306a36Sopenharmony_ci const struct net_device *bridge); 108362306a36Sopenharmony_ciint ocelot_port_lag_join(struct ocelot *ocelot, int port, 108462306a36Sopenharmony_ci struct net_device *bond, 108562306a36Sopenharmony_ci struct netdev_lag_upper_info *info, 108662306a36Sopenharmony_ci struct netlink_ext_ack *extack); 108762306a36Sopenharmony_civoid ocelot_port_lag_leave(struct ocelot *ocelot, int port, 108862306a36Sopenharmony_ci struct net_device *bond); 108962306a36Sopenharmony_civoid ocelot_port_lag_change(struct ocelot *ocelot, int port, bool lag_tx_active); 109062306a36Sopenharmony_ciint ocelot_bond_get_id(struct ocelot *ocelot, struct net_device *bond); 109162306a36Sopenharmony_ci 109262306a36Sopenharmony_ciint ocelot_devlink_sb_register(struct ocelot *ocelot); 109362306a36Sopenharmony_civoid ocelot_devlink_sb_unregister(struct ocelot *ocelot); 109462306a36Sopenharmony_ciint ocelot_sb_pool_get(struct ocelot *ocelot, unsigned int sb_index, 109562306a36Sopenharmony_ci u16 pool_index, 109662306a36Sopenharmony_ci struct devlink_sb_pool_info *pool_info); 109762306a36Sopenharmony_ciint ocelot_sb_pool_set(struct ocelot *ocelot, unsigned int sb_index, 109862306a36Sopenharmony_ci u16 pool_index, u32 size, 109962306a36Sopenharmony_ci enum devlink_sb_threshold_type threshold_type, 110062306a36Sopenharmony_ci struct netlink_ext_ack *extack); 110162306a36Sopenharmony_ciint ocelot_sb_port_pool_get(struct ocelot *ocelot, int port, 110262306a36Sopenharmony_ci unsigned int sb_index, u16 pool_index, 110362306a36Sopenharmony_ci u32 *p_threshold); 110462306a36Sopenharmony_ciint ocelot_sb_port_pool_set(struct ocelot *ocelot, int port, 110562306a36Sopenharmony_ci unsigned int sb_index, u16 pool_index, 110662306a36Sopenharmony_ci u32 threshold, struct netlink_ext_ack *extack); 110762306a36Sopenharmony_ciint ocelot_sb_tc_pool_bind_get(struct ocelot *ocelot, int port, 110862306a36Sopenharmony_ci unsigned int sb_index, u16 tc_index, 110962306a36Sopenharmony_ci enum devlink_sb_pool_type pool_type, 111062306a36Sopenharmony_ci u16 *p_pool_index, u32 *p_threshold); 111162306a36Sopenharmony_ciint ocelot_sb_tc_pool_bind_set(struct ocelot *ocelot, int port, 111262306a36Sopenharmony_ci unsigned int sb_index, u16 tc_index, 111362306a36Sopenharmony_ci enum devlink_sb_pool_type pool_type, 111462306a36Sopenharmony_ci u16 pool_index, u32 threshold, 111562306a36Sopenharmony_ci struct netlink_ext_ack *extack); 111662306a36Sopenharmony_ciint ocelot_sb_occ_snapshot(struct ocelot *ocelot, unsigned int sb_index); 111762306a36Sopenharmony_ciint ocelot_sb_occ_max_clear(struct ocelot *ocelot, unsigned int sb_index); 111862306a36Sopenharmony_ciint ocelot_sb_occ_port_pool_get(struct ocelot *ocelot, int port, 111962306a36Sopenharmony_ci unsigned int sb_index, u16 pool_index, 112062306a36Sopenharmony_ci u32 *p_cur, u32 *p_max); 112162306a36Sopenharmony_ciint ocelot_sb_occ_tc_port_bind_get(struct ocelot *ocelot, int port, 112262306a36Sopenharmony_ci unsigned int sb_index, u16 tc_index, 112362306a36Sopenharmony_ci enum devlink_sb_pool_type pool_type, 112462306a36Sopenharmony_ci u32 *p_cur, u32 *p_max); 112562306a36Sopenharmony_ci 112662306a36Sopenharmony_ciint ocelot_port_configure_serdes(struct ocelot *ocelot, int port, 112762306a36Sopenharmony_ci struct device_node *portnp); 112862306a36Sopenharmony_ci 112962306a36Sopenharmony_civoid ocelot_phylink_mac_config(struct ocelot *ocelot, int port, 113062306a36Sopenharmony_ci unsigned int link_an_mode, 113162306a36Sopenharmony_ci const struct phylink_link_state *state); 113262306a36Sopenharmony_civoid ocelot_phylink_mac_link_down(struct ocelot *ocelot, int port, 113362306a36Sopenharmony_ci unsigned int link_an_mode, 113462306a36Sopenharmony_ci phy_interface_t interface, 113562306a36Sopenharmony_ci unsigned long quirks); 113662306a36Sopenharmony_civoid ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port, 113762306a36Sopenharmony_ci struct phy_device *phydev, 113862306a36Sopenharmony_ci unsigned int link_an_mode, 113962306a36Sopenharmony_ci phy_interface_t interface, 114062306a36Sopenharmony_ci int speed, int duplex, 114162306a36Sopenharmony_ci bool tx_pause, bool rx_pause, 114262306a36Sopenharmony_ci unsigned long quirks); 114362306a36Sopenharmony_ci 114462306a36Sopenharmony_ciint ocelot_mact_lookup(struct ocelot *ocelot, int *dst_idx, 114562306a36Sopenharmony_ci const unsigned char mac[ETH_ALEN], 114662306a36Sopenharmony_ci unsigned int vid, enum macaccess_entry_type *type); 114762306a36Sopenharmony_ciint ocelot_mact_learn_streamdata(struct ocelot *ocelot, int dst_idx, 114862306a36Sopenharmony_ci const unsigned char mac[ETH_ALEN], 114962306a36Sopenharmony_ci unsigned int vid, 115062306a36Sopenharmony_ci enum macaccess_entry_type type, 115162306a36Sopenharmony_ci int sfid, int ssid); 115262306a36Sopenharmony_ci 115362306a36Sopenharmony_ciint ocelot_migrate_mdbs(struct ocelot *ocelot, unsigned long from_mask, 115462306a36Sopenharmony_ci unsigned long to_mask); 115562306a36Sopenharmony_ci 115662306a36Sopenharmony_ciint ocelot_vcap_policer_add(struct ocelot *ocelot, u32 pol_ix, 115762306a36Sopenharmony_ci struct ocelot_policer *pol); 115862306a36Sopenharmony_ciint ocelot_vcap_policer_del(struct ocelot *ocelot, u32 pol_ix); 115962306a36Sopenharmony_ci 116062306a36Sopenharmony_civoid ocelot_mm_irq(struct ocelot *ocelot); 116162306a36Sopenharmony_ciint ocelot_port_set_mm(struct ocelot *ocelot, int port, 116262306a36Sopenharmony_ci struct ethtool_mm_cfg *cfg, 116362306a36Sopenharmony_ci struct netlink_ext_ack *extack); 116462306a36Sopenharmony_ciint ocelot_port_get_mm(struct ocelot *ocelot, int port, 116562306a36Sopenharmony_ci struct ethtool_mm_state *state); 116662306a36Sopenharmony_ciint ocelot_port_mqprio(struct ocelot *ocelot, int port, 116762306a36Sopenharmony_ci struct tc_mqprio_qopt_offload *mqprio); 116862306a36Sopenharmony_ci 116962306a36Sopenharmony_ci#if IS_ENABLED(CONFIG_BRIDGE_MRP) 117062306a36Sopenharmony_ciint ocelot_mrp_add(struct ocelot *ocelot, int port, 117162306a36Sopenharmony_ci const struct switchdev_obj_mrp *mrp); 117262306a36Sopenharmony_ciint ocelot_mrp_del(struct ocelot *ocelot, int port, 117362306a36Sopenharmony_ci const struct switchdev_obj_mrp *mrp); 117462306a36Sopenharmony_ciint ocelot_mrp_add_ring_role(struct ocelot *ocelot, int port, 117562306a36Sopenharmony_ci const struct switchdev_obj_ring_role_mrp *mrp); 117662306a36Sopenharmony_ciint ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port, 117762306a36Sopenharmony_ci const struct switchdev_obj_ring_role_mrp *mrp); 117862306a36Sopenharmony_ci#else 117962306a36Sopenharmony_cistatic inline int ocelot_mrp_add(struct ocelot *ocelot, int port, 118062306a36Sopenharmony_ci const struct switchdev_obj_mrp *mrp) 118162306a36Sopenharmony_ci{ 118262306a36Sopenharmony_ci return -EOPNOTSUPP; 118362306a36Sopenharmony_ci} 118462306a36Sopenharmony_ci 118562306a36Sopenharmony_cistatic inline int ocelot_mrp_del(struct ocelot *ocelot, int port, 118662306a36Sopenharmony_ci const struct switchdev_obj_mrp *mrp) 118762306a36Sopenharmony_ci{ 118862306a36Sopenharmony_ci return -EOPNOTSUPP; 118962306a36Sopenharmony_ci} 119062306a36Sopenharmony_ci 119162306a36Sopenharmony_cistatic inline int 119262306a36Sopenharmony_ciocelot_mrp_add_ring_role(struct ocelot *ocelot, int port, 119362306a36Sopenharmony_ci const struct switchdev_obj_ring_role_mrp *mrp) 119462306a36Sopenharmony_ci{ 119562306a36Sopenharmony_ci return -EOPNOTSUPP; 119662306a36Sopenharmony_ci} 119762306a36Sopenharmony_ci 119862306a36Sopenharmony_cistatic inline int 119962306a36Sopenharmony_ciocelot_mrp_del_ring_role(struct ocelot *ocelot, int port, 120062306a36Sopenharmony_ci const struct switchdev_obj_ring_role_mrp *mrp) 120162306a36Sopenharmony_ci{ 120262306a36Sopenharmony_ci return -EOPNOTSUPP; 120362306a36Sopenharmony_ci} 120462306a36Sopenharmony_ci#endif 120562306a36Sopenharmony_ci 120662306a36Sopenharmony_civoid ocelot_pll5_init(struct ocelot *ocelot); 120762306a36Sopenharmony_ci 120862306a36Sopenharmony_ci#endif 1209