701-net-0260-net-mscc-ocelot-publish-structure-definitions-to-inc.patch 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414
  1. From 417b5a156ca8ab4c986c9deacf58309ce4e09410 Mon Sep 17 00:00:00 2001
  2. From: Vladimir Oltean <[email protected]>
  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
  6. We will be registering another switch driver based on ocelot, which
  7. lives under drivers/net/dsa.
  8. Make sure the Felix DSA front-end has the necessary abstractions to
  9. implement a new Ocelot driver instantiation. This includes the function
  10. prototypes for implementing DSA callbacks.
  11. Signed-off-by: Vladimir Oltean <[email protected]>
  12. Reviewed-by: Florian Fainelli <[email protected]>
  13. Signed-off-by: David S. Miller <[email protected]>
  14. ---
  15. drivers/net/ethernet/mscc/ocelot.c | 78 +++---
  16. drivers/net/ethernet/mscc/ocelot.h | 482 +--------------------------------
  17. include/soc/mscc/ocelot.h | 539 +++++++++++++++++++++++++++++++++++++
  18. 3 files changed, 588 insertions(+), 511 deletions(-)
  19. create mode 100644 include/soc/mscc/ocelot.h
  20. --- a/drivers/net/ethernet/mscc/ocelot.c
  21. +++ b/drivers/net/ethernet/mscc/ocelot.c
  22. @@ -21,7 +21,6 @@
  23. #include <net/netevent.h>
  24. #include <net/rtnetlink.h>
  25. #include <net/switchdev.h>
  26. -#include <net/dsa.h>
  27. #include "ocelot.h"
  28. #include "ocelot_ace.h"
  29. @@ -184,8 +183,8 @@ static void ocelot_vlan_mode(struct ocel
  30. ocelot_write(ocelot, val, ANA_VLANMASK);
  31. }
  32. -static void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
  33. - bool vlan_aware)
  34. +void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
  35. + bool vlan_aware)
  36. {
  37. struct ocelot_port *ocelot_port = ocelot->ports[port];
  38. u32 val;
  39. @@ -230,6 +229,7 @@ static void ocelot_port_vlan_filtering(s
  40. REW_TAG_CFG_TAG_CFG_M,
  41. REW_TAG_CFG, port);
  42. }
  43. +EXPORT_SYMBOL(ocelot_port_vlan_filtering);
  44. static int ocelot_port_set_native_vlan(struct ocelot *ocelot, int port,
  45. u16 vid)
  46. @@ -267,8 +267,8 @@ static void ocelot_port_set_pvid(struct
  47. ocelot_port->pvid = pvid;
  48. }
  49. -static int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
  50. - bool untagged)
  51. +int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
  52. + bool untagged)
  53. {
  54. int ret;
  55. @@ -291,6 +291,7 @@ static int ocelot_vlan_add(struct ocelot
  56. return 0;
  57. }
  58. +EXPORT_SYMBOL(ocelot_vlan_add);
  59. static int ocelot_vlan_vid_add(struct net_device *dev, u16 vid, bool pvid,
  60. bool untagged)
  61. @@ -312,7 +313,7 @@ static int ocelot_vlan_vid_add(struct ne
  62. return 0;
  63. }
  64. -static int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid)
  65. +int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid)
  66. {
  67. struct ocelot_port *ocelot_port = ocelot->ports[port];
  68. int ret;
  69. @@ -333,6 +334,7 @@ static int ocelot_vlan_del(struct ocelot
  70. return 0;
  71. }
  72. +EXPORT_SYMBOL(ocelot_vlan_del);
  73. static int ocelot_vlan_vid_del(struct net_device *dev, u16 vid)
  74. {
  75. @@ -404,8 +406,8 @@ static u16 ocelot_wm_enc(u16 value)
  76. return value;
  77. }
  78. -static void ocelot_adjust_link(struct ocelot *ocelot, int port,
  79. - struct phy_device *phydev)
  80. +void ocelot_adjust_link(struct ocelot *ocelot, int port,
  81. + struct phy_device *phydev)
  82. {
  83. struct ocelot_port *ocelot_port = ocelot->ports[port];
  84. int speed, mode = 0;
  85. @@ -471,6 +473,7 @@ static void ocelot_adjust_link(struct oc
  86. SYS_MAC_FC_CFG, port);
  87. ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port);
  88. }
  89. +EXPORT_SYMBOL(ocelot_adjust_link);
  90. static void ocelot_port_adjust_link(struct net_device *dev)
  91. {
  92. @@ -481,8 +484,8 @@ static void ocelot_port_adjust_link(stru
  93. ocelot_adjust_link(ocelot, port, dev->phydev);
  94. }
  95. -static void ocelot_port_enable(struct ocelot *ocelot, int port,
  96. - struct phy_device *phy)
  97. +void ocelot_port_enable(struct ocelot *ocelot, int port,
  98. + struct phy_device *phy)
  99. {
  100. /* Enable receiving frames on the port, and activate auto-learning of
  101. * MAC addresses.
  102. @@ -492,6 +495,7 @@ static void ocelot_port_enable(struct oc
  103. ANA_PORT_PORT_CFG_PORTID_VAL(port),
  104. ANA_PORT_PORT_CFG, port);
  105. }
  106. +EXPORT_SYMBOL(ocelot_port_enable);
  107. static int ocelot_port_open(struct net_device *dev)
  108. {
  109. @@ -526,7 +530,7 @@ static int ocelot_port_open(struct net_d
  110. return 0;
  111. }
  112. -static void ocelot_port_disable(struct ocelot *ocelot, int port)
  113. +void ocelot_port_disable(struct ocelot *ocelot, int port)
  114. {
  115. struct ocelot_port *ocelot_port = ocelot->ports[port];
  116. @@ -534,6 +538,7 @@ static void ocelot_port_disable(struct o
  117. ocelot_rmw_rix(ocelot, 0, QSYS_SWITCH_PORT_MODE_PORT_ENA,
  118. QSYS_SWITCH_PORT_MODE, port);
  119. }
  120. +EXPORT_SYMBOL(ocelot_port_disable);
  121. static int ocelot_port_stop(struct net_device *dev)
  122. {
  123. @@ -790,9 +795,8 @@ static void ocelot_get_stats64(struct ne
  124. stats->collisions = ocelot_read(ocelot, SYS_COUNT_TX_COLLISION);
  125. }
  126. -static int ocelot_fdb_add(struct ocelot *ocelot, int port,
  127. - const unsigned char *addr, u16 vid,
  128. - bool vlan_aware)
  129. +int ocelot_fdb_add(struct ocelot *ocelot, int port,
  130. + const unsigned char *addr, u16 vid, bool vlan_aware)
  131. {
  132. struct ocelot_port *ocelot_port = ocelot->ports[port];
  133. @@ -812,6 +816,7 @@ static int ocelot_fdb_add(struct ocelot
  134. return ocelot_mact_learn(ocelot, port, addr, vid, ENTRYTYPE_LOCKED);
  135. }
  136. +EXPORT_SYMBOL(ocelot_fdb_add);
  137. static int ocelot_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
  138. struct net_device *dev,
  139. @@ -826,11 +831,12 @@ static int ocelot_port_fdb_add(struct nd
  140. return ocelot_fdb_add(ocelot, port, addr, vid, priv->vlan_aware);
  141. }
  142. -static int ocelot_fdb_del(struct ocelot *ocelot, int port,
  143. - const unsigned char *addr, u16 vid)
  144. +int ocelot_fdb_del(struct ocelot *ocelot, int port,
  145. + const unsigned char *addr, u16 vid)
  146. {
  147. return ocelot_mact_forget(ocelot, addr, vid);
  148. }
  149. +EXPORT_SYMBOL(ocelot_fdb_del);
  150. static int ocelot_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
  151. struct net_device *dev,
  152. @@ -940,8 +946,8 @@ static int ocelot_mact_read(struct ocelo
  153. return 0;
  154. }
  155. -static int ocelot_fdb_dump(struct ocelot *ocelot, int port,
  156. - dsa_fdb_dump_cb_t *cb, void *data)
  157. +int ocelot_fdb_dump(struct ocelot *ocelot, int port,
  158. + dsa_fdb_dump_cb_t *cb, void *data)
  159. {
  160. int i, j;
  161. @@ -973,6 +979,7 @@ static int ocelot_fdb_dump(struct ocelot
  162. return 0;
  163. }
  164. +EXPORT_SYMBOL(ocelot_fdb_dump);
  165. static int ocelot_port_fdb_dump(struct sk_buff *skb,
  166. struct netlink_callback *cb,
  167. @@ -1153,8 +1160,7 @@ static const struct net_device_ops ocelo
  168. .ndo_do_ioctl = ocelot_ioctl,
  169. };
  170. -static void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset,
  171. - u8 *data)
  172. +void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data)
  173. {
  174. int i;
  175. @@ -1165,6 +1171,7 @@ static void ocelot_get_strings(struct oc
  176. memcpy(data + i * ETH_GSTRING_LEN, ocelot->stats_layout[i].name,
  177. ETH_GSTRING_LEN);
  178. }
  179. +EXPORT_SYMBOL(ocelot_get_strings);
  180. static void ocelot_port_get_strings(struct net_device *netdev, u32 sset,
  181. u8 *data)
  182. @@ -1216,7 +1223,7 @@ static void ocelot_check_stats_work(stru
  183. OCELOT_STATS_CHECK_DELAY);
  184. }
  185. -static void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data)
  186. +void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data)
  187. {
  188. int i;
  189. @@ -1227,6 +1234,7 @@ static void ocelot_get_ethtool_stats(str
  190. for (i = 0; i < ocelot->num_stats; i++)
  191. *data++ = ocelot->stats[port * ocelot->num_stats + i];
  192. }
  193. +EXPORT_SYMBOL(ocelot_get_ethtool_stats);
  194. static void ocelot_port_get_ethtool_stats(struct net_device *dev,
  195. struct ethtool_stats *stats,
  196. @@ -1239,13 +1247,14 @@ static void ocelot_port_get_ethtool_stat
  197. ocelot_get_ethtool_stats(ocelot, port, data);
  198. }
  199. -static int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset)
  200. +int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset)
  201. {
  202. if (sset != ETH_SS_STATS)
  203. return -EOPNOTSUPP;
  204. return ocelot->num_stats;
  205. }
  206. +EXPORT_SYMBOL(ocelot_get_sset_count);
  207. static int ocelot_port_get_sset_count(struct net_device *dev, int sset)
  208. {
  209. @@ -1256,8 +1265,8 @@ static int ocelot_port_get_sset_count(st
  210. return ocelot_get_sset_count(ocelot, port, sset);
  211. }
  212. -static int ocelot_get_ts_info(struct ocelot *ocelot, int port,
  213. - struct ethtool_ts_info *info)
  214. +int ocelot_get_ts_info(struct ocelot *ocelot, int port,
  215. + struct ethtool_ts_info *info)
  216. {
  217. info->phc_index = ocelot->ptp_clock ?
  218. ptp_clock_index(ocelot->ptp_clock) : -1;
  219. @@ -1273,6 +1282,7 @@ static int ocelot_get_ts_info(struct oce
  220. return 0;
  221. }
  222. +EXPORT_SYMBOL(ocelot_get_ts_info);
  223. static int ocelot_port_get_ts_info(struct net_device *dev,
  224. struct ethtool_ts_info *info)
  225. @@ -1296,8 +1306,7 @@ static const struct ethtool_ops ocelot_e
  226. .get_ts_info = ocelot_port_get_ts_info,
  227. };
  228. -static void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port,
  229. - u8 state)
  230. +void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state)
  231. {
  232. u32 port_cfg;
  233. int p, i;
  234. @@ -1358,6 +1367,7 @@ static void ocelot_bridge_stp_state_set(
  235. }
  236. }
  237. }
  238. +EXPORT_SYMBOL(ocelot_bridge_stp_state_set);
  239. static void ocelot_port_attr_stp_state_set(struct ocelot *ocelot, int port,
  240. struct switchdev_trans *trans,
  241. @@ -1369,11 +1379,12 @@ static void ocelot_port_attr_stp_state_s
  242. ocelot_bridge_stp_state_set(ocelot, port, state);
  243. }
  244. -static void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs)
  245. +void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs)
  246. {
  247. ocelot_write(ocelot, ANA_AUTOAGE_AGE_PERIOD(msecs / 2),
  248. ANA_AUTOAGE);
  249. }
  250. +EXPORT_SYMBOL(ocelot_set_ageing_time);
  251. static void ocelot_port_attr_ageing_set(struct ocelot *ocelot, int port,
  252. unsigned long ageing_clock_t)
  253. @@ -1604,8 +1615,8 @@ static int ocelot_port_obj_del(struct ne
  254. return ret;
  255. }
  256. -static int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
  257. - struct net_device *bridge)
  258. +int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
  259. + struct net_device *bridge)
  260. {
  261. if (!ocelot->bridge_mask) {
  262. ocelot->hw_bridge_dev = bridge;
  263. @@ -1620,9 +1631,10 @@ static int ocelot_port_bridge_join(struc
  264. return 0;
  265. }
  266. +EXPORT_SYMBOL(ocelot_port_bridge_join);
  267. -static int ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
  268. - struct net_device *bridge)
  269. +int ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
  270. + struct net_device *bridge)
  271. {
  272. ocelot->bridge_mask &= ~BIT(port);
  273. @@ -1633,6 +1645,7 @@ static int ocelot_port_bridge_leave(stru
  274. ocelot_port_set_pvid(ocelot, port, 0);
  275. return ocelot_port_set_native_vlan(ocelot, port, 0);
  276. }
  277. +EXPORT_SYMBOL(ocelot_port_bridge_leave);
  278. static void ocelot_set_aggr_pgids(struct ocelot *ocelot)
  279. {
  280. @@ -2121,7 +2134,7 @@ static void ocelot_port_set_mtu(struct o
  281. ocelot_write(ocelot, ocelot_wm_enc(atop_wm), SYS_ATOP_TOT_CFG);
  282. }
  283. -static void ocelot_init_port(struct ocelot *ocelot, int port)
  284. +void ocelot_init_port(struct ocelot *ocelot, int port)
  285. {
  286. struct ocelot_port *ocelot_port = ocelot->ports[port];
  287. @@ -2168,6 +2181,7 @@ static void ocelot_init_port(struct ocel
  288. /* Enable vcap lookups */
  289. ocelot_vcap_enable(ocelot, port);
  290. }
  291. +EXPORT_SYMBOL(ocelot_init_port);
  292. int ocelot_probe_port(struct ocelot *ocelot, u8 port,
  293. void __iomem *regs,
  294. --- a/drivers/net/ethernet/mscc/ocelot.h
  295. +++ b/drivers/net/ethernet/mscc/ocelot.h
  296. @@ -18,6 +18,7 @@
  297. #include <linux/ptp_clock_kernel.h>
  298. #include <linux/regmap.h>
  299. +#include <soc/mscc/ocelot.h>
  300. #include "ocelot_ana.h"
  301. #include "ocelot_dev.h"
  302. #include "ocelot_qsys.h"
  303. @@ -52,376 +53,6 @@ struct frame_info {
  304. u32 timestamp; /* rew_val */
  305. };
  306. -#define IFH_INJ_BYPASS BIT(31)
  307. -#define IFH_INJ_POP_CNT_DISABLE (3 << 28)
  308. -
  309. -#define IFH_TAG_TYPE_C 0
  310. -#define IFH_TAG_TYPE_S 1
  311. -
  312. -#define IFH_REW_OP_NOOP 0x0
  313. -#define IFH_REW_OP_DSCP 0x1
  314. -#define IFH_REW_OP_ONE_STEP_PTP 0x2
  315. -#define IFH_REW_OP_TWO_STEP_PTP 0x3
  316. -#define IFH_REW_OP_ORIGIN_PTP 0x5
  317. -
  318. -#define OCELOT_TAG_LEN 16
  319. -#define OCELOT_SHORT_PREFIX_LEN 4
  320. -#define OCELOT_LONG_PREFIX_LEN 16
  321. -
  322. -#define OCELOT_SPEED_2500 0
  323. -#define OCELOT_SPEED_1000 1
  324. -#define OCELOT_SPEED_100 2
  325. -#define OCELOT_SPEED_10 3
  326. -
  327. -#define TARGET_OFFSET 24
  328. -#define REG_MASK GENMASK(TARGET_OFFSET - 1, 0)
  329. -#define REG(reg, offset) [reg & REG_MASK] = offset
  330. -
  331. -enum ocelot_target {
  332. - ANA = 1,
  333. - QS,
  334. - QSYS,
  335. - REW,
  336. - SYS,
  337. - S2,
  338. - HSIO,
  339. - PTP,
  340. - TARGET_MAX,
  341. -};
  342. -
  343. -enum ocelot_reg {
  344. - ANA_ADVLEARN = ANA << TARGET_OFFSET,
  345. - ANA_VLANMASK,
  346. - ANA_PORT_B_DOMAIN,
  347. - ANA_ANAGEFIL,
  348. - ANA_ANEVENTS,
  349. - ANA_STORMLIMIT_BURST,
  350. - ANA_STORMLIMIT_CFG,
  351. - ANA_ISOLATED_PORTS,
  352. - ANA_COMMUNITY_PORTS,
  353. - ANA_AUTOAGE,
  354. - ANA_MACTOPTIONS,
  355. - ANA_LEARNDISC,
  356. - ANA_AGENCTRL,
  357. - ANA_MIRRORPORTS,
  358. - ANA_EMIRRORPORTS,
  359. - ANA_FLOODING,
  360. - ANA_FLOODING_IPMC,
  361. - ANA_SFLOW_CFG,
  362. - ANA_PORT_MODE,
  363. - ANA_CUT_THRU_CFG,
  364. - ANA_PGID_PGID,
  365. - ANA_TABLES_ANMOVED,
  366. - ANA_TABLES_MACHDATA,
  367. - ANA_TABLES_MACLDATA,
  368. - ANA_TABLES_STREAMDATA,
  369. - ANA_TABLES_MACACCESS,
  370. - ANA_TABLES_MACTINDX,
  371. - ANA_TABLES_VLANACCESS,
  372. - ANA_TABLES_VLANTIDX,
  373. - ANA_TABLES_ISDXACCESS,
  374. - ANA_TABLES_ISDXTIDX,
  375. - ANA_TABLES_ENTRYLIM,
  376. - ANA_TABLES_PTP_ID_HIGH,
  377. - ANA_TABLES_PTP_ID_LOW,
  378. - ANA_TABLES_STREAMACCESS,
  379. - ANA_TABLES_STREAMTIDX,
  380. - ANA_TABLES_SEQ_HISTORY,
  381. - ANA_TABLES_SEQ_MASK,
  382. - ANA_TABLES_SFID_MASK,
  383. - ANA_TABLES_SFIDACCESS,
  384. - ANA_TABLES_SFIDTIDX,
  385. - ANA_MSTI_STATE,
  386. - ANA_OAM_UPM_LM_CNT,
  387. - ANA_SG_ACCESS_CTRL,
  388. - ANA_SG_CONFIG_REG_1,
  389. - ANA_SG_CONFIG_REG_2,
  390. - ANA_SG_CONFIG_REG_3,
  391. - ANA_SG_CONFIG_REG_4,
  392. - ANA_SG_CONFIG_REG_5,
  393. - ANA_SG_GCL_GS_CONFIG,
  394. - ANA_SG_GCL_TI_CONFIG,
  395. - ANA_SG_STATUS_REG_1,
  396. - ANA_SG_STATUS_REG_2,
  397. - ANA_SG_STATUS_REG_3,
  398. - ANA_PORT_VLAN_CFG,
  399. - ANA_PORT_DROP_CFG,
  400. - ANA_PORT_QOS_CFG,
  401. - ANA_PORT_VCAP_CFG,
  402. - ANA_PORT_VCAP_S1_KEY_CFG,
  403. - ANA_PORT_VCAP_S2_CFG,
  404. - ANA_PORT_PCP_DEI_MAP,
  405. - ANA_PORT_CPU_FWD_CFG,
  406. - ANA_PORT_CPU_FWD_BPDU_CFG,
  407. - ANA_PORT_CPU_FWD_GARP_CFG,
  408. - ANA_PORT_CPU_FWD_CCM_CFG,
  409. - ANA_PORT_PORT_CFG,
  410. - ANA_PORT_POL_CFG,
  411. - ANA_PORT_PTP_CFG,
  412. - ANA_PORT_PTP_DLY1_CFG,
  413. - ANA_PORT_PTP_DLY2_CFG,
  414. - ANA_PORT_SFID_CFG,
  415. - ANA_PFC_PFC_CFG,
  416. - ANA_PFC_PFC_TIMER,
  417. - ANA_IPT_OAM_MEP_CFG,
  418. - ANA_IPT_IPT,
  419. - ANA_PPT_PPT,
  420. - ANA_FID_MAP_FID_MAP,
  421. - ANA_AGGR_CFG,
  422. - ANA_CPUQ_CFG,
  423. - ANA_CPUQ_CFG2,
  424. - ANA_CPUQ_8021_CFG,
  425. - ANA_DSCP_CFG,
  426. - ANA_DSCP_REWR_CFG,
  427. - ANA_VCAP_RNG_TYPE_CFG,
  428. - ANA_VCAP_RNG_VAL_CFG,
  429. - ANA_VRAP_CFG,
  430. - ANA_VRAP_HDR_DATA,
  431. - ANA_VRAP_HDR_MASK,
  432. - ANA_DISCARD_CFG,
  433. - ANA_FID_CFG,
  434. - ANA_POL_PIR_CFG,
  435. - ANA_POL_CIR_CFG,
  436. - ANA_POL_MODE_CFG,
  437. - ANA_POL_PIR_STATE,
  438. - ANA_POL_CIR_STATE,
  439. - ANA_POL_STATE,
  440. - ANA_POL_FLOWC,
  441. - ANA_POL_HYST,
  442. - ANA_POL_MISC_CFG,
  443. - QS_XTR_GRP_CFG = QS << TARGET_OFFSET,
  444. - QS_XTR_RD,
  445. - QS_XTR_FRM_PRUNING,
  446. - QS_XTR_FLUSH,
  447. - QS_XTR_DATA_PRESENT,
  448. - QS_XTR_CFG,
  449. - QS_INJ_GRP_CFG,
  450. - QS_INJ_WR,
  451. - QS_INJ_CTRL,
  452. - QS_INJ_STATUS,
  453. - QS_INJ_ERR,
  454. - QS_INH_DBG,
  455. - QSYS_PORT_MODE = QSYS << TARGET_OFFSET,
  456. - QSYS_SWITCH_PORT_MODE,
  457. - QSYS_STAT_CNT_CFG,
  458. - QSYS_EEE_CFG,
  459. - QSYS_EEE_THRES,
  460. - QSYS_IGR_NO_SHARING,
  461. - QSYS_EGR_NO_SHARING,
  462. - QSYS_SW_STATUS,
  463. - QSYS_EXT_CPU_CFG,
  464. - QSYS_PAD_CFG,
  465. - QSYS_CPU_GROUP_MAP,
  466. - QSYS_QMAP,
  467. - QSYS_ISDX_SGRP,
  468. - QSYS_TIMED_FRAME_ENTRY,
  469. - QSYS_TFRM_MISC,
  470. - QSYS_TFRM_PORT_DLY,
  471. - QSYS_TFRM_TIMER_CFG_1,
  472. - QSYS_TFRM_TIMER_CFG_2,
  473. - QSYS_TFRM_TIMER_CFG_3,
  474. - QSYS_TFRM_TIMER_CFG_4,
  475. - QSYS_TFRM_TIMER_CFG_5,
  476. - QSYS_TFRM_TIMER_CFG_6,
  477. - QSYS_TFRM_TIMER_CFG_7,
  478. - QSYS_TFRM_TIMER_CFG_8,
  479. - QSYS_RED_PROFILE,
  480. - QSYS_RES_QOS_MODE,
  481. - QSYS_RES_CFG,
  482. - QSYS_RES_STAT,
  483. - QSYS_EGR_DROP_MODE,
  484. - QSYS_EQ_CTRL,
  485. - QSYS_EVENTS_CORE,
  486. - QSYS_QMAXSDU_CFG_0,
  487. - QSYS_QMAXSDU_CFG_1,
  488. - QSYS_QMAXSDU_CFG_2,
  489. - QSYS_QMAXSDU_CFG_3,
  490. - QSYS_QMAXSDU_CFG_4,
  491. - QSYS_QMAXSDU_CFG_5,
  492. - QSYS_QMAXSDU_CFG_6,
  493. - QSYS_QMAXSDU_CFG_7,
  494. - QSYS_PREEMPTION_CFG,
  495. - QSYS_CIR_CFG,
  496. - QSYS_EIR_CFG,
  497. - QSYS_SE_CFG,
  498. - QSYS_SE_DWRR_CFG,
  499. - QSYS_SE_CONNECT,
  500. - QSYS_SE_DLB_SENSE,
  501. - QSYS_CIR_STATE,
  502. - QSYS_EIR_STATE,
  503. - QSYS_SE_STATE,
  504. - QSYS_HSCH_MISC_CFG,
  505. - QSYS_TAG_CONFIG,
  506. - QSYS_TAS_PARAM_CFG_CTRL,
  507. - QSYS_PORT_MAX_SDU,
  508. - QSYS_PARAM_CFG_REG_1,
  509. - QSYS_PARAM_CFG_REG_2,
  510. - QSYS_PARAM_CFG_REG_3,
  511. - QSYS_PARAM_CFG_REG_4,
  512. - QSYS_PARAM_CFG_REG_5,
  513. - QSYS_GCL_CFG_REG_1,
  514. - QSYS_GCL_CFG_REG_2,
  515. - QSYS_PARAM_STATUS_REG_1,
  516. - QSYS_PARAM_STATUS_REG_2,
  517. - QSYS_PARAM_STATUS_REG_3,
  518. - QSYS_PARAM_STATUS_REG_4,
  519. - QSYS_PARAM_STATUS_REG_5,
  520. - QSYS_PARAM_STATUS_REG_6,
  521. - QSYS_PARAM_STATUS_REG_7,
  522. - QSYS_PARAM_STATUS_REG_8,
  523. - QSYS_PARAM_STATUS_REG_9,
  524. - QSYS_GCL_STATUS_REG_1,
  525. - QSYS_GCL_STATUS_REG_2,
  526. - REW_PORT_VLAN_CFG = REW << TARGET_OFFSET,
  527. - REW_TAG_CFG,
  528. - REW_PORT_CFG,
  529. - REW_DSCP_CFG,
  530. - REW_PCP_DEI_QOS_MAP_CFG,
  531. - REW_PTP_CFG,
  532. - REW_PTP_DLY1_CFG,
  533. - REW_RED_TAG_CFG,
  534. - REW_DSCP_REMAP_DP1_CFG,
  535. - REW_DSCP_REMAP_CFG,
  536. - REW_STAT_CFG,
  537. - REW_REW_STICKY,
  538. - REW_PPT,
  539. - SYS_COUNT_RX_OCTETS = SYS << TARGET_OFFSET,
  540. - SYS_COUNT_RX_UNICAST,
  541. - SYS_COUNT_RX_MULTICAST,
  542. - SYS_COUNT_RX_BROADCAST,
  543. - SYS_COUNT_RX_SHORTS,
  544. - SYS_COUNT_RX_FRAGMENTS,
  545. - SYS_COUNT_RX_JABBERS,
  546. - SYS_COUNT_RX_CRC_ALIGN_ERRS,
  547. - SYS_COUNT_RX_SYM_ERRS,
  548. - SYS_COUNT_RX_64,
  549. - SYS_COUNT_RX_65_127,
  550. - SYS_COUNT_RX_128_255,
  551. - SYS_COUNT_RX_256_1023,
  552. - SYS_COUNT_RX_1024_1526,
  553. - SYS_COUNT_RX_1527_MAX,
  554. - SYS_COUNT_RX_PAUSE,
  555. - SYS_COUNT_RX_CONTROL,
  556. - SYS_COUNT_RX_LONGS,
  557. - SYS_COUNT_RX_CLASSIFIED_DROPS,
  558. - SYS_COUNT_TX_OCTETS,
  559. - SYS_COUNT_TX_UNICAST,
  560. - SYS_COUNT_TX_MULTICAST,
  561. - SYS_COUNT_TX_BROADCAST,
  562. - SYS_COUNT_TX_COLLISION,
  563. - SYS_COUNT_TX_DROPS,
  564. - SYS_COUNT_TX_PAUSE,
  565. - SYS_COUNT_TX_64,
  566. - SYS_COUNT_TX_65_127,
  567. - SYS_COUNT_TX_128_511,
  568. - SYS_COUNT_TX_512_1023,
  569. - SYS_COUNT_TX_1024_1526,
  570. - SYS_COUNT_TX_1527_MAX,
  571. - SYS_COUNT_TX_AGING,
  572. - SYS_RESET_CFG,
  573. - SYS_SR_ETYPE_CFG,
  574. - SYS_VLAN_ETYPE_CFG,
  575. - SYS_PORT_MODE,
  576. - SYS_FRONT_PORT_MODE,
  577. - SYS_FRM_AGING,
  578. - SYS_STAT_CFG,
  579. - SYS_SW_STATUS,
  580. - SYS_MISC_CFG,
  581. - SYS_REW_MAC_HIGH_CFG,
  582. - SYS_REW_MAC_LOW_CFG,
  583. - SYS_TIMESTAMP_OFFSET,
  584. - SYS_CMID,
  585. - SYS_PAUSE_CFG,
  586. - SYS_PAUSE_TOT_CFG,
  587. - SYS_ATOP,
  588. - SYS_ATOP_TOT_CFG,
  589. - SYS_MAC_FC_CFG,
  590. - SYS_MMGT,
  591. - SYS_MMGT_FAST,
  592. - SYS_EVENTS_DIF,
  593. - SYS_EVENTS_CORE,
  594. - SYS_CNT,
  595. - SYS_PTP_STATUS,
  596. - SYS_PTP_TXSTAMP,
  597. - SYS_PTP_NXT,
  598. - SYS_PTP_CFG,
  599. - SYS_RAM_INIT,
  600. - SYS_CM_ADDR,
  601. - SYS_CM_DATA_WR,
  602. - SYS_CM_DATA_RD,
  603. - SYS_CM_OP,
  604. - SYS_CM_DATA,
  605. - S2_CORE_UPDATE_CTRL = S2 << TARGET_OFFSET,
  606. - S2_CORE_MV_CFG,
  607. - S2_CACHE_ENTRY_DAT,
  608. - S2_CACHE_MASK_DAT,
  609. - S2_CACHE_ACTION_DAT,
  610. - S2_CACHE_CNT_DAT,
  611. - S2_CACHE_TG_DAT,
  612. - PTP_PIN_CFG = PTP << TARGET_OFFSET,
  613. - PTP_PIN_TOD_SEC_MSB,
  614. - PTP_PIN_TOD_SEC_LSB,
  615. - PTP_PIN_TOD_NSEC,
  616. - PTP_CFG_MISC,
  617. - PTP_CLK_CFG_ADJ_CFG,
  618. - PTP_CLK_CFG_ADJ_FREQ,
  619. -};
  620. -
  621. -enum ocelot_regfield {
  622. - ANA_ADVLEARN_VLAN_CHK,
  623. - ANA_ADVLEARN_LEARN_MIRROR,
  624. - ANA_ANEVENTS_FLOOD_DISCARD,
  625. - ANA_ANEVENTS_MSTI_DROP,
  626. - ANA_ANEVENTS_ACLKILL,
  627. - ANA_ANEVENTS_ACLUSED,
  628. - ANA_ANEVENTS_AUTOAGE,
  629. - ANA_ANEVENTS_VS2TTL1,
  630. - ANA_ANEVENTS_STORM_DROP,
  631. - ANA_ANEVENTS_LEARN_DROP,
  632. - ANA_ANEVENTS_AGED_ENTRY,
  633. - ANA_ANEVENTS_CPU_LEARN_FAILED,
  634. - ANA_ANEVENTS_AUTO_LEARN_FAILED,
  635. - ANA_ANEVENTS_LEARN_REMOVE,
  636. - ANA_ANEVENTS_AUTO_LEARNED,
  637. - ANA_ANEVENTS_AUTO_MOVED,
  638. - ANA_ANEVENTS_DROPPED,
  639. - ANA_ANEVENTS_CLASSIFIED_DROP,
  640. - ANA_ANEVENTS_CLASSIFIED_COPY,
  641. - ANA_ANEVENTS_VLAN_DISCARD,
  642. - ANA_ANEVENTS_FWD_DISCARD,
  643. - ANA_ANEVENTS_MULTICAST_FLOOD,
  644. - ANA_ANEVENTS_UNICAST_FLOOD,
  645. - ANA_ANEVENTS_DEST_KNOWN,
  646. - ANA_ANEVENTS_BUCKET3_MATCH,
  647. - ANA_ANEVENTS_BUCKET2_MATCH,
  648. - ANA_ANEVENTS_BUCKET1_MATCH,
  649. - ANA_ANEVENTS_BUCKET0_MATCH,
  650. - ANA_ANEVENTS_CPU_OPERATION,
  651. - ANA_ANEVENTS_DMAC_LOOKUP,
  652. - ANA_ANEVENTS_SMAC_LOOKUP,
  653. - ANA_ANEVENTS_SEQ_GEN_ERR_0,
  654. - ANA_ANEVENTS_SEQ_GEN_ERR_1,
  655. - ANA_TABLES_MACACCESS_B_DOM,
  656. - ANA_TABLES_MACTINDX_BUCKET,
  657. - ANA_TABLES_MACTINDX_M_INDEX,
  658. - QSYS_TIMED_FRAME_ENTRY_TFRM_VLD,
  659. - QSYS_TIMED_FRAME_ENTRY_TFRM_FP,
  660. - QSYS_TIMED_FRAME_ENTRY_TFRM_PORTNO,
  661. - QSYS_TIMED_FRAME_ENTRY_TFRM_TM_SEL,
  662. - QSYS_TIMED_FRAME_ENTRY_TFRM_TM_T,
  663. - SYS_RESET_CFG_CORE_ENA,
  664. - SYS_RESET_CFG_MEM_ENA,
  665. - SYS_RESET_CFG_MEM_INIT,
  666. - REGFIELD_MAX
  667. -};
  668. -
  669. -enum ocelot_clk_pins {
  670. - ALT_PPS_PIN = 1,
  671. - EXT_CLK_PIN,
  672. - ALT_LDST_PIN,
  673. - TOD_ACC_PIN
  674. -};
  675. -
  676. struct ocelot_multicast {
  677. struct list_head list;
  678. unsigned char addr[ETH_ALEN];
  679. @@ -429,88 +60,6 @@ struct ocelot_multicast {
  680. u16 ports;
  681. };
  682. -enum ocelot_tag_prefix {
  683. - OCELOT_TAG_PREFIX_DISABLED = 0,
  684. - OCELOT_TAG_PREFIX_NONE,
  685. - OCELOT_TAG_PREFIX_SHORT,
  686. - OCELOT_TAG_PREFIX_LONG,
  687. -};
  688. -
  689. -struct ocelot_port;
  690. -struct ocelot;
  691. -
  692. -struct ocelot_stat_layout {
  693. - u32 offset;
  694. - char name[ETH_GSTRING_LEN];
  695. -};
  696. -
  697. -struct ocelot_ops {
  698. - void (*pcs_init)(struct ocelot *ocelot, int port);
  699. - int (*reset)(struct ocelot *ocelot);
  700. -};
  701. -
  702. -struct ocelot {
  703. - const struct ocelot_ops *ops;
  704. - struct device *dev;
  705. -
  706. - struct regmap *targets[TARGET_MAX];
  707. - struct regmap_field *regfields[REGFIELD_MAX];
  708. - const u32 *const *map;
  709. - const struct ocelot_stat_layout *stats_layout;
  710. - unsigned int num_stats;
  711. -
  712. - u8 base_mac[ETH_ALEN];
  713. -
  714. - struct net_device *hw_bridge_dev;
  715. - u16 bridge_mask;
  716. - u16 bridge_fwd_mask;
  717. -
  718. - struct workqueue_struct *ocelot_owq;
  719. -
  720. - int shared_queue_sz;
  721. -
  722. - u8 num_phys_ports;
  723. - u8 num_cpu_ports;
  724. - u8 cpu;
  725. - struct ocelot_port **ports;
  726. -
  727. - u32 *lags;
  728. -
  729. - /* Keep track of the vlan port masks */
  730. - u32 vlan_mask[VLAN_N_VID];
  731. -
  732. - struct list_head multicast;
  733. -
  734. - /* Workqueue to check statistics for overflow with its lock */
  735. - struct mutex stats_lock;
  736. - u64 *stats;
  737. - struct delayed_work stats_work;
  738. - struct workqueue_struct *stats_queue;
  739. -
  740. - u8 ptp:1;
  741. - struct ptp_clock *ptp_clock;
  742. - struct ptp_clock_info ptp_info;
  743. - struct hwtstamp_config hwtstamp_config;
  744. - struct mutex ptp_lock; /* Protects the PTP interface state */
  745. - spinlock_t ptp_clock_lock; /* Protects the PTP clock */
  746. -};
  747. -
  748. -struct ocelot_port {
  749. - struct ocelot *ocelot;
  750. -
  751. - void __iomem *regs;
  752. -
  753. - /* Ingress default VLAN (pvid) */
  754. - u16 pvid;
  755. -
  756. - /* Egress default VLAN (vid) */
  757. - u16 vid;
  758. -
  759. - u8 ptp_cmd;
  760. - struct list_head skbs;
  761. - u8 ts_id;
  762. -};
  763. -
  764. struct ocelot_port_private {
  765. struct ocelot_port port;
  766. struct net_device *dev;
  767. @@ -531,37 +80,12 @@ struct ocelot_skb {
  768. u8 id;
  769. };
  770. -u32 __ocelot_read_ix(struct ocelot *ocelot, u32 reg, u32 offset);
  771. -#define ocelot_read_ix(ocelot, reg, gi, ri) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
  772. -#define ocelot_read_gix(ocelot, reg, gi) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi))
  773. -#define ocelot_read_rix(ocelot, reg, ri) __ocelot_read_ix(ocelot, reg, reg##_RSZ * (ri))
  774. -#define ocelot_read(ocelot, reg) __ocelot_read_ix(ocelot, reg, 0)
  775. -
  776. -void __ocelot_write_ix(struct ocelot *ocelot, u32 val, u32 reg, u32 offset);
  777. -#define ocelot_write_ix(ocelot, val, reg, gi, ri) __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
  778. -#define ocelot_write_gix(ocelot, val, reg, gi) __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi))
  779. -#define ocelot_write_rix(ocelot, val, reg, ri) __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))
  780. -#define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0)
  781. -
  782. -void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, u32 reg,
  783. - u32 offset);
  784. -#define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
  785. -#define ocelot_rmw_gix(ocelot, val, m, reg, gi) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi))
  786. -#define ocelot_rmw_rix(ocelot, val, m, reg, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_RSZ * (ri))
  787. -#define ocelot_rmw(ocelot, val, m, reg) __ocelot_rmw_ix(ocelot, val, m, reg, 0)
  788. -
  789. u32 ocelot_port_readl(struct ocelot_port *port, u32 reg);
  790. void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg);
  791. -int ocelot_regfields_init(struct ocelot *ocelot,
  792. - const struct reg_field *const regfields);
  793. -struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res);
  794. -
  795. #define ocelot_field_write(ocelot, reg, val) regmap_field_write((ocelot)->regfields[(reg)], (val))
  796. #define ocelot_field_read(ocelot, reg, val) regmap_field_read((ocelot)->regfields[(reg)], (val))
  797. -int ocelot_init(struct ocelot *ocelot);
  798. -void ocelot_deinit(struct ocelot *ocelot);
  799. int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops);
  800. int ocelot_probe_port(struct ocelot *ocelot, u8 port,
  801. void __iomem *regs,
  802. @@ -575,7 +99,7 @@ extern struct notifier_block ocelot_netd
  803. extern struct notifier_block ocelot_switchdev_nb;
  804. extern struct notifier_block ocelot_switchdev_blocking_nb;
  805. -int ocelot_ptp_gettime64(struct ptp_clock_info *ptp, struct timespec64 *ts);
  806. -void ocelot_get_hwtimestamp(struct ocelot *ocelot, struct timespec64 *ts);
  807. +#define ocelot_field_write(ocelot, reg, val) regmap_field_write((ocelot)->regfields[(reg)], (val))
  808. +#define ocelot_field_read(ocelot, reg, val) regmap_field_read((ocelot)->regfields[(reg)], (val))
  809. #endif
  810. --- /dev/null
  811. +++ b/include/soc/mscc/ocelot.h
  812. @@ -0,0 +1,539 @@
  813. +/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
  814. +/* Copyright (c) 2017 Microsemi Corporation
  815. + */
  816. +
  817. +#ifndef _SOC_MSCC_OCELOT_H
  818. +#define _SOC_MSCC_OCELOT_H
  819. +
  820. +#include <linux/ptp_clock_kernel.h>
  821. +#include <linux/net_tstamp.h>
  822. +#include <linux/if_vlan.h>
  823. +#include <linux/regmap.h>
  824. +#include <net/dsa.h>
  825. +
  826. +#define IFH_INJ_BYPASS BIT(31)
  827. +#define IFH_INJ_POP_CNT_DISABLE (3 << 28)
  828. +
  829. +#define IFH_TAG_TYPE_C 0
  830. +#define IFH_TAG_TYPE_S 1
  831. +
  832. +#define IFH_REW_OP_NOOP 0x0
  833. +#define IFH_REW_OP_DSCP 0x1
  834. +#define IFH_REW_OP_ONE_STEP_PTP 0x2
  835. +#define IFH_REW_OP_TWO_STEP_PTP 0x3
  836. +#define IFH_REW_OP_ORIGIN_PTP 0x5
  837. +
  838. +#define OCELOT_TAG_LEN 16
  839. +#define OCELOT_SHORT_PREFIX_LEN 4
  840. +#define OCELOT_LONG_PREFIX_LEN 16
  841. +
  842. +#define OCELOT_SPEED_2500 0
  843. +#define OCELOT_SPEED_1000 1
  844. +#define OCELOT_SPEED_100 2
  845. +#define OCELOT_SPEED_10 3
  846. +
  847. +#define TARGET_OFFSET 24
  848. +#define REG_MASK GENMASK(TARGET_OFFSET - 1, 0)
  849. +#define REG(reg, offset) [reg & REG_MASK] = offset
  850. +
  851. +#define REG_RESERVED_ADDR 0xffffffff
  852. +#define REG_RESERVED(reg) REG(reg, REG_RESERVED_ADDR)
  853. +
  854. +enum ocelot_target {
  855. + ANA = 1,
  856. + QS,
  857. + QSYS,
  858. + REW,
  859. + SYS,
  860. + S2,
  861. + HSIO,
  862. + PTP,
  863. + GCB,
  864. + TARGET_MAX,
  865. +};
  866. +
  867. +enum ocelot_reg {
  868. + ANA_ADVLEARN = ANA << TARGET_OFFSET,
  869. + ANA_VLANMASK,
  870. + ANA_PORT_B_DOMAIN,
  871. + ANA_ANAGEFIL,
  872. + ANA_ANEVENTS,
  873. + ANA_STORMLIMIT_BURST,
  874. + ANA_STORMLIMIT_CFG,
  875. + ANA_ISOLATED_PORTS,
  876. + ANA_COMMUNITY_PORTS,
  877. + ANA_AUTOAGE,
  878. + ANA_MACTOPTIONS,
  879. + ANA_LEARNDISC,
  880. + ANA_AGENCTRL,
  881. + ANA_MIRRORPORTS,
  882. + ANA_EMIRRORPORTS,
  883. + ANA_FLOODING,
  884. + ANA_FLOODING_IPMC,
  885. + ANA_SFLOW_CFG,
  886. + ANA_PORT_MODE,
  887. + ANA_CUT_THRU_CFG,
  888. + ANA_PGID_PGID,
  889. + ANA_TABLES_ANMOVED,
  890. + ANA_TABLES_MACHDATA,
  891. + ANA_TABLES_MACLDATA,
  892. + ANA_TABLES_STREAMDATA,
  893. + ANA_TABLES_MACACCESS,
  894. + ANA_TABLES_MACTINDX,
  895. + ANA_TABLES_VLANACCESS,
  896. + ANA_TABLES_VLANTIDX,
  897. + ANA_TABLES_ISDXACCESS,
  898. + ANA_TABLES_ISDXTIDX,
  899. + ANA_TABLES_ENTRYLIM,
  900. + ANA_TABLES_PTP_ID_HIGH,
  901. + ANA_TABLES_PTP_ID_LOW,
  902. + ANA_TABLES_STREAMACCESS,
  903. + ANA_TABLES_STREAMTIDX,
  904. + ANA_TABLES_SEQ_HISTORY,
  905. + ANA_TABLES_SEQ_MASK,
  906. + ANA_TABLES_SFID_MASK,
  907. + ANA_TABLES_SFIDACCESS,
  908. + ANA_TABLES_SFIDTIDX,
  909. + ANA_MSTI_STATE,
  910. + ANA_OAM_UPM_LM_CNT,
  911. + ANA_SG_ACCESS_CTRL,
  912. + ANA_SG_CONFIG_REG_1,
  913. + ANA_SG_CONFIG_REG_2,
  914. + ANA_SG_CONFIG_REG_3,
  915. + ANA_SG_CONFIG_REG_4,
  916. + ANA_SG_CONFIG_REG_5,
  917. + ANA_SG_GCL_GS_CONFIG,
  918. + ANA_SG_GCL_TI_CONFIG,
  919. + ANA_SG_STATUS_REG_1,
  920. + ANA_SG_STATUS_REG_2,
  921. + ANA_SG_STATUS_REG_3,
  922. + ANA_PORT_VLAN_CFG,
  923. + ANA_PORT_DROP_CFG,
  924. + ANA_PORT_QOS_CFG,
  925. + ANA_PORT_VCAP_CFG,
  926. + ANA_PORT_VCAP_S1_KEY_CFG,
  927. + ANA_PORT_VCAP_S2_CFG,
  928. + ANA_PORT_PCP_DEI_MAP,
  929. + ANA_PORT_CPU_FWD_CFG,
  930. + ANA_PORT_CPU_FWD_BPDU_CFG,
  931. + ANA_PORT_CPU_FWD_GARP_CFG,
  932. + ANA_PORT_CPU_FWD_CCM_CFG,
  933. + ANA_PORT_PORT_CFG,
  934. + ANA_PORT_POL_CFG,
  935. + ANA_PORT_PTP_CFG,
  936. + ANA_PORT_PTP_DLY1_CFG,
  937. + ANA_PORT_PTP_DLY2_CFG,
  938. + ANA_PORT_SFID_CFG,
  939. + ANA_PFC_PFC_CFG,
  940. + ANA_PFC_PFC_TIMER,
  941. + ANA_IPT_OAM_MEP_CFG,
  942. + ANA_IPT_IPT,
  943. + ANA_PPT_PPT,
  944. + ANA_FID_MAP_FID_MAP,
  945. + ANA_AGGR_CFG,
  946. + ANA_CPUQ_CFG,
  947. + ANA_CPUQ_CFG2,
  948. + ANA_CPUQ_8021_CFG,
  949. + ANA_DSCP_CFG,
  950. + ANA_DSCP_REWR_CFG,
  951. + ANA_VCAP_RNG_TYPE_CFG,
  952. + ANA_VCAP_RNG_VAL_CFG,
  953. + ANA_VRAP_CFG,
  954. + ANA_VRAP_HDR_DATA,
  955. + ANA_VRAP_HDR_MASK,
  956. + ANA_DISCARD_CFG,
  957. + ANA_FID_CFG,
  958. + ANA_POL_PIR_CFG,
  959. + ANA_POL_CIR_CFG,
  960. + ANA_POL_MODE_CFG,
  961. + ANA_POL_PIR_STATE,
  962. + ANA_POL_CIR_STATE,
  963. + ANA_POL_STATE,
  964. + ANA_POL_FLOWC,
  965. + ANA_POL_HYST,
  966. + ANA_POL_MISC_CFG,
  967. + QS_XTR_GRP_CFG = QS << TARGET_OFFSET,
  968. + QS_XTR_RD,
  969. + QS_XTR_FRM_PRUNING,
  970. + QS_XTR_FLUSH,
  971. + QS_XTR_DATA_PRESENT,
  972. + QS_XTR_CFG,
  973. + QS_INJ_GRP_CFG,
  974. + QS_INJ_WR,
  975. + QS_INJ_CTRL,
  976. + QS_INJ_STATUS,
  977. + QS_INJ_ERR,
  978. + QS_INH_DBG,
  979. + QSYS_PORT_MODE = QSYS << TARGET_OFFSET,
  980. + QSYS_SWITCH_PORT_MODE,
  981. + QSYS_STAT_CNT_CFG,
  982. + QSYS_EEE_CFG,
  983. + QSYS_EEE_THRES,
  984. + QSYS_IGR_NO_SHARING,
  985. + QSYS_EGR_NO_SHARING,
  986. + QSYS_SW_STATUS,
  987. + QSYS_EXT_CPU_CFG,
  988. + QSYS_PAD_CFG,
  989. + QSYS_CPU_GROUP_MAP,
  990. + QSYS_QMAP,
  991. + QSYS_ISDX_SGRP,
  992. + QSYS_TIMED_FRAME_ENTRY,
  993. + QSYS_TFRM_MISC,
  994. + QSYS_TFRM_PORT_DLY,
  995. + QSYS_TFRM_TIMER_CFG_1,
  996. + QSYS_TFRM_TIMER_CFG_2,
  997. + QSYS_TFRM_TIMER_CFG_3,
  998. + QSYS_TFRM_TIMER_CFG_4,
  999. + QSYS_TFRM_TIMER_CFG_5,
  1000. + QSYS_TFRM_TIMER_CFG_6,
  1001. + QSYS_TFRM_TIMER_CFG_7,
  1002. + QSYS_TFRM_TIMER_CFG_8,
  1003. + QSYS_RED_PROFILE,
  1004. + QSYS_RES_QOS_MODE,
  1005. + QSYS_RES_CFG,
  1006. + QSYS_RES_STAT,
  1007. + QSYS_EGR_DROP_MODE,
  1008. + QSYS_EQ_CTRL,
  1009. + QSYS_EVENTS_CORE,
  1010. + QSYS_QMAXSDU_CFG_0,
  1011. + QSYS_QMAXSDU_CFG_1,
  1012. + QSYS_QMAXSDU_CFG_2,
  1013. + QSYS_QMAXSDU_CFG_3,
  1014. + QSYS_QMAXSDU_CFG_4,
  1015. + QSYS_QMAXSDU_CFG_5,
  1016. + QSYS_QMAXSDU_CFG_6,
  1017. + QSYS_QMAXSDU_CFG_7,
  1018. + QSYS_PREEMPTION_CFG,
  1019. + QSYS_CIR_CFG,
  1020. + QSYS_EIR_CFG,
  1021. + QSYS_SE_CFG,
  1022. + QSYS_SE_DWRR_CFG,
  1023. + QSYS_SE_CONNECT,
  1024. + QSYS_SE_DLB_SENSE,
  1025. + QSYS_CIR_STATE,
  1026. + QSYS_EIR_STATE,
  1027. + QSYS_SE_STATE,
  1028. + QSYS_HSCH_MISC_CFG,
  1029. + QSYS_TAG_CONFIG,
  1030. + QSYS_TAS_PARAM_CFG_CTRL,
  1031. + QSYS_PORT_MAX_SDU,
  1032. + QSYS_PARAM_CFG_REG_1,
  1033. + QSYS_PARAM_CFG_REG_2,
  1034. + QSYS_PARAM_CFG_REG_3,
  1035. + QSYS_PARAM_CFG_REG_4,
  1036. + QSYS_PARAM_CFG_REG_5,
  1037. + QSYS_GCL_CFG_REG_1,
  1038. + QSYS_GCL_CFG_REG_2,
  1039. + QSYS_PARAM_STATUS_REG_1,
  1040. + QSYS_PARAM_STATUS_REG_2,
  1041. + QSYS_PARAM_STATUS_REG_3,
  1042. + QSYS_PARAM_STATUS_REG_4,
  1043. + QSYS_PARAM_STATUS_REG_5,
  1044. + QSYS_PARAM_STATUS_REG_6,
  1045. + QSYS_PARAM_STATUS_REG_7,
  1046. + QSYS_PARAM_STATUS_REG_8,
  1047. + QSYS_PARAM_STATUS_REG_9,
  1048. + QSYS_GCL_STATUS_REG_1,
  1049. + QSYS_GCL_STATUS_REG_2,
  1050. + REW_PORT_VLAN_CFG = REW << TARGET_OFFSET,
  1051. + REW_TAG_CFG,
  1052. + REW_PORT_CFG,
  1053. + REW_DSCP_CFG,
  1054. + REW_PCP_DEI_QOS_MAP_CFG,
  1055. + REW_PTP_CFG,
  1056. + REW_PTP_DLY1_CFG,
  1057. + REW_RED_TAG_CFG,
  1058. + REW_DSCP_REMAP_DP1_CFG,
  1059. + REW_DSCP_REMAP_CFG,
  1060. + REW_STAT_CFG,
  1061. + REW_REW_STICKY,
  1062. + REW_PPT,
  1063. + SYS_COUNT_RX_OCTETS = SYS << TARGET_OFFSET,
  1064. + SYS_COUNT_RX_UNICAST,
  1065. + SYS_COUNT_RX_MULTICAST,
  1066. + SYS_COUNT_RX_BROADCAST,
  1067. + SYS_COUNT_RX_SHORTS,
  1068. + SYS_COUNT_RX_FRAGMENTS,
  1069. + SYS_COUNT_RX_JABBERS,
  1070. + SYS_COUNT_RX_CRC_ALIGN_ERRS,
  1071. + SYS_COUNT_RX_SYM_ERRS,
  1072. + SYS_COUNT_RX_64,
  1073. + SYS_COUNT_RX_65_127,
  1074. + SYS_COUNT_RX_128_255,
  1075. + SYS_COUNT_RX_256_1023,
  1076. + SYS_COUNT_RX_1024_1526,
  1077. + SYS_COUNT_RX_1527_MAX,
  1078. + SYS_COUNT_RX_PAUSE,
  1079. + SYS_COUNT_RX_CONTROL,
  1080. + SYS_COUNT_RX_LONGS,
  1081. + SYS_COUNT_RX_CLASSIFIED_DROPS,
  1082. + SYS_COUNT_TX_OCTETS,
  1083. + SYS_COUNT_TX_UNICAST,
  1084. + SYS_COUNT_TX_MULTICAST,
  1085. + SYS_COUNT_TX_BROADCAST,
  1086. + SYS_COUNT_TX_COLLISION,
  1087. + SYS_COUNT_TX_DROPS,
  1088. + SYS_COUNT_TX_PAUSE,
  1089. + SYS_COUNT_TX_64,
  1090. + SYS_COUNT_TX_65_127,
  1091. + SYS_COUNT_TX_128_511,
  1092. + SYS_COUNT_TX_512_1023,
  1093. + SYS_COUNT_TX_1024_1526,
  1094. + SYS_COUNT_TX_1527_MAX,
  1095. + SYS_COUNT_TX_AGING,
  1096. + SYS_RESET_CFG,
  1097. + SYS_SR_ETYPE_CFG,
  1098. + SYS_VLAN_ETYPE_CFG,
  1099. + SYS_PORT_MODE,
  1100. + SYS_FRONT_PORT_MODE,
  1101. + SYS_FRM_AGING,
  1102. + SYS_STAT_CFG,
  1103. + SYS_SW_STATUS,
  1104. + SYS_MISC_CFG,
  1105. + SYS_REW_MAC_HIGH_CFG,
  1106. + SYS_REW_MAC_LOW_CFG,
  1107. + SYS_TIMESTAMP_OFFSET,
  1108. + SYS_CMID,
  1109. + SYS_PAUSE_CFG,
  1110. + SYS_PAUSE_TOT_CFG,
  1111. + SYS_ATOP,
  1112. + SYS_ATOP_TOT_CFG,
  1113. + SYS_MAC_FC_CFG,
  1114. + SYS_MMGT,
  1115. + SYS_MMGT_FAST,
  1116. + SYS_EVENTS_DIF,
  1117. + SYS_EVENTS_CORE,
  1118. + SYS_CNT,
  1119. + SYS_PTP_STATUS,
  1120. + SYS_PTP_TXSTAMP,
  1121. + SYS_PTP_NXT,
  1122. + SYS_PTP_CFG,
  1123. + SYS_RAM_INIT,
  1124. + SYS_CM_ADDR,
  1125. + SYS_CM_DATA_WR,
  1126. + SYS_CM_DATA_RD,
  1127. + SYS_CM_OP,
  1128. + SYS_CM_DATA,
  1129. + S2_CORE_UPDATE_CTRL = S2 << TARGET_OFFSET,
  1130. + S2_CORE_MV_CFG,
  1131. + S2_CACHE_ENTRY_DAT,
  1132. + S2_CACHE_MASK_DAT,
  1133. + S2_CACHE_ACTION_DAT,
  1134. + S2_CACHE_CNT_DAT,
  1135. + S2_CACHE_TG_DAT,
  1136. + PTP_PIN_CFG = PTP << TARGET_OFFSET,
  1137. + PTP_PIN_TOD_SEC_MSB,
  1138. + PTP_PIN_TOD_SEC_LSB,
  1139. + PTP_PIN_TOD_NSEC,
  1140. + PTP_CFG_MISC,
  1141. + PTP_CLK_CFG_ADJ_CFG,
  1142. + PTP_CLK_CFG_ADJ_FREQ,
  1143. + GCB_SOFT_RST = GCB << TARGET_OFFSET,
  1144. +};
  1145. +
  1146. +enum ocelot_regfield {
  1147. + ANA_ADVLEARN_VLAN_CHK,
  1148. + ANA_ADVLEARN_LEARN_MIRROR,
  1149. + ANA_ANEVENTS_FLOOD_DISCARD,
  1150. + ANA_ANEVENTS_MSTI_DROP,
  1151. + ANA_ANEVENTS_ACLKILL,
  1152. + ANA_ANEVENTS_ACLUSED,
  1153. + ANA_ANEVENTS_AUTOAGE,
  1154. + ANA_ANEVENTS_VS2TTL1,
  1155. + ANA_ANEVENTS_STORM_DROP,
  1156. + ANA_ANEVENTS_LEARN_DROP,
  1157. + ANA_ANEVENTS_AGED_ENTRY,
  1158. + ANA_ANEVENTS_CPU_LEARN_FAILED,
  1159. + ANA_ANEVENTS_AUTO_LEARN_FAILED,
  1160. + ANA_ANEVENTS_LEARN_REMOVE,
  1161. + ANA_ANEVENTS_AUTO_LEARNED,
  1162. + ANA_ANEVENTS_AUTO_MOVED,
  1163. + ANA_ANEVENTS_DROPPED,
  1164. + ANA_ANEVENTS_CLASSIFIED_DROP,
  1165. + ANA_ANEVENTS_CLASSIFIED_COPY,
  1166. + ANA_ANEVENTS_VLAN_DISCARD,
  1167. + ANA_ANEVENTS_FWD_DISCARD,
  1168. + ANA_ANEVENTS_MULTICAST_FLOOD,
  1169. + ANA_ANEVENTS_UNICAST_FLOOD,
  1170. + ANA_ANEVENTS_DEST_KNOWN,
  1171. + ANA_ANEVENTS_BUCKET3_MATCH,
  1172. + ANA_ANEVENTS_BUCKET2_MATCH,
  1173. + ANA_ANEVENTS_BUCKET1_MATCH,
  1174. + ANA_ANEVENTS_BUCKET0_MATCH,
  1175. + ANA_ANEVENTS_CPU_OPERATION,
  1176. + ANA_ANEVENTS_DMAC_LOOKUP,
  1177. + ANA_ANEVENTS_SMAC_LOOKUP,
  1178. + ANA_ANEVENTS_SEQ_GEN_ERR_0,
  1179. + ANA_ANEVENTS_SEQ_GEN_ERR_1,
  1180. + ANA_TABLES_MACACCESS_B_DOM,
  1181. + ANA_TABLES_MACTINDX_BUCKET,
  1182. + ANA_TABLES_MACTINDX_M_INDEX,
  1183. + QSYS_TIMED_FRAME_ENTRY_TFRM_VLD,
  1184. + QSYS_TIMED_FRAME_ENTRY_TFRM_FP,
  1185. + QSYS_TIMED_FRAME_ENTRY_TFRM_PORTNO,
  1186. + QSYS_TIMED_FRAME_ENTRY_TFRM_TM_SEL,
  1187. + QSYS_TIMED_FRAME_ENTRY_TFRM_TM_T,
  1188. + SYS_RESET_CFG_CORE_ENA,
  1189. + SYS_RESET_CFG_MEM_ENA,
  1190. + SYS_RESET_CFG_MEM_INIT,
  1191. + GCB_SOFT_RST_SWC_RST,
  1192. + REGFIELD_MAX
  1193. +};
  1194. +
  1195. +enum ocelot_clk_pins {
  1196. + ALT_PPS_PIN = 1,
  1197. + EXT_CLK_PIN,
  1198. + ALT_LDST_PIN,
  1199. + TOD_ACC_PIN
  1200. +};
  1201. +
  1202. +struct ocelot_stat_layout {
  1203. + u32 offset;
  1204. + char name[ETH_GSTRING_LEN];
  1205. +};
  1206. +
  1207. +enum ocelot_tag_prefix {
  1208. + OCELOT_TAG_PREFIX_DISABLED = 0,
  1209. + OCELOT_TAG_PREFIX_NONE,
  1210. + OCELOT_TAG_PREFIX_SHORT,
  1211. + OCELOT_TAG_PREFIX_LONG,
  1212. +};
  1213. +
  1214. +struct ocelot;
  1215. +
  1216. +struct ocelot_ops {
  1217. + void (*pcs_init)(struct ocelot *ocelot, int port);
  1218. + int (*reset)(struct ocelot *ocelot);
  1219. +};
  1220. +
  1221. +struct ocelot_port {
  1222. + struct ocelot *ocelot;
  1223. +
  1224. + void __iomem *regs;
  1225. +
  1226. + /* Ingress default VLAN (pvid) */
  1227. + u16 pvid;
  1228. +
  1229. + /* Egress default VLAN (vid) */
  1230. + u16 vid;
  1231. +
  1232. + u8 ptp_cmd;
  1233. + struct list_head skbs;
  1234. + u8 ts_id;
  1235. +};
  1236. +
  1237. +struct ocelot {
  1238. + struct device *dev;
  1239. +
  1240. + const struct ocelot_ops *ops;
  1241. + struct regmap *targets[TARGET_MAX];
  1242. + struct regmap_field *regfields[REGFIELD_MAX];
  1243. + const u32 *const *map;
  1244. + const struct ocelot_stat_layout *stats_layout;
  1245. + unsigned int num_stats;
  1246. +
  1247. + int shared_queue_sz;
  1248. +
  1249. + struct net_device *hw_bridge_dev;
  1250. + u16 bridge_mask;
  1251. + u16 bridge_fwd_mask;
  1252. +
  1253. + struct ocelot_port **ports;
  1254. +
  1255. + u8 base_mac[ETH_ALEN];
  1256. +
  1257. + /* Keep track of the vlan port masks */
  1258. + u32 vlan_mask[VLAN_N_VID];
  1259. +
  1260. + u8 num_phys_ports;
  1261. + u8 num_cpu_ports;
  1262. + u8 cpu;
  1263. +
  1264. + u32 *lags;
  1265. +
  1266. + struct list_head multicast;
  1267. +
  1268. + /* Workqueue to check statistics for overflow with its lock */
  1269. + struct mutex stats_lock;
  1270. + u64 *stats;
  1271. + struct delayed_work stats_work;
  1272. + struct workqueue_struct *stats_queue;
  1273. +
  1274. + u8 ptp:1;
  1275. + struct ptp_clock *ptp_clock;
  1276. + struct ptp_clock_info ptp_info;
  1277. + struct hwtstamp_config hwtstamp_config;
  1278. + /* Protects the PTP interface state */
  1279. + struct mutex ptp_lock;
  1280. + /* Protects the PTP clock */
  1281. + spinlock_t ptp_clock_lock;
  1282. +
  1283. + void (*port_pcs_init)(struct ocelot_port *port);
  1284. +};
  1285. +
  1286. +#define ocelot_read_ix(ocelot, reg, gi, ri) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
  1287. +#define ocelot_read_gix(ocelot, reg, gi) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi))
  1288. +#define ocelot_read_rix(ocelot, reg, ri) __ocelot_read_ix(ocelot, reg, reg##_RSZ * (ri))
  1289. +#define ocelot_read(ocelot, reg) __ocelot_read_ix(ocelot, reg, 0)
  1290. +
  1291. +#define ocelot_write_ix(ocelot, val, reg, gi, ri) __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
  1292. +#define ocelot_write_gix(ocelot, val, reg, gi) __ocelot_write_ix(ocelot, val, reg, reg##_GSZ * (gi))
  1293. +#define ocelot_write_rix(ocelot, val, reg, ri) __ocelot_write_ix(ocelot, val, reg, reg##_RSZ * (ri))
  1294. +#define ocelot_write(ocelot, val, reg) __ocelot_write_ix(ocelot, val, reg, 0)
  1295. +
  1296. +#define ocelot_rmw_ix(ocelot, val, m, reg, gi, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri))
  1297. +#define ocelot_rmw_gix(ocelot, val, m, reg, gi) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_GSZ * (gi))
  1298. +#define ocelot_rmw_rix(ocelot, val, m, reg, ri) __ocelot_rmw_ix(ocelot, val, m, reg, reg##_RSZ * (ri))
  1299. +#define ocelot_rmw(ocelot, val, m, reg) __ocelot_rmw_ix(ocelot, val, m, reg, 0)
  1300. +
  1301. +/* I/O */
  1302. +u32 ocelot_port_readl(struct ocelot_port *port, u32 reg);
  1303. +void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg);
  1304. +u32 __ocelot_read_ix(struct ocelot *ocelot, u32 reg, u32 offset);
  1305. +void __ocelot_write_ix(struct ocelot *ocelot, u32 val, u32 reg, u32 offset);
  1306. +void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, u32 reg,
  1307. + u32 offset);
  1308. +
  1309. +/* Hardware initialization */
  1310. +int ocelot_regfields_init(struct ocelot *ocelot,
  1311. + const struct reg_field *const regfields);
  1312. +struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res);
  1313. +void ocelot_set_cpu_port(struct ocelot *ocelot, int cpu,
  1314. + enum ocelot_tag_prefix injection,
  1315. + enum ocelot_tag_prefix extraction);
  1316. +int ocelot_init(struct ocelot *ocelot);
  1317. +void ocelot_deinit(struct ocelot *ocelot);
  1318. +void ocelot_init_port(struct ocelot *ocelot, int port);
  1319. +
  1320. +/* DSA callbacks */
  1321. +void ocelot_port_enable(struct ocelot *ocelot, int port,
  1322. + struct phy_device *phy);
  1323. +void ocelot_port_disable(struct ocelot *ocelot, int port);
  1324. +void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data);
  1325. +void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data);
  1326. +int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset);
  1327. +int ocelot_get_ts_info(struct ocelot *ocelot, int port,
  1328. + struct ethtool_ts_info *info);
  1329. +void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs);
  1330. +void ocelot_adjust_link(struct ocelot *ocelot, int port,
  1331. + struct phy_device *phydev);
  1332. +void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
  1333. + bool vlan_aware);
  1334. +void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state);
  1335. +int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
  1336. + struct net_device *bridge);
  1337. +int ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
  1338. + struct net_device *bridge);
  1339. +int ocelot_fdb_dump(struct ocelot *ocelot, int port,
  1340. + dsa_fdb_dump_cb_t *cb, void *data);
  1341. +int ocelot_fdb_add(struct ocelot *ocelot, int port,
  1342. + const unsigned char *addr, u16 vid, bool vlan_aware);
  1343. +int ocelot_fdb_del(struct ocelot *ocelot, int port,
  1344. + const unsigned char *addr, u16 vid);
  1345. +int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
  1346. + bool untagged);
  1347. +int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid);
  1348. +int ocelot_ptp_gettime64(struct ptp_clock_info *ptp, struct timespec64 *ts);
  1349. +void ocelot_get_hwtimestamp(struct ocelot *ocelot, struct timespec64 *ts);
  1350. +
  1351. +#endif