xref: /openbmc/linux/include/soc/mscc/ocelot.h (revision 5c816641)
1 /* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
2 /* Copyright (c) 2017 Microsemi Corporation
3  */
4 
5 #ifndef _SOC_MSCC_OCELOT_H
6 #define _SOC_MSCC_OCELOT_H
7 
8 #include <linux/ptp_clock_kernel.h>
9 #include <linux/net_tstamp.h>
10 #include <linux/if_vlan.h>
11 #include <linux/regmap.h>
12 #include <net/dsa.h>
13 
14 /* Port Group IDs (PGID) are masks of destination ports.
15  *
16  * For L2 forwarding, the switch performs 3 lookups in the PGID table for each
17  * frame, and forwards the frame to the ports that are present in the logical
18  * AND of all 3 PGIDs.
19  *
20  * These PGID lookups are:
21  * - In one of PGID[0-63]: for the destination masks. There are 2 paths by
22  *   which the switch selects a destination PGID:
23  *     - The {DMAC, VID} is present in the MAC table. In that case, the
24  *       destination PGID is given by the DEST_IDX field of the MAC table entry
25  *       that matched.
26  *     - The {DMAC, VID} is not present in the MAC table (it is unknown). The
27  *       frame is disseminated as being either unicast, multicast or broadcast,
28  *       and according to that, the destination PGID is chosen as being the
29  *       value contained by ANA_FLOODING_FLD_UNICAST,
30  *       ANA_FLOODING_FLD_MULTICAST or ANA_FLOODING_FLD_BROADCAST.
31  *   The destination PGID can be an unicast set: the first PGIDs, 0 to
32  *   ocelot->num_phys_ports - 1, or a multicast set: the PGIDs from
33  *   ocelot->num_phys_ports to 63. By convention, a unicast PGID corresponds to
34  *   a physical port and has a single bit set in the destination ports mask:
35  *   that corresponding to the port number itself. In contrast, a multicast
36  *   PGID will have potentially more than one single bit set in the destination
37  *   ports mask.
38  * - In one of PGID[64-79]: for the aggregation mask. The switch classifier
39  *   dissects each frame and generates a 4-bit Link Aggregation Code which is
40  *   used for this second PGID table lookup. The goal of link aggregation is to
41  *   hash multiple flows within the same LAG on to different destination ports.
42  *   The first lookup will result in a PGID with all the LAG members present in
43  *   the destination ports mask, and the second lookup, by Link Aggregation
44  *   Code, will ensure that each flow gets forwarded only to a single port out
45  *   of that mask (there are no duplicates).
46  * - In one of PGID[80-90]: for the source mask. The third time, the PGID table
47  *   is indexed with the ingress port (plus 80). These PGIDs answer the
48  *   question "is port i allowed to forward traffic to port j?" If yes, then
49  *   BIT(j) of PGID 80+i will be found set. The third PGID lookup can be used
50  *   to enforce the L2 forwarding matrix imposed by e.g. a Linux bridge.
51  */
52 
53 /* Reserve some destination PGIDs at the end of the range:
54  * PGID_BLACKHOLE: used for not forwarding the frames
55  * PGID_CPU: used for whitelisting certain MAC addresses, such as the addresses
56  *           of the switch port net devices, towards the CPU port module.
57  * PGID_UC: the flooding destinations for unknown unicast traffic.
58  * PGID_MC: the flooding destinations for non-IP multicast traffic.
59  * PGID_MCIPV4: the flooding destinations for IPv4 multicast traffic.
60  * PGID_MCIPV6: the flooding destinations for IPv6 multicast traffic.
61  * PGID_BC: the flooding destinations for broadcast traffic.
62  */
63 #define PGID_BLACKHOLE			57
64 #define PGID_CPU			58
65 #define PGID_UC				59
66 #define PGID_MC				60
67 #define PGID_MCIPV4			61
68 #define PGID_MCIPV6			62
69 #define PGID_BC				63
70 
71 #define for_each_unicast_dest_pgid(ocelot, pgid)		\
72 	for ((pgid) = 0;					\
73 	     (pgid) < (ocelot)->num_phys_ports;			\
74 	     (pgid)++)
75 
76 #define for_each_nonreserved_multicast_dest_pgid(ocelot, pgid)	\
77 	for ((pgid) = (ocelot)->num_phys_ports + 1;		\
78 	     (pgid) < PGID_BLACKHOLE;				\
79 	     (pgid)++)
80 
81 #define for_each_aggr_pgid(ocelot, pgid)			\
82 	for ((pgid) = PGID_AGGR;				\
83 	     (pgid) < PGID_SRC;					\
84 	     (pgid)++)
85 
86 /* Aggregation PGIDs, one per Link Aggregation Code */
87 #define PGID_AGGR			64
88 
89 /* Source PGIDs, one per physical port */
90 #define PGID_SRC			80
91 
92 #define OCELOT_NUM_TC			8
93 
94 #define OCELOT_SPEED_2500		0
95 #define OCELOT_SPEED_1000		1
96 #define OCELOT_SPEED_100		2
97 #define OCELOT_SPEED_10			3
98 
99 #define OCELOT_PTP_PINS_NUM		4
100 
101 #define TARGET_OFFSET			24
102 #define REG_MASK			GENMASK(TARGET_OFFSET - 1, 0)
103 #define REG(reg, offset)		[reg & REG_MASK] = offset
104 
105 #define REG_RESERVED_ADDR		0xffffffff
106 #define REG_RESERVED(reg)		REG(reg, REG_RESERVED_ADDR)
107 
108 #define OCELOT_MRP_CPUQ			7
109 
110 enum ocelot_target {
111 	ANA = 1,
112 	QS,
113 	QSYS,
114 	REW,
115 	SYS,
116 	S0,
117 	S1,
118 	S2,
119 	HSIO,
120 	PTP,
121 	FDMA,
122 	GCB,
123 	DEV_GMII,
124 	TARGET_MAX,
125 };
126 
127 enum ocelot_reg {
128 	ANA_ADVLEARN = ANA << TARGET_OFFSET,
129 	ANA_VLANMASK,
130 	ANA_PORT_B_DOMAIN,
131 	ANA_ANAGEFIL,
132 	ANA_ANEVENTS,
133 	ANA_STORMLIMIT_BURST,
134 	ANA_STORMLIMIT_CFG,
135 	ANA_ISOLATED_PORTS,
136 	ANA_COMMUNITY_PORTS,
137 	ANA_AUTOAGE,
138 	ANA_MACTOPTIONS,
139 	ANA_LEARNDISC,
140 	ANA_AGENCTRL,
141 	ANA_MIRRORPORTS,
142 	ANA_EMIRRORPORTS,
143 	ANA_FLOODING,
144 	ANA_FLOODING_IPMC,
145 	ANA_SFLOW_CFG,
146 	ANA_PORT_MODE,
147 	ANA_CUT_THRU_CFG,
148 	ANA_PGID_PGID,
149 	ANA_TABLES_ANMOVED,
150 	ANA_TABLES_MACHDATA,
151 	ANA_TABLES_MACLDATA,
152 	ANA_TABLES_STREAMDATA,
153 	ANA_TABLES_MACACCESS,
154 	ANA_TABLES_MACTINDX,
155 	ANA_TABLES_VLANACCESS,
156 	ANA_TABLES_VLANTIDX,
157 	ANA_TABLES_ISDXACCESS,
158 	ANA_TABLES_ISDXTIDX,
159 	ANA_TABLES_ENTRYLIM,
160 	ANA_TABLES_PTP_ID_HIGH,
161 	ANA_TABLES_PTP_ID_LOW,
162 	ANA_TABLES_STREAMACCESS,
163 	ANA_TABLES_STREAMTIDX,
164 	ANA_TABLES_SEQ_HISTORY,
165 	ANA_TABLES_SEQ_MASK,
166 	ANA_TABLES_SFID_MASK,
167 	ANA_TABLES_SFIDACCESS,
168 	ANA_TABLES_SFIDTIDX,
169 	ANA_MSTI_STATE,
170 	ANA_OAM_UPM_LM_CNT,
171 	ANA_SG_ACCESS_CTRL,
172 	ANA_SG_CONFIG_REG_1,
173 	ANA_SG_CONFIG_REG_2,
174 	ANA_SG_CONFIG_REG_3,
175 	ANA_SG_CONFIG_REG_4,
176 	ANA_SG_CONFIG_REG_5,
177 	ANA_SG_GCL_GS_CONFIG,
178 	ANA_SG_GCL_TI_CONFIG,
179 	ANA_SG_STATUS_REG_1,
180 	ANA_SG_STATUS_REG_2,
181 	ANA_SG_STATUS_REG_3,
182 	ANA_PORT_VLAN_CFG,
183 	ANA_PORT_DROP_CFG,
184 	ANA_PORT_QOS_CFG,
185 	ANA_PORT_VCAP_CFG,
186 	ANA_PORT_VCAP_S1_KEY_CFG,
187 	ANA_PORT_VCAP_S2_CFG,
188 	ANA_PORT_PCP_DEI_MAP,
189 	ANA_PORT_CPU_FWD_CFG,
190 	ANA_PORT_CPU_FWD_BPDU_CFG,
191 	ANA_PORT_CPU_FWD_GARP_CFG,
192 	ANA_PORT_CPU_FWD_CCM_CFG,
193 	ANA_PORT_PORT_CFG,
194 	ANA_PORT_POL_CFG,
195 	ANA_PORT_PTP_CFG,
196 	ANA_PORT_PTP_DLY1_CFG,
197 	ANA_PORT_PTP_DLY2_CFG,
198 	ANA_PORT_SFID_CFG,
199 	ANA_PFC_PFC_CFG,
200 	ANA_PFC_PFC_TIMER,
201 	ANA_IPT_OAM_MEP_CFG,
202 	ANA_IPT_IPT,
203 	ANA_PPT_PPT,
204 	ANA_FID_MAP_FID_MAP,
205 	ANA_AGGR_CFG,
206 	ANA_CPUQ_CFG,
207 	ANA_CPUQ_CFG2,
208 	ANA_CPUQ_8021_CFG,
209 	ANA_DSCP_CFG,
210 	ANA_DSCP_REWR_CFG,
211 	ANA_VCAP_RNG_TYPE_CFG,
212 	ANA_VCAP_RNG_VAL_CFG,
213 	ANA_VRAP_CFG,
214 	ANA_VRAP_HDR_DATA,
215 	ANA_VRAP_HDR_MASK,
216 	ANA_DISCARD_CFG,
217 	ANA_FID_CFG,
218 	ANA_POL_PIR_CFG,
219 	ANA_POL_CIR_CFG,
220 	ANA_POL_MODE_CFG,
221 	ANA_POL_PIR_STATE,
222 	ANA_POL_CIR_STATE,
223 	ANA_POL_STATE,
224 	ANA_POL_FLOWC,
225 	ANA_POL_HYST,
226 	ANA_POL_MISC_CFG,
227 	QS_XTR_GRP_CFG = QS << TARGET_OFFSET,
228 	QS_XTR_RD,
229 	QS_XTR_FRM_PRUNING,
230 	QS_XTR_FLUSH,
231 	QS_XTR_DATA_PRESENT,
232 	QS_XTR_CFG,
233 	QS_INJ_GRP_CFG,
234 	QS_INJ_WR,
235 	QS_INJ_CTRL,
236 	QS_INJ_STATUS,
237 	QS_INJ_ERR,
238 	QS_INH_DBG,
239 	QSYS_PORT_MODE = QSYS << TARGET_OFFSET,
240 	QSYS_SWITCH_PORT_MODE,
241 	QSYS_STAT_CNT_CFG,
242 	QSYS_EEE_CFG,
243 	QSYS_EEE_THRES,
244 	QSYS_IGR_NO_SHARING,
245 	QSYS_EGR_NO_SHARING,
246 	QSYS_SW_STATUS,
247 	QSYS_EXT_CPU_CFG,
248 	QSYS_PAD_CFG,
249 	QSYS_CPU_GROUP_MAP,
250 	QSYS_QMAP,
251 	QSYS_ISDX_SGRP,
252 	QSYS_TIMED_FRAME_ENTRY,
253 	QSYS_TFRM_MISC,
254 	QSYS_TFRM_PORT_DLY,
255 	QSYS_TFRM_TIMER_CFG_1,
256 	QSYS_TFRM_TIMER_CFG_2,
257 	QSYS_TFRM_TIMER_CFG_3,
258 	QSYS_TFRM_TIMER_CFG_4,
259 	QSYS_TFRM_TIMER_CFG_5,
260 	QSYS_TFRM_TIMER_CFG_6,
261 	QSYS_TFRM_TIMER_CFG_7,
262 	QSYS_TFRM_TIMER_CFG_8,
263 	QSYS_RED_PROFILE,
264 	QSYS_RES_QOS_MODE,
265 	QSYS_RES_CFG,
266 	QSYS_RES_STAT,
267 	QSYS_EGR_DROP_MODE,
268 	QSYS_EQ_CTRL,
269 	QSYS_EVENTS_CORE,
270 	QSYS_QMAXSDU_CFG_0,
271 	QSYS_QMAXSDU_CFG_1,
272 	QSYS_QMAXSDU_CFG_2,
273 	QSYS_QMAXSDU_CFG_3,
274 	QSYS_QMAXSDU_CFG_4,
275 	QSYS_QMAXSDU_CFG_5,
276 	QSYS_QMAXSDU_CFG_6,
277 	QSYS_QMAXSDU_CFG_7,
278 	QSYS_PREEMPTION_CFG,
279 	QSYS_CIR_CFG,
280 	QSYS_EIR_CFG,
281 	QSYS_SE_CFG,
282 	QSYS_SE_DWRR_CFG,
283 	QSYS_SE_CONNECT,
284 	QSYS_SE_DLB_SENSE,
285 	QSYS_CIR_STATE,
286 	QSYS_EIR_STATE,
287 	QSYS_SE_STATE,
288 	QSYS_HSCH_MISC_CFG,
289 	QSYS_TAG_CONFIG,
290 	QSYS_TAS_PARAM_CFG_CTRL,
291 	QSYS_PORT_MAX_SDU,
292 	QSYS_PARAM_CFG_REG_1,
293 	QSYS_PARAM_CFG_REG_2,
294 	QSYS_PARAM_CFG_REG_3,
295 	QSYS_PARAM_CFG_REG_4,
296 	QSYS_PARAM_CFG_REG_5,
297 	QSYS_GCL_CFG_REG_1,
298 	QSYS_GCL_CFG_REG_2,
299 	QSYS_PARAM_STATUS_REG_1,
300 	QSYS_PARAM_STATUS_REG_2,
301 	QSYS_PARAM_STATUS_REG_3,
302 	QSYS_PARAM_STATUS_REG_4,
303 	QSYS_PARAM_STATUS_REG_5,
304 	QSYS_PARAM_STATUS_REG_6,
305 	QSYS_PARAM_STATUS_REG_7,
306 	QSYS_PARAM_STATUS_REG_8,
307 	QSYS_PARAM_STATUS_REG_9,
308 	QSYS_GCL_STATUS_REG_1,
309 	QSYS_GCL_STATUS_REG_2,
310 	REW_PORT_VLAN_CFG = REW << TARGET_OFFSET,
311 	REW_TAG_CFG,
312 	REW_PORT_CFG,
313 	REW_DSCP_CFG,
314 	REW_PCP_DEI_QOS_MAP_CFG,
315 	REW_PTP_CFG,
316 	REW_PTP_DLY1_CFG,
317 	REW_RED_TAG_CFG,
318 	REW_DSCP_REMAP_DP1_CFG,
319 	REW_DSCP_REMAP_CFG,
320 	REW_STAT_CFG,
321 	REW_REW_STICKY,
322 	REW_PPT,
323 	SYS_COUNT_RX_OCTETS = SYS << TARGET_OFFSET,
324 	SYS_COUNT_RX_UNICAST,
325 	SYS_COUNT_RX_MULTICAST,
326 	SYS_COUNT_RX_BROADCAST,
327 	SYS_COUNT_RX_SHORTS,
328 	SYS_COUNT_RX_FRAGMENTS,
329 	SYS_COUNT_RX_JABBERS,
330 	SYS_COUNT_RX_CRC_ALIGN_ERRS,
331 	SYS_COUNT_RX_SYM_ERRS,
332 	SYS_COUNT_RX_64,
333 	SYS_COUNT_RX_65_127,
334 	SYS_COUNT_RX_128_255,
335 	SYS_COUNT_RX_256_1023,
336 	SYS_COUNT_RX_1024_1526,
337 	SYS_COUNT_RX_1527_MAX,
338 	SYS_COUNT_RX_PAUSE,
339 	SYS_COUNT_RX_CONTROL,
340 	SYS_COUNT_RX_LONGS,
341 	SYS_COUNT_RX_CLASSIFIED_DROPS,
342 	SYS_COUNT_TX_OCTETS,
343 	SYS_COUNT_TX_UNICAST,
344 	SYS_COUNT_TX_MULTICAST,
345 	SYS_COUNT_TX_BROADCAST,
346 	SYS_COUNT_TX_COLLISION,
347 	SYS_COUNT_TX_DROPS,
348 	SYS_COUNT_TX_PAUSE,
349 	SYS_COUNT_TX_64,
350 	SYS_COUNT_TX_65_127,
351 	SYS_COUNT_TX_128_511,
352 	SYS_COUNT_TX_512_1023,
353 	SYS_COUNT_TX_1024_1526,
354 	SYS_COUNT_TX_1527_MAX,
355 	SYS_COUNT_TX_AGING,
356 	SYS_RESET_CFG,
357 	SYS_SR_ETYPE_CFG,
358 	SYS_VLAN_ETYPE_CFG,
359 	SYS_PORT_MODE,
360 	SYS_FRONT_PORT_MODE,
361 	SYS_FRM_AGING,
362 	SYS_STAT_CFG,
363 	SYS_SW_STATUS,
364 	SYS_MISC_CFG,
365 	SYS_REW_MAC_HIGH_CFG,
366 	SYS_REW_MAC_LOW_CFG,
367 	SYS_TIMESTAMP_OFFSET,
368 	SYS_CMID,
369 	SYS_PAUSE_CFG,
370 	SYS_PAUSE_TOT_CFG,
371 	SYS_ATOP,
372 	SYS_ATOP_TOT_CFG,
373 	SYS_MAC_FC_CFG,
374 	SYS_MMGT,
375 	SYS_MMGT_FAST,
376 	SYS_EVENTS_DIF,
377 	SYS_EVENTS_CORE,
378 	SYS_CNT,
379 	SYS_PTP_STATUS,
380 	SYS_PTP_TXSTAMP,
381 	SYS_PTP_NXT,
382 	SYS_PTP_CFG,
383 	SYS_RAM_INIT,
384 	SYS_CM_ADDR,
385 	SYS_CM_DATA_WR,
386 	SYS_CM_DATA_RD,
387 	SYS_CM_OP,
388 	SYS_CM_DATA,
389 	PTP_PIN_CFG = PTP << TARGET_OFFSET,
390 	PTP_PIN_TOD_SEC_MSB,
391 	PTP_PIN_TOD_SEC_LSB,
392 	PTP_PIN_TOD_NSEC,
393 	PTP_PIN_WF_HIGH_PERIOD,
394 	PTP_PIN_WF_LOW_PERIOD,
395 	PTP_CFG_MISC,
396 	PTP_CLK_CFG_ADJ_CFG,
397 	PTP_CLK_CFG_ADJ_FREQ,
398 	GCB_SOFT_RST = GCB << TARGET_OFFSET,
399 	GCB_MIIM_MII_STATUS,
400 	GCB_MIIM_MII_CMD,
401 	GCB_MIIM_MII_DATA,
402 	DEV_CLOCK_CFG = DEV_GMII << TARGET_OFFSET,
403 	DEV_PORT_MISC,
404 	DEV_EVENTS,
405 	DEV_EEE_CFG,
406 	DEV_RX_PATH_DELAY,
407 	DEV_TX_PATH_DELAY,
408 	DEV_PTP_PREDICT_CFG,
409 	DEV_MAC_ENA_CFG,
410 	DEV_MAC_MODE_CFG,
411 	DEV_MAC_MAXLEN_CFG,
412 	DEV_MAC_TAGS_CFG,
413 	DEV_MAC_ADV_CHK_CFG,
414 	DEV_MAC_IFG_CFG,
415 	DEV_MAC_HDX_CFG,
416 	DEV_MAC_DBG_CFG,
417 	DEV_MAC_FC_MAC_LOW_CFG,
418 	DEV_MAC_FC_MAC_HIGH_CFG,
419 	DEV_MAC_STICKY,
420 	PCS1G_CFG,
421 	PCS1G_MODE_CFG,
422 	PCS1G_SD_CFG,
423 	PCS1G_ANEG_CFG,
424 	PCS1G_ANEG_NP_CFG,
425 	PCS1G_LB_CFG,
426 	PCS1G_DBG_CFG,
427 	PCS1G_CDET_CFG,
428 	PCS1G_ANEG_STATUS,
429 	PCS1G_ANEG_NP_STATUS,
430 	PCS1G_LINK_STATUS,
431 	PCS1G_LINK_DOWN_CNT,
432 	PCS1G_STICKY,
433 	PCS1G_DEBUG_STATUS,
434 	PCS1G_LPI_CFG,
435 	PCS1G_LPI_WAKE_ERROR_CNT,
436 	PCS1G_LPI_STATUS,
437 	PCS1G_TSTPAT_MODE_CFG,
438 	PCS1G_TSTPAT_STATUS,
439 	DEV_PCS_FX100_CFG,
440 	DEV_PCS_FX100_STATUS,
441 };
442 
443 enum ocelot_regfield {
444 	ANA_ADVLEARN_VLAN_CHK,
445 	ANA_ADVLEARN_LEARN_MIRROR,
446 	ANA_ANEVENTS_FLOOD_DISCARD,
447 	ANA_ANEVENTS_MSTI_DROP,
448 	ANA_ANEVENTS_ACLKILL,
449 	ANA_ANEVENTS_ACLUSED,
450 	ANA_ANEVENTS_AUTOAGE,
451 	ANA_ANEVENTS_VS2TTL1,
452 	ANA_ANEVENTS_STORM_DROP,
453 	ANA_ANEVENTS_LEARN_DROP,
454 	ANA_ANEVENTS_AGED_ENTRY,
455 	ANA_ANEVENTS_CPU_LEARN_FAILED,
456 	ANA_ANEVENTS_AUTO_LEARN_FAILED,
457 	ANA_ANEVENTS_LEARN_REMOVE,
458 	ANA_ANEVENTS_AUTO_LEARNED,
459 	ANA_ANEVENTS_AUTO_MOVED,
460 	ANA_ANEVENTS_DROPPED,
461 	ANA_ANEVENTS_CLASSIFIED_DROP,
462 	ANA_ANEVENTS_CLASSIFIED_COPY,
463 	ANA_ANEVENTS_VLAN_DISCARD,
464 	ANA_ANEVENTS_FWD_DISCARD,
465 	ANA_ANEVENTS_MULTICAST_FLOOD,
466 	ANA_ANEVENTS_UNICAST_FLOOD,
467 	ANA_ANEVENTS_DEST_KNOWN,
468 	ANA_ANEVENTS_BUCKET3_MATCH,
469 	ANA_ANEVENTS_BUCKET2_MATCH,
470 	ANA_ANEVENTS_BUCKET1_MATCH,
471 	ANA_ANEVENTS_BUCKET0_MATCH,
472 	ANA_ANEVENTS_CPU_OPERATION,
473 	ANA_ANEVENTS_DMAC_LOOKUP,
474 	ANA_ANEVENTS_SMAC_LOOKUP,
475 	ANA_ANEVENTS_SEQ_GEN_ERR_0,
476 	ANA_ANEVENTS_SEQ_GEN_ERR_1,
477 	ANA_TABLES_MACACCESS_B_DOM,
478 	ANA_TABLES_MACTINDX_BUCKET,
479 	ANA_TABLES_MACTINDX_M_INDEX,
480 	QSYS_SWITCH_PORT_MODE_PORT_ENA,
481 	QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG,
482 	QSYS_SWITCH_PORT_MODE_YEL_RSRVD,
483 	QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE,
484 	QSYS_SWITCH_PORT_MODE_TX_PFC_ENA,
485 	QSYS_SWITCH_PORT_MODE_TX_PFC_MODE,
486 	QSYS_TIMED_FRAME_ENTRY_TFRM_VLD,
487 	QSYS_TIMED_FRAME_ENTRY_TFRM_FP,
488 	QSYS_TIMED_FRAME_ENTRY_TFRM_PORTNO,
489 	QSYS_TIMED_FRAME_ENTRY_TFRM_TM_SEL,
490 	QSYS_TIMED_FRAME_ENTRY_TFRM_TM_T,
491 	SYS_PORT_MODE_DATA_WO_TS,
492 	SYS_PORT_MODE_INCL_INJ_HDR,
493 	SYS_PORT_MODE_INCL_XTR_HDR,
494 	SYS_PORT_MODE_INCL_HDR_ERR,
495 	SYS_RESET_CFG_CORE_ENA,
496 	SYS_RESET_CFG_MEM_ENA,
497 	SYS_RESET_CFG_MEM_INIT,
498 	GCB_SOFT_RST_SWC_RST,
499 	GCB_MIIM_MII_STATUS_PENDING,
500 	GCB_MIIM_MII_STATUS_BUSY,
501 	SYS_PAUSE_CFG_PAUSE_START,
502 	SYS_PAUSE_CFG_PAUSE_STOP,
503 	SYS_PAUSE_CFG_PAUSE_ENA,
504 	REGFIELD_MAX
505 };
506 
507 enum {
508 	/* VCAP_CORE_CFG */
509 	VCAP_CORE_UPDATE_CTRL,
510 	VCAP_CORE_MV_CFG,
511 	/* VCAP_CORE_CACHE */
512 	VCAP_CACHE_ENTRY_DAT,
513 	VCAP_CACHE_MASK_DAT,
514 	VCAP_CACHE_ACTION_DAT,
515 	VCAP_CACHE_CNT_DAT,
516 	VCAP_CACHE_TG_DAT,
517 	/* VCAP_CONST */
518 	VCAP_CONST_VCAP_VER,
519 	VCAP_CONST_ENTRY_WIDTH,
520 	VCAP_CONST_ENTRY_CNT,
521 	VCAP_CONST_ENTRY_SWCNT,
522 	VCAP_CONST_ENTRY_TG_WIDTH,
523 	VCAP_CONST_ACTION_DEF_CNT,
524 	VCAP_CONST_ACTION_WIDTH,
525 	VCAP_CONST_CNT_WIDTH,
526 	VCAP_CONST_CORE_CNT,
527 	VCAP_CONST_IF_CNT,
528 };
529 
530 enum ocelot_ptp_pins {
531 	PTP_PIN_0,
532 	PTP_PIN_1,
533 	PTP_PIN_2,
534 	PTP_PIN_3,
535 	TOD_ACC_PIN
536 };
537 
538 struct ocelot_stat_layout {
539 	u32 offset;
540 	char name[ETH_GSTRING_LEN];
541 };
542 
543 enum ocelot_tag_prefix {
544 	OCELOT_TAG_PREFIX_DISABLED	= 0,
545 	OCELOT_TAG_PREFIX_NONE,
546 	OCELOT_TAG_PREFIX_SHORT,
547 	OCELOT_TAG_PREFIX_LONG,
548 };
549 
550 struct ocelot;
551 
552 struct ocelot_ops {
553 	struct net_device *(*port_to_netdev)(struct ocelot *ocelot, int port);
554 	int (*netdev_to_port)(struct net_device *dev);
555 	int (*reset)(struct ocelot *ocelot);
556 	u16 (*wm_enc)(u16 value);
557 	u16 (*wm_dec)(u16 value);
558 	void (*wm_stat)(u32 val, u32 *inuse, u32 *maxuse);
559 	void (*psfp_init)(struct ocelot *ocelot);
560 	int (*psfp_filter_add)(struct ocelot *ocelot, int port,
561 			       struct flow_cls_offload *f);
562 	int (*psfp_filter_del)(struct ocelot *ocelot, struct flow_cls_offload *f);
563 	int (*psfp_stats_get)(struct ocelot *ocelot, struct flow_cls_offload *f,
564 			      struct flow_stats *stats);
565 	void (*cut_through_fwd)(struct ocelot *ocelot);
566 };
567 
568 struct ocelot_vcap_policer {
569 	struct list_head pol_list;
570 	u16 base;
571 	u16 max;
572 	u16 base2;
573 	u16 max2;
574 };
575 
576 struct ocelot_vcap_block {
577 	struct list_head rules;
578 	int count;
579 };
580 
581 struct ocelot_bridge_vlan {
582 	u16 vid;
583 	unsigned long portmask;
584 	unsigned long untagged;
585 	struct list_head list;
586 };
587 
588 enum ocelot_port_tag_config {
589 	/* all VLANs are egress-untagged */
590 	OCELOT_PORT_TAG_DISABLED = 0,
591 	/* all VLANs except the native VLAN and VID 0 are egress-tagged */
592 	OCELOT_PORT_TAG_NATIVE = 1,
593 	/* all VLANs except VID 0 are egress-tagged */
594 	OCELOT_PORT_TAG_TRUNK_NO_VID0 = 2,
595 	/* all VLANs are egress-tagged */
596 	OCELOT_PORT_TAG_TRUNK = 3,
597 };
598 
599 struct ocelot_psfp_list {
600 	struct list_head stream_list;
601 	struct list_head sfi_list;
602 	struct list_head sgi_list;
603 };
604 
605 enum ocelot_sb {
606 	OCELOT_SB_BUF,
607 	OCELOT_SB_REF,
608 	OCELOT_SB_NUM,
609 };
610 
611 enum ocelot_sb_pool {
612 	OCELOT_SB_POOL_ING,
613 	OCELOT_SB_POOL_EGR,
614 	OCELOT_SB_POOL_NUM,
615 };
616 
617 /* MAC table entry types.
618  * ENTRYTYPE_NORMAL is subject to aging.
619  * ENTRYTYPE_LOCKED is not subject to aging.
620  * ENTRYTYPE_MACv4 is not subject to aging. For IPv4 multicast.
621  * ENTRYTYPE_MACv6 is not subject to aging. For IPv6 multicast.
622  */
623 enum macaccess_entry_type {
624 	ENTRYTYPE_NORMAL = 0,
625 	ENTRYTYPE_LOCKED,
626 	ENTRYTYPE_MACv4,
627 	ENTRYTYPE_MACv6,
628 };
629 
630 #define OCELOT_QUIRK_PCS_PERFORMS_RATE_ADAPTATION	BIT(0)
631 #define OCELOT_QUIRK_QSGMII_PORTS_MUST_BE_UP		BIT(1)
632 
633 struct ocelot_port {
634 	struct ocelot			*ocelot;
635 
636 	struct regmap			*target;
637 
638 	bool				vlan_aware;
639 	/* VLAN that untagged frames are classified to, on ingress */
640 	const struct ocelot_bridge_vlan	*pvid_vlan;
641 
642 	unsigned int			ptp_skbs_in_flight;
643 	u8				ptp_cmd;
644 	struct sk_buff_head		tx_skbs;
645 	u8				ts_id;
646 
647 	phy_interface_t			phy_mode;
648 
649 	u8				*xmit_template;
650 	bool				is_dsa_8021q_cpu;
651 	bool				learn_ena;
652 
653 	struct net_device		*bond;
654 	bool				lag_tx_active;
655 
656 	u16				mrp_ring_id;
657 
658 	struct net_device		*bridge;
659 	u8				stp_state;
660 
661 	int				speed;
662 };
663 
664 struct ocelot {
665 	struct device			*dev;
666 	struct devlink			*devlink;
667 	struct devlink_port		*devlink_ports;
668 
669 	const struct ocelot_ops		*ops;
670 	struct regmap			*targets[TARGET_MAX];
671 	struct regmap_field		*regfields[REGFIELD_MAX];
672 	const u32 *const		*map;
673 	const struct ocelot_stat_layout	*stats_layout;
674 	unsigned int			num_stats;
675 
676 	u32				pool_size[OCELOT_SB_NUM][OCELOT_SB_POOL_NUM];
677 	int				packet_buffer_size;
678 	int				num_frame_refs;
679 	int				num_mact_rows;
680 
681 	struct ocelot_port		**ports;
682 
683 	u8				base_mac[ETH_ALEN];
684 
685 	struct list_head		vlans;
686 
687 	/* Switches like VSC9959 have flooding per traffic class */
688 	int				num_flooding_pgids;
689 
690 	/* In tables like ANA:PORT and the ANA:PGID:PGID mask,
691 	 * the CPU is located after the physical ports (at the
692 	 * num_phys_ports index).
693 	 */
694 	u8				num_phys_ports;
695 
696 	int				npi;
697 
698 	enum ocelot_tag_prefix		npi_inj_prefix;
699 	enum ocelot_tag_prefix		npi_xtr_prefix;
700 
701 	struct list_head		multicast;
702 	struct list_head		pgids;
703 
704 	struct list_head		dummy_rules;
705 	struct ocelot_vcap_block	block[3];
706 	struct ocelot_vcap_policer	vcap_pol;
707 	struct vcap_props		*vcap;
708 
709 	struct ocelot_psfp_list		psfp;
710 
711 	/* Workqueue to check statistics for overflow with its lock */
712 	struct mutex			stats_lock;
713 	u64				*stats;
714 	struct delayed_work		stats_work;
715 	struct workqueue_struct		*stats_queue;
716 
717 	/* Lock for serializing access to the MAC table */
718 	struct mutex			mact_lock;
719 	/* Lock for serializing forwarding domain changes */
720 	struct mutex			fwd_domain_lock;
721 
722 	struct workqueue_struct		*owq;
723 
724 	u8				ptp:1;
725 	struct ptp_clock		*ptp_clock;
726 	struct ptp_clock_info		ptp_info;
727 	struct hwtstamp_config		hwtstamp_config;
728 	unsigned int			ptp_skbs_in_flight;
729 	/* Protects the 2-step TX timestamp ID logic */
730 	spinlock_t			ts_id_lock;
731 	/* Protects the PTP interface state */
732 	struct mutex			ptp_lock;
733 	/* Protects the PTP clock */
734 	spinlock_t			ptp_clock_lock;
735 	struct ptp_pin_desc		ptp_pins[OCELOT_PTP_PINS_NUM];
736 
737 	struct ocelot_fdma		*fdma;
738 };
739 
740 struct ocelot_policer {
741 	u32 rate; /* kilobit per second */
742 	u32 burst; /* bytes */
743 };
744 
745 #define ocelot_read_ix(ocelot, reg, gi, ri) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
746 #define ocelot_read_gix(ocelot, reg, gi) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi))
747 #define ocelot_read_rix(ocelot, reg, ri) __ocelot_read_ix(ocelot, reg, reg##_RSZ * (ri))
748 #define ocelot_read(ocelot, reg) __ocelot_read_ix(ocelot, reg, 0)
749 
750 #define ocelot_write_ix(ocelot, val, reg, gi, ri) __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
751 #define ocelot_write_gix(ocelot, val, reg, gi) __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi))
752 #define ocelot_write_rix(ocelot, val, reg, ri) __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))
753 #define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0)
754 
755 #define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
756 #define ocelot_rmw_gix(ocelot, val, m, reg, gi) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi))
757 #define ocelot_rmw_rix(ocelot, val, m, reg, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_RSZ * (ri))
758 #define ocelot_rmw(ocelot, val, m, reg) __ocelot_rmw_ix(ocelot, val, m, reg, 0)
759 
760 #define ocelot_field_write(ocelot, reg, val) regmap_field_write((ocelot)->regfields[(reg)], (val))
761 #define ocelot_field_read(ocelot, reg, val) regmap_field_read((ocelot)->regfields[(reg)], (val))
762 #define ocelot_fields_write(ocelot, id, reg, val) regmap_fields_write((ocelot)->regfields[(reg)], (id), (val))
763 #define ocelot_fields_read(ocelot, id, reg, val) regmap_fields_read((ocelot)->regfields[(reg)], (id), (val))
764 
765 #define ocelot_target_read_ix(ocelot, target, reg, gi, ri) \
766 	__ocelot_target_read_ix(ocelot, target, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
767 #define ocelot_target_read_gix(ocelot, target, reg, gi) \
768 	__ocelot_target_read_ix(ocelot, target, reg, reg##_GSZ * (gi))
769 #define ocelot_target_read_rix(ocelot, target, reg, ri) \
770 	__ocelot_target_read_ix(ocelot, target, reg, reg##_RSZ * (ri))
771 #define ocelot_target_read(ocelot, target, reg) \
772 	__ocelot_target_read_ix(ocelot, target, reg, 0)
773 
774 #define ocelot_target_write_ix(ocelot, target, val, reg, gi, ri) \
775 	__ocelot_target_write_ix(ocelot, target, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
776 #define ocelot_target_write_gix(ocelot, target, val, reg, gi) \
777 	__ocelot_target_write_ix(ocelot, target, val, reg, reg##_GSZ * (gi))
778 #define ocelot_target_write_rix(ocelot, target, val, reg, ri) \
779 	__ocelot_target_write_ix(ocelot, target, val, reg, reg##_RSZ * (ri))
780 #define ocelot_target_write(ocelot, target, val, reg) \
781 	__ocelot_target_write_ix(ocelot, target, val, reg, 0)
782 
783 /* I/O */
784 u32 ocelot_port_readl(struct ocelot_port *port, u32 reg);
785 void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg);
786 void ocelot_port_rmwl(struct ocelot_port *port, u32 val, u32 mask, u32 reg);
787 u32 __ocelot_read_ix(struct ocelot *ocelot, u32 reg, u32 offset);
788 void __ocelot_write_ix(struct ocelot *ocelot, u32 val, u32 reg, u32 offset);
789 void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, u32 reg,
790 		     u32 offset);
791 u32 __ocelot_target_read_ix(struct ocelot *ocelot, enum ocelot_target target,
792 			    u32 reg, u32 offset);
793 void __ocelot_target_write_ix(struct ocelot *ocelot, enum ocelot_target target,
794 			      u32 val, u32 reg, u32 offset);
795 
796 /* Packet I/O */
797 bool ocelot_can_inject(struct ocelot *ocelot, int grp);
798 void ocelot_port_inject_frame(struct ocelot *ocelot, int port, int grp,
799 			      u32 rew_op, struct sk_buff *skb);
800 void ocelot_ifh_port_set(void *ifh, int port, u32 rew_op, u32 vlan_tag);
801 int ocelot_xtr_poll_frame(struct ocelot *ocelot, int grp, struct sk_buff **skb);
802 void ocelot_drain_cpu_queue(struct ocelot *ocelot, int grp);
803 void ocelot_ptp_rx_timestamp(struct ocelot *ocelot, struct sk_buff *skb,
804 			     u64 timestamp);
805 
806 /* Hardware initialization */
807 int ocelot_regfields_init(struct ocelot *ocelot,
808 			  const struct reg_field *const regfields);
809 struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res);
810 int ocelot_init(struct ocelot *ocelot);
811 void ocelot_deinit(struct ocelot *ocelot);
812 void ocelot_init_port(struct ocelot *ocelot, int port);
813 void ocelot_deinit_port(struct ocelot *ocelot, int port);
814 
815 /* DSA callbacks */
816 void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data);
817 void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data);
818 int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset);
819 int ocelot_get_ts_info(struct ocelot *ocelot, int port,
820 		       struct ethtool_ts_info *info);
821 void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs);
822 int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled,
823 			       struct netlink_ext_ack *extack);
824 void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state);
825 u32 ocelot_get_dsa_8021q_cpu_mask(struct ocelot *ocelot);
826 u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, int src_port);
827 void ocelot_apply_bridge_fwd_mask(struct ocelot *ocelot, bool joining);
828 int ocelot_port_pre_bridge_flags(struct ocelot *ocelot, int port,
829 				 struct switchdev_brport_flags val);
830 void ocelot_port_bridge_flags(struct ocelot *ocelot, int port,
831 			      struct switchdev_brport_flags val);
832 void ocelot_port_bridge_join(struct ocelot *ocelot, int port,
833 			     struct net_device *bridge);
834 void ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
835 			      struct net_device *bridge);
836 int ocelot_mact_flush(struct ocelot *ocelot, int port);
837 int ocelot_fdb_dump(struct ocelot *ocelot, int port,
838 		    dsa_fdb_dump_cb_t *cb, void *data);
839 int ocelot_fdb_add(struct ocelot *ocelot, int port,
840 		   const unsigned char *addr, u16 vid);
841 int ocelot_fdb_del(struct ocelot *ocelot, int port,
842 		   const unsigned char *addr, u16 vid);
843 int ocelot_vlan_prepare(struct ocelot *ocelot, int port, u16 vid, bool pvid,
844 			bool untagged, struct netlink_ext_ack *extack);
845 int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
846 		    bool untagged);
847 int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid);
848 int ocelot_hwstamp_get(struct ocelot *ocelot, int port, struct ifreq *ifr);
849 int ocelot_hwstamp_set(struct ocelot *ocelot, int port, struct ifreq *ifr);
850 int ocelot_port_txtstamp_request(struct ocelot *ocelot, int port,
851 				 struct sk_buff *skb,
852 				 struct sk_buff **clone);
853 void ocelot_get_txtstamp(struct ocelot *ocelot);
854 void ocelot_port_set_maxlen(struct ocelot *ocelot, int port, size_t sdu);
855 int ocelot_get_max_mtu(struct ocelot *ocelot, int port);
856 int ocelot_port_policer_add(struct ocelot *ocelot, int port,
857 			    struct ocelot_policer *pol);
858 int ocelot_port_policer_del(struct ocelot *ocelot, int port);
859 int ocelot_cls_flower_replace(struct ocelot *ocelot, int port,
860 			      struct flow_cls_offload *f, bool ingress);
861 int ocelot_cls_flower_destroy(struct ocelot *ocelot, int port,
862 			      struct flow_cls_offload *f, bool ingress);
863 int ocelot_cls_flower_stats(struct ocelot *ocelot, int port,
864 			    struct flow_cls_offload *f, bool ingress);
865 int ocelot_port_mdb_add(struct ocelot *ocelot, int port,
866 			const struct switchdev_obj_port_mdb *mdb);
867 int ocelot_port_mdb_del(struct ocelot *ocelot, int port,
868 			const struct switchdev_obj_port_mdb *mdb);
869 int ocelot_port_lag_join(struct ocelot *ocelot, int port,
870 			 struct net_device *bond,
871 			 struct netdev_lag_upper_info *info);
872 void ocelot_port_lag_leave(struct ocelot *ocelot, int port,
873 			   struct net_device *bond);
874 void ocelot_port_lag_change(struct ocelot *ocelot, int port, bool lag_tx_active);
875 
876 int ocelot_devlink_sb_register(struct ocelot *ocelot);
877 void ocelot_devlink_sb_unregister(struct ocelot *ocelot);
878 int ocelot_sb_pool_get(struct ocelot *ocelot, unsigned int sb_index,
879 		       u16 pool_index,
880 		       struct devlink_sb_pool_info *pool_info);
881 int ocelot_sb_pool_set(struct ocelot *ocelot, unsigned int sb_index,
882 		       u16 pool_index, u32 size,
883 		       enum devlink_sb_threshold_type threshold_type,
884 		       struct netlink_ext_ack *extack);
885 int ocelot_sb_port_pool_get(struct ocelot *ocelot, int port,
886 			    unsigned int sb_index, u16 pool_index,
887 			    u32 *p_threshold);
888 int ocelot_sb_port_pool_set(struct ocelot *ocelot, int port,
889 			    unsigned int sb_index, u16 pool_index,
890 			    u32 threshold, struct netlink_ext_ack *extack);
891 int ocelot_sb_tc_pool_bind_get(struct ocelot *ocelot, int port,
892 			       unsigned int sb_index, u16 tc_index,
893 			       enum devlink_sb_pool_type pool_type,
894 			       u16 *p_pool_index, u32 *p_threshold);
895 int ocelot_sb_tc_pool_bind_set(struct ocelot *ocelot, int port,
896 			       unsigned int sb_index, u16 tc_index,
897 			       enum devlink_sb_pool_type pool_type,
898 			       u16 pool_index, u32 threshold,
899 			       struct netlink_ext_ack *extack);
900 int ocelot_sb_occ_snapshot(struct ocelot *ocelot, unsigned int sb_index);
901 int ocelot_sb_occ_max_clear(struct ocelot *ocelot, unsigned int sb_index);
902 int ocelot_sb_occ_port_pool_get(struct ocelot *ocelot, int port,
903 				unsigned int sb_index, u16 pool_index,
904 				u32 *p_cur, u32 *p_max);
905 int ocelot_sb_occ_tc_port_bind_get(struct ocelot *ocelot, int port,
906 				   unsigned int sb_index, u16 tc_index,
907 				   enum devlink_sb_pool_type pool_type,
908 				   u32 *p_cur, u32 *p_max);
909 
910 void ocelot_phylink_mac_link_down(struct ocelot *ocelot, int port,
911 				  unsigned int link_an_mode,
912 				  phy_interface_t interface,
913 				  unsigned long quirks);
914 void ocelot_phylink_mac_link_up(struct ocelot *ocelot, int port,
915 				struct phy_device *phydev,
916 				unsigned int link_an_mode,
917 				phy_interface_t interface,
918 				int speed, int duplex,
919 				bool tx_pause, bool rx_pause,
920 				unsigned long quirks);
921 
922 int ocelot_mact_lookup(struct ocelot *ocelot, int *dst_idx,
923 		       const unsigned char mac[ETH_ALEN],
924 		       unsigned int vid, enum macaccess_entry_type *type);
925 int ocelot_mact_learn_streamdata(struct ocelot *ocelot, int dst_idx,
926 				 const unsigned char mac[ETH_ALEN],
927 				 unsigned int vid,
928 				 enum macaccess_entry_type type,
929 				 int sfid, int ssid);
930 
931 int ocelot_vcap_policer_add(struct ocelot *ocelot, u32 pol_ix,
932 			    struct ocelot_policer *pol);
933 int ocelot_vcap_policer_del(struct ocelot *ocelot, u32 pol_ix);
934 
935 #if IS_ENABLED(CONFIG_BRIDGE_MRP)
936 int ocelot_mrp_add(struct ocelot *ocelot, int port,
937 		   const struct switchdev_obj_mrp *mrp);
938 int ocelot_mrp_del(struct ocelot *ocelot, int port,
939 		   const struct switchdev_obj_mrp *mrp);
940 int ocelot_mrp_add_ring_role(struct ocelot *ocelot, int port,
941 			     const struct switchdev_obj_ring_role_mrp *mrp);
942 int ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port,
943 			     const struct switchdev_obj_ring_role_mrp *mrp);
944 #else
945 static inline int ocelot_mrp_add(struct ocelot *ocelot, int port,
946 				 const struct switchdev_obj_mrp *mrp)
947 {
948 	return -EOPNOTSUPP;
949 }
950 
951 static inline int ocelot_mrp_del(struct ocelot *ocelot, int port,
952 				 const struct switchdev_obj_mrp *mrp)
953 {
954 	return -EOPNOTSUPP;
955 }
956 
957 static inline int
958 ocelot_mrp_add_ring_role(struct ocelot *ocelot, int port,
959 			 const struct switchdev_obj_ring_role_mrp *mrp)
960 {
961 	return -EOPNOTSUPP;
962 }
963 
964 static inline int
965 ocelot_mrp_del_ring_role(struct ocelot *ocelot, int port,
966 			 const struct switchdev_obj_ring_role_mrp *mrp)
967 {
968 	return -EOPNOTSUPP;
969 }
970 #endif
971 
972 #endif
973