1 From 417b5a156ca8ab4c986c9deacf58309ce4e09410 Mon Sep 17 00:00:00 2001
2 From: Vladimir Oltean <vladimir.oltean@nxp.com>
3 Date: Thu, 14 Nov 2019 17:03:27 +0200
4 Subject: [PATCH] net: mscc: ocelot: publish structure definitions to
5 include/soc/mscc/ocelot.h
7 We will be registering another switch driver based on ocelot, which
8 lives under drivers/net/dsa.
10 Make sure the Felix DSA front-end has the necessary abstractions to
11 implement a new Ocelot driver instantiation. This includes the function
12 prototypes for implementing DSA callbacks.
14 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
15 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
16 Signed-off-by: David S. Miller <davem@davemloft.net>
18 drivers/net/ethernet/mscc/ocelot.c | 78 +++---
19 drivers/net/ethernet/mscc/ocelot.h | 482 +--------------------------------
20 include/soc/mscc/ocelot.h | 539 +++++++++++++++++++++++++++++++++++++
21 3 files changed, 588 insertions(+), 511 deletions(-)
22 create mode 100644 include/soc/mscc/ocelot.h
24 --- a/drivers/net/ethernet/mscc/ocelot.c
25 +++ b/drivers/net/ethernet/mscc/ocelot.c
27 #include <net/netevent.h>
28 #include <net/rtnetlink.h>
29 #include <net/switchdev.h>
33 #include "ocelot_ace.h"
34 @@ -184,8 +183,8 @@ static void ocelot_vlan_mode(struct ocel
35 ocelot_write(ocelot, val, ANA_VLANMASK);
38 -static void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
40 +void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
43 struct ocelot_port *ocelot_port = ocelot->ports[port];
45 @@ -230,6 +229,7 @@ static void ocelot_port_vlan_filtering(s
46 REW_TAG_CFG_TAG_CFG_M,
49 +EXPORT_SYMBOL(ocelot_port_vlan_filtering);
51 static int ocelot_port_set_native_vlan(struct ocelot *ocelot, int port,
53 @@ -267,8 +267,8 @@ static void ocelot_port_set_pvid(struct
54 ocelot_port->pvid = pvid;
57 -static int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
59 +int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
64 @@ -291,6 +291,7 @@ static int ocelot_vlan_add(struct ocelot
68 +EXPORT_SYMBOL(ocelot_vlan_add);
70 static int ocelot_vlan_vid_add(struct net_device *dev, u16 vid, bool pvid,
72 @@ -312,7 +313,7 @@ static int ocelot_vlan_vid_add(struct ne
76 -static int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid)
77 +int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid)
79 struct ocelot_port *ocelot_port = ocelot->ports[port];
81 @@ -333,6 +334,7 @@ static int ocelot_vlan_del(struct ocelot
85 +EXPORT_SYMBOL(ocelot_vlan_del);
87 static int ocelot_vlan_vid_del(struct net_device *dev, u16 vid)
89 @@ -404,8 +406,8 @@ static u16 ocelot_wm_enc(u16 value)
93 -static void ocelot_adjust_link(struct ocelot *ocelot, int port,
94 - struct phy_device *phydev)
95 +void ocelot_adjust_link(struct ocelot *ocelot, int port,
96 + struct phy_device *phydev)
98 struct ocelot_port *ocelot_port = ocelot->ports[port];
100 @@ -471,6 +473,7 @@ static void ocelot_adjust_link(struct oc
101 SYS_MAC_FC_CFG, port);
102 ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port);
104 +EXPORT_SYMBOL(ocelot_adjust_link);
106 static void ocelot_port_adjust_link(struct net_device *dev)
108 @@ -481,8 +484,8 @@ static void ocelot_port_adjust_link(stru
109 ocelot_adjust_link(ocelot, port, dev->phydev);
112 -static void ocelot_port_enable(struct ocelot *ocelot, int port,
113 - struct phy_device *phy)
114 +void ocelot_port_enable(struct ocelot *ocelot, int port,
115 + struct phy_device *phy)
117 /* Enable receiving frames on the port, and activate auto-learning of
119 @@ -492,6 +495,7 @@ static void ocelot_port_enable(struct oc
120 ANA_PORT_PORT_CFG_PORTID_VAL(port),
121 ANA_PORT_PORT_CFG, port);
123 +EXPORT_SYMBOL(ocelot_port_enable);
125 static int ocelot_port_open(struct net_device *dev)
127 @@ -526,7 +530,7 @@ static int ocelot_port_open(struct net_d
131 -static void ocelot_port_disable(struct ocelot *ocelot, int port)
132 +void ocelot_port_disable(struct ocelot *ocelot, int port)
134 struct ocelot_port *ocelot_port = ocelot->ports[port];
136 @@ -534,6 +538,7 @@ static void ocelot_port_disable(struct o
137 ocelot_rmw_rix(ocelot, 0, QSYS_SWITCH_PORT_MODE_PORT_ENA,
138 QSYS_SWITCH_PORT_MODE, port);
140 +EXPORT_SYMBOL(ocelot_port_disable);
142 static int ocelot_port_stop(struct net_device *dev)
144 @@ -790,9 +795,8 @@ static void ocelot_get_stats64(struct ne
145 stats->collisions = ocelot_read(ocelot, SYS_COUNT_TX_COLLISION);
148 -static int ocelot_fdb_add(struct ocelot *ocelot, int port,
149 - const unsigned char *addr, u16 vid,
151 +int ocelot_fdb_add(struct ocelot *ocelot, int port,
152 + const unsigned char *addr, u16 vid, bool vlan_aware)
154 struct ocelot_port *ocelot_port = ocelot->ports[port];
156 @@ -812,6 +816,7 @@ static int ocelot_fdb_add(struct ocelot
158 return ocelot_mact_learn(ocelot, port, addr, vid, ENTRYTYPE_LOCKED);
160 +EXPORT_SYMBOL(ocelot_fdb_add);
162 static int ocelot_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
163 struct net_device *dev,
164 @@ -826,11 +831,12 @@ static int ocelot_port_fdb_add(struct nd
165 return ocelot_fdb_add(ocelot, port, addr, vid, priv->vlan_aware);
168 -static int ocelot_fdb_del(struct ocelot *ocelot, int port,
169 - const unsigned char *addr, u16 vid)
170 +int ocelot_fdb_del(struct ocelot *ocelot, int port,
171 + const unsigned char *addr, u16 vid)
173 return ocelot_mact_forget(ocelot, addr, vid);
175 +EXPORT_SYMBOL(ocelot_fdb_del);
177 static int ocelot_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
178 struct net_device *dev,
179 @@ -940,8 +946,8 @@ static int ocelot_mact_read(struct ocelo
183 -static int ocelot_fdb_dump(struct ocelot *ocelot, int port,
184 - dsa_fdb_dump_cb_t *cb, void *data)
185 +int ocelot_fdb_dump(struct ocelot *ocelot, int port,
186 + dsa_fdb_dump_cb_t *cb, void *data)
190 @@ -973,6 +979,7 @@ static int ocelot_fdb_dump(struct ocelot
194 +EXPORT_SYMBOL(ocelot_fdb_dump);
196 static int ocelot_port_fdb_dump(struct sk_buff *skb,
197 struct netlink_callback *cb,
198 @@ -1153,8 +1160,7 @@ static const struct net_device_ops ocelo
199 .ndo_do_ioctl = ocelot_ioctl,
202 -static void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset,
204 +void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data)
208 @@ -1165,6 +1171,7 @@ static void ocelot_get_strings(struct oc
209 memcpy(data + i * ETH_GSTRING_LEN, ocelot->stats_layout[i].name,
212 +EXPORT_SYMBOL(ocelot_get_strings);
214 static void ocelot_port_get_strings(struct net_device *netdev, u32 sset,
216 @@ -1216,7 +1223,7 @@ static void ocelot_check_stats_work(stru
217 OCELOT_STATS_CHECK_DELAY);
220 -static void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data)
221 +void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data)
225 @@ -1227,6 +1234,7 @@ static void ocelot_get_ethtool_stats(str
226 for (i = 0; i < ocelot->num_stats; i++)
227 *data++ = ocelot->stats[port * ocelot->num_stats + i];
229 +EXPORT_SYMBOL(ocelot_get_ethtool_stats);
231 static void ocelot_port_get_ethtool_stats(struct net_device *dev,
232 struct ethtool_stats *stats,
233 @@ -1239,13 +1247,14 @@ static void ocelot_port_get_ethtool_stat
234 ocelot_get_ethtool_stats(ocelot, port, data);
237 -static int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset)
238 +int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset)
240 if (sset != ETH_SS_STATS)
243 return ocelot->num_stats;
245 +EXPORT_SYMBOL(ocelot_get_sset_count);
247 static int ocelot_port_get_sset_count(struct net_device *dev, int sset)
249 @@ -1256,8 +1265,8 @@ static int ocelot_port_get_sset_count(st
250 return ocelot_get_sset_count(ocelot, port, sset);
253 -static int ocelot_get_ts_info(struct ocelot *ocelot, int port,
254 - struct ethtool_ts_info *info)
255 +int ocelot_get_ts_info(struct ocelot *ocelot, int port,
256 + struct ethtool_ts_info *info)
258 info->phc_index = ocelot->ptp_clock ?
259 ptp_clock_index(ocelot->ptp_clock) : -1;
260 @@ -1273,6 +1282,7 @@ static int ocelot_get_ts_info(struct oce
264 +EXPORT_SYMBOL(ocelot_get_ts_info);
266 static int ocelot_port_get_ts_info(struct net_device *dev,
267 struct ethtool_ts_info *info)
268 @@ -1296,8 +1306,7 @@ static const struct ethtool_ops ocelot_e
269 .get_ts_info = ocelot_port_get_ts_info,
272 -static void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port,
274 +void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state)
278 @@ -1358,6 +1367,7 @@ static void ocelot_bridge_stp_state_set(
282 +EXPORT_SYMBOL(ocelot_bridge_stp_state_set);
284 static void ocelot_port_attr_stp_state_set(struct ocelot *ocelot, int port,
285 struct switchdev_trans *trans,
286 @@ -1369,11 +1379,12 @@ static void ocelot_port_attr_stp_state_s
287 ocelot_bridge_stp_state_set(ocelot, port, state);
290 -static void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs)
291 +void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs)
293 ocelot_write(ocelot, ANA_AUTOAGE_AGE_PERIOD(msecs / 2),
296 +EXPORT_SYMBOL(ocelot_set_ageing_time);
298 static void ocelot_port_attr_ageing_set(struct ocelot *ocelot, int port,
299 unsigned long ageing_clock_t)
300 @@ -1604,8 +1615,8 @@ static int ocelot_port_obj_del(struct ne
304 -static int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
305 - struct net_device *bridge)
306 +int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
307 + struct net_device *bridge)
309 if (!ocelot->bridge_mask) {
310 ocelot->hw_bridge_dev = bridge;
311 @@ -1620,9 +1631,10 @@ static int ocelot_port_bridge_join(struc
315 +EXPORT_SYMBOL(ocelot_port_bridge_join);
317 -static int ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
318 - struct net_device *bridge)
319 +int ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
320 + struct net_device *bridge)
322 ocelot->bridge_mask &= ~BIT(port);
324 @@ -1633,6 +1645,7 @@ static int ocelot_port_bridge_leave(stru
325 ocelot_port_set_pvid(ocelot, port, 0);
326 return ocelot_port_set_native_vlan(ocelot, port, 0);
328 +EXPORT_SYMBOL(ocelot_port_bridge_leave);
330 static void ocelot_set_aggr_pgids(struct ocelot *ocelot)
332 @@ -2121,7 +2134,7 @@ static void ocelot_port_set_mtu(struct o
333 ocelot_write(ocelot, ocelot_wm_enc(atop_wm), SYS_ATOP_TOT_CFG);
336 -static void ocelot_init_port(struct ocelot *ocelot, int port)
337 +void ocelot_init_port(struct ocelot *ocelot, int port)
339 struct ocelot_port *ocelot_port = ocelot->ports[port];
341 @@ -2168,6 +2181,7 @@ static void ocelot_init_port(struct ocel
342 /* Enable vcap lookups */
343 ocelot_vcap_enable(ocelot, port);
345 +EXPORT_SYMBOL(ocelot_init_port);
347 int ocelot_probe_port(struct ocelot *ocelot, u8 port,
349 --- a/drivers/net/ethernet/mscc/ocelot.h
350 +++ b/drivers/net/ethernet/mscc/ocelot.h
352 #include <linux/ptp_clock_kernel.h>
353 #include <linux/regmap.h>
355 +#include <soc/mscc/ocelot.h>
356 #include "ocelot_ana.h"
357 #include "ocelot_dev.h"
358 #include "ocelot_qsys.h"
359 @@ -52,376 +53,6 @@ struct frame_info {
360 u32 timestamp; /* rew_val */
363 -#define IFH_INJ_BYPASS BIT(31)
364 -#define IFH_INJ_POP_CNT_DISABLE (3 << 28)
366 -#define IFH_TAG_TYPE_C 0
367 -#define IFH_TAG_TYPE_S 1
369 -#define IFH_REW_OP_NOOP 0x0
370 -#define IFH_REW_OP_DSCP 0x1
371 -#define IFH_REW_OP_ONE_STEP_PTP 0x2
372 -#define IFH_REW_OP_TWO_STEP_PTP 0x3
373 -#define IFH_REW_OP_ORIGIN_PTP 0x5
375 -#define OCELOT_TAG_LEN 16
376 -#define OCELOT_SHORT_PREFIX_LEN 4
377 -#define OCELOT_LONG_PREFIX_LEN 16
379 -#define OCELOT_SPEED_2500 0
380 -#define OCELOT_SPEED_1000 1
381 -#define OCELOT_SPEED_100 2
382 -#define OCELOT_SPEED_10 3
384 -#define TARGET_OFFSET 24
385 -#define REG_MASK GENMASK(TARGET_OFFSET - 1, 0)
386 -#define REG(reg, offset) [reg & REG_MASK] = offset
388 -enum ocelot_target {
401 - ANA_ADVLEARN = ANA << TARGET_OFFSET,
406 - ANA_STORMLIMIT_BURST,
407 - ANA_STORMLIMIT_CFG,
408 - ANA_ISOLATED_PORTS,
409 - ANA_COMMUNITY_PORTS,
422 - ANA_TABLES_ANMOVED,
423 - ANA_TABLES_MACHDATA,
424 - ANA_TABLES_MACLDATA,
425 - ANA_TABLES_STREAMDATA,
426 - ANA_TABLES_MACACCESS,
427 - ANA_TABLES_MACTINDX,
428 - ANA_TABLES_VLANACCESS,
429 - ANA_TABLES_VLANTIDX,
430 - ANA_TABLES_ISDXACCESS,
431 - ANA_TABLES_ISDXTIDX,
432 - ANA_TABLES_ENTRYLIM,
433 - ANA_TABLES_PTP_ID_HIGH,
434 - ANA_TABLES_PTP_ID_LOW,
435 - ANA_TABLES_STREAMACCESS,
436 - ANA_TABLES_STREAMTIDX,
437 - ANA_TABLES_SEQ_HISTORY,
438 - ANA_TABLES_SEQ_MASK,
439 - ANA_TABLES_SFID_MASK,
440 - ANA_TABLES_SFIDACCESS,
441 - ANA_TABLES_SFIDTIDX,
443 - ANA_OAM_UPM_LM_CNT,
444 - ANA_SG_ACCESS_CTRL,
445 - ANA_SG_CONFIG_REG_1,
446 - ANA_SG_CONFIG_REG_2,
447 - ANA_SG_CONFIG_REG_3,
448 - ANA_SG_CONFIG_REG_4,
449 - ANA_SG_CONFIG_REG_5,
450 - ANA_SG_GCL_GS_CONFIG,
451 - ANA_SG_GCL_TI_CONFIG,
452 - ANA_SG_STATUS_REG_1,
453 - ANA_SG_STATUS_REG_2,
454 - ANA_SG_STATUS_REG_3,
459 - ANA_PORT_VCAP_S1_KEY_CFG,
460 - ANA_PORT_VCAP_S2_CFG,
461 - ANA_PORT_PCP_DEI_MAP,
462 - ANA_PORT_CPU_FWD_CFG,
463 - ANA_PORT_CPU_FWD_BPDU_CFG,
464 - ANA_PORT_CPU_FWD_GARP_CFG,
465 - ANA_PORT_CPU_FWD_CCM_CFG,
469 - ANA_PORT_PTP_DLY1_CFG,
470 - ANA_PORT_PTP_DLY2_CFG,
474 - ANA_IPT_OAM_MEP_CFG,
477 - ANA_FID_MAP_FID_MAP,
484 - ANA_VCAP_RNG_TYPE_CFG,
485 - ANA_VCAP_RNG_VAL_CFG,
500 - QS_XTR_GRP_CFG = QS << TARGET_OFFSET,
502 - QS_XTR_FRM_PRUNING,
504 - QS_XTR_DATA_PRESENT,
512 - QSYS_PORT_MODE = QSYS << TARGET_OFFSET,
513 - QSYS_SWITCH_PORT_MODE,
517 - QSYS_IGR_NO_SHARING,
518 - QSYS_EGR_NO_SHARING,
522 - QSYS_CPU_GROUP_MAP,
525 - QSYS_TIMED_FRAME_ENTRY,
527 - QSYS_TFRM_PORT_DLY,
528 - QSYS_TFRM_TIMER_CFG_1,
529 - QSYS_TFRM_TIMER_CFG_2,
530 - QSYS_TFRM_TIMER_CFG_3,
531 - QSYS_TFRM_TIMER_CFG_4,
532 - QSYS_TFRM_TIMER_CFG_5,
533 - QSYS_TFRM_TIMER_CFG_6,
534 - QSYS_TFRM_TIMER_CFG_7,
535 - QSYS_TFRM_TIMER_CFG_8,
540 - QSYS_EGR_DROP_MODE,
543 - QSYS_QMAXSDU_CFG_0,
544 - QSYS_QMAXSDU_CFG_1,
545 - QSYS_QMAXSDU_CFG_2,
546 - QSYS_QMAXSDU_CFG_3,
547 - QSYS_QMAXSDU_CFG_4,
548 - QSYS_QMAXSDU_CFG_5,
549 - QSYS_QMAXSDU_CFG_6,
550 - QSYS_QMAXSDU_CFG_7,
551 - QSYS_PREEMPTION_CFG,
561 - QSYS_HSCH_MISC_CFG,
563 - QSYS_TAS_PARAM_CFG_CTRL,
565 - QSYS_PARAM_CFG_REG_1,
566 - QSYS_PARAM_CFG_REG_2,
567 - QSYS_PARAM_CFG_REG_3,
568 - QSYS_PARAM_CFG_REG_4,
569 - QSYS_PARAM_CFG_REG_5,
570 - QSYS_GCL_CFG_REG_1,
571 - QSYS_GCL_CFG_REG_2,
572 - QSYS_PARAM_STATUS_REG_1,
573 - QSYS_PARAM_STATUS_REG_2,
574 - QSYS_PARAM_STATUS_REG_3,
575 - QSYS_PARAM_STATUS_REG_4,
576 - QSYS_PARAM_STATUS_REG_5,
577 - QSYS_PARAM_STATUS_REG_6,
578 - QSYS_PARAM_STATUS_REG_7,
579 - QSYS_PARAM_STATUS_REG_8,
580 - QSYS_PARAM_STATUS_REG_9,
581 - QSYS_GCL_STATUS_REG_1,
582 - QSYS_GCL_STATUS_REG_2,
583 - REW_PORT_VLAN_CFG = REW << TARGET_OFFSET,
587 - REW_PCP_DEI_QOS_MAP_CFG,
591 - REW_DSCP_REMAP_DP1_CFG,
592 - REW_DSCP_REMAP_CFG,
596 - SYS_COUNT_RX_OCTETS = SYS << TARGET_OFFSET,
597 - SYS_COUNT_RX_UNICAST,
598 - SYS_COUNT_RX_MULTICAST,
599 - SYS_COUNT_RX_BROADCAST,
600 - SYS_COUNT_RX_SHORTS,
601 - SYS_COUNT_RX_FRAGMENTS,
602 - SYS_COUNT_RX_JABBERS,
603 - SYS_COUNT_RX_CRC_ALIGN_ERRS,
604 - SYS_COUNT_RX_SYM_ERRS,
606 - SYS_COUNT_RX_65_127,
607 - SYS_COUNT_RX_128_255,
608 - SYS_COUNT_RX_256_1023,
609 - SYS_COUNT_RX_1024_1526,
610 - SYS_COUNT_RX_1527_MAX,
611 - SYS_COUNT_RX_PAUSE,
612 - SYS_COUNT_RX_CONTROL,
613 - SYS_COUNT_RX_LONGS,
614 - SYS_COUNT_RX_CLASSIFIED_DROPS,
615 - SYS_COUNT_TX_OCTETS,
616 - SYS_COUNT_TX_UNICAST,
617 - SYS_COUNT_TX_MULTICAST,
618 - SYS_COUNT_TX_BROADCAST,
619 - SYS_COUNT_TX_COLLISION,
620 - SYS_COUNT_TX_DROPS,
621 - SYS_COUNT_TX_PAUSE,
623 - SYS_COUNT_TX_65_127,
624 - SYS_COUNT_TX_128_511,
625 - SYS_COUNT_TX_512_1023,
626 - SYS_COUNT_TX_1024_1526,
627 - SYS_COUNT_TX_1527_MAX,
628 - SYS_COUNT_TX_AGING,
631 - SYS_VLAN_ETYPE_CFG,
633 - SYS_FRONT_PORT_MODE,
638 - SYS_REW_MAC_HIGH_CFG,
639 - SYS_REW_MAC_LOW_CFG,
640 - SYS_TIMESTAMP_OFFSET,
662 - S2_CORE_UPDATE_CTRL = S2 << TARGET_OFFSET,
664 - S2_CACHE_ENTRY_DAT,
666 - S2_CACHE_ACTION_DAT,
669 - PTP_PIN_CFG = PTP << TARGET_OFFSET,
670 - PTP_PIN_TOD_SEC_MSB,
671 - PTP_PIN_TOD_SEC_LSB,
674 - PTP_CLK_CFG_ADJ_CFG,
675 - PTP_CLK_CFG_ADJ_FREQ,
678 -enum ocelot_regfield {
679 - ANA_ADVLEARN_VLAN_CHK,
680 - ANA_ADVLEARN_LEARN_MIRROR,
681 - ANA_ANEVENTS_FLOOD_DISCARD,
682 - ANA_ANEVENTS_MSTI_DROP,
683 - ANA_ANEVENTS_ACLKILL,
684 - ANA_ANEVENTS_ACLUSED,
685 - ANA_ANEVENTS_AUTOAGE,
686 - ANA_ANEVENTS_VS2TTL1,
687 - ANA_ANEVENTS_STORM_DROP,
688 - ANA_ANEVENTS_LEARN_DROP,
689 - ANA_ANEVENTS_AGED_ENTRY,
690 - ANA_ANEVENTS_CPU_LEARN_FAILED,
691 - ANA_ANEVENTS_AUTO_LEARN_FAILED,
692 - ANA_ANEVENTS_LEARN_REMOVE,
693 - ANA_ANEVENTS_AUTO_LEARNED,
694 - ANA_ANEVENTS_AUTO_MOVED,
695 - ANA_ANEVENTS_DROPPED,
696 - ANA_ANEVENTS_CLASSIFIED_DROP,
697 - ANA_ANEVENTS_CLASSIFIED_COPY,
698 - ANA_ANEVENTS_VLAN_DISCARD,
699 - ANA_ANEVENTS_FWD_DISCARD,
700 - ANA_ANEVENTS_MULTICAST_FLOOD,
701 - ANA_ANEVENTS_UNICAST_FLOOD,
702 - ANA_ANEVENTS_DEST_KNOWN,
703 - ANA_ANEVENTS_BUCKET3_MATCH,
704 - ANA_ANEVENTS_BUCKET2_MATCH,
705 - ANA_ANEVENTS_BUCKET1_MATCH,
706 - ANA_ANEVENTS_BUCKET0_MATCH,
707 - ANA_ANEVENTS_CPU_OPERATION,
708 - ANA_ANEVENTS_DMAC_LOOKUP,
709 - ANA_ANEVENTS_SMAC_LOOKUP,
710 - ANA_ANEVENTS_SEQ_GEN_ERR_0,
711 - ANA_ANEVENTS_SEQ_GEN_ERR_1,
712 - ANA_TABLES_MACACCESS_B_DOM,
713 - ANA_TABLES_MACTINDX_BUCKET,
714 - ANA_TABLES_MACTINDX_M_INDEX,
715 - QSYS_TIMED_FRAME_ENTRY_TFRM_VLD,
716 - QSYS_TIMED_FRAME_ENTRY_TFRM_FP,
717 - QSYS_TIMED_FRAME_ENTRY_TFRM_PORTNO,
718 - QSYS_TIMED_FRAME_ENTRY_TFRM_TM_SEL,
719 - QSYS_TIMED_FRAME_ENTRY_TFRM_TM_T,
720 - SYS_RESET_CFG_CORE_ENA,
721 - SYS_RESET_CFG_MEM_ENA,
722 - SYS_RESET_CFG_MEM_INIT,
726 -enum ocelot_clk_pins {
733 struct ocelot_multicast {
734 struct list_head list;
735 unsigned char addr[ETH_ALEN];
736 @@ -429,88 +60,6 @@ struct ocelot_multicast {
740 -enum ocelot_tag_prefix {
741 - OCELOT_TAG_PREFIX_DISABLED = 0,
742 - OCELOT_TAG_PREFIX_NONE,
743 - OCELOT_TAG_PREFIX_SHORT,
744 - OCELOT_TAG_PREFIX_LONG,
750 -struct ocelot_stat_layout {
752 - char name[ETH_GSTRING_LEN];
756 - void (*pcs_init)(struct ocelot *ocelot, int port);
757 - int (*reset)(struct ocelot *ocelot);
761 - const struct ocelot_ops *ops;
762 - struct device *dev;
764 - struct regmap *targets[TARGET_MAX];
765 - struct regmap_field *regfields[REGFIELD_MAX];
766 - const u32 *const *map;
767 - const struct ocelot_stat_layout *stats_layout;
768 - unsigned int num_stats;
770 - u8 base_mac[ETH_ALEN];
772 - struct net_device *hw_bridge_dev;
774 - u16 bridge_fwd_mask;
776 - struct workqueue_struct *ocelot_owq;
778 - int shared_queue_sz;
783 - struct ocelot_port **ports;
787 - /* Keep track of the vlan port masks */
788 - u32 vlan_mask[VLAN_N_VID];
790 - struct list_head multicast;
792 - /* Workqueue to check statistics for overflow with its lock */
793 - struct mutex stats_lock;
795 - struct delayed_work stats_work;
796 - struct workqueue_struct *stats_queue;
799 - struct ptp_clock *ptp_clock;
800 - struct ptp_clock_info ptp_info;
801 - struct hwtstamp_config hwtstamp_config;
802 - struct mutex ptp_lock; /* Protects the PTP interface state */
803 - spinlock_t ptp_clock_lock; /* Protects the PTP clock */
806 -struct ocelot_port {
807 - struct ocelot *ocelot;
809 - void __iomem *regs;
811 - /* Ingress default VLAN (pvid) */
814 - /* Egress default VLAN (vid) */
818 - struct list_head skbs;
822 struct ocelot_port_private {
823 struct ocelot_port port;
824 struct net_device *dev;
825 @@ -531,37 +80,12 @@ struct ocelot_skb {
829 -u32 __ocelot_read_ix(struct ocelot *ocelot, u32 reg, u32 offset);
830 -#define ocelot_read_ix(ocelot, reg, gi, ri) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
831 -#define ocelot_read_gix(ocelot, reg, gi) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi))
832 -#define ocelot_read_rix(ocelot, reg, ri) __ocelot_read_ix(ocelot, reg, reg##_RSZ * (ri))
833 -#define ocelot_read(ocelot, reg) __ocelot_read_ix(ocelot, reg, 0)
835 -void __ocelot_write_ix(struct ocelot *ocelot, u32 val, u32 reg, u32 offset);
836 -#define ocelot_write_ix(ocelot, val, reg, gi, ri) __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
837 -#define ocelot_write_gix(ocelot, val, reg, gi) __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi))
838 -#define ocelot_write_rix(ocelot, val, reg, ri) __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))
839 -#define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0)
841 -void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, u32 reg,
843 -#define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
844 -#define ocelot_rmw_gix(ocelot, val, m, reg, gi) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi))
845 -#define ocelot_rmw_rix(ocelot, val, m, reg, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_RSZ * (ri))
846 -#define ocelot_rmw(ocelot, val, m, reg) __ocelot_rmw_ix(ocelot, val, m, reg, 0)
848 u32 ocelot_port_readl(struct ocelot_port *port, u32 reg);
849 void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg);
851 -int ocelot_regfields_init(struct ocelot *ocelot,
852 - const struct reg_field *const regfields);
853 -struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res);
855 #define ocelot_field_write(ocelot, reg, val) regmap_field_write((ocelot)->regfields[(reg)], (val))
856 #define ocelot_field_read(ocelot, reg, val) regmap_field_read((ocelot)->regfields[(reg)], (val))
858 -int ocelot_init(struct ocelot *ocelot);
859 -void ocelot_deinit(struct ocelot *ocelot);
860 int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops);
861 int ocelot_probe_port(struct ocelot *ocelot, u8 port,
863 @@ -575,7 +99,7 @@ extern struct notifier_block ocelot_netd
864 extern struct notifier_block ocelot_switchdev_nb;
865 extern struct notifier_block ocelot_switchdev_blocking_nb;
867 -int ocelot_ptp_gettime64(struct ptp_clock_info *ptp, struct timespec64 *ts);
868 -void ocelot_get_hwtimestamp(struct ocelot *ocelot, struct timespec64 *ts);
869 +#define ocelot_field_write(ocelot, reg, val) regmap_field_write((ocelot)->regfields[(reg)], (val))
870 +#define ocelot_field_read(ocelot, reg, val) regmap_field_read((ocelot)->regfields[(reg)], (val))
874 +++ b/include/soc/mscc/ocelot.h
876 +/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
877 +/* Copyright (c) 2017 Microsemi Corporation
880 +#ifndef _SOC_MSCC_OCELOT_H
881 +#define _SOC_MSCC_OCELOT_H
883 +#include <linux/ptp_clock_kernel.h>
884 +#include <linux/net_tstamp.h>
885 +#include <linux/if_vlan.h>
886 +#include <linux/regmap.h>
887 +#include <net/dsa.h>
889 +#define IFH_INJ_BYPASS BIT(31)
890 +#define IFH_INJ_POP_CNT_DISABLE (3 << 28)
892 +#define IFH_TAG_TYPE_C 0
893 +#define IFH_TAG_TYPE_S 1
895 +#define IFH_REW_OP_NOOP 0x0
896 +#define IFH_REW_OP_DSCP 0x1
897 +#define IFH_REW_OP_ONE_STEP_PTP 0x2
898 +#define IFH_REW_OP_TWO_STEP_PTP 0x3
899 +#define IFH_REW_OP_ORIGIN_PTP 0x5
901 +#define OCELOT_TAG_LEN 16
902 +#define OCELOT_SHORT_PREFIX_LEN 4
903 +#define OCELOT_LONG_PREFIX_LEN 16
905 +#define OCELOT_SPEED_2500 0
906 +#define OCELOT_SPEED_1000 1
907 +#define OCELOT_SPEED_100 2
908 +#define OCELOT_SPEED_10 3
910 +#define TARGET_OFFSET 24
911 +#define REG_MASK GENMASK(TARGET_OFFSET - 1, 0)
912 +#define REG(reg, offset) [reg & REG_MASK] = offset
914 +#define REG_RESERVED_ADDR 0xffffffff
915 +#define REG_RESERVED(reg) REG(reg, REG_RESERVED_ADDR)
917 +enum ocelot_target {
931 + ANA_ADVLEARN = ANA << TARGET_OFFSET,
936 + ANA_STORMLIMIT_BURST,
937 + ANA_STORMLIMIT_CFG,
938 + ANA_ISOLATED_PORTS,
939 + ANA_COMMUNITY_PORTS,
952 + ANA_TABLES_ANMOVED,
953 + ANA_TABLES_MACHDATA,
954 + ANA_TABLES_MACLDATA,
955 + ANA_TABLES_STREAMDATA,
956 + ANA_TABLES_MACACCESS,
957 + ANA_TABLES_MACTINDX,
958 + ANA_TABLES_VLANACCESS,
959 + ANA_TABLES_VLANTIDX,
960 + ANA_TABLES_ISDXACCESS,
961 + ANA_TABLES_ISDXTIDX,
962 + ANA_TABLES_ENTRYLIM,
963 + ANA_TABLES_PTP_ID_HIGH,
964 + ANA_TABLES_PTP_ID_LOW,
965 + ANA_TABLES_STREAMACCESS,
966 + ANA_TABLES_STREAMTIDX,
967 + ANA_TABLES_SEQ_HISTORY,
968 + ANA_TABLES_SEQ_MASK,
969 + ANA_TABLES_SFID_MASK,
970 + ANA_TABLES_SFIDACCESS,
971 + ANA_TABLES_SFIDTIDX,
973 + ANA_OAM_UPM_LM_CNT,
974 + ANA_SG_ACCESS_CTRL,
975 + ANA_SG_CONFIG_REG_1,
976 + ANA_SG_CONFIG_REG_2,
977 + ANA_SG_CONFIG_REG_3,
978 + ANA_SG_CONFIG_REG_4,
979 + ANA_SG_CONFIG_REG_5,
980 + ANA_SG_GCL_GS_CONFIG,
981 + ANA_SG_GCL_TI_CONFIG,
982 + ANA_SG_STATUS_REG_1,
983 + ANA_SG_STATUS_REG_2,
984 + ANA_SG_STATUS_REG_3,
989 + ANA_PORT_VCAP_S1_KEY_CFG,
990 + ANA_PORT_VCAP_S2_CFG,
991 + ANA_PORT_PCP_DEI_MAP,
992 + ANA_PORT_CPU_FWD_CFG,
993 + ANA_PORT_CPU_FWD_BPDU_CFG,
994 + ANA_PORT_CPU_FWD_GARP_CFG,
995 + ANA_PORT_CPU_FWD_CCM_CFG,
999 + ANA_PORT_PTP_DLY1_CFG,
1000 + ANA_PORT_PTP_DLY2_CFG,
1001 + ANA_PORT_SFID_CFG,
1003 + ANA_PFC_PFC_TIMER,
1004 + ANA_IPT_OAM_MEP_CFG,
1007 + ANA_FID_MAP_FID_MAP,
1011 + ANA_CPUQ_8021_CFG,
1013 + ANA_DSCP_REWR_CFG,
1014 + ANA_VCAP_RNG_TYPE_CFG,
1015 + ANA_VCAP_RNG_VAL_CFG,
1017 + ANA_VRAP_HDR_DATA,
1018 + ANA_VRAP_HDR_MASK,
1024 + ANA_POL_PIR_STATE,
1025 + ANA_POL_CIR_STATE,
1030 + QS_XTR_GRP_CFG = QS << TARGET_OFFSET,
1032 + QS_XTR_FRM_PRUNING,
1034 + QS_XTR_DATA_PRESENT,
1042 + QSYS_PORT_MODE = QSYS << TARGET_OFFSET,
1043 + QSYS_SWITCH_PORT_MODE,
1044 + QSYS_STAT_CNT_CFG,
1047 + QSYS_IGR_NO_SHARING,
1048 + QSYS_EGR_NO_SHARING,
1052 + QSYS_CPU_GROUP_MAP,
1055 + QSYS_TIMED_FRAME_ENTRY,
1057 + QSYS_TFRM_PORT_DLY,
1058 + QSYS_TFRM_TIMER_CFG_1,
1059 + QSYS_TFRM_TIMER_CFG_2,
1060 + QSYS_TFRM_TIMER_CFG_3,
1061 + QSYS_TFRM_TIMER_CFG_4,
1062 + QSYS_TFRM_TIMER_CFG_5,
1063 + QSYS_TFRM_TIMER_CFG_6,
1064 + QSYS_TFRM_TIMER_CFG_7,
1065 + QSYS_TFRM_TIMER_CFG_8,
1067 + QSYS_RES_QOS_MODE,
1070 + QSYS_EGR_DROP_MODE,
1073 + QSYS_QMAXSDU_CFG_0,
1074 + QSYS_QMAXSDU_CFG_1,
1075 + QSYS_QMAXSDU_CFG_2,
1076 + QSYS_QMAXSDU_CFG_3,
1077 + QSYS_QMAXSDU_CFG_4,
1078 + QSYS_QMAXSDU_CFG_5,
1079 + QSYS_QMAXSDU_CFG_6,
1080 + QSYS_QMAXSDU_CFG_7,
1081 + QSYS_PREEMPTION_CFG,
1087 + QSYS_SE_DLB_SENSE,
1091 + QSYS_HSCH_MISC_CFG,
1093 + QSYS_TAS_PARAM_CFG_CTRL,
1094 + QSYS_PORT_MAX_SDU,
1095 + QSYS_PARAM_CFG_REG_1,
1096 + QSYS_PARAM_CFG_REG_2,
1097 + QSYS_PARAM_CFG_REG_3,
1098 + QSYS_PARAM_CFG_REG_4,
1099 + QSYS_PARAM_CFG_REG_5,
1100 + QSYS_GCL_CFG_REG_1,
1101 + QSYS_GCL_CFG_REG_2,
1102 + QSYS_PARAM_STATUS_REG_1,
1103 + QSYS_PARAM_STATUS_REG_2,
1104 + QSYS_PARAM_STATUS_REG_3,
1105 + QSYS_PARAM_STATUS_REG_4,
1106 + QSYS_PARAM_STATUS_REG_5,
1107 + QSYS_PARAM_STATUS_REG_6,
1108 + QSYS_PARAM_STATUS_REG_7,
1109 + QSYS_PARAM_STATUS_REG_8,
1110 + QSYS_PARAM_STATUS_REG_9,
1111 + QSYS_GCL_STATUS_REG_1,
1112 + QSYS_GCL_STATUS_REG_2,
1113 + REW_PORT_VLAN_CFG = REW << TARGET_OFFSET,
1117 + REW_PCP_DEI_QOS_MAP_CFG,
1121 + REW_DSCP_REMAP_DP1_CFG,
1122 + REW_DSCP_REMAP_CFG,
1126 + SYS_COUNT_RX_OCTETS = SYS << TARGET_OFFSET,
1127 + SYS_COUNT_RX_UNICAST,
1128 + SYS_COUNT_RX_MULTICAST,
1129 + SYS_COUNT_RX_BROADCAST,
1130 + SYS_COUNT_RX_SHORTS,
1131 + SYS_COUNT_RX_FRAGMENTS,
1132 + SYS_COUNT_RX_JABBERS,
1133 + SYS_COUNT_RX_CRC_ALIGN_ERRS,
1134 + SYS_COUNT_RX_SYM_ERRS,
1136 + SYS_COUNT_RX_65_127,
1137 + SYS_COUNT_RX_128_255,
1138 + SYS_COUNT_RX_256_1023,
1139 + SYS_COUNT_RX_1024_1526,
1140 + SYS_COUNT_RX_1527_MAX,
1141 + SYS_COUNT_RX_PAUSE,
1142 + SYS_COUNT_RX_CONTROL,
1143 + SYS_COUNT_RX_LONGS,
1144 + SYS_COUNT_RX_CLASSIFIED_DROPS,
1145 + SYS_COUNT_TX_OCTETS,
1146 + SYS_COUNT_TX_UNICAST,
1147 + SYS_COUNT_TX_MULTICAST,
1148 + SYS_COUNT_TX_BROADCAST,
1149 + SYS_COUNT_TX_COLLISION,
1150 + SYS_COUNT_TX_DROPS,
1151 + SYS_COUNT_TX_PAUSE,
1153 + SYS_COUNT_TX_65_127,
1154 + SYS_COUNT_TX_128_511,
1155 + SYS_COUNT_TX_512_1023,
1156 + SYS_COUNT_TX_1024_1526,
1157 + SYS_COUNT_TX_1527_MAX,
1158 + SYS_COUNT_TX_AGING,
1161 + SYS_VLAN_ETYPE_CFG,
1163 + SYS_FRONT_PORT_MODE,
1168 + SYS_REW_MAC_HIGH_CFG,
1169 + SYS_REW_MAC_LOW_CFG,
1170 + SYS_TIMESTAMP_OFFSET,
1173 + SYS_PAUSE_TOT_CFG,
1192 + S2_CORE_UPDATE_CTRL = S2 << TARGET_OFFSET,
1194 + S2_CACHE_ENTRY_DAT,
1195 + S2_CACHE_MASK_DAT,
1196 + S2_CACHE_ACTION_DAT,
1199 + PTP_PIN_CFG = PTP << TARGET_OFFSET,
1200 + PTP_PIN_TOD_SEC_MSB,
1201 + PTP_PIN_TOD_SEC_LSB,
1204 + PTP_CLK_CFG_ADJ_CFG,
1205 + PTP_CLK_CFG_ADJ_FREQ,
1206 + GCB_SOFT_RST = GCB << TARGET_OFFSET,
1209 +enum ocelot_regfield {
1210 + ANA_ADVLEARN_VLAN_CHK,
1211 + ANA_ADVLEARN_LEARN_MIRROR,
1212 + ANA_ANEVENTS_FLOOD_DISCARD,
1213 + ANA_ANEVENTS_MSTI_DROP,
1214 + ANA_ANEVENTS_ACLKILL,
1215 + ANA_ANEVENTS_ACLUSED,
1216 + ANA_ANEVENTS_AUTOAGE,
1217 + ANA_ANEVENTS_VS2TTL1,
1218 + ANA_ANEVENTS_STORM_DROP,
1219 + ANA_ANEVENTS_LEARN_DROP,
1220 + ANA_ANEVENTS_AGED_ENTRY,
1221 + ANA_ANEVENTS_CPU_LEARN_FAILED,
1222 + ANA_ANEVENTS_AUTO_LEARN_FAILED,
1223 + ANA_ANEVENTS_LEARN_REMOVE,
1224 + ANA_ANEVENTS_AUTO_LEARNED,
1225 + ANA_ANEVENTS_AUTO_MOVED,
1226 + ANA_ANEVENTS_DROPPED,
1227 + ANA_ANEVENTS_CLASSIFIED_DROP,
1228 + ANA_ANEVENTS_CLASSIFIED_COPY,
1229 + ANA_ANEVENTS_VLAN_DISCARD,
1230 + ANA_ANEVENTS_FWD_DISCARD,
1231 + ANA_ANEVENTS_MULTICAST_FLOOD,
1232 + ANA_ANEVENTS_UNICAST_FLOOD,
1233 + ANA_ANEVENTS_DEST_KNOWN,
1234 + ANA_ANEVENTS_BUCKET3_MATCH,
1235 + ANA_ANEVENTS_BUCKET2_MATCH,
1236 + ANA_ANEVENTS_BUCKET1_MATCH,
1237 + ANA_ANEVENTS_BUCKET0_MATCH,
1238 + ANA_ANEVENTS_CPU_OPERATION,
1239 + ANA_ANEVENTS_DMAC_LOOKUP,
1240 + ANA_ANEVENTS_SMAC_LOOKUP,
1241 + ANA_ANEVENTS_SEQ_GEN_ERR_0,
1242 + ANA_ANEVENTS_SEQ_GEN_ERR_1,
1243 + ANA_TABLES_MACACCESS_B_DOM,
1244 + ANA_TABLES_MACTINDX_BUCKET,
1245 + ANA_TABLES_MACTINDX_M_INDEX,
1246 + QSYS_TIMED_FRAME_ENTRY_TFRM_VLD,
1247 + QSYS_TIMED_FRAME_ENTRY_TFRM_FP,
1248 + QSYS_TIMED_FRAME_ENTRY_TFRM_PORTNO,
1249 + QSYS_TIMED_FRAME_ENTRY_TFRM_TM_SEL,
1250 + QSYS_TIMED_FRAME_ENTRY_TFRM_TM_T,
1251 + SYS_RESET_CFG_CORE_ENA,
1252 + SYS_RESET_CFG_MEM_ENA,
1253 + SYS_RESET_CFG_MEM_INIT,
1254 + GCB_SOFT_RST_SWC_RST,
1258 +enum ocelot_clk_pins {
1265 +struct ocelot_stat_layout {
1267 + char name[ETH_GSTRING_LEN];
1270 +enum ocelot_tag_prefix {
1271 + OCELOT_TAG_PREFIX_DISABLED = 0,
1272 + OCELOT_TAG_PREFIX_NONE,
1273 + OCELOT_TAG_PREFIX_SHORT,
1274 + OCELOT_TAG_PREFIX_LONG,
1279 +struct ocelot_ops {
1280 + void (*pcs_init)(struct ocelot *ocelot, int port);
1281 + int (*reset)(struct ocelot *ocelot);
1284 +struct ocelot_port {
1285 + struct ocelot *ocelot;
1287 + void __iomem *regs;
1289 + /* Ingress default VLAN (pvid) */
1292 + /* Egress default VLAN (vid) */
1296 + struct list_head skbs;
1301 + struct device *dev;
1303 + const struct ocelot_ops *ops;
1304 + struct regmap *targets[TARGET_MAX];
1305 + struct regmap_field *regfields[REGFIELD_MAX];
1306 + const u32 *const *map;
1307 + const struct ocelot_stat_layout *stats_layout;
1308 + unsigned int num_stats;
1310 + int shared_queue_sz;
1312 + struct net_device *hw_bridge_dev;
1314 + u16 bridge_fwd_mask;
1316 + struct ocelot_port **ports;
1318 + u8 base_mac[ETH_ALEN];
1320 + /* Keep track of the vlan port masks */
1321 + u32 vlan_mask[VLAN_N_VID];
1323 + u8 num_phys_ports;
1329 + struct list_head multicast;
1331 + /* Workqueue to check statistics for overflow with its lock */
1332 + struct mutex stats_lock;
1334 + struct delayed_work stats_work;
1335 + struct workqueue_struct *stats_queue;
1338 + struct ptp_clock *ptp_clock;
1339 + struct ptp_clock_info ptp_info;
1340 + struct hwtstamp_config hwtstamp_config;
1341 + /* Protects the PTP interface state */
1342 + struct mutex ptp_lock;
1343 + /* Protects the PTP clock */
1344 + spinlock_t ptp_clock_lock;
1346 + void (*port_pcs_init)(struct ocelot_port *port);
1349 +#define ocelot_read_ix(ocelot, reg, gi, ri) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
1350 +#define ocelot_read_gix(ocelot, reg, gi) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi))
1351 +#define ocelot_read_rix(ocelot, reg, ri) __ocelot_read_ix(ocelot, reg, reg##_RSZ * (ri))
1352 +#define ocelot_read(ocelot, reg) __ocelot_read_ix(ocelot, reg, 0)
1354 +#define ocelot_write_ix(ocelot, val, reg, gi, ri) __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
1355 +#define ocelot_write_gix(ocelot, val, reg, gi) __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi))
1356 +#define ocelot_write_rix(ocelot, val, reg, ri) __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))
1357 +#define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0)
1359 +#define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
1360 +#define ocelot_rmw_gix(ocelot, val, m, reg, gi) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi))
1361 +#define ocelot_rmw_rix(ocelot, val, m, reg, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_RSZ * (ri))
1362 +#define ocelot_rmw(ocelot, val, m, reg) __ocelot_rmw_ix(ocelot, val, m, reg, 0)
1365 +u32 ocelot_port_readl(struct ocelot_port *port, u32 reg);
1366 +void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg);
1367 +u32 __ocelot_read_ix(struct ocelot *ocelot, u32 reg, u32 offset);
1368 +void __ocelot_write_ix(struct ocelot *ocelot, u32 val, u32 reg, u32 offset);
1369 +void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, u32 reg,
1372 +/* Hardware initialization */
1373 +int ocelot_regfields_init(struct ocelot *ocelot,
1374 + const struct reg_field *const regfields);
1375 +struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res);
1376 +void ocelot_set_cpu_port(struct ocelot *ocelot, int cpu,
1377 + enum ocelot_tag_prefix injection,
1378 + enum ocelot_tag_prefix extraction);
1379 +int ocelot_init(struct ocelot *ocelot);
1380 +void ocelot_deinit(struct ocelot *ocelot);
1381 +void ocelot_init_port(struct ocelot *ocelot, int port);
1383 +/* DSA callbacks */
1384 +void ocelot_port_enable(struct ocelot *ocelot, int port,
1385 + struct phy_device *phy);
1386 +void ocelot_port_disable(struct ocelot *ocelot, int port);
1387 +void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data);
1388 +void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data);
1389 +int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset);
1390 +int ocelot_get_ts_info(struct ocelot *ocelot, int port,
1391 + struct ethtool_ts_info *info);
1392 +void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs);
1393 +void ocelot_adjust_link(struct ocelot *ocelot, int port,
1394 + struct phy_device *phydev);
1395 +void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
1397 +void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state);
1398 +int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
1399 + struct net_device *bridge);
1400 +int ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
1401 + struct net_device *bridge);
1402 +int ocelot_fdb_dump(struct ocelot *ocelot, int port,
1403 + dsa_fdb_dump_cb_t *cb, void *data);
1404 +int ocelot_fdb_add(struct ocelot *ocelot, int port,
1405 + const unsigned char *addr, u16 vid, bool vlan_aware);
1406 +int ocelot_fdb_del(struct ocelot *ocelot, int port,
1407 + const unsigned char *addr, u16 vid);
1408 +int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
1410 +int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid);
1411 +int ocelot_ptp_gettime64(struct ptp_clock_info *ptp, struct timespec64 *ts);
1412 +void ocelot_get_hwtimestamp(struct ocelot *ocelot, struct timespec64 *ts);