xref: /openbmc/linux/drivers/net/dsa/sja1105/sja1105.h (revision ff4cf8eae0a316a09bfff2eb281caa58354be6d3)
1b790b554SNishad Kamdar /* SPDX-License-Identifier: GPL-2.0 */
2b790b554SNishad Kamdar /* Copyright (c) 2018, Sensor-Technik Wiedemann GmbH
38aa9ebccSVladimir Oltean  * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
48aa9ebccSVladimir Oltean  */
58aa9ebccSVladimir Oltean #ifndef _SJA1105_H
68aa9ebccSVladimir Oltean #define _SJA1105_H
78aa9ebccSVladimir Oltean 
8bb77f36aSVladimir Oltean #include <linux/ptp_clock_kernel.h>
9bb77f36aSVladimir Oltean #include <linux/timecounter.h>
108aa9ebccSVladimir Oltean #include <linux/dsa/sja1105.h>
11ac02a451SVladimir Oltean #include <linux/dsa/8021q.h>
128aa9ebccSVladimir Oltean #include <net/dsa.h>
13227d07a0SVladimir Oltean #include <linux/mutex.h>
148aa9ebccSVladimir Oltean #include "sja1105_static_config.h"
158aa9ebccSVladimir Oltean 
168aa9ebccSVladimir Oltean #define SJA1105_NUM_PORTS		5
178aa9ebccSVladimir Oltean #define SJA1105_NUM_TC			8
188aa9ebccSVladimir Oltean #define SJA1105ET_FDB_BIN_SIZE		4
198456721dSVladimir Oltean /* The hardware value is in multiples of 10 ms.
208456721dSVladimir Oltean  * The passed parameter is in multiples of 1 ms.
218456721dSVladimir Oltean  */
228456721dSVladimir Oltean #define SJA1105_AGEING_TIME_MS(ms)	((ms) / 10)
23a6af7763SVladimir Oltean #define SJA1105_NUM_L2_POLICERS		45
248aa9ebccSVladimir Oltean 
2541603d78SVladimir Oltean typedef enum {
2641603d78SVladimir Oltean 	SPI_READ = 0,
2741603d78SVladimir Oltean 	SPI_WRITE = 1,
2841603d78SVladimir Oltean } sja1105_spi_rw_mode_t;
2941603d78SVladimir Oltean 
30317ab5b8SVladimir Oltean #include "sja1105_tas.h"
31a9d6ed7aSVladimir Oltean #include "sja1105_ptp.h"
32317ab5b8SVladimir Oltean 
338aa9ebccSVladimir Oltean /* Keeps the different addresses between E/T and P/Q/R/S */
348aa9ebccSVladimir Oltean struct sja1105_regs {
358aa9ebccSVladimir Oltean 	u64 device_id;
368aa9ebccSVladimir Oltean 	u64 prod_id;
378aa9ebccSVladimir Oltean 	u64 status;
381a4c6940SVladimir Oltean 	u64 port_control;
398aa9ebccSVladimir Oltean 	u64 rgu;
40834f8933SVladimir Oltean 	u64 vl_status;
418aa9ebccSVladimir Oltean 	u64 config;
42ffe10e67SVladimir Oltean 	u64 sgmii;
438aa9ebccSVladimir Oltean 	u64 rmii_pll1;
44747e5eb3SVladimir Oltean 	u64 ptppinst;
45747e5eb3SVladimir Oltean 	u64 ptppindur;
46bb77f36aSVladimir Oltean 	u64 ptp_control;
472fb079a2SVladimir Oltean 	u64 ptpclkval;
48bb77f36aSVladimir Oltean 	u64 ptpclkrate;
4986db36a3SVladimir Oltean 	u64 ptpclkcorp;
50747e5eb3SVladimir Oltean 	u64 ptpsyncts;
5186db36a3SVladimir Oltean 	u64 ptpschtm;
5247ed985eSVladimir Oltean 	u64 ptpegr_ts[SJA1105_NUM_PORTS];
538aa9ebccSVladimir Oltean 	u64 pad_mii_tx[SJA1105_NUM_PORTS];
54135e3018SVladimir Oltean 	u64 pad_mii_rx[SJA1105_NUM_PORTS];
55b5b0c7f4SVladimir Oltean 	u64 pad_mii_id[SJA1105_NUM_PORTS];
568aa9ebccSVladimir Oltean 	u64 cgu_idiv[SJA1105_NUM_PORTS];
578aa9ebccSVladimir Oltean 	u64 mii_tx_clk[SJA1105_NUM_PORTS];
588aa9ebccSVladimir Oltean 	u64 mii_rx_clk[SJA1105_NUM_PORTS];
598aa9ebccSVladimir Oltean 	u64 mii_ext_tx_clk[SJA1105_NUM_PORTS];
608aa9ebccSVladimir Oltean 	u64 mii_ext_rx_clk[SJA1105_NUM_PORTS];
618aa9ebccSVladimir Oltean 	u64 rgmii_tx_clk[SJA1105_NUM_PORTS];
628aa9ebccSVladimir Oltean 	u64 rmii_ref_clk[SJA1105_NUM_PORTS];
638aa9ebccSVladimir Oltean 	u64 rmii_ext_tx_clk[SJA1105_NUM_PORTS];
648aa9ebccSVladimir Oltean 	u64 mac[SJA1105_NUM_PORTS];
658aa9ebccSVladimir Oltean 	u64 mac_hl1[SJA1105_NUM_PORTS];
668aa9ebccSVladimir Oltean 	u64 mac_hl2[SJA1105_NUM_PORTS];
67336aa67bSVladimir Oltean 	u64 ether_stats[SJA1105_NUM_PORTS];
688aa9ebccSVladimir Oltean 	u64 qlevel[SJA1105_NUM_PORTS];
698aa9ebccSVladimir Oltean };
708aa9ebccSVladimir Oltean 
718aa9ebccSVladimir Oltean struct sja1105_info {
728aa9ebccSVladimir Oltean 	u64 device_id;
738aa9ebccSVladimir Oltean 	/* Needed for distinction between P and R, and between Q and S
748aa9ebccSVladimir Oltean 	 * (since the parts with/without SGMII share the same
758aa9ebccSVladimir Oltean 	 * switch core and device_id)
768aa9ebccSVladimir Oltean 	 */
778aa9ebccSVladimir Oltean 	u64 part_no;
7847ed985eSVladimir Oltean 	/* E/T and P/Q/R/S have partial timestamps of different sizes.
7947ed985eSVladimir Oltean 	 * They must be reconstructed on both families anyway to get the full
8047ed985eSVladimir Oltean 	 * 64-bit values back.
8147ed985eSVladimir Oltean 	 */
8247ed985eSVladimir Oltean 	int ptp_ts_bits;
8347ed985eSVladimir Oltean 	/* Also SPI commands are of different sizes to retrieve
8447ed985eSVladimir Oltean 	 * the egress timestamps.
8547ed985eSVladimir Oltean 	 */
8647ed985eSVladimir Oltean 	int ptpegr_ts_bytes;
874d752508SVladimir Oltean 	int num_cbs_shapers;
888aa9ebccSVladimir Oltean 	const struct sja1105_dynamic_table_ops *dyn_ops;
898aa9ebccSVladimir Oltean 	const struct sja1105_table_ops *static_ops;
908aa9ebccSVladimir Oltean 	const struct sja1105_regs *regs;
9138b5beeaSVladimir Oltean 	/* Both E/T and P/Q/R/S have quirks when it comes to popping the S-Tag
9238b5beeaSVladimir Oltean 	 * from double-tagged frames. E/T will pop it only when it's equal to
9338b5beeaSVladimir Oltean 	 * TPID from the General Parameters Table, while P/Q/R/S will only
9438b5beeaSVladimir Oltean 	 * pop it when it's equal to TPID2.
9538b5beeaSVladimir Oltean 	 */
9638b5beeaSVladimir Oltean 	u16 qinq_tpid;
97abfb228aSVladimir Oltean 	int (*reset_cmd)(struct dsa_switch *ds);
98f5b8631cSVladimir Oltean 	int (*setup_rgmii_delay)(const void *ctx, int port);
999dfa6911SVladimir Oltean 	/* Prototypes from include/net/dsa.h */
1009dfa6911SVladimir Oltean 	int (*fdb_add_cmd)(struct dsa_switch *ds, int port,
1019dfa6911SVladimir Oltean 			   const unsigned char *addr, u16 vid);
1029dfa6911SVladimir Oltean 	int (*fdb_del_cmd)(struct dsa_switch *ds, int port,
1039dfa6911SVladimir Oltean 			   const unsigned char *addr, u16 vid);
10441603d78SVladimir Oltean 	void (*ptp_cmd_packing)(u8 *buf, struct sja1105_ptp_cmd *cmd,
10541603d78SVladimir Oltean 				enum packing_op op);
1068aa9ebccSVladimir Oltean 	const char *name;
1078aa9ebccSVladimir Oltean };
1088aa9ebccSVladimir Oltean 
109b70bb8d4SVladimir Oltean enum sja1105_key_type {
110b70bb8d4SVladimir Oltean 	SJA1105_KEY_BCAST,
111b70bb8d4SVladimir Oltean 	SJA1105_KEY_TC,
112b70bb8d4SVladimir Oltean 	SJA1105_KEY_VLAN_UNAWARE_VL,
113b70bb8d4SVladimir Oltean 	SJA1105_KEY_VLAN_AWARE_VL,
114b70bb8d4SVladimir Oltean };
115b70bb8d4SVladimir Oltean 
116b70bb8d4SVladimir Oltean struct sja1105_key {
117b70bb8d4SVladimir Oltean 	enum sja1105_key_type type;
118b70bb8d4SVladimir Oltean 
119b70bb8d4SVladimir Oltean 	union {
120b70bb8d4SVladimir Oltean 		/* SJA1105_KEY_TC */
121b70bb8d4SVladimir Oltean 		struct {
122b70bb8d4SVladimir Oltean 			int pcp;
123b70bb8d4SVladimir Oltean 		} tc;
124b70bb8d4SVladimir Oltean 
125b70bb8d4SVladimir Oltean 		/* SJA1105_KEY_VLAN_UNAWARE_VL */
126b70bb8d4SVladimir Oltean 		/* SJA1105_KEY_VLAN_AWARE_VL */
127b70bb8d4SVladimir Oltean 		struct {
128b70bb8d4SVladimir Oltean 			u64 dmac;
129b70bb8d4SVladimir Oltean 			u16 vid;
130b70bb8d4SVladimir Oltean 			u16 pcp;
131b70bb8d4SVladimir Oltean 		} vl;
132b70bb8d4SVladimir Oltean 	};
133b70bb8d4SVladimir Oltean };
134b70bb8d4SVladimir Oltean 
135a6af7763SVladimir Oltean enum sja1105_rule_type {
136a6af7763SVladimir Oltean 	SJA1105_RULE_BCAST_POLICER,
137a6af7763SVladimir Oltean 	SJA1105_RULE_TC_POLICER,
138dfacc5a2SVladimir Oltean 	SJA1105_RULE_VL,
139dfacc5a2SVladimir Oltean };
140dfacc5a2SVladimir Oltean 
141dfacc5a2SVladimir Oltean enum sja1105_vl_type {
142dfacc5a2SVladimir Oltean 	SJA1105_VL_NONCRITICAL,
143dfacc5a2SVladimir Oltean 	SJA1105_VL_RATE_CONSTRAINED,
144dfacc5a2SVladimir Oltean 	SJA1105_VL_TIME_TRIGGERED,
145a6af7763SVladimir Oltean };
146a6af7763SVladimir Oltean 
147a6af7763SVladimir Oltean struct sja1105_rule {
148a6af7763SVladimir Oltean 	struct list_head list;
149a6af7763SVladimir Oltean 	unsigned long cookie;
150a6af7763SVladimir Oltean 	unsigned long port_mask;
151b70bb8d4SVladimir Oltean 	struct sja1105_key key;
152a6af7763SVladimir Oltean 	enum sja1105_rule_type type;
153a6af7763SVladimir Oltean 
154dfacc5a2SVladimir Oltean 	/* Action */
155a6af7763SVladimir Oltean 	union {
156a6af7763SVladimir Oltean 		/* SJA1105_RULE_BCAST_POLICER */
157a6af7763SVladimir Oltean 		struct {
158a6af7763SVladimir Oltean 			int sharindx;
159a6af7763SVladimir Oltean 		} bcast_pol;
160a6af7763SVladimir Oltean 
161a6af7763SVladimir Oltean 		/* SJA1105_RULE_TC_POLICER */
162a6af7763SVladimir Oltean 		struct {
163a6af7763SVladimir Oltean 			int sharindx;
164a6af7763SVladimir Oltean 		} tc_pol;
165dfacc5a2SVladimir Oltean 
166dfacc5a2SVladimir Oltean 		/* SJA1105_RULE_VL */
167dfacc5a2SVladimir Oltean 		struct {
168dfacc5a2SVladimir Oltean 			enum sja1105_vl_type type;
169834f8933SVladimir Oltean 			unsigned long destports;
170834f8933SVladimir Oltean 			int sharindx;
171834f8933SVladimir Oltean 			int maxlen;
172834f8933SVladimir Oltean 			int ipv;
173834f8933SVladimir Oltean 			u64 base_time;
174834f8933SVladimir Oltean 			u64 cycle_time;
175834f8933SVladimir Oltean 			int num_entries;
176834f8933SVladimir Oltean 			struct action_gate_entry *entries;
177834f8933SVladimir Oltean 			struct flow_stats stats;
178dfacc5a2SVladimir Oltean 		} vl;
179a6af7763SVladimir Oltean 	};
180a6af7763SVladimir Oltean };
181a6af7763SVladimir Oltean 
182a6af7763SVladimir Oltean struct sja1105_flow_block {
183a6af7763SVladimir Oltean 	struct list_head rules;
184a6af7763SVladimir Oltean 	bool l2_policer_used[SJA1105_NUM_L2_POLICERS];
185dfacc5a2SVladimir Oltean 	int num_virtual_links;
186a6af7763SVladimir Oltean };
187a6af7763SVladimir Oltean 
188ec5ae610SVladimir Oltean struct sja1105_bridge_vlan {
189ec5ae610SVladimir Oltean 	struct list_head list;
190ec5ae610SVladimir Oltean 	int port;
191ec5ae610SVladimir Oltean 	u16 vid;
192ec5ae610SVladimir Oltean 	bool pvid;
193ec5ae610SVladimir Oltean 	bool untagged;
194ec5ae610SVladimir Oltean };
195ec5ae610SVladimir Oltean 
1967f14937fSVladimir Oltean enum sja1105_vlan_state {
1977f14937fSVladimir Oltean 	SJA1105_VLAN_UNAWARE,
1982cafa72eSVladimir Oltean 	SJA1105_VLAN_BEST_EFFORT,
1997f14937fSVladimir Oltean 	SJA1105_VLAN_FILTERING_FULL,
2007f14937fSVladimir Oltean };
2017f14937fSVladimir Oltean 
2028aa9ebccSVladimir Oltean struct sja1105_private {
2038aa9ebccSVladimir Oltean 	struct sja1105_static_config static_config;
204f5b8631cSVladimir Oltean 	bool rgmii_rx_delay[SJA1105_NUM_PORTS];
205f5b8631cSVladimir Oltean 	bool rgmii_tx_delay[SJA1105_NUM_PORTS];
2062cafa72eSVladimir Oltean 	bool best_effort_vlan_filtering;
2078aa9ebccSVladimir Oltean 	const struct sja1105_info *info;
2088aa9ebccSVladimir Oltean 	struct gpio_desc *reset_gpio;
2098aa9ebccSVladimir Oltean 	struct spi_device *spidev;
2108aa9ebccSVladimir Oltean 	struct dsa_switch *ds;
211ec5ae610SVladimir Oltean 	struct list_head dsa_8021q_vlans;
212ec5ae610SVladimir Oltean 	struct list_head bridge_vlans;
213a6af7763SVladimir Oltean 	struct sja1105_flow_block flow_block;
214227d07a0SVladimir Oltean 	struct sja1105_port ports[SJA1105_NUM_PORTS];
215227d07a0SVladimir Oltean 	/* Serializes transmission of management frames so that
216227d07a0SVladimir Oltean 	 * the switch doesn't confuse them with one another.
217227d07a0SVladimir Oltean 	 */
218227d07a0SVladimir Oltean 	struct mutex mgmt_lock;
2195899ee36SVladimir Oltean 	struct dsa_8021q_context *dsa_8021q_ctx;
2207f14937fSVladimir Oltean 	enum sja1105_vlan_state vlan_state;
221bf425b82SVladimir Oltean 	struct devlink_region **regions;
2224d752508SVladimir Oltean 	struct sja1105_cbs_entry *cbs;
223844d7edcSVladimir Oltean 	struct sja1105_tagger_data tagger_data;
224a9d6ed7aSVladimir Oltean 	struct sja1105_ptp_data ptp_data;
225317ab5b8SVladimir Oltean 	struct sja1105_tas_data tas_data;
2268aa9ebccSVladimir Oltean };
2278aa9ebccSVladimir Oltean 
2288aa9ebccSVladimir Oltean #include "sja1105_dynamic_config.h"
2298aa9ebccSVladimir Oltean 
2308aa9ebccSVladimir Oltean struct sja1105_spi_message {
2318aa9ebccSVladimir Oltean 	u64 access;
2328aa9ebccSVladimir Oltean 	u64 read_count;
2338aa9ebccSVladimir Oltean 	u64 address;
2348aa9ebccSVladimir Oltean };
2358aa9ebccSVladimir Oltean 
236317ab5b8SVladimir Oltean /* From sja1105_main.c */
2372eea1fa8SVladimir Oltean enum sja1105_reset_reason {
2382eea1fa8SVladimir Oltean 	SJA1105_VLAN_FILTERING = 0,
2392eea1fa8SVladimir Oltean 	SJA1105_RX_HWTSTAMPING,
2402eea1fa8SVladimir Oltean 	SJA1105_AGEING_TIME,
2412eea1fa8SVladimir Oltean 	SJA1105_SCHEDULING,
242c279c726SVladimir Oltean 	SJA1105_BEST_EFFORT_POLICING,
243dfacc5a2SVladimir Oltean 	SJA1105_VIRTUAL_LINKS,
2442eea1fa8SVladimir Oltean };
2452eea1fa8SVladimir Oltean 
2462eea1fa8SVladimir Oltean int sja1105_static_config_reload(struct sja1105_private *priv,
2472eea1fa8SVladimir Oltean 				 enum sja1105_reset_reason reason);
2480a7bdbc2SVladimir Oltean int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled);
249aaa270c6SVladimir Oltean void sja1105_frame_memory_partitioning(struct sja1105_private *priv);
250aaa270c6SVladimir Oltean 
2510a7bdbc2SVladimir Oltean /* From sja1105_devlink.c */
2520a7bdbc2SVladimir Oltean int sja1105_devlink_setup(struct dsa_switch *ds);
2530a7bdbc2SVladimir Oltean void sja1105_devlink_teardown(struct dsa_switch *ds);
2540a7bdbc2SVladimir Oltean int sja1105_devlink_param_get(struct dsa_switch *ds, u32 id,
2550a7bdbc2SVladimir Oltean 			      struct devlink_param_gset_ctx *ctx);
2560a7bdbc2SVladimir Oltean int sja1105_devlink_param_set(struct dsa_switch *ds, u32 id,
2570a7bdbc2SVladimir Oltean 			      struct devlink_param_gset_ctx *ctx);
258*ff4cf8eaSVladimir Oltean int sja1105_devlink_info_get(struct dsa_switch *ds,
259*ff4cf8eaSVladimir Oltean 			     struct devlink_info_req *req,
260*ff4cf8eaSVladimir Oltean 			     struct netlink_ext_ack *extack);
2610a7bdbc2SVladimir Oltean 
2628aa9ebccSVladimir Oltean /* From sja1105_spi.c */
2631bd44870SVladimir Oltean int sja1105_xfer_buf(const struct sja1105_private *priv,
2648aa9ebccSVladimir Oltean 		     sja1105_spi_rw_mode_t rw, u64 reg_addr,
26508839c06SVladimir Oltean 		     u8 *buf, size_t len);
266dff79620SVladimir Oltean int sja1105_xfer_u32(const struct sja1105_private *priv,
26734d76e9fSVladimir Oltean 		     sja1105_spi_rw_mode_t rw, u64 reg_addr, u32 *value,
26834d76e9fSVladimir Oltean 		     struct ptp_system_timestamp *ptp_sts);
269dff79620SVladimir Oltean int sja1105_xfer_u64(const struct sja1105_private *priv,
27034d76e9fSVladimir Oltean 		     sja1105_spi_rw_mode_t rw, u64 reg_addr, u64 *value,
27134d76e9fSVladimir Oltean 		     struct ptp_system_timestamp *ptp_sts);
272bf425b82SVladimir Oltean int static_config_buf_prepare_for_upload(struct sja1105_private *priv,
273bf425b82SVladimir Oltean 					 void *config_buf, int buf_len);
2748aa9ebccSVladimir Oltean int sja1105_static_config_upload(struct sja1105_private *priv);
275d114fb04SVladimir Oltean int sja1105_inhibit_tx(const struct sja1105_private *priv,
276d114fb04SVladimir Oltean 		       unsigned long port_bitmap, bool tx_inhibited);
2778aa9ebccSVladimir Oltean 
27813c832a4SVladimir Oltean extern const struct sja1105_info sja1105e_info;
27913c832a4SVladimir Oltean extern const struct sja1105_info sja1105t_info;
28013c832a4SVladimir Oltean extern const struct sja1105_info sja1105p_info;
28113c832a4SVladimir Oltean extern const struct sja1105_info sja1105q_info;
28213c832a4SVladimir Oltean extern const struct sja1105_info sja1105r_info;
28313c832a4SVladimir Oltean extern const struct sja1105_info sja1105s_info;
2848aa9ebccSVladimir Oltean 
2858aa9ebccSVladimir Oltean /* From sja1105_clocking.c */
2868aa9ebccSVladimir Oltean 
2878aa9ebccSVladimir Oltean typedef enum {
2888aa9ebccSVladimir Oltean 	XMII_MAC = 0,
2898aa9ebccSVladimir Oltean 	XMII_PHY = 1,
2908aa9ebccSVladimir Oltean } sja1105_mii_role_t;
2918aa9ebccSVladimir Oltean 
2928aa9ebccSVladimir Oltean typedef enum {
2938aa9ebccSVladimir Oltean 	XMII_MODE_MII		= 0,
2948aa9ebccSVladimir Oltean 	XMII_MODE_RMII		= 1,
2958aa9ebccSVladimir Oltean 	XMII_MODE_RGMII		= 2,
296ffe10e67SVladimir Oltean 	XMII_MODE_SGMII		= 3,
2978aa9ebccSVladimir Oltean } sja1105_phy_interface_t;
2988aa9ebccSVladimir Oltean 
2998aa9ebccSVladimir Oltean typedef enum {
3008aa9ebccSVladimir Oltean 	SJA1105_SPEED_10MBPS	= 3,
3018aa9ebccSVladimir Oltean 	SJA1105_SPEED_100MBPS	= 2,
3028aa9ebccSVladimir Oltean 	SJA1105_SPEED_1000MBPS	= 1,
3038aa9ebccSVladimir Oltean 	SJA1105_SPEED_AUTO	= 0,
3048aa9ebccSVladimir Oltean } sja1105_speed_t;
3058aa9ebccSVladimir Oltean 
306c05ec3d4SVladimir Oltean int sja1105pqrs_setup_rgmii_delay(const void *ctx, int port);
3078aa9ebccSVladimir Oltean int sja1105_clocking_setup_port(struct sja1105_private *priv, int port);
3088aa9ebccSVladimir Oltean int sja1105_clocking_setup(struct sja1105_private *priv);
3098aa9ebccSVladimir Oltean 
31052c34e6eSVladimir Oltean /* From sja1105_ethtool.c */
31152c34e6eSVladimir Oltean void sja1105_get_ethtool_stats(struct dsa_switch *ds, int port, u64 *data);
31252c34e6eSVladimir Oltean void sja1105_get_strings(struct dsa_switch *ds, int port,
31352c34e6eSVladimir Oltean 			 u32 stringset, u8 *data);
31452c34e6eSVladimir Oltean int sja1105_get_sset_count(struct dsa_switch *ds, int port, int sset);
3158aa9ebccSVladimir Oltean 
31652c34e6eSVladimir Oltean /* From sja1105_dynamic_config.c */
3178aa9ebccSVladimir Oltean int sja1105_dynamic_config_read(struct sja1105_private *priv,
3188aa9ebccSVladimir Oltean 				enum sja1105_blk_idx blk_idx,
3198aa9ebccSVladimir Oltean 				int index, void *entry);
3208aa9ebccSVladimir Oltean int sja1105_dynamic_config_write(struct sja1105_private *priv,
3218aa9ebccSVladimir Oltean 				 enum sja1105_blk_idx blk_idx,
3228aa9ebccSVladimir Oltean 				 int index, void *entry, bool keep);
3238aa9ebccSVladimir Oltean 
3241da73821SVladimir Oltean enum sja1105_iotag {
3251da73821SVladimir Oltean 	SJA1105_C_TAG = 0, /* Inner VLAN header */
3261da73821SVladimir Oltean 	SJA1105_S_TAG = 1, /* Outer VLAN header */
3271da73821SVladimir Oltean };
3281da73821SVladimir Oltean 
3299dfa6911SVladimir Oltean u8 sja1105et_fdb_hash(struct sja1105_private *priv, const u8 *addr, u16 vid);
3309dfa6911SVladimir Oltean int sja1105et_fdb_add(struct dsa_switch *ds, int port,
3319dfa6911SVladimir Oltean 		      const unsigned char *addr, u16 vid);
3329dfa6911SVladimir Oltean int sja1105et_fdb_del(struct dsa_switch *ds, int port,
3339dfa6911SVladimir Oltean 		      const unsigned char *addr, u16 vid);
3349dfa6911SVladimir Oltean int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port,
3359dfa6911SVladimir Oltean 			const unsigned char *addr, u16 vid);
3369dfa6911SVladimir Oltean int sja1105pqrs_fdb_del(struct dsa_switch *ds, int port,
3379dfa6911SVladimir Oltean 			const unsigned char *addr, u16 vid);
338291d1e72SVladimir Oltean 
339a6af7763SVladimir Oltean /* From sja1105_flower.c */
340a6af7763SVladimir Oltean int sja1105_cls_flower_del(struct dsa_switch *ds, int port,
341a6af7763SVladimir Oltean 			   struct flow_cls_offload *cls, bool ingress);
342a6af7763SVladimir Oltean int sja1105_cls_flower_add(struct dsa_switch *ds, int port,
343a6af7763SVladimir Oltean 			   struct flow_cls_offload *cls, bool ingress);
344834f8933SVladimir Oltean int sja1105_cls_flower_stats(struct dsa_switch *ds, int port,
345834f8933SVladimir Oltean 			     struct flow_cls_offload *cls, bool ingress);
346a6af7763SVladimir Oltean void sja1105_flower_setup(struct dsa_switch *ds);
347a6af7763SVladimir Oltean void sja1105_flower_teardown(struct dsa_switch *ds);
348dfacc5a2SVladimir Oltean struct sja1105_rule *sja1105_rule_find(struct sja1105_private *priv,
349dfacc5a2SVladimir Oltean 				       unsigned long cookie);
350a6af7763SVladimir Oltean 
3518aa9ebccSVladimir Oltean #endif
352