xref: /openbmc/linux/include/soc/mscc/ocelot.h (revision 49e62a04)
15e256365SVladimir Oltean /* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
25e256365SVladimir Oltean /* Copyright (c) 2017 Microsemi Corporation
35e256365SVladimir Oltean  */
45e256365SVladimir Oltean 
55e256365SVladimir Oltean #ifndef _SOC_MSCC_OCELOT_H
65e256365SVladimir Oltean #define _SOC_MSCC_OCELOT_H
75e256365SVladimir Oltean 
85e256365SVladimir Oltean #include <linux/ptp_clock_kernel.h>
95e256365SVladimir Oltean #include <linux/net_tstamp.h>
105e256365SVladimir Oltean #include <linux/if_vlan.h>
115e256365SVladimir Oltean #include <linux/regmap.h>
125e256365SVladimir Oltean #include <net/dsa.h>
135e256365SVladimir Oltean 
14aac80140SVladimir Oltean struct tc_mqprio_qopt_offload;
15aac80140SVladimir Oltean 
161cf3299bSVladimir Oltean /* Port Group IDs (PGID) are masks of destination ports.
171cf3299bSVladimir Oltean  *
181cf3299bSVladimir Oltean  * For L2 forwarding, the switch performs 3 lookups in the PGID table for each
191cf3299bSVladimir Oltean  * frame, and forwards the frame to the ports that are present in the logical
201cf3299bSVladimir Oltean  * AND of all 3 PGIDs.
211cf3299bSVladimir Oltean  *
221cf3299bSVladimir Oltean  * These PGID lookups are:
231cf3299bSVladimir Oltean  * - In one of PGID[0-63]: for the destination masks. There are 2 paths by
241cf3299bSVladimir Oltean  *   which the switch selects a destination PGID:
251cf3299bSVladimir Oltean  *     - The {DMAC, VID} is present in the MAC table. In that case, the
261cf3299bSVladimir Oltean  *       destination PGID is given by the DEST_IDX field of the MAC table entry
271cf3299bSVladimir Oltean  *       that matched.
281cf3299bSVladimir Oltean  *     - The {DMAC, VID} is not present in the MAC table (it is unknown). The
291cf3299bSVladimir Oltean  *       frame is disseminated as being either unicast, multicast or broadcast,
301cf3299bSVladimir Oltean  *       and according to that, the destination PGID is chosen as being the
311cf3299bSVladimir Oltean  *       value contained by ANA_FLOODING_FLD_UNICAST,
321cf3299bSVladimir Oltean  *       ANA_FLOODING_FLD_MULTICAST or ANA_FLOODING_FLD_BROADCAST.
331cf3299bSVladimir Oltean  *   The destination PGID can be an unicast set: the first PGIDs, 0 to
341cf3299bSVladimir Oltean  *   ocelot->num_phys_ports - 1, or a multicast set: the PGIDs from
351cf3299bSVladimir Oltean  *   ocelot->num_phys_ports to 63. By convention, a unicast PGID corresponds to
361cf3299bSVladimir Oltean  *   a physical port and has a single bit set in the destination ports mask:
371cf3299bSVladimir Oltean  *   that corresponding to the port number itself. In contrast, a multicast
381cf3299bSVladimir Oltean  *   PGID will have potentially more than one single bit set in the destination
391cf3299bSVladimir Oltean  *   ports mask.
401cf3299bSVladimir Oltean  * - In one of PGID[64-79]: for the aggregation mask. The switch classifier
411cf3299bSVladimir Oltean  *   dissects each frame and generates a 4-bit Link Aggregation Code which is
421cf3299bSVladimir Oltean  *   used for this second PGID table lookup. The goal of link aggregation is to
431cf3299bSVladimir Oltean  *   hash multiple flows within the same LAG on to different destination ports.
441cf3299bSVladimir Oltean  *   The first lookup will result in a PGID with all the LAG members present in
451cf3299bSVladimir Oltean  *   the destination ports mask, and the second lookup, by Link Aggregation
461cf3299bSVladimir Oltean  *   Code, will ensure that each flow gets forwarded only to a single port out
471cf3299bSVladimir Oltean  *   of that mask (there are no duplicates).
481cf3299bSVladimir Oltean  * - In one of PGID[80-90]: for the source mask. The third time, the PGID table
491cf3299bSVladimir Oltean  *   is indexed with the ingress port (plus 80). These PGIDs answer the
501cf3299bSVladimir Oltean  *   question "is port i allowed to forward traffic to port j?" If yes, then
511cf3299bSVladimir Oltean  *   BIT(j) of PGID 80+i will be found set. The third PGID lookup can be used
521cf3299bSVladimir Oltean  *   to enforce the L2 forwarding matrix imposed by e.g. a Linux bridge.
531cf3299bSVladimir Oltean  */
541cf3299bSVladimir Oltean 
551cf3299bSVladimir Oltean /* Reserve some destination PGIDs at the end of the range:
56ebb1bb40SHoratiu Vultur  * PGID_BLACKHOLE: used for not forwarding the frames
571cf3299bSVladimir Oltean  * PGID_CPU: used for whitelisting certain MAC addresses, such as the addresses
581cf3299bSVladimir Oltean  *           of the switch port net devices, towards the CPU port module.
591cf3299bSVladimir Oltean  * PGID_UC: the flooding destinations for unknown unicast traffic.
60b360d94fSVladimir Oltean  * PGID_MC: the flooding destinations for non-IP multicast traffic.
611cf3299bSVladimir Oltean  * PGID_MCIPV4: the flooding destinations for IPv4 multicast traffic.
621cf3299bSVladimir Oltean  * PGID_MCIPV6: the flooding destinations for IPv6 multicast traffic.
63b360d94fSVladimir Oltean  * PGID_BC: the flooding destinations for broadcast traffic.
641cf3299bSVladimir Oltean  */
65ebb1bb40SHoratiu Vultur #define PGID_BLACKHOLE			57
66b360d94fSVladimir Oltean #define PGID_CPU			58
67b360d94fSVladimir Oltean #define PGID_UC				59
68b360d94fSVladimir Oltean #define PGID_MC				60
69b360d94fSVladimir Oltean #define PGID_MCIPV4			61
70b360d94fSVladimir Oltean #define PGID_MCIPV6			62
71b360d94fSVladimir Oltean #define PGID_BC				63
721cf3299bSVladimir Oltean 
7396b029b0SVladimir Oltean #define for_each_unicast_dest_pgid(ocelot, pgid)		\
7496b029b0SVladimir Oltean 	for ((pgid) = 0;					\
7596b029b0SVladimir Oltean 	     (pgid) < (ocelot)->num_phys_ports;			\
7696b029b0SVladimir Oltean 	     (pgid)++)
7796b029b0SVladimir Oltean 
7896b029b0SVladimir Oltean #define for_each_nonreserved_multicast_dest_pgid(ocelot, pgid)	\
7996b029b0SVladimir Oltean 	for ((pgid) = (ocelot)->num_phys_ports + 1;		\
80ebb1bb40SHoratiu Vultur 	     (pgid) < PGID_BLACKHOLE;				\
8196b029b0SVladimir Oltean 	     (pgid)++)
8296b029b0SVladimir Oltean 
8396b029b0SVladimir Oltean #define for_each_aggr_pgid(ocelot, pgid)			\
8496b029b0SVladimir Oltean 	for ((pgid) = PGID_AGGR;				\
8596b029b0SVladimir Oltean 	     (pgid) < PGID_SRC;					\
8696b029b0SVladimir Oltean 	     (pgid)++)
8796b029b0SVladimir Oltean 
881cf3299bSVladimir Oltean /* Aggregation PGIDs, one per Link Aggregation Code */
891cf3299bSVladimir Oltean #define PGID_AGGR			64
901cf3299bSVladimir Oltean 
911cf3299bSVladimir Oltean /* Source PGIDs, one per physical port */
921cf3299bSVladimir Oltean #define PGID_SRC			80
931cf3299bSVladimir Oltean 
9470d39a6eSVladimir Oltean #define OCELOT_NUM_TC			8
955e256365SVladimir Oltean 
965e256365SVladimir Oltean #define OCELOT_SPEED_2500		0
975e256365SVladimir Oltean #define OCELOT_SPEED_1000		1
985e256365SVladimir Oltean #define OCELOT_SPEED_100		2
995e256365SVladimir Oltean #define OCELOT_SPEED_10			3
1005e256365SVladimir Oltean 
101cc2d87bbSYangbo Lu #define OCELOT_PTP_PINS_NUM		4
102cc2d87bbSYangbo Lu 
1035e256365SVladimir Oltean #define TARGET_OFFSET			24
1045e256365SVladimir Oltean #define REG_MASK			GENMASK(TARGET_OFFSET - 1, 0)
1055e256365SVladimir Oltean #define REG(reg, offset)		[reg & REG_MASK] = offset
1065e256365SVladimir Oltean 
1075e256365SVladimir Oltean #define REG_RESERVED_ADDR		0xffffffff
1085e256365SVladimir Oltean #define REG_RESERVED(reg)		REG(reg, REG_RESERVED_ADDR)
1095e256365SVladimir Oltean 
1105e256365SVladimir Oltean enum ocelot_target {
1115e256365SVladimir Oltean 	ANA = 1,
1125e256365SVladimir Oltean 	QS,
1135e256365SVladimir Oltean 	QSYS,
1145e256365SVladimir Oltean 	REW,
1155e256365SVladimir Oltean 	SYS,
116e3aea296SVladimir Oltean 	S0,
117a61e365dSVladimir Oltean 	S1,
1185e256365SVladimir Oltean 	S2,
1195e256365SVladimir Oltean 	HSIO,
1205e256365SVladimir Oltean 	PTP,
121753a026cSClément Léger 	FDMA,
1225e256365SVladimir Oltean 	GCB,
12391c724cfSVladimir Oltean 	DEV_GMII,
1245e256365SVladimir Oltean 	TARGET_MAX,
1255e256365SVladimir Oltean };
1265e256365SVladimir Oltean 
1275e256365SVladimir Oltean enum ocelot_reg {
1285e256365SVladimir Oltean 	ANA_ADVLEARN = ANA << TARGET_OFFSET,
1295e256365SVladimir Oltean 	ANA_VLANMASK,
1305e256365SVladimir Oltean 	ANA_PORT_B_DOMAIN,
1315e256365SVladimir Oltean 	ANA_ANAGEFIL,
1325e256365SVladimir Oltean 	ANA_ANEVENTS,
1335e256365SVladimir Oltean 	ANA_STORMLIMIT_BURST,
1345e256365SVladimir Oltean 	ANA_STORMLIMIT_CFG,
1355e256365SVladimir Oltean 	ANA_ISOLATED_PORTS,
1365e256365SVladimir Oltean 	ANA_COMMUNITY_PORTS,
1375e256365SVladimir Oltean 	ANA_AUTOAGE,
1385e256365SVladimir Oltean 	ANA_MACTOPTIONS,
1395e256365SVladimir Oltean 	ANA_LEARNDISC,
1405e256365SVladimir Oltean 	ANA_AGENCTRL,
1415e256365SVladimir Oltean 	ANA_MIRRORPORTS,
1425e256365SVladimir Oltean 	ANA_EMIRRORPORTS,
1435e256365SVladimir Oltean 	ANA_FLOODING,
1445e256365SVladimir Oltean 	ANA_FLOODING_IPMC,
1455e256365SVladimir Oltean 	ANA_SFLOW_CFG,
1465e256365SVladimir Oltean 	ANA_PORT_MODE,
1475e256365SVladimir Oltean 	ANA_CUT_THRU_CFG,
1485e256365SVladimir Oltean 	ANA_PGID_PGID,
1495e256365SVladimir Oltean 	ANA_TABLES_ANMOVED,
1505e256365SVladimir Oltean 	ANA_TABLES_MACHDATA,
1515e256365SVladimir Oltean 	ANA_TABLES_MACLDATA,
1525e256365SVladimir Oltean 	ANA_TABLES_STREAMDATA,
1535e256365SVladimir Oltean 	ANA_TABLES_MACACCESS,
1545e256365SVladimir Oltean 	ANA_TABLES_MACTINDX,
1555e256365SVladimir Oltean 	ANA_TABLES_VLANACCESS,
1565e256365SVladimir Oltean 	ANA_TABLES_VLANTIDX,
1575e256365SVladimir Oltean 	ANA_TABLES_ISDXACCESS,
1585e256365SVladimir Oltean 	ANA_TABLES_ISDXTIDX,
1595e256365SVladimir Oltean 	ANA_TABLES_ENTRYLIM,
1605e256365SVladimir Oltean 	ANA_TABLES_PTP_ID_HIGH,
1615e256365SVladimir Oltean 	ANA_TABLES_PTP_ID_LOW,
1625e256365SVladimir Oltean 	ANA_TABLES_STREAMACCESS,
1635e256365SVladimir Oltean 	ANA_TABLES_STREAMTIDX,
1645e256365SVladimir Oltean 	ANA_TABLES_SEQ_HISTORY,
1655e256365SVladimir Oltean 	ANA_TABLES_SEQ_MASK,
1665e256365SVladimir Oltean 	ANA_TABLES_SFID_MASK,
1675e256365SVladimir Oltean 	ANA_TABLES_SFIDACCESS,
1685e256365SVladimir Oltean 	ANA_TABLES_SFIDTIDX,
1695e256365SVladimir Oltean 	ANA_MSTI_STATE,
1705e256365SVladimir Oltean 	ANA_OAM_UPM_LM_CNT,
1715e256365SVladimir Oltean 	ANA_SG_ACCESS_CTRL,
1725e256365SVladimir Oltean 	ANA_SG_CONFIG_REG_1,
1735e256365SVladimir Oltean 	ANA_SG_CONFIG_REG_2,
1745e256365SVladimir Oltean 	ANA_SG_CONFIG_REG_3,
1755e256365SVladimir Oltean 	ANA_SG_CONFIG_REG_4,
1765e256365SVladimir Oltean 	ANA_SG_CONFIG_REG_5,
1775e256365SVladimir Oltean 	ANA_SG_GCL_GS_CONFIG,
1785e256365SVladimir Oltean 	ANA_SG_GCL_TI_CONFIG,
1795e256365SVladimir Oltean 	ANA_SG_STATUS_REG_1,
1805e256365SVladimir Oltean 	ANA_SG_STATUS_REG_2,
1815e256365SVladimir Oltean 	ANA_SG_STATUS_REG_3,
1825e256365SVladimir Oltean 	ANA_PORT_VLAN_CFG,
1835e256365SVladimir Oltean 	ANA_PORT_DROP_CFG,
1845e256365SVladimir Oltean 	ANA_PORT_QOS_CFG,
1855e256365SVladimir Oltean 	ANA_PORT_VCAP_CFG,
1865e256365SVladimir Oltean 	ANA_PORT_VCAP_S1_KEY_CFG,
1875e256365SVladimir Oltean 	ANA_PORT_VCAP_S2_CFG,
1885e256365SVladimir Oltean 	ANA_PORT_PCP_DEI_MAP,
1895e256365SVladimir Oltean 	ANA_PORT_CPU_FWD_CFG,
1905e256365SVladimir Oltean 	ANA_PORT_CPU_FWD_BPDU_CFG,
1915e256365SVladimir Oltean 	ANA_PORT_CPU_FWD_GARP_CFG,
1925e256365SVladimir Oltean 	ANA_PORT_CPU_FWD_CCM_CFG,
1935e256365SVladimir Oltean 	ANA_PORT_PORT_CFG,
1945e256365SVladimir Oltean 	ANA_PORT_POL_CFG,
1955e256365SVladimir Oltean 	ANA_PORT_PTP_CFG,
1965e256365SVladimir Oltean 	ANA_PORT_PTP_DLY1_CFG,
1975e256365SVladimir Oltean 	ANA_PORT_PTP_DLY2_CFG,
1985e256365SVladimir Oltean 	ANA_PORT_SFID_CFG,
1995e256365SVladimir Oltean 	ANA_PFC_PFC_CFG,
2005e256365SVladimir Oltean 	ANA_PFC_PFC_TIMER,
2015e256365SVladimir Oltean 	ANA_IPT_OAM_MEP_CFG,
2025e256365SVladimir Oltean 	ANA_IPT_IPT,
2035e256365SVladimir Oltean 	ANA_PPT_PPT,
2045e256365SVladimir Oltean 	ANA_FID_MAP_FID_MAP,
2055e256365SVladimir Oltean 	ANA_AGGR_CFG,
2065e256365SVladimir Oltean 	ANA_CPUQ_CFG,
2075e256365SVladimir Oltean 	ANA_CPUQ_CFG2,
2085e256365SVladimir Oltean 	ANA_CPUQ_8021_CFG,
2095e256365SVladimir Oltean 	ANA_DSCP_CFG,
2105e256365SVladimir Oltean 	ANA_DSCP_REWR_CFG,
2115e256365SVladimir Oltean 	ANA_VCAP_RNG_TYPE_CFG,
2125e256365SVladimir Oltean 	ANA_VCAP_RNG_VAL_CFG,
2135e256365SVladimir Oltean 	ANA_VRAP_CFG,
2145e256365SVladimir Oltean 	ANA_VRAP_HDR_DATA,
2155e256365SVladimir Oltean 	ANA_VRAP_HDR_MASK,
2165e256365SVladimir Oltean 	ANA_DISCARD_CFG,
2175e256365SVladimir Oltean 	ANA_FID_CFG,
2185e256365SVladimir Oltean 	ANA_POL_PIR_CFG,
2195e256365SVladimir Oltean 	ANA_POL_CIR_CFG,
2205e256365SVladimir Oltean 	ANA_POL_MODE_CFG,
2215e256365SVladimir Oltean 	ANA_POL_PIR_STATE,
2225e256365SVladimir Oltean 	ANA_POL_CIR_STATE,
2235e256365SVladimir Oltean 	ANA_POL_STATE,
2245e256365SVladimir Oltean 	ANA_POL_FLOWC,
2255e256365SVladimir Oltean 	ANA_POL_HYST,
2265e256365SVladimir Oltean 	ANA_POL_MISC_CFG,
2275e256365SVladimir Oltean 	QS_XTR_GRP_CFG = QS << TARGET_OFFSET,
2285e256365SVladimir Oltean 	QS_XTR_RD,
2295e256365SVladimir Oltean 	QS_XTR_FRM_PRUNING,
2305e256365SVladimir Oltean 	QS_XTR_FLUSH,
2315e256365SVladimir Oltean 	QS_XTR_DATA_PRESENT,
2325e256365SVladimir Oltean 	QS_XTR_CFG,
2335e256365SVladimir Oltean 	QS_INJ_GRP_CFG,
2345e256365SVladimir Oltean 	QS_INJ_WR,
2355e256365SVladimir Oltean 	QS_INJ_CTRL,
2365e256365SVladimir Oltean 	QS_INJ_STATUS,
2375e256365SVladimir Oltean 	QS_INJ_ERR,
2385e256365SVladimir Oltean 	QS_INH_DBG,
2395e256365SVladimir Oltean 	QSYS_PORT_MODE = QSYS << TARGET_OFFSET,
2405e256365SVladimir Oltean 	QSYS_SWITCH_PORT_MODE,
2415e256365SVladimir Oltean 	QSYS_STAT_CNT_CFG,
2425e256365SVladimir Oltean 	QSYS_EEE_CFG,
2435e256365SVladimir Oltean 	QSYS_EEE_THRES,
2445e256365SVladimir Oltean 	QSYS_IGR_NO_SHARING,
2455e256365SVladimir Oltean 	QSYS_EGR_NO_SHARING,
2465e256365SVladimir Oltean 	QSYS_SW_STATUS,
2475e256365SVladimir Oltean 	QSYS_EXT_CPU_CFG,
2485e256365SVladimir Oltean 	QSYS_PAD_CFG,
2495e256365SVladimir Oltean 	QSYS_CPU_GROUP_MAP,
2505e256365SVladimir Oltean 	QSYS_QMAP,
2515e256365SVladimir Oltean 	QSYS_ISDX_SGRP,
2525e256365SVladimir Oltean 	QSYS_TIMED_FRAME_ENTRY,
2535e256365SVladimir Oltean 	QSYS_TFRM_MISC,
2545e256365SVladimir Oltean 	QSYS_TFRM_PORT_DLY,
2555e256365SVladimir Oltean 	QSYS_TFRM_TIMER_CFG_1,
2565e256365SVladimir Oltean 	QSYS_TFRM_TIMER_CFG_2,
2575e256365SVladimir Oltean 	QSYS_TFRM_TIMER_CFG_3,
2585e256365SVladimir Oltean 	QSYS_TFRM_TIMER_CFG_4,
2595e256365SVladimir Oltean 	QSYS_TFRM_TIMER_CFG_5,
2605e256365SVladimir Oltean 	QSYS_TFRM_TIMER_CFG_6,
2615e256365SVladimir Oltean 	QSYS_TFRM_TIMER_CFG_7,
2625e256365SVladimir Oltean 	QSYS_TFRM_TIMER_CFG_8,
2635e256365SVladimir Oltean 	QSYS_RED_PROFILE,
2645e256365SVladimir Oltean 	QSYS_RES_QOS_MODE,
2655e256365SVladimir Oltean 	QSYS_RES_CFG,
2665e256365SVladimir Oltean 	QSYS_RES_STAT,
2675e256365SVladimir Oltean 	QSYS_EGR_DROP_MODE,
2685e256365SVladimir Oltean 	QSYS_EQ_CTRL,
2695e256365SVladimir Oltean 	QSYS_EVENTS_CORE,
2705e256365SVladimir Oltean 	QSYS_QMAXSDU_CFG_0,
2715e256365SVladimir Oltean 	QSYS_QMAXSDU_CFG_1,
2725e256365SVladimir Oltean 	QSYS_QMAXSDU_CFG_2,
2735e256365SVladimir Oltean 	QSYS_QMAXSDU_CFG_3,
2745e256365SVladimir Oltean 	QSYS_QMAXSDU_CFG_4,
2755e256365SVladimir Oltean 	QSYS_QMAXSDU_CFG_5,
2765e256365SVladimir Oltean 	QSYS_QMAXSDU_CFG_6,
2775e256365SVladimir Oltean 	QSYS_QMAXSDU_CFG_7,
2785e256365SVladimir Oltean 	QSYS_PREEMPTION_CFG,
2795e256365SVladimir Oltean 	QSYS_CIR_CFG,
2805e256365SVladimir Oltean 	QSYS_EIR_CFG,
2815e256365SVladimir Oltean 	QSYS_SE_CFG,
2825e256365SVladimir Oltean 	QSYS_SE_DWRR_CFG,
2835e256365SVladimir Oltean 	QSYS_SE_CONNECT,
2845e256365SVladimir Oltean 	QSYS_SE_DLB_SENSE,
2855e256365SVladimir Oltean 	QSYS_CIR_STATE,
2865e256365SVladimir Oltean 	QSYS_EIR_STATE,
2875e256365SVladimir Oltean 	QSYS_SE_STATE,
2885e256365SVladimir Oltean 	QSYS_HSCH_MISC_CFG,
2895e256365SVladimir Oltean 	QSYS_TAG_CONFIG,
2905e256365SVladimir Oltean 	QSYS_TAS_PARAM_CFG_CTRL,
2915e256365SVladimir Oltean 	QSYS_PORT_MAX_SDU,
2925e256365SVladimir Oltean 	QSYS_PARAM_CFG_REG_1,
2935e256365SVladimir Oltean 	QSYS_PARAM_CFG_REG_2,
2945e256365SVladimir Oltean 	QSYS_PARAM_CFG_REG_3,
2955e256365SVladimir Oltean 	QSYS_PARAM_CFG_REG_4,
2965e256365SVladimir Oltean 	QSYS_PARAM_CFG_REG_5,
2975e256365SVladimir Oltean 	QSYS_GCL_CFG_REG_1,
2985e256365SVladimir Oltean 	QSYS_GCL_CFG_REG_2,
2995e256365SVladimir Oltean 	QSYS_PARAM_STATUS_REG_1,
3005e256365SVladimir Oltean 	QSYS_PARAM_STATUS_REG_2,
3015e256365SVladimir Oltean 	QSYS_PARAM_STATUS_REG_3,
3025e256365SVladimir Oltean 	QSYS_PARAM_STATUS_REG_4,
3035e256365SVladimir Oltean 	QSYS_PARAM_STATUS_REG_5,
3045e256365SVladimir Oltean 	QSYS_PARAM_STATUS_REG_6,
3055e256365SVladimir Oltean 	QSYS_PARAM_STATUS_REG_7,
3065e256365SVladimir Oltean 	QSYS_PARAM_STATUS_REG_8,
3075e256365SVladimir Oltean 	QSYS_PARAM_STATUS_REG_9,
3085e256365SVladimir Oltean 	QSYS_GCL_STATUS_REG_1,
3095e256365SVladimir Oltean 	QSYS_GCL_STATUS_REG_2,
3105e256365SVladimir Oltean 	REW_PORT_VLAN_CFG = REW << TARGET_OFFSET,
3115e256365SVladimir Oltean 	REW_TAG_CFG,
3125e256365SVladimir Oltean 	REW_PORT_CFG,
3135e256365SVladimir Oltean 	REW_DSCP_CFG,
3145e256365SVladimir Oltean 	REW_PCP_DEI_QOS_MAP_CFG,
3155e256365SVladimir Oltean 	REW_PTP_CFG,
3165e256365SVladimir Oltean 	REW_PTP_DLY1_CFG,
3175e256365SVladimir Oltean 	REW_RED_TAG_CFG,
3185e256365SVladimir Oltean 	REW_DSCP_REMAP_DP1_CFG,
3195e256365SVladimir Oltean 	REW_DSCP_REMAP_CFG,
3205e256365SVladimir Oltean 	REW_STAT_CFG,
3215e256365SVladimir Oltean 	REW_REW_STICKY,
3225e256365SVladimir Oltean 	REW_PPT,
3235e256365SVladimir Oltean 	SYS_COUNT_RX_OCTETS = SYS << TARGET_OFFSET,
3245e256365SVladimir Oltean 	SYS_COUNT_RX_UNICAST,
3255e256365SVladimir Oltean 	SYS_COUNT_RX_MULTICAST,
3265e256365SVladimir Oltean 	SYS_COUNT_RX_BROADCAST,
3275e256365SVladimir Oltean 	SYS_COUNT_RX_SHORTS,
3285e256365SVladimir Oltean 	SYS_COUNT_RX_FRAGMENTS,
3295e256365SVladimir Oltean 	SYS_COUNT_RX_JABBERS,
3305e256365SVladimir Oltean 	SYS_COUNT_RX_CRC_ALIGN_ERRS,
3315e256365SVladimir Oltean 	SYS_COUNT_RX_SYM_ERRS,
3325e256365SVladimir Oltean 	SYS_COUNT_RX_64,
3335e256365SVladimir Oltean 	SYS_COUNT_RX_65_127,
3345e256365SVladimir Oltean 	SYS_COUNT_RX_128_255,
3355152de7bSVladimir Oltean 	SYS_COUNT_RX_256_511,
3365152de7bSVladimir Oltean 	SYS_COUNT_RX_512_1023,
3375e256365SVladimir Oltean 	SYS_COUNT_RX_1024_1526,
3385e256365SVladimir Oltean 	SYS_COUNT_RX_1527_MAX,
3395e256365SVladimir Oltean 	SYS_COUNT_RX_PAUSE,
3405e256365SVladimir Oltean 	SYS_COUNT_RX_CONTROL,
3415e256365SVladimir Oltean 	SYS_COUNT_RX_LONGS,
3425e256365SVladimir Oltean 	SYS_COUNT_RX_CLASSIFIED_DROPS,
343d4c36765SVladimir Oltean 	SYS_COUNT_RX_RED_PRIO_0,
344d4c36765SVladimir Oltean 	SYS_COUNT_RX_RED_PRIO_1,
345d4c36765SVladimir Oltean 	SYS_COUNT_RX_RED_PRIO_2,
346d4c36765SVladimir Oltean 	SYS_COUNT_RX_RED_PRIO_3,
347d4c36765SVladimir Oltean 	SYS_COUNT_RX_RED_PRIO_4,
348d4c36765SVladimir Oltean 	SYS_COUNT_RX_RED_PRIO_5,
349d4c36765SVladimir Oltean 	SYS_COUNT_RX_RED_PRIO_6,
350d4c36765SVladimir Oltean 	SYS_COUNT_RX_RED_PRIO_7,
351d4c36765SVladimir Oltean 	SYS_COUNT_RX_YELLOW_PRIO_0,
352d4c36765SVladimir Oltean 	SYS_COUNT_RX_YELLOW_PRIO_1,
353d4c36765SVladimir Oltean 	SYS_COUNT_RX_YELLOW_PRIO_2,
354d4c36765SVladimir Oltean 	SYS_COUNT_RX_YELLOW_PRIO_3,
355d4c36765SVladimir Oltean 	SYS_COUNT_RX_YELLOW_PRIO_4,
356d4c36765SVladimir Oltean 	SYS_COUNT_RX_YELLOW_PRIO_5,
357d4c36765SVladimir Oltean 	SYS_COUNT_RX_YELLOW_PRIO_6,
358d4c36765SVladimir Oltean 	SYS_COUNT_RX_YELLOW_PRIO_7,
359d4c36765SVladimir Oltean 	SYS_COUNT_RX_GREEN_PRIO_0,
360d4c36765SVladimir Oltean 	SYS_COUNT_RX_GREEN_PRIO_1,
361d4c36765SVladimir Oltean 	SYS_COUNT_RX_GREEN_PRIO_2,
362d4c36765SVladimir Oltean 	SYS_COUNT_RX_GREEN_PRIO_3,
363d4c36765SVladimir Oltean 	SYS_COUNT_RX_GREEN_PRIO_4,
364d4c36765SVladimir Oltean 	SYS_COUNT_RX_GREEN_PRIO_5,
365d4c36765SVladimir Oltean 	SYS_COUNT_RX_GREEN_PRIO_6,
366d4c36765SVladimir Oltean 	SYS_COUNT_RX_GREEN_PRIO_7,
367ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_ASSEMBLY_ERRS,
368ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_SMD_ERRS,
369ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_ASSEMBLY_OK,
370ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_MERGE_FRAGMENTS,
371ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_OCTETS,
372ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_UNICAST,
373ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_MULTICAST,
374ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_BROADCAST,
375ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_SHORTS,
376ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_FRAGMENTS,
377ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_JABBERS,
378ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_CRC_ALIGN_ERRS,
379ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_SYM_ERRS,
380ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_64,
381ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_65_127,
382ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_128_255,
383ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_256_511,
384ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_512_1023,
385ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_1024_1526,
386ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_1527_MAX,
387ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_PAUSE,
388ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_CONTROL,
389ab3f97a9SVladimir Oltean 	SYS_COUNT_RX_PMAC_LONGS,
3905e256365SVladimir Oltean 	SYS_COUNT_TX_OCTETS,
3915e256365SVladimir Oltean 	SYS_COUNT_TX_UNICAST,
3925e256365SVladimir Oltean 	SYS_COUNT_TX_MULTICAST,
3935e256365SVladimir Oltean 	SYS_COUNT_TX_BROADCAST,
3945e256365SVladimir Oltean 	SYS_COUNT_TX_COLLISION,
3955e256365SVladimir Oltean 	SYS_COUNT_TX_DROPS,
3965e256365SVladimir Oltean 	SYS_COUNT_TX_PAUSE,
3975e256365SVladimir Oltean 	SYS_COUNT_TX_64,
3985e256365SVladimir Oltean 	SYS_COUNT_TX_65_127,
3995152de7bSVladimir Oltean 	SYS_COUNT_TX_128_255,
4005152de7bSVladimir Oltean 	SYS_COUNT_TX_256_511,
4015e256365SVladimir Oltean 	SYS_COUNT_TX_512_1023,
4025e256365SVladimir Oltean 	SYS_COUNT_TX_1024_1526,
4035e256365SVladimir Oltean 	SYS_COUNT_TX_1527_MAX,
404d4c36765SVladimir Oltean 	SYS_COUNT_TX_YELLOW_PRIO_0,
405d4c36765SVladimir Oltean 	SYS_COUNT_TX_YELLOW_PRIO_1,
406d4c36765SVladimir Oltean 	SYS_COUNT_TX_YELLOW_PRIO_2,
407d4c36765SVladimir Oltean 	SYS_COUNT_TX_YELLOW_PRIO_3,
408d4c36765SVladimir Oltean 	SYS_COUNT_TX_YELLOW_PRIO_4,
409d4c36765SVladimir Oltean 	SYS_COUNT_TX_YELLOW_PRIO_5,
410d4c36765SVladimir Oltean 	SYS_COUNT_TX_YELLOW_PRIO_6,
411d4c36765SVladimir Oltean 	SYS_COUNT_TX_YELLOW_PRIO_7,
412d4c36765SVladimir Oltean 	SYS_COUNT_TX_GREEN_PRIO_0,
413d4c36765SVladimir Oltean 	SYS_COUNT_TX_GREEN_PRIO_1,
414d4c36765SVladimir Oltean 	SYS_COUNT_TX_GREEN_PRIO_2,
415d4c36765SVladimir Oltean 	SYS_COUNT_TX_GREEN_PRIO_3,
416d4c36765SVladimir Oltean 	SYS_COUNT_TX_GREEN_PRIO_4,
417d4c36765SVladimir Oltean 	SYS_COUNT_TX_GREEN_PRIO_5,
418d4c36765SVladimir Oltean 	SYS_COUNT_TX_GREEN_PRIO_6,
419d4c36765SVladimir Oltean 	SYS_COUNT_TX_GREEN_PRIO_7,
420be5c13f2SVladimir Oltean 	SYS_COUNT_TX_AGED,
421ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_MM_HOLD,
422ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_MERGE_FRAGMENTS,
423ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_PMAC_OCTETS,
424ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_PMAC_UNICAST,
425ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_PMAC_MULTICAST,
426ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_PMAC_BROADCAST,
427ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_PMAC_PAUSE,
428ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_PMAC_64,
429ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_PMAC_65_127,
430ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_PMAC_128_255,
431ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_PMAC_256_511,
432ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_PMAC_512_1023,
433ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_PMAC_1024_1526,
434ab3f97a9SVladimir Oltean 	SYS_COUNT_TX_PMAC_1527_MAX,
435d4c36765SVladimir Oltean 	SYS_COUNT_DROP_LOCAL,
436d4c36765SVladimir Oltean 	SYS_COUNT_DROP_TAIL,
437d4c36765SVladimir Oltean 	SYS_COUNT_DROP_YELLOW_PRIO_0,
438d4c36765SVladimir Oltean 	SYS_COUNT_DROP_YELLOW_PRIO_1,
439d4c36765SVladimir Oltean 	SYS_COUNT_DROP_YELLOW_PRIO_2,
440d4c36765SVladimir Oltean 	SYS_COUNT_DROP_YELLOW_PRIO_3,
441d4c36765SVladimir Oltean 	SYS_COUNT_DROP_YELLOW_PRIO_4,
442d4c36765SVladimir Oltean 	SYS_COUNT_DROP_YELLOW_PRIO_5,
443d4c36765SVladimir Oltean 	SYS_COUNT_DROP_YELLOW_PRIO_6,
444d4c36765SVladimir Oltean 	SYS_COUNT_DROP_YELLOW_PRIO_7,
445d4c36765SVladimir Oltean 	SYS_COUNT_DROP_GREEN_PRIO_0,
446d4c36765SVladimir Oltean 	SYS_COUNT_DROP_GREEN_PRIO_1,
447d4c36765SVladimir Oltean 	SYS_COUNT_DROP_GREEN_PRIO_2,
448d4c36765SVladimir Oltean 	SYS_COUNT_DROP_GREEN_PRIO_3,
449d4c36765SVladimir Oltean 	SYS_COUNT_DROP_GREEN_PRIO_4,
450d4c36765SVladimir Oltean 	SYS_COUNT_DROP_GREEN_PRIO_5,
451d4c36765SVladimir Oltean 	SYS_COUNT_DROP_GREEN_PRIO_6,
452d4c36765SVladimir Oltean 	SYS_COUNT_DROP_GREEN_PRIO_7,
4530a2360c5SVladimir Oltean 	SYS_COUNT_SF_MATCHING_FRAMES,
4540a2360c5SVladimir Oltean 	SYS_COUNT_SF_NOT_PASSING_FRAMES,
4550a2360c5SVladimir Oltean 	SYS_COUNT_SF_NOT_PASSING_SDU,
4560a2360c5SVladimir Oltean 	SYS_COUNT_SF_RED_FRAMES,
4575e256365SVladimir Oltean 	SYS_RESET_CFG,
4585e256365SVladimir Oltean 	SYS_SR_ETYPE_CFG,
4595e256365SVladimir Oltean 	SYS_VLAN_ETYPE_CFG,
4605e256365SVladimir Oltean 	SYS_PORT_MODE,
4615e256365SVladimir Oltean 	SYS_FRONT_PORT_MODE,
4625e256365SVladimir Oltean 	SYS_FRM_AGING,
4635e256365SVladimir Oltean 	SYS_STAT_CFG,
4645e256365SVladimir Oltean 	SYS_SW_STATUS,
4655e256365SVladimir Oltean 	SYS_MISC_CFG,
4665e256365SVladimir Oltean 	SYS_REW_MAC_HIGH_CFG,
4675e256365SVladimir Oltean 	SYS_REW_MAC_LOW_CFG,
4685e256365SVladimir Oltean 	SYS_TIMESTAMP_OFFSET,
4695e256365SVladimir Oltean 	SYS_CMID,
4705e256365SVladimir Oltean 	SYS_PAUSE_CFG,
4715e256365SVladimir Oltean 	SYS_PAUSE_TOT_CFG,
4725e256365SVladimir Oltean 	SYS_ATOP,
4735e256365SVladimir Oltean 	SYS_ATOP_TOT_CFG,
4745e256365SVladimir Oltean 	SYS_MAC_FC_CFG,
4755e256365SVladimir Oltean 	SYS_MMGT,
4765e256365SVladimir Oltean 	SYS_MMGT_FAST,
4775e256365SVladimir Oltean 	SYS_EVENTS_DIF,
4785e256365SVladimir Oltean 	SYS_EVENTS_CORE,
4795e256365SVladimir Oltean 	SYS_PTP_STATUS,
4805e256365SVladimir Oltean 	SYS_PTP_TXSTAMP,
4815e256365SVladimir Oltean 	SYS_PTP_NXT,
4825e256365SVladimir Oltean 	SYS_PTP_CFG,
4835e256365SVladimir Oltean 	SYS_RAM_INIT,
4845e256365SVladimir Oltean 	SYS_CM_ADDR,
4855e256365SVladimir Oltean 	SYS_CM_DATA_WR,
4865e256365SVladimir Oltean 	SYS_CM_DATA_RD,
4875e256365SVladimir Oltean 	SYS_CM_OP,
4885e256365SVladimir Oltean 	SYS_CM_DATA,
4895e256365SVladimir Oltean 	PTP_PIN_CFG = PTP << TARGET_OFFSET,
4905e256365SVladimir Oltean 	PTP_PIN_TOD_SEC_MSB,
4915e256365SVladimir Oltean 	PTP_PIN_TOD_SEC_LSB,
4925e256365SVladimir Oltean 	PTP_PIN_TOD_NSEC,
49394aca082SYangbo Lu 	PTP_PIN_WF_HIGH_PERIOD,
49494aca082SYangbo Lu 	PTP_PIN_WF_LOW_PERIOD,
4955e256365SVladimir Oltean 	PTP_CFG_MISC,
4965e256365SVladimir Oltean 	PTP_CLK_CFG_ADJ_CFG,
4975e256365SVladimir Oltean 	PTP_CLK_CFG_ADJ_FREQ,
4985e256365SVladimir Oltean 	GCB_SOFT_RST = GCB << TARGET_OFFSET,
4992789658fSMaxim Kochetkov 	GCB_MIIM_MII_STATUS,
5002789658fSMaxim Kochetkov 	GCB_MIIM_MII_CMD,
5012789658fSMaxim Kochetkov 	GCB_MIIM_MII_DATA,
50291c724cfSVladimir Oltean 	DEV_CLOCK_CFG = DEV_GMII << TARGET_OFFSET,
50391c724cfSVladimir Oltean 	DEV_PORT_MISC,
50491c724cfSVladimir Oltean 	DEV_EVENTS,
50591c724cfSVladimir Oltean 	DEV_EEE_CFG,
50691c724cfSVladimir Oltean 	DEV_RX_PATH_DELAY,
50791c724cfSVladimir Oltean 	DEV_TX_PATH_DELAY,
50891c724cfSVladimir Oltean 	DEV_PTP_PREDICT_CFG,
50991c724cfSVladimir Oltean 	DEV_MAC_ENA_CFG,
51091c724cfSVladimir Oltean 	DEV_MAC_MODE_CFG,
51191c724cfSVladimir Oltean 	DEV_MAC_MAXLEN_CFG,
51291c724cfSVladimir Oltean 	DEV_MAC_TAGS_CFG,
51391c724cfSVladimir Oltean 	DEV_MAC_ADV_CHK_CFG,
51491c724cfSVladimir Oltean 	DEV_MAC_IFG_CFG,
51591c724cfSVladimir Oltean 	DEV_MAC_HDX_CFG,
51691c724cfSVladimir Oltean 	DEV_MAC_DBG_CFG,
51791c724cfSVladimir Oltean 	DEV_MAC_FC_MAC_LOW_CFG,
51891c724cfSVladimir Oltean 	DEV_MAC_FC_MAC_HIGH_CFG,
51991c724cfSVladimir Oltean 	DEV_MAC_STICKY,
5206505b680SVladimir Oltean 	DEV_MM_ENABLE_CONFIG,
5216505b680SVladimir Oltean 	DEV_MM_VERIF_CONFIG,
5226505b680SVladimir Oltean 	DEV_MM_STATUS,
52391c724cfSVladimir Oltean 	PCS1G_CFG,
52491c724cfSVladimir Oltean 	PCS1G_MODE_CFG,
52591c724cfSVladimir Oltean 	PCS1G_SD_CFG,
52691c724cfSVladimir Oltean 	PCS1G_ANEG_CFG,
52791c724cfSVladimir Oltean 	PCS1G_ANEG_NP_CFG,
52891c724cfSVladimir Oltean 	PCS1G_LB_CFG,
52991c724cfSVladimir Oltean 	PCS1G_DBG_CFG,
53091c724cfSVladimir Oltean 	PCS1G_CDET_CFG,
53191c724cfSVladimir Oltean 	PCS1G_ANEG_STATUS,
53291c724cfSVladimir Oltean 	PCS1G_ANEG_NP_STATUS,
53391c724cfSVladimir Oltean 	PCS1G_LINK_STATUS,
53491c724cfSVladimir Oltean 	PCS1G_LINK_DOWN_CNT,
53591c724cfSVladimir Oltean 	PCS1G_STICKY,
53691c724cfSVladimir Oltean 	PCS1G_DEBUG_STATUS,
53791c724cfSVladimir Oltean 	PCS1G_LPI_CFG,
53891c724cfSVladimir Oltean 	PCS1G_LPI_WAKE_ERROR_CNT,
53991c724cfSVladimir Oltean 	PCS1G_LPI_STATUS,
54091c724cfSVladimir Oltean 	PCS1G_TSTPAT_MODE_CFG,
54191c724cfSVladimir Oltean 	PCS1G_TSTPAT_STATUS,
54291c724cfSVladimir Oltean 	DEV_PCS_FX100_CFG,
54391c724cfSVladimir Oltean 	DEV_PCS_FX100_STATUS,
5445e256365SVladimir Oltean };
5455e256365SVladimir Oltean 
5465e256365SVladimir Oltean enum ocelot_regfield {
5475e256365SVladimir Oltean 	ANA_ADVLEARN_VLAN_CHK,
5485e256365SVladimir Oltean 	ANA_ADVLEARN_LEARN_MIRROR,
5495e256365SVladimir Oltean 	ANA_ANEVENTS_FLOOD_DISCARD,
5505e256365SVladimir Oltean 	ANA_ANEVENTS_MSTI_DROP,
5515e256365SVladimir Oltean 	ANA_ANEVENTS_ACLKILL,
5525e256365SVladimir Oltean 	ANA_ANEVENTS_ACLUSED,
5535e256365SVladimir Oltean 	ANA_ANEVENTS_AUTOAGE,
5545e256365SVladimir Oltean 	ANA_ANEVENTS_VS2TTL1,
5555e256365SVladimir Oltean 	ANA_ANEVENTS_STORM_DROP,
5565e256365SVladimir Oltean 	ANA_ANEVENTS_LEARN_DROP,
5575e256365SVladimir Oltean 	ANA_ANEVENTS_AGED_ENTRY,
5585e256365SVladimir Oltean 	ANA_ANEVENTS_CPU_LEARN_FAILED,
5595e256365SVladimir Oltean 	ANA_ANEVENTS_AUTO_LEARN_FAILED,
5605e256365SVladimir Oltean 	ANA_ANEVENTS_LEARN_REMOVE,
5615e256365SVladimir Oltean 	ANA_ANEVENTS_AUTO_LEARNED,
5625e256365SVladimir Oltean 	ANA_ANEVENTS_AUTO_MOVED,
5635e256365SVladimir Oltean 	ANA_ANEVENTS_DROPPED,
5645e256365SVladimir Oltean 	ANA_ANEVENTS_CLASSIFIED_DROP,
5655e256365SVladimir Oltean 	ANA_ANEVENTS_CLASSIFIED_COPY,
5665e256365SVladimir Oltean 	ANA_ANEVENTS_VLAN_DISCARD,
5675e256365SVladimir Oltean 	ANA_ANEVENTS_FWD_DISCARD,
5685e256365SVladimir Oltean 	ANA_ANEVENTS_MULTICAST_FLOOD,
5695e256365SVladimir Oltean 	ANA_ANEVENTS_UNICAST_FLOOD,
5705e256365SVladimir Oltean 	ANA_ANEVENTS_DEST_KNOWN,
5715e256365SVladimir Oltean 	ANA_ANEVENTS_BUCKET3_MATCH,
5725e256365SVladimir Oltean 	ANA_ANEVENTS_BUCKET2_MATCH,
5735e256365SVladimir Oltean 	ANA_ANEVENTS_BUCKET1_MATCH,
5745e256365SVladimir Oltean 	ANA_ANEVENTS_BUCKET0_MATCH,
5755e256365SVladimir Oltean 	ANA_ANEVENTS_CPU_OPERATION,
5765e256365SVladimir Oltean 	ANA_ANEVENTS_DMAC_LOOKUP,
5775e256365SVladimir Oltean 	ANA_ANEVENTS_SMAC_LOOKUP,
5785e256365SVladimir Oltean 	ANA_ANEVENTS_SEQ_GEN_ERR_0,
5795e256365SVladimir Oltean 	ANA_ANEVENTS_SEQ_GEN_ERR_1,
5805e256365SVladimir Oltean 	ANA_TABLES_MACACCESS_B_DOM,
5815e256365SVladimir Oltean 	ANA_TABLES_MACTINDX_BUCKET,
5825e256365SVladimir Oltean 	ANA_TABLES_MACTINDX_M_INDEX,
583886e1387SVladimir Oltean 	QSYS_SWITCH_PORT_MODE_PORT_ENA,
584886e1387SVladimir Oltean 	QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG,
585886e1387SVladimir Oltean 	QSYS_SWITCH_PORT_MODE_YEL_RSRVD,
586886e1387SVladimir Oltean 	QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE,
587886e1387SVladimir Oltean 	QSYS_SWITCH_PORT_MODE_TX_PFC_ENA,
588886e1387SVladimir Oltean 	QSYS_SWITCH_PORT_MODE_TX_PFC_MODE,
5895e256365SVladimir Oltean 	QSYS_TIMED_FRAME_ENTRY_TFRM_VLD,
5905e256365SVladimir Oltean 	QSYS_TIMED_FRAME_ENTRY_TFRM_FP,
5915e256365SVladimir Oltean 	QSYS_TIMED_FRAME_ENTRY_TFRM_PORTNO,
5925e256365SVladimir Oltean 	QSYS_TIMED_FRAME_ENTRY_TFRM_TM_SEL,
5935e256365SVladimir Oltean 	QSYS_TIMED_FRAME_ENTRY_TFRM_TM_T,
594886e1387SVladimir Oltean 	SYS_PORT_MODE_DATA_WO_TS,
595886e1387SVladimir Oltean 	SYS_PORT_MODE_INCL_INJ_HDR,
596886e1387SVladimir Oltean 	SYS_PORT_MODE_INCL_XTR_HDR,
597886e1387SVladimir Oltean 	SYS_PORT_MODE_INCL_HDR_ERR,
5985e256365SVladimir Oltean 	SYS_RESET_CFG_CORE_ENA,
5995e256365SVladimir Oltean 	SYS_RESET_CFG_MEM_ENA,
6005e256365SVladimir Oltean 	SYS_RESET_CFG_MEM_INIT,
6015e256365SVladimir Oltean 	GCB_SOFT_RST_SWC_RST,
6022789658fSMaxim Kochetkov 	GCB_MIIM_MII_STATUS_PENDING,
6032789658fSMaxim Kochetkov 	GCB_MIIM_MII_STATUS_BUSY,
604541132f0SMaxim Kochetkov 	SYS_PAUSE_CFG_PAUSE_START,
605541132f0SMaxim Kochetkov 	SYS_PAUSE_CFG_PAUSE_STOP,
606541132f0SMaxim Kochetkov 	SYS_PAUSE_CFG_PAUSE_ENA,
6075e256365SVladimir Oltean 	REGFIELD_MAX
6085e256365SVladimir Oltean };
6095e256365SVladimir Oltean 
610c1c3993eSVladimir Oltean enum {
611c1c3993eSVladimir Oltean 	/* VCAP_CORE_CFG */
612c1c3993eSVladimir Oltean 	VCAP_CORE_UPDATE_CTRL,
613c1c3993eSVladimir Oltean 	VCAP_CORE_MV_CFG,
614c1c3993eSVladimir Oltean 	/* VCAP_CORE_CACHE */
615c1c3993eSVladimir Oltean 	VCAP_CACHE_ENTRY_DAT,
616c1c3993eSVladimir Oltean 	VCAP_CACHE_MASK_DAT,
617c1c3993eSVladimir Oltean 	VCAP_CACHE_ACTION_DAT,
618c1c3993eSVladimir Oltean 	VCAP_CACHE_CNT_DAT,
619c1c3993eSVladimir Oltean 	VCAP_CACHE_TG_DAT,
62020968054SVladimir Oltean 	/* VCAP_CONST */
62120968054SVladimir Oltean 	VCAP_CONST_VCAP_VER,
62220968054SVladimir Oltean 	VCAP_CONST_ENTRY_WIDTH,
62320968054SVladimir Oltean 	VCAP_CONST_ENTRY_CNT,
62420968054SVladimir Oltean 	VCAP_CONST_ENTRY_SWCNT,
62520968054SVladimir Oltean 	VCAP_CONST_ENTRY_TG_WIDTH,
62620968054SVladimir Oltean 	VCAP_CONST_ACTION_DEF_CNT,
62720968054SVladimir Oltean 	VCAP_CONST_ACTION_WIDTH,
62820968054SVladimir Oltean 	VCAP_CONST_CNT_WIDTH,
62920968054SVladimir Oltean 	VCAP_CONST_CORE_CNT,
63020968054SVladimir Oltean 	VCAP_CONST_IF_CNT,
631c1c3993eSVladimir Oltean };
632c1c3993eSVladimir Oltean 
6333007bc73SYangbo Lu enum ocelot_ptp_pins {
6343007bc73SYangbo Lu 	PTP_PIN_0,
6353007bc73SYangbo Lu 	PTP_PIN_1,
6363007bc73SYangbo Lu 	PTP_PIN_2,
6373007bc73SYangbo Lu 	PTP_PIN_3,
6385e256365SVladimir Oltean 	TOD_ACC_PIN
6395e256365SVladimir Oltean };
6405e256365SVladimir Oltean 
6415e256365SVladimir Oltean enum ocelot_tag_prefix {
6425e256365SVladimir Oltean 	OCELOT_TAG_PREFIX_DISABLED	= 0,
6435e256365SVladimir Oltean 	OCELOT_TAG_PREFIX_NONE,
6445e256365SVladimir Oltean 	OCELOT_TAG_PREFIX_SHORT,
6455e256365SVladimir Oltean 	OCELOT_TAG_PREFIX_LONG,
6465e256365SVladimir Oltean };
6475e256365SVladimir Oltean 
6485e256365SVladimir Oltean struct ocelot;
649dfca93edSColin Foster struct device_node;
6505e256365SVladimir Oltean 
6515e256365SVladimir Oltean struct ocelot_ops {
652319e4dd1SVladimir Oltean 	struct net_device *(*port_to_netdev)(struct ocelot *ocelot, int port);
653319e4dd1SVladimir Oltean 	int (*netdev_to_port)(struct net_device *dev);
6545e256365SVladimir Oltean 	int (*reset)(struct ocelot *ocelot);
655aa92d836SMaxim Kochetkov 	u16 (*wm_enc)(u16 value);
656703b7621SVladimir Oltean 	u16 (*wm_dec)(u16 value);
657703b7621SVladimir Oltean 	void (*wm_stat)(u32 val, u32 *inuse, u32 *maxuse);
65823e2c506SXiaoliang Yang 	void (*psfp_init)(struct ocelot *ocelot);
659a7e13edfSXiaoliang Yang 	int (*psfp_filter_add)(struct ocelot *ocelot, int port,
660a7e13edfSXiaoliang Yang 			       struct flow_cls_offload *f);
66123e2c506SXiaoliang Yang 	int (*psfp_filter_del)(struct ocelot *ocelot, struct flow_cls_offload *f);
66223e2c506SXiaoliang Yang 	int (*psfp_stats_get)(struct ocelot *ocelot, struct flow_cls_offload *f,
66323e2c506SXiaoliang Yang 			      struct flow_stats *stats);
6648abe1970SVladimir Oltean 	void (*cut_through_fwd)(struct ocelot *ocelot);
6658670dc33SXiaoliang Yang 	void (*tas_clock_adjust)(struct ocelot *ocelot);
666*c6081914SVladimir Oltean 	void (*tas_guard_bands_update)(struct ocelot *ocelot, int port);
66725027c84SVladimir Oltean 	void (*update_stats)(struct ocelot *ocelot);
6685e256365SVladimir Oltean };
6695e256365SVladimir Oltean 
67077043c37SXiaoliang Yang struct ocelot_vcap_policer {
67177043c37SXiaoliang Yang 	struct list_head pol_list;
67277043c37SXiaoliang Yang 	u16 base;
67377043c37SXiaoliang Yang 	u16 max;
67477043c37SXiaoliang Yang 	u16 base2;
67577043c37SXiaoliang Yang 	u16 max2;
67677043c37SXiaoliang Yang };
67777043c37SXiaoliang Yang 
678aae4e500SVladimir Oltean struct ocelot_vcap_block {
679a56d7a34SVladimir Oltean 	struct list_head rules;
680a56d7a34SVladimir Oltean 	int count;
681a56d7a34SVladimir Oltean };
682a56d7a34SVladimir Oltean 
68390e0aa8dSVladimir Oltean struct ocelot_bridge_vlan {
68490e0aa8dSVladimir Oltean 	u16 vid;
68590e0aa8dSVladimir Oltean 	unsigned long portmask;
6860da1a1c4SVladimir Oltean 	unsigned long untagged;
68790e0aa8dSVladimir Oltean 	struct list_head list;
68890e0aa8dSVladimir Oltean };
68990e0aa8dSVladimir Oltean 
69062a22bcbSVladimir Oltean enum ocelot_port_tag_config {
69162a22bcbSVladimir Oltean 	/* all VLANs are egress-untagged */
69262a22bcbSVladimir Oltean 	OCELOT_PORT_TAG_DISABLED = 0,
69362a22bcbSVladimir Oltean 	/* all VLANs except the native VLAN and VID 0 are egress-tagged */
69462a22bcbSVladimir Oltean 	OCELOT_PORT_TAG_NATIVE = 1,
69562a22bcbSVladimir Oltean 	/* all VLANs except VID 0 are egress-tagged */
69662a22bcbSVladimir Oltean 	OCELOT_PORT_TAG_TRUNK_NO_VID0 = 2,
69762a22bcbSVladimir Oltean 	/* all VLANs are egress-tagged */
69862a22bcbSVladimir Oltean 	OCELOT_PORT_TAG_TRUNK = 3,
69962a22bcbSVladimir Oltean };
70062a22bcbSVladimir Oltean 
7017d4b564dSXiaoliang Yang struct ocelot_psfp_list {
7027d4b564dSXiaoliang Yang 	struct list_head stream_list;
7037d4b564dSXiaoliang Yang 	struct list_head sfi_list;
7047d4b564dSXiaoliang Yang 	struct list_head sgi_list;
70525027c84SVladimir Oltean 	/* Serialize access to the lists */
70625027c84SVladimir Oltean 	struct mutex lock;
7077d4b564dSXiaoliang Yang };
7087d4b564dSXiaoliang Yang 
709f59fd9caSVladimir Oltean enum ocelot_sb {
710f59fd9caSVladimir Oltean 	OCELOT_SB_BUF,
711f59fd9caSVladimir Oltean 	OCELOT_SB_REF,
712f59fd9caSVladimir Oltean 	OCELOT_SB_NUM,
713f59fd9caSVladimir Oltean };
714f59fd9caSVladimir Oltean 
715f59fd9caSVladimir Oltean enum ocelot_sb_pool {
716f59fd9caSVladimir Oltean 	OCELOT_SB_POOL_ING,
717f59fd9caSVladimir Oltean 	OCELOT_SB_POOL_EGR,
718f59fd9caSVladimir Oltean 	OCELOT_SB_POOL_NUM,
719f59fd9caSVladimir Oltean };
720f59fd9caSVladimir Oltean 
7210568c3bfSXiaoliang Yang /* MAC table entry types.
7220568c3bfSXiaoliang Yang  * ENTRYTYPE_NORMAL is subject to aging.
7230568c3bfSXiaoliang Yang  * ENTRYTYPE_LOCKED is not subject to aging.
7240568c3bfSXiaoliang Yang  * ENTRYTYPE_MACv4 is not subject to aging. For IPv4 multicast.
7250568c3bfSXiaoliang Yang  * ENTRYTYPE_MACv6 is not subject to aging. For IPv6 multicast.
7260568c3bfSXiaoliang Yang  */
7270568c3bfSXiaoliang Yang enum macaccess_entry_type {
7280568c3bfSXiaoliang Yang 	ENTRYTYPE_NORMAL = 0,
7290568c3bfSXiaoliang Yang 	ENTRYTYPE_LOCKED,
7300568c3bfSXiaoliang Yang 	ENTRYTYPE_MACv4,
7310568c3bfSXiaoliang Yang 	ENTRYTYPE_MACv6,
7320568c3bfSXiaoliang Yang };
7330568c3bfSXiaoliang Yang 
73445d0fcb5SVladimir Oltean enum ocelot_proto {
73545d0fcb5SVladimir Oltean 	OCELOT_PROTO_PTP_L2 = BIT(0),
73645d0fcb5SVladimir Oltean 	OCELOT_PROTO_PTP_L4 = BIT(1),
73745d0fcb5SVladimir Oltean };
73845d0fcb5SVladimir Oltean 
739e6e12df6SVladimir Oltean #define OCELOT_QUIRK_PCS_PERFORMS_RATE_ADAPTATION	BIT(0)
740e6e12df6SVladimir Oltean #define OCELOT_QUIRK_QSGMII_PORTS_MUST_BE_UP		BIT(1)
741e6e12df6SVladimir Oltean 
742961d8b69SVladimir Oltean struct ocelot_lag_fdb {
743961d8b69SVladimir Oltean 	unsigned char addr[ETH_ALEN];
744961d8b69SVladimir Oltean 	u16 vid;
745961d8b69SVladimir Oltean 	struct net_device *bond;
746961d8b69SVladimir Oltean 	struct list_head list;
747961d8b69SVladimir Oltean };
748961d8b69SVladimir Oltean 
749ccb6ed42SVladimir Oltean struct ocelot_mirror {
750ccb6ed42SVladimir Oltean 	refcount_t refcount;
751ccb6ed42SVladimir Oltean 	int to;
752ccb6ed42SVladimir Oltean };
753ccb6ed42SVladimir Oltean 
7546505b680SVladimir Oltean struct ocelot_mm_state {
7556505b680SVladimir Oltean 	enum ethtool_mm_verify_status verify_status;
7567bf4a5b0SVladimir Oltean 	bool tx_enabled;
7576505b680SVladimir Oltean 	bool tx_active;
758403ffc2cSVladimir Oltean 	u8 preemptible_tcs;
759403ffc2cSVladimir Oltean 	u8 active_preemptible_tcs;
7606505b680SVladimir Oltean };
7616505b680SVladimir Oltean 
762c295f983SVladimir Oltean struct ocelot_port;
763c295f983SVladimir Oltean 
7645e256365SVladimir Oltean struct ocelot_port {
7655e256365SVladimir Oltean 	struct ocelot			*ocelot;
7665e256365SVladimir Oltean 
76791c724cfSVladimir Oltean 	struct regmap			*target;
7685e256365SVladimir Oltean 
7696d0be600SVladimir Oltean 	struct net_device		*bond;
7706d0be600SVladimir Oltean 	struct net_device		*bridge;
7716d0be600SVladimir Oltean 
772c295f983SVladimir Oltean 	struct ocelot_port		*dsa_8021q_cpu;
773c295f983SVladimir Oltean 
774c3e58a75SVladimir Oltean 	/* VLAN that untagged frames are classified to, on ingress */
775d4004422SVladimir Oltean 	const struct ocelot_bridge_vlan	*pvid_vlan;
7765e256365SVladimir Oltean 
7771c9017e4SVladimir Oltean 	struct tc_taprio_qopt_offload	*taprio;
7781c9017e4SVladimir Oltean 
779ee50d07cSVladimir Oltean 	phy_interface_t			phy_mode;
78067c24049SVladimir Oltean 
7816d0be600SVladimir Oltean 	unsigned int			ptp_skbs_in_flight;
7826d0be600SVladimir Oltean 	struct sk_buff_head		tx_skbs;
7837c588c3eSHoratiu Vultur 
78445d0fcb5SVladimir Oltean 	unsigned int			trap_proto;
78545d0fcb5SVladimir Oltean 
7867c588c3eSHoratiu Vultur 	u16				mrp_ring_id;
787df291e54SVladimir Oltean 
7886d0be600SVladimir Oltean 	u8				ptp_cmd;
7896d0be600SVladimir Oltean 	u8				ts_id;
7906d0be600SVladimir Oltean 
7917e708760SVladimir Oltean 	u8				index;
7927e708760SVladimir Oltean 
793df291e54SVladimir Oltean 	u8				stp_state;
7946d0be600SVladimir Oltean 	bool				vlan_aware;
7956d0be600SVladimir Oltean 	bool				is_dsa_8021q_cpu;
7966d0be600SVladimir Oltean 	bool				learn_ena;
7976d0be600SVladimir Oltean 
7986d0be600SVladimir Oltean 	bool				lag_tx_active;
7996d0be600SVladimir Oltean 
8006d0be600SVladimir Oltean 	int				bridge_num;
8018abe1970SVladimir Oltean 
8028abe1970SVladimir Oltean 	int				speed;
8035e256365SVladimir Oltean };
8045e256365SVladimir Oltean 
8055e256365SVladimir Oltean struct ocelot {
8065e256365SVladimir Oltean 	struct device			*dev;
8076c30384eSVladimir Oltean 	struct devlink			*devlink;
8086c30384eSVladimir Oltean 	struct devlink_port		*devlink_ports;
8095e256365SVladimir Oltean 
8105e256365SVladimir Oltean 	const struct ocelot_ops		*ops;
8115e256365SVladimir Oltean 	struct regmap			*targets[TARGET_MAX];
8125e256365SVladimir Oltean 	struct regmap_field		*regfields[REGFIELD_MAX];
8135e256365SVladimir Oltean 	const u32 *const		*map;
814d87b1c08SColin Foster 	struct list_head		stats_regions;
8155e256365SVladimir Oltean 
816f59fd9caSVladimir Oltean 	u32				pool_size[OCELOT_SB_NUM][OCELOT_SB_POOL_NUM];
817f6fe01d6SVladimir Oltean 	int				packet_buffer_size;
818f6fe01d6SVladimir Oltean 	int				num_frame_refs;
81921ce7f3eSVladimir Oltean 	int				num_mact_rows;
8205e256365SVladimir Oltean 
8215e256365SVladimir Oltean 	struct ocelot_port		**ports;
8225e256365SVladimir Oltean 
8235e256365SVladimir Oltean 	u8				base_mac[ETH_ALEN];
8245e256365SVladimir Oltean 
82590e0aa8dSVladimir Oltean 	struct list_head		vlans;
826e42bd4edSVladimir Oltean 	struct list_head		traps;
827961d8b69SVladimir Oltean 	struct list_head		lag_fdbs;
8285e256365SVladimir Oltean 
829edd2410bSVladimir Oltean 	/* Switches like VSC9959 have flooding per traffic class */
830edd2410bSVladimir Oltean 	int				num_flooding_pgids;
831edd2410bSVladimir Oltean 
83269df578cSVladimir Oltean 	/* In tables like ANA:PORT and the ANA:PGID:PGID mask,
83369df578cSVladimir Oltean 	 * the CPU is located after the physical ports (at the
83469df578cSVladimir Oltean 	 * num_phys_ports index).
83569df578cSVladimir Oltean 	 */
8365e256365SVladimir Oltean 	u8				num_phys_ports;
8375e256365SVladimir Oltean 
8380b912fc9SVladimir Oltean 	int				npi;
8390b912fc9SVladimir Oltean 
840cacea62fSVladimir Oltean 	enum ocelot_tag_prefix		npi_inj_prefix;
841cacea62fSVladimir Oltean 	enum ocelot_tag_prefix		npi_xtr_prefix;
8420b912fc9SVladimir Oltean 
84354c31984SVladimir Oltean 	unsigned long			bridges;
84454c31984SVladimir Oltean 
8455e256365SVladimir Oltean 	struct list_head		multicast;
846e5d1f896SVladimir Oltean 	struct list_head		pgids;
8475e256365SVladimir Oltean 
8481397a2ebSVladimir Oltean 	struct list_head		dummy_rules;
8491397a2ebSVladimir Oltean 	struct ocelot_vcap_block	block[3];
85077043c37SXiaoliang Yang 	struct ocelot_vcap_policer	vcap_pol;
85120968054SVladimir Oltean 	struct vcap_props		*vcap;
852ccb6ed42SVladimir Oltean 	struct ocelot_mirror		*mirror;
853e0632940SVladimir Oltean 
8547d4b564dSXiaoliang Yang 	struct ocelot_psfp_list		psfp;
8557d4b564dSXiaoliang Yang 
85696980ff7SVladimir Oltean 	/* Workqueue to check statistics for overflow */
8575e256365SVladimir Oltean 	struct delayed_work		stats_work;
8585e256365SVladimir Oltean 	struct workqueue_struct		*stats_queue;
85996980ff7SVladimir Oltean 	/* Lock for serializing access to the statistics array */
86096980ff7SVladimir Oltean 	spinlock_t			stats_lock;
86196980ff7SVladimir Oltean 	u64				*stats;
8625e256365SVladimir Oltean 
86396980ff7SVladimir Oltean 	/* Lock for serializing indirect access to STAT_VIEW registers */
86496980ff7SVladimir Oltean 	struct mutex			stat_view_lock;
8652468346cSVladimir Oltean 	/* Lock for serializing access to the MAC table */
8662468346cSVladimir Oltean 	struct mutex			mact_lock;
867009d30f1SVladimir Oltean 	/* Lock for serializing forwarding domain changes, including the
868009d30f1SVladimir Oltean 	 * configuration of the Time-Aware Shaper, MAC Merge layer and
869009d30f1SVladimir Oltean 	 * cut-through forwarding, on which it depends
870009d30f1SVladimir Oltean 	 */
8718abe1970SVladimir Oltean 	struct mutex			fwd_domain_lock;
8722468346cSVladimir Oltean 
873ca0b272bSVladimir Oltean 	struct workqueue_struct		*owq;
874ca0b272bSVladimir Oltean 
8755e256365SVladimir Oltean 	u8				ptp:1;
876ab3f97a9SVladimir Oltean 	u8				mm_supported:1;
8775e256365SVladimir Oltean 	struct ptp_clock		*ptp_clock;
8785e256365SVladimir Oltean 	struct ptp_clock_info		ptp_info;
87952849bcfSVladimir Oltean 	unsigned int			ptp_skbs_in_flight;
88052849bcfSVladimir Oltean 	/* Protects the 2-step TX timestamp ID logic */
88152849bcfSVladimir Oltean 	spinlock_t			ts_id_lock;
8825e256365SVladimir Oltean 	/* Protects the PTP clock */
8835e256365SVladimir Oltean 	spinlock_t			ptp_clock_lock;
884cc2d87bbSYangbo Lu 	struct ptp_pin_desc		ptp_pins[OCELOT_PTP_PINS_NUM];
885753a026cSClément Léger 
8866505b680SVladimir Oltean 	struct ocelot_mm_state		*mm;
8876505b680SVladimir Oltean 
888753a026cSClément Léger 	struct ocelot_fdma		*fdma;
8895e256365SVladimir Oltean };
8905e256365SVladimir Oltean 
891fc411eaaSVladimir Oltean struct ocelot_policer {
892fc411eaaSVladimir Oltean 	u32 rate; /* kilobit per second */
893fc411eaaSVladimir Oltean 	u32 burst; /* bytes */
894fc411eaaSVladimir Oltean };
895fc411eaaSVladimir Oltean 
896d4c36765SVladimir Oltean #define ocelot_bulk_read(ocelot, reg, buf, count) \
897d4c36765SVladimir Oltean 	__ocelot_bulk_read_ix(ocelot, reg, 0, buf, count)
89840f3a5c8SColin Foster 
89965c53595SColin Foster #define ocelot_read_ix(ocelot, reg, gi, ri) \
90065c53595SColin Foster 	__ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
90165c53595SColin Foster #define ocelot_read_gix(ocelot, reg, gi) \
90265c53595SColin Foster 	__ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi))
90365c53595SColin Foster #define ocelot_read_rix(ocelot, reg, ri) \
90465c53595SColin Foster 	__ocelot_read_ix(ocelot, reg, reg##_RSZ * (ri))
90565c53595SColin Foster #define ocelot_read(ocelot, reg) \
90665c53595SColin Foster 	__ocelot_read_ix(ocelot, reg, 0)
9075e256365SVladimir Oltean 
90865c53595SColin Foster #define ocelot_write_ix(ocelot, val, reg, gi, ri) \
90965c53595SColin Foster 	__ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
91065c53595SColin Foster #define ocelot_write_gix(ocelot, val, reg, gi) \
91165c53595SColin Foster 	__ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi))
91265c53595SColin Foster #define ocelot_write_rix(ocelot, val, reg, ri) \
91365c53595SColin Foster 	__ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))
9145e256365SVladimir Oltean #define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0)
9155e256365SVladimir Oltean 
91665c53595SColin Foster #define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) \
91765c53595SColin Foster 	__ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
91865c53595SColin Foster #define ocelot_rmw_gix(ocelot, val, m, reg, gi) \
91965c53595SColin Foster 	__ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi))
92065c53595SColin Foster #define ocelot_rmw_rix(ocelot, val, m, reg, ri) \
92165c53595SColin Foster 	__ocelot_rmw_ix(ocelot, val, m, reg, reg##_RSZ * (ri))
9225e256365SVladimir Oltean #define ocelot_rmw(ocelot, val, m, reg) __ocelot_rmw_ix(ocelot, val, m, reg, 0)
9235e256365SVladimir Oltean 
92465c53595SColin Foster #define ocelot_field_write(ocelot, reg, val) \
92565c53595SColin Foster 	regmap_field_write((ocelot)->regfields[(reg)], (val))
92665c53595SColin Foster #define ocelot_field_read(ocelot, reg, val) \
92765c53595SColin Foster 	regmap_field_read((ocelot)->regfields[(reg)], (val))
92865c53595SColin Foster #define ocelot_fields_write(ocelot, id, reg, val) \
92965c53595SColin Foster 	regmap_fields_write((ocelot)->regfields[(reg)], (id), (val))
93065c53595SColin Foster #define ocelot_fields_read(ocelot, id, reg, val) \
93165c53595SColin Foster 	regmap_fields_read((ocelot)->regfields[(reg)], (id), (val))
932886e1387SVladimir Oltean 
9333c0e37a9SVladimir Oltean #define ocelot_target_read_ix(ocelot, target, reg, gi, ri) \
9343c0e37a9SVladimir Oltean 	__ocelot_target_read_ix(ocelot, target, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
9353c0e37a9SVladimir Oltean #define ocelot_target_read_gix(ocelot, target, reg, gi) \
9363c0e37a9SVladimir Oltean 	__ocelot_target_read_ix(ocelot, target, reg, reg##_GSZ * (gi))
9373c0e37a9SVladimir Oltean #define ocelot_target_read_rix(ocelot, target, reg, ri) \
9383c0e37a9SVladimir Oltean 	__ocelot_target_read_ix(ocelot, target, reg, reg##_RSZ * (ri))
9393c0e37a9SVladimir Oltean #define ocelot_target_read(ocelot, target, reg) \
9403c0e37a9SVladimir Oltean 	__ocelot_target_read_ix(ocelot, target, reg, 0)
9413c0e37a9SVladimir Oltean 
9423c0e37a9SVladimir Oltean #define ocelot_target_write_ix(ocelot, target, val, reg, gi, ri) \
9433c0e37a9SVladimir Oltean 	__ocelot_target_write_ix(ocelot, target, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
9443c0e37a9SVladimir Oltean #define ocelot_target_write_gix(ocelot, target, val, reg, gi) \
9453c0e37a9SVladimir Oltean 	__ocelot_target_write_ix(ocelot, target, val, reg, reg##_GSZ * (gi))
9463c0e37a9SVladimir Oltean #define ocelot_target_write_rix(ocelot, target, val, reg, ri) \
9473c0e37a9SVladimir Oltean 	__ocelot_target_write_ix(ocelot, target, val, reg, reg##_RSZ * (ri))
9483c0e37a9SVladimir Oltean #define ocelot_target_write(ocelot, target, val, reg) \
9493c0e37a9SVladimir Oltean 	__ocelot_target_write_ix(ocelot, target, val, reg, 0)
9503c0e37a9SVladimir Oltean 
9515e256365SVladimir Oltean /* I/O */
9529ecd0579SVladimir Oltean u32 ocelot_port_readl(struct ocelot_port *port, enum ocelot_reg reg);
9539ecd0579SVladimir Oltean void ocelot_port_writel(struct ocelot_port *port, u32 val, enum ocelot_reg reg);
9549ecd0579SVladimir Oltean void ocelot_port_rmwl(struct ocelot_port *port, u32 val, u32 mask,
9559ecd0579SVladimir Oltean 		      enum ocelot_reg reg);
9569ecd0579SVladimir Oltean int __ocelot_bulk_read_ix(struct ocelot *ocelot, enum ocelot_reg reg,
9579ecd0579SVladimir Oltean 			  u32 offset, void *buf, int count);
9589ecd0579SVladimir Oltean u32 __ocelot_read_ix(struct ocelot *ocelot, enum ocelot_reg reg, u32 offset);
9599ecd0579SVladimir Oltean void __ocelot_write_ix(struct ocelot *ocelot, u32 val, enum ocelot_reg reg,
9605e256365SVladimir Oltean 		       u32 offset);
9619ecd0579SVladimir Oltean void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask,
9629ecd0579SVladimir Oltean 		     enum ocelot_reg reg, u32 offset);
9633c0e37a9SVladimir Oltean u32 __ocelot_target_read_ix(struct ocelot *ocelot, enum ocelot_target target,
9643c0e37a9SVladimir Oltean 			    u32 reg, u32 offset);
9653c0e37a9SVladimir Oltean void __ocelot_target_write_ix(struct ocelot *ocelot, enum ocelot_target target,
9663c0e37a9SVladimir Oltean 			      u32 val, u32 reg, u32 offset);
9675e256365SVladimir Oltean 
96839e5308bSYangbo Lu /* Packet I/O */
969137ffbc4SVladimir Oltean bool ocelot_can_inject(struct ocelot *ocelot, int grp);
970137ffbc4SVladimir Oltean void ocelot_port_inject_frame(struct ocelot *ocelot, int port, int grp,
971137ffbc4SVladimir Oltean 			      u32 rew_op, struct sk_buff *skb);
972e5150f00SClément Léger void ocelot_ifh_port_set(void *ifh, int port, u32 rew_op, u32 vlan_tag);
973924ee317SVladimir Oltean int ocelot_xtr_poll_frame(struct ocelot *ocelot, int grp, struct sk_buff **skb);
9740a6f17c6SVladimir Oltean void ocelot_drain_cpu_queue(struct ocelot *ocelot, int grp);
975b471a71eSClément Léger void ocelot_ptp_rx_timestamp(struct ocelot *ocelot, struct sk_buff *skb,
976b471a71eSClément Léger 			     u64 timestamp);
977137ffbc4SVladimir Oltean 
9785e256365SVladimir Oltean /* Hardware initialization */
9795e256365SVladimir Oltean int ocelot_regfields_init(struct ocelot *ocelot,
9805e256365SVladimir Oltean 			  const struct reg_field *const regfields);
9815e256365SVladimir Oltean struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res);
982b67f5502SColin Foster int ocelot_reset(struct ocelot *ocelot);
9835e256365SVladimir Oltean int ocelot_init(struct ocelot *ocelot);
9845e256365SVladimir Oltean void ocelot_deinit(struct ocelot *ocelot);
9855e256365SVladimir Oltean void ocelot_init_port(struct ocelot *ocelot, int port);
986e5fb512dSVladimir Oltean void ocelot_deinit_port(struct ocelot *ocelot, int port);
9875e256365SVladimir Oltean 
98836a0bf44SVladimir Oltean void ocelot_port_setup_dsa_8021q_cpu(struct ocelot *ocelot, int cpu);
98936a0bf44SVladimir Oltean void ocelot_port_teardown_dsa_8021q_cpu(struct ocelot *ocelot, int cpu);
990c295f983SVladimir Oltean void ocelot_port_assign_dsa_8021q_cpu(struct ocelot *ocelot, int port, int cpu);
991c295f983SVladimir Oltean void ocelot_port_unassign_dsa_8021q_cpu(struct ocelot *ocelot, int port);
992c295f983SVladimir Oltean u32 ocelot_port_assigned_dsa_8021q_cpu_mask(struct ocelot *ocelot, int port);
99354c31984SVladimir Oltean 
994c6a9321bSColin Foster /* Watermark interface */
995c6a9321bSColin Foster u16 ocelot_wm_enc(u16 value);
996c6a9321bSColin Foster u16 ocelot_wm_dec(u16 wm);
997c6a9321bSColin Foster void ocelot_wm_stat(u32 val, u32 *inuse, u32 *maxuse);
998c6a9321bSColin Foster 
9995e256365SVladimir Oltean /* DSA callbacks */
10005e256365SVladimir Oltean void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data);
10015e256365SVladimir Oltean void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data);
10025e256365SVladimir Oltean int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset);
1003776b71e5SVladimir Oltean void ocelot_port_get_stats64(struct ocelot *ocelot, int port,
1004776b71e5SVladimir Oltean 			     struct rtnl_link_stats64 *stats);
1005e32036e1SVladimir Oltean void ocelot_port_get_pause_stats(struct ocelot *ocelot, int port,
1006e32036e1SVladimir Oltean 				 struct ethtool_pause_stats *pause_stats);
1007ab3f97a9SVladimir Oltean void ocelot_port_get_mm_stats(struct ocelot *ocelot, int port,
1008ab3f97a9SVladimir Oltean 			      struct ethtool_mm_stats *stats);
1009e32036e1SVladimir Oltean void ocelot_port_get_rmon_stats(struct ocelot *ocelot, int port,
1010e32036e1SVladimir Oltean 				struct ethtool_rmon_stats *rmon_stats,
1011e32036e1SVladimir Oltean 				const struct ethtool_rmon_hist_range **ranges);
1012e32036e1SVladimir Oltean void ocelot_port_get_eth_ctrl_stats(struct ocelot *ocelot, int port,
1013e32036e1SVladimir Oltean 				    struct ethtool_eth_ctrl_stats *ctrl_stats);
1014e32036e1SVladimir Oltean void ocelot_port_get_eth_mac_stats(struct ocelot *ocelot, int port,
1015e32036e1SVladimir Oltean 				   struct ethtool_eth_mac_stats *mac_stats);
1016e32036e1SVladimir Oltean void ocelot_port_get_eth_phy_stats(struct ocelot *ocelot, int port,
1017e32036e1SVladimir Oltean 				   struct ethtool_eth_phy_stats *phy_stats);
10185e256365SVladimir Oltean int ocelot_get_ts_info(struct ocelot *ocelot, int port,
10195e256365SVladimir Oltean 		       struct ethtool_ts_info *info);
10205e256365SVladimir Oltean void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs);
10213b95d1b2SVladimir Oltean int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled,
10223b95d1b2SVladimir Oltean 			       struct netlink_ext_ack *extack);
10235e256365SVladimir Oltean void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state);
10248abe1970SVladimir Oltean u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, int src_port);
1025421741eaSVladimir Oltean int ocelot_port_pre_bridge_flags(struct ocelot *ocelot, int port,
1026421741eaSVladimir Oltean 				 struct switchdev_brport_flags val);
1027421741eaSVladimir Oltean void ocelot_port_bridge_flags(struct ocelot *ocelot, int port,
1028421741eaSVladimir Oltean 			      struct switchdev_brport_flags val);
1029978777d0SVladimir Oltean int ocelot_port_get_default_prio(struct ocelot *ocelot, int port);
1030978777d0SVladimir Oltean int ocelot_port_set_default_prio(struct ocelot *ocelot, int port, u8 prio);
1031978777d0SVladimir Oltean int ocelot_port_get_dscp_prio(struct ocelot *ocelot, int port, u8 dscp);
1032978777d0SVladimir Oltean int ocelot_port_add_dscp_prio(struct ocelot *ocelot, int port, u8 dscp, u8 prio);
1033978777d0SVladimir Oltean int ocelot_port_del_dscp_prio(struct ocelot *ocelot, int port, u8 dscp, u8 prio);
103454c31984SVladimir Oltean int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
103554c31984SVladimir Oltean 			    struct net_device *bridge, int bridge_num,
103654c31984SVladimir Oltean 			    struct netlink_ext_ack *extack);
1037e4bd44e8SVladimir Oltean void ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
10385e256365SVladimir Oltean 			      struct net_device *bridge);
10395cad43a5SVladimir Oltean int ocelot_mact_flush(struct ocelot *ocelot, int port);
10405e256365SVladimir Oltean int ocelot_fdb_dump(struct ocelot *ocelot, int port,
10415e256365SVladimir Oltean 		    dsa_fdb_dump_cb_t *cb, void *data);
104254c31984SVladimir Oltean int ocelot_fdb_add(struct ocelot *ocelot, int port, const unsigned char *addr,
104354c31984SVladimir Oltean 		   u16 vid, const struct net_device *bridge);
104454c31984SVladimir Oltean int ocelot_fdb_del(struct ocelot *ocelot, int port, const unsigned char *addr,
104554c31984SVladimir Oltean 		   u16 vid, const struct net_device *bridge);
1046961d8b69SVladimir Oltean int ocelot_lag_fdb_add(struct ocelot *ocelot, struct net_device *bond,
104754c31984SVladimir Oltean 		       const unsigned char *addr, u16 vid,
104854c31984SVladimir Oltean 		       const struct net_device *bridge);
1049961d8b69SVladimir Oltean int ocelot_lag_fdb_del(struct ocelot *ocelot, struct net_device *bond,
105054c31984SVladimir Oltean 		       const unsigned char *addr, u16 vid,
105154c31984SVladimir Oltean 		       const struct net_device *bridge);
10522f0402feSVladimir Oltean int ocelot_vlan_prepare(struct ocelot *ocelot, int port, u16 vid, bool pvid,
105301af940eSVladimir Oltean 			bool untagged, struct netlink_ext_ack *extack);
10545e256365SVladimir Oltean int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
10555e256365SVladimir Oltean 		    bool untagged);
10565e256365SVladimir Oltean int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid);
1057f145922dSYangbo Lu int ocelot_hwstamp_get(struct ocelot *ocelot, int port, struct ifreq *ifr);
1058f145922dSYangbo Lu int ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct ifreq *ifr);
1059682eaad9SYangbo Lu int ocelot_port_txtstamp_request(struct ocelot *ocelot, int port,
1060682eaad9SYangbo Lu 				 struct sk_buff *skb,
1061682eaad9SYangbo Lu 				 struct sk_buff **clone);
1062e23a7b3eSYangbo Lu void ocelot_get_txtstamp(struct ocelot *ocelot);
10630b912fc9SVladimir Oltean void ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu);
10640b912fc9SVladimir Oltean int ocelot_get_max_mtu(struct ocelot *ocelot, int port);
1065fc411eaaSVladimir Oltean int ocelot_port_policer_add(struct ocelot *ocelot, int port,
1066fc411eaaSVladimir Oltean 			    struct ocelot_policer *pol);
1067fc411eaaSVladimir Oltean int ocelot_port_policer_del(struct ocelot *ocelot, int port);
1068ccb6ed42SVladimir Oltean int ocelot_port_mirror_add(struct ocelot *ocelot, int from, int to,
1069ccb6ed42SVladimir Oltean 			   bool ingress, struct netlink_ext_ack *extack);
1070ccb6ed42SVladimir Oltean void ocelot_port_mirror_del(struct ocelot *ocelot, int from, bool ingress);
107107d985eeSVladimir Oltean int ocelot_cls_flower_replace(struct ocelot *ocelot, int port,
107207d985eeSVladimir Oltean 			      struct flow_cls_offload *f, bool ingress);
107307d985eeSVladimir Oltean int ocelot_cls_flower_destroy(struct ocelot *ocelot, int port,
107407d985eeSVladimir Oltean 			      struct flow_cls_offload *f, bool ingress);
107507d985eeSVladimir Oltean int ocelot_cls_flower_stats(struct ocelot *ocelot, int port,
107607d985eeSVladimir Oltean 			    struct flow_cls_offload *f, bool ingress);
1077209edf95SVladimir Oltean int ocelot_port_mdb_add(struct ocelot *ocelot, int port,
107854c31984SVladimir Oltean 			const struct switchdev_obj_port_mdb *mdb,
107954c31984SVladimir Oltean 			const struct net_device *bridge);
1080209edf95SVladimir Oltean int ocelot_port_mdb_del(struct ocelot *ocelot, int port,
108154c31984SVladimir Oltean 			const struct switchdev_obj_port_mdb *mdb,
108254c31984SVladimir Oltean 			const struct net_device *bridge);
10838fe6832eSVladimir Oltean int ocelot_port_lag_join(struct ocelot *ocelot, int port,
10848fe6832eSVladimir Oltean 			 struct net_device *bond,
10852e359b00SVladimir Oltean 			 struct netdev_lag_upper_info *info,
10862e359b00SVladimir Oltean 			 struct netlink_ext_ack *extack);
10878fe6832eSVladimir Oltean void ocelot_port_lag_leave(struct ocelot *ocelot, int port,
10888fe6832eSVladimir Oltean 			   struct net_device *bond);
10898fe6832eSVladimir Oltean void ocelot_port_lag_change(struct ocelot *ocelot, int port, bool lag_tx_active);
1090eca70102SVladimir Oltean int ocelot_bond_get_id(struct ocelot *ocelot, struct net_device *bond);
10915e256365SVladimir Oltean 
1092f59fd9caSVladimir Oltean int ocelot_devlink_sb_register(struct ocelot *ocelot);
1093f59fd9caSVladimir Oltean void ocelot_devlink_sb_unregister(struct ocelot *ocelot);
1094f59fd9caSVladimir Oltean int ocelot_sb_pool_get(struct ocelot *ocelot, unsigned int sb_index,
1095f59fd9caSVladimir Oltean 		       u16 pool_index,
1096f59fd9caSVladimir Oltean 		       struct devlink_sb_pool_info *pool_info);
1097f59fd9caSVladimir Oltean int ocelot_sb_pool_set(struct ocelot *ocelot, unsigned int sb_index,
1098f59fd9caSVladimir Oltean 		       u16 pool_index, u32 size,
1099f59fd9caSVladimir Oltean 		       enum devlink_sb_threshold_type threshold_type,
1100f59fd9caSVladimir Oltean 		       struct netlink_ext_ack *extack);
1101f59fd9caSVladimir Oltean int ocelot_sb_port_pool_get(struct ocelot *ocelot, int port,
1102f59fd9caSVladimir Oltean 			    unsigned int sb_index, u16 pool_index,
1103f59fd9caSVladimir Oltean 			    u32 *p_threshold);
1104f59fd9caSVladimir Oltean int ocelot_sb_port_pool_set(struct ocelot *ocelot, int port,
1105f59fd9caSVladimir Oltean 			    unsigned int sb_index, u16 pool_index,
1106f59fd9caSVladimir Oltean 			    u32 threshold, struct netlink_ext_ack *extack);
1107f59fd9caSVladimir Oltean int ocelot_sb_tc_pool_bind_get(struct ocelot *ocelot, int port,
1108f59fd9caSVladimir Oltean 			       unsigned int sb_index, u16 tc_index,
1109f59fd9caSVladimir Oltean 			       enum devlink_sb_pool_type pool_type,
1110f59fd9caSVladimir Oltean 			       u16 *p_pool_index, u32 *p_threshold);
1111f59fd9caSVladimir Oltean int ocelot_sb_tc_pool_bind_set(struct ocelot *ocelot, int port,
1112f59fd9caSVladimir Oltean 			       unsigned int sb_index, u16 tc_index,
1113f59fd9caSVladimir Oltean 			       enum devlink_sb_pool_type pool_type,
1114f59fd9caSVladimir Oltean 			       u16 pool_index, u32 threshold,
1115f59fd9caSVladimir Oltean 			       struct netlink_ext_ack *extack);
1116f59fd9caSVladimir Oltean int ocelot_sb_occ_snapshot(struct ocelot *ocelot, unsigned int sb_index);
1117f59fd9caSVladimir Oltean int ocelot_sb_occ_max_clear(struct ocelot *ocelot, unsigned int sb_index);
1118f59fd9caSVladimir Oltean int ocelot_sb_occ_port_pool_get(struct ocelot *ocelot, int port,
1119f59fd9caSVladimir Oltean 				unsigned int sb_index, u16 pool_index,
1120f59fd9caSVladimir Oltean 				u32 *p_cur, u32 *p_max);
1121f59fd9caSVladimir Oltean int ocelot_sb_occ_tc_port_bind_get(struct ocelot *ocelot, int port,
1122f59fd9caSVladimir Oltean 				   unsigned int sb_index, u16 tc_index,
1123f59fd9caSVladimir Oltean 				   enum devlink_sb_pool_type pool_type,
1124f59fd9caSVladimir Oltean 				   u32 *p_cur, u32 *p_max);
1125f59fd9caSVladimir Oltean 
1126dfca93edSColin Foster int ocelot_port_configure_serdes(struct ocelot *ocelot, int port,
1127dfca93edSColin Foster 				 struct device_node *portnp);
1128dfca93edSColin Foster 
112969f7f89cSColin Foster void ocelot_phylink_mac_config(struct ocelot *ocelot, int port,
113069f7f89cSColin Foster 			       unsigned int link_an_mode,
113169f7f89cSColin Foster 			       const struct phylink_link_state *state);
1132e6e12df6SVladimir Oltean void ocelot_phylink_mac_link_down(struct ocelot *ocelot, int port,
1133e6e12df6SVladimir Oltean 				  unsigned int link_an_mode,
1134e6e12df6SVladimir Oltean 				  phy_interface_t interface,
1135e6e12df6SVladimir Oltean 				  unsigned long quirks);
1136e6e12df6SVladimir Oltean void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port,
1137e6e12df6SVladimir Oltean 				struct phy_device *phydev,
1138e6e12df6SVladimir Oltean 				unsigned int link_an_mode,
1139e6e12df6SVladimir Oltean 				phy_interface_t interface,
1140e6e12df6SVladimir Oltean 				int speed, int duplex,
1141e6e12df6SVladimir Oltean 				bool tx_pause, bool rx_pause,
1142e6e12df6SVladimir Oltean 				unsigned long quirks);
1143e6e12df6SVladimir Oltean 
11440568c3bfSXiaoliang Yang int ocelot_mact_lookup(struct ocelot *ocelot, int *dst_idx,
11450568c3bfSXiaoliang Yang 		       const unsigned char mac[ETH_ALEN],
11460568c3bfSXiaoliang Yang 		       unsigned int vid, enum macaccess_entry_type *type);
11470568c3bfSXiaoliang Yang int ocelot_mact_learn_streamdata(struct ocelot *ocelot, int dst_idx,
11480568c3bfSXiaoliang Yang 				 const unsigned char mac[ETH_ALEN],
11490568c3bfSXiaoliang Yang 				 unsigned int vid,
11500568c3bfSXiaoliang Yang 				 enum macaccess_entry_type type,
11510568c3bfSXiaoliang Yang 				 int sfid, int ssid);
11520568c3bfSXiaoliang Yang 
115328de0f9fSVladimir Oltean int ocelot_migrate_mdbs(struct ocelot *ocelot, unsigned long from_mask,
115428de0f9fSVladimir Oltean 			unsigned long to_mask);
115528de0f9fSVladimir Oltean 
115677043c37SXiaoliang Yang int ocelot_vcap_policer_add(struct ocelot *ocelot, u32 pol_ix,
115777043c37SXiaoliang Yang 			    struct ocelot_policer *pol);
115877043c37SXiaoliang Yang int ocelot_vcap_policer_del(struct ocelot *ocelot, u32 pol_ix);
115977043c37SXiaoliang Yang 
116015f93f46SVladimir Oltean void ocelot_mm_irq(struct ocelot *ocelot);
11616505b680SVladimir Oltean int ocelot_port_set_mm(struct ocelot *ocelot, int port,
11626505b680SVladimir Oltean 		       struct ethtool_mm_cfg *cfg,
11636505b680SVladimir Oltean 		       struct netlink_ext_ack *extack);
11646505b680SVladimir Oltean int ocelot_port_get_mm(struct ocelot *ocelot, int port,
11656505b680SVladimir Oltean 		       struct ethtool_mm_state *state);
1166aac80140SVladimir Oltean int ocelot_port_mqprio(struct ocelot *ocelot, int port,
1167aac80140SVladimir Oltean 		       struct tc_mqprio_qopt_offload *mqprio);
11686505b680SVladimir Oltean 
1169d8ea7ff3SHoratiu Vultur #if IS_ENABLED(CONFIG_BRIDGE_MRP)
1170d8ea7ff3SHoratiu Vultur int ocelot_mrp_add(struct ocelot *ocelot, int port,
1171d8ea7ff3SHoratiu Vultur 		   const struct switchdev_obj_mrp *mrp);
1172d8ea7ff3SHoratiu Vultur int ocelot_mrp_del(struct ocelot *ocelot, int port,
1173d8ea7ff3SHoratiu Vultur 		   const struct switchdev_obj_mrp *mrp);
1174d8ea7ff3SHoratiu Vultur int ocelot_mrp_add_ring_role(struct ocelot *ocelot, int port,
1175d8ea7ff3SHoratiu Vultur 			     const struct switchdev_obj_ring_role_mrp *mrp);
1176d8ea7ff3SHoratiu Vultur int ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port,
1177d8ea7ff3SHoratiu Vultur 			     const struct switchdev_obj_ring_role_mrp *mrp);
1178d8ea7ff3SHoratiu Vultur #else
ocelot_mrp_add(struct ocelot * ocelot,int port,const struct switchdev_obj_mrp * mrp)1179d8ea7ff3SHoratiu Vultur static inline int ocelot_mrp_add(struct ocelot *ocelot, int port,
1180d8ea7ff3SHoratiu Vultur 				 const struct switchdev_obj_mrp *mrp)
1181d8ea7ff3SHoratiu Vultur {
1182d8ea7ff3SHoratiu Vultur 	return -EOPNOTSUPP;
1183d8ea7ff3SHoratiu Vultur }
1184d8ea7ff3SHoratiu Vultur 
ocelot_mrp_del(struct ocelot * ocelot,int port,const struct switchdev_obj_mrp * mrp)1185d8ea7ff3SHoratiu Vultur static inline int ocelot_mrp_del(struct ocelot *ocelot, int port,
1186d8ea7ff3SHoratiu Vultur 				 const struct switchdev_obj_mrp *mrp)
1187d8ea7ff3SHoratiu Vultur {
1188d8ea7ff3SHoratiu Vultur 	return -EOPNOTSUPP;
1189d8ea7ff3SHoratiu Vultur }
1190d8ea7ff3SHoratiu Vultur 
1191d8ea7ff3SHoratiu Vultur static inline int
ocelot_mrp_add_ring_role(struct ocelot * ocelot,int port,const struct switchdev_obj_ring_role_mrp * mrp)1192d8ea7ff3SHoratiu Vultur ocelot_mrp_add_ring_role(struct ocelot *ocelot, int port,
1193d8ea7ff3SHoratiu Vultur 			 const struct switchdev_obj_ring_role_mrp *mrp)
1194d8ea7ff3SHoratiu Vultur {
1195d8ea7ff3SHoratiu Vultur 	return -EOPNOTSUPP;
1196d8ea7ff3SHoratiu Vultur }
1197d8ea7ff3SHoratiu Vultur 
1198d8ea7ff3SHoratiu Vultur static inline int
ocelot_mrp_del_ring_role(struct ocelot * ocelot,int port,const struct switchdev_obj_ring_role_mrp * mrp)1199d8ea7ff3SHoratiu Vultur ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port,
1200d8ea7ff3SHoratiu Vultur 			 const struct switchdev_obj_ring_role_mrp *mrp)
1201d8ea7ff3SHoratiu Vultur {
1202d8ea7ff3SHoratiu Vultur 	return -EOPNOTSUPP;
1203d8ea7ff3SHoratiu Vultur }
1204d8ea7ff3SHoratiu Vultur #endif
1205d8ea7ff3SHoratiu Vultur 
1206fec53f44SColin Foster void ocelot_pll5_init(struct ocelot *ocelot);
1207fec53f44SColin Foster 
12085e256365SVladimir Oltean #endif
1209