xref: /openbmc/linux/drivers/net/dsa/sja1105/sja1105.h (revision 82760d7f2ea63829d6ab0f3de7ec98b93132c8ee)
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
17*82760d7fSVladimir Oltean #define SJA1105_MAX_NUM_PORTS		SJA1105_NUM_PORTS
188aa9ebccSVladimir Oltean #define SJA1105_NUM_TC			8
198aa9ebccSVladimir Oltean #define SJA1105ET_FDB_BIN_SIZE		4
208456721dSVladimir Oltean /* The hardware value is in multiples of 10 ms.
218456721dSVladimir Oltean  * The passed parameter is in multiples of 1 ms.
228456721dSVladimir Oltean  */
238456721dSVladimir Oltean #define SJA1105_AGEING_TIME_MS(ms)	((ms) / 10)
24a6af7763SVladimir Oltean #define SJA1105_NUM_L2_POLICERS		45
258aa9ebccSVladimir Oltean 
2641603d78SVladimir Oltean typedef enum {
2741603d78SVladimir Oltean 	SPI_READ = 0,
2841603d78SVladimir Oltean 	SPI_WRITE = 1,
2941603d78SVladimir Oltean } sja1105_spi_rw_mode_t;
3041603d78SVladimir Oltean 
31317ab5b8SVladimir Oltean #include "sja1105_tas.h"
32a9d6ed7aSVladimir Oltean #include "sja1105_ptp.h"
33317ab5b8SVladimir Oltean 
34039b167dSVladimir Oltean enum sja1105_stats_area {
35039b167dSVladimir Oltean 	MAC,
36039b167dSVladimir Oltean 	HL1,
37039b167dSVladimir Oltean 	HL2,
38039b167dSVladimir Oltean 	ETHER,
39039b167dSVladimir Oltean 	__MAX_SJA1105_STATS_AREA,
40039b167dSVladimir Oltean };
41039b167dSVladimir Oltean 
428aa9ebccSVladimir Oltean /* Keeps the different addresses between E/T and P/Q/R/S */
438aa9ebccSVladimir Oltean struct sja1105_regs {
448aa9ebccSVladimir Oltean 	u64 device_id;
458aa9ebccSVladimir Oltean 	u64 prod_id;
468aa9ebccSVladimir Oltean 	u64 status;
471a4c6940SVladimir Oltean 	u64 port_control;
488aa9ebccSVladimir Oltean 	u64 rgu;
49834f8933SVladimir Oltean 	u64 vl_status;
508aa9ebccSVladimir Oltean 	u64 config;
51ffe10e67SVladimir Oltean 	u64 sgmii;
528aa9ebccSVladimir Oltean 	u64 rmii_pll1;
53747e5eb3SVladimir Oltean 	u64 ptppinst;
54747e5eb3SVladimir Oltean 	u64 ptppindur;
55bb77f36aSVladimir Oltean 	u64 ptp_control;
562fb079a2SVladimir Oltean 	u64 ptpclkval;
57bb77f36aSVladimir Oltean 	u64 ptpclkrate;
5886db36a3SVladimir Oltean 	u64 ptpclkcorp;
59747e5eb3SVladimir Oltean 	u64 ptpsyncts;
6086db36a3SVladimir Oltean 	u64 ptpschtm;
61*82760d7fSVladimir Oltean 	u64 ptpegr_ts[SJA1105_MAX_NUM_PORTS];
62*82760d7fSVladimir Oltean 	u64 pad_mii_tx[SJA1105_MAX_NUM_PORTS];
63*82760d7fSVladimir Oltean 	u64 pad_mii_rx[SJA1105_MAX_NUM_PORTS];
64*82760d7fSVladimir Oltean 	u64 pad_mii_id[SJA1105_MAX_NUM_PORTS];
65*82760d7fSVladimir Oltean 	u64 cgu_idiv[SJA1105_MAX_NUM_PORTS];
66*82760d7fSVladimir Oltean 	u64 mii_tx_clk[SJA1105_MAX_NUM_PORTS];
67*82760d7fSVladimir Oltean 	u64 mii_rx_clk[SJA1105_MAX_NUM_PORTS];
68*82760d7fSVladimir Oltean 	u64 mii_ext_tx_clk[SJA1105_MAX_NUM_PORTS];
69*82760d7fSVladimir Oltean 	u64 mii_ext_rx_clk[SJA1105_MAX_NUM_PORTS];
70*82760d7fSVladimir Oltean 	u64 rgmii_tx_clk[SJA1105_MAX_NUM_PORTS];
71*82760d7fSVladimir Oltean 	u64 rmii_ref_clk[SJA1105_MAX_NUM_PORTS];
72*82760d7fSVladimir Oltean 	u64 rmii_ext_tx_clk[SJA1105_MAX_NUM_PORTS];
73*82760d7fSVladimir Oltean 	u64 stats[__MAX_SJA1105_STATS_AREA][SJA1105_MAX_NUM_PORTS];
748aa9ebccSVladimir Oltean };
758aa9ebccSVladimir Oltean 
768aa9ebccSVladimir Oltean struct sja1105_info {
778aa9ebccSVladimir Oltean 	u64 device_id;
788aa9ebccSVladimir Oltean 	/* Needed for distinction between P and R, and between Q and S
798aa9ebccSVladimir Oltean 	 * (since the parts with/without SGMII share the same
808aa9ebccSVladimir Oltean 	 * switch core and device_id)
818aa9ebccSVladimir Oltean 	 */
828aa9ebccSVladimir Oltean 	u64 part_no;
8347ed985eSVladimir Oltean 	/* E/T and P/Q/R/S have partial timestamps of different sizes.
8447ed985eSVladimir Oltean 	 * They must be reconstructed on both families anyway to get the full
8547ed985eSVladimir Oltean 	 * 64-bit values back.
8647ed985eSVladimir Oltean 	 */
8747ed985eSVladimir Oltean 	int ptp_ts_bits;
8847ed985eSVladimir Oltean 	/* Also SPI commands are of different sizes to retrieve
8947ed985eSVladimir Oltean 	 * the egress timestamps.
9047ed985eSVladimir Oltean 	 */
9147ed985eSVladimir Oltean 	int ptpegr_ts_bytes;
924d752508SVladimir Oltean 	int num_cbs_shapers;
938aa9ebccSVladimir Oltean 	const struct sja1105_dynamic_table_ops *dyn_ops;
948aa9ebccSVladimir Oltean 	const struct sja1105_table_ops *static_ops;
958aa9ebccSVladimir Oltean 	const struct sja1105_regs *regs;
9638b5beeaSVladimir Oltean 	/* Both E/T and P/Q/R/S have quirks when it comes to popping the S-Tag
9738b5beeaSVladimir Oltean 	 * from double-tagged frames. E/T will pop it only when it's equal to
9838b5beeaSVladimir Oltean 	 * TPID from the General Parameters Table, while P/Q/R/S will only
9938b5beeaSVladimir Oltean 	 * pop it when it's equal to TPID2.
10038b5beeaSVladimir Oltean 	 */
10138b5beeaSVladimir Oltean 	u16 qinq_tpid;
1024d942354SVladimir Oltean 	bool can_limit_mcast_flood;
103abfb228aSVladimir Oltean 	int (*reset_cmd)(struct dsa_switch *ds);
104f5b8631cSVladimir Oltean 	int (*setup_rgmii_delay)(const void *ctx, int port);
1059dfa6911SVladimir Oltean 	/* Prototypes from include/net/dsa.h */
1069dfa6911SVladimir Oltean 	int (*fdb_add_cmd)(struct dsa_switch *ds, int port,
1079dfa6911SVladimir Oltean 			   const unsigned char *addr, u16 vid);
1089dfa6911SVladimir Oltean 	int (*fdb_del_cmd)(struct dsa_switch *ds, int port,
1099dfa6911SVladimir Oltean 			   const unsigned char *addr, u16 vid);
11041603d78SVladimir Oltean 	void (*ptp_cmd_packing)(u8 *buf, struct sja1105_ptp_cmd *cmd,
11141603d78SVladimir Oltean 				enum packing_op op);
1128aa9ebccSVladimir Oltean 	const char *name;
1138aa9ebccSVladimir Oltean };
1148aa9ebccSVladimir Oltean 
115b70bb8d4SVladimir Oltean enum sja1105_key_type {
116b70bb8d4SVladimir Oltean 	SJA1105_KEY_BCAST,
117b70bb8d4SVladimir Oltean 	SJA1105_KEY_TC,
118b70bb8d4SVladimir Oltean 	SJA1105_KEY_VLAN_UNAWARE_VL,
119b70bb8d4SVladimir Oltean 	SJA1105_KEY_VLAN_AWARE_VL,
120b70bb8d4SVladimir Oltean };
121b70bb8d4SVladimir Oltean 
122b70bb8d4SVladimir Oltean struct sja1105_key {
123b70bb8d4SVladimir Oltean 	enum sja1105_key_type type;
124b70bb8d4SVladimir Oltean 
125b70bb8d4SVladimir Oltean 	union {
126b70bb8d4SVladimir Oltean 		/* SJA1105_KEY_TC */
127b70bb8d4SVladimir Oltean 		struct {
128b70bb8d4SVladimir Oltean 			int pcp;
129b70bb8d4SVladimir Oltean 		} tc;
130b70bb8d4SVladimir Oltean 
131b70bb8d4SVladimir Oltean 		/* SJA1105_KEY_VLAN_UNAWARE_VL */
132b70bb8d4SVladimir Oltean 		/* SJA1105_KEY_VLAN_AWARE_VL */
133b70bb8d4SVladimir Oltean 		struct {
134b70bb8d4SVladimir Oltean 			u64 dmac;
135b70bb8d4SVladimir Oltean 			u16 vid;
136b70bb8d4SVladimir Oltean 			u16 pcp;
137b70bb8d4SVladimir Oltean 		} vl;
138b70bb8d4SVladimir Oltean 	};
139b70bb8d4SVladimir Oltean };
140b70bb8d4SVladimir Oltean 
141a6af7763SVladimir Oltean enum sja1105_rule_type {
142a6af7763SVladimir Oltean 	SJA1105_RULE_BCAST_POLICER,
143a6af7763SVladimir Oltean 	SJA1105_RULE_TC_POLICER,
144dfacc5a2SVladimir Oltean 	SJA1105_RULE_VL,
145dfacc5a2SVladimir Oltean };
146dfacc5a2SVladimir Oltean 
147dfacc5a2SVladimir Oltean enum sja1105_vl_type {
148dfacc5a2SVladimir Oltean 	SJA1105_VL_NONCRITICAL,
149dfacc5a2SVladimir Oltean 	SJA1105_VL_RATE_CONSTRAINED,
150dfacc5a2SVladimir Oltean 	SJA1105_VL_TIME_TRIGGERED,
151a6af7763SVladimir Oltean };
152a6af7763SVladimir Oltean 
153a6af7763SVladimir Oltean struct sja1105_rule {
154a6af7763SVladimir Oltean 	struct list_head list;
155a6af7763SVladimir Oltean 	unsigned long cookie;
156a6af7763SVladimir Oltean 	unsigned long port_mask;
157b70bb8d4SVladimir Oltean 	struct sja1105_key key;
158a6af7763SVladimir Oltean 	enum sja1105_rule_type type;
159a6af7763SVladimir Oltean 
160dfacc5a2SVladimir Oltean 	/* Action */
161a6af7763SVladimir Oltean 	union {
162a6af7763SVladimir Oltean 		/* SJA1105_RULE_BCAST_POLICER */
163a6af7763SVladimir Oltean 		struct {
164a6af7763SVladimir Oltean 			int sharindx;
165a6af7763SVladimir Oltean 		} bcast_pol;
166a6af7763SVladimir Oltean 
167a6af7763SVladimir Oltean 		/* SJA1105_RULE_TC_POLICER */
168a6af7763SVladimir Oltean 		struct {
169a6af7763SVladimir Oltean 			int sharindx;
170a6af7763SVladimir Oltean 		} tc_pol;
171dfacc5a2SVladimir Oltean 
172dfacc5a2SVladimir Oltean 		/* SJA1105_RULE_VL */
173dfacc5a2SVladimir Oltean 		struct {
174dfacc5a2SVladimir Oltean 			enum sja1105_vl_type type;
175834f8933SVladimir Oltean 			unsigned long destports;
176834f8933SVladimir Oltean 			int sharindx;
177834f8933SVladimir Oltean 			int maxlen;
178834f8933SVladimir Oltean 			int ipv;
179834f8933SVladimir Oltean 			u64 base_time;
180834f8933SVladimir Oltean 			u64 cycle_time;
181834f8933SVladimir Oltean 			int num_entries;
182834f8933SVladimir Oltean 			struct action_gate_entry *entries;
183834f8933SVladimir Oltean 			struct flow_stats stats;
184dfacc5a2SVladimir Oltean 		} vl;
185a6af7763SVladimir Oltean 	};
186a6af7763SVladimir Oltean };
187a6af7763SVladimir Oltean 
188a6af7763SVladimir Oltean struct sja1105_flow_block {
189a6af7763SVladimir Oltean 	struct list_head rules;
190a6af7763SVladimir Oltean 	bool l2_policer_used[SJA1105_NUM_L2_POLICERS];
191dfacc5a2SVladimir Oltean 	int num_virtual_links;
192a6af7763SVladimir Oltean };
193a6af7763SVladimir Oltean 
194ec5ae610SVladimir Oltean struct sja1105_bridge_vlan {
195ec5ae610SVladimir Oltean 	struct list_head list;
196ec5ae610SVladimir Oltean 	int port;
197ec5ae610SVladimir Oltean 	u16 vid;
198ec5ae610SVladimir Oltean 	bool pvid;
199ec5ae610SVladimir Oltean 	bool untagged;
200ec5ae610SVladimir Oltean };
201ec5ae610SVladimir Oltean 
2027f14937fSVladimir Oltean enum sja1105_vlan_state {
2037f14937fSVladimir Oltean 	SJA1105_VLAN_UNAWARE,
2042cafa72eSVladimir Oltean 	SJA1105_VLAN_BEST_EFFORT,
2057f14937fSVladimir Oltean 	SJA1105_VLAN_FILTERING_FULL,
2067f14937fSVladimir Oltean };
2077f14937fSVladimir Oltean 
2088aa9ebccSVladimir Oltean struct sja1105_private {
2098aa9ebccSVladimir Oltean 	struct sja1105_static_config static_config;
210*82760d7fSVladimir Oltean 	bool rgmii_rx_delay[SJA1105_MAX_NUM_PORTS];
211*82760d7fSVladimir Oltean 	bool rgmii_tx_delay[SJA1105_MAX_NUM_PORTS];
2122cafa72eSVladimir Oltean 	bool best_effort_vlan_filtering;
2134d942354SVladimir Oltean 	unsigned long learn_ena;
2147f7ccdeaSVladimir Oltean 	unsigned long ucast_egress_floods;
2157f7ccdeaSVladimir Oltean 	unsigned long bcast_egress_floods;
2168aa9ebccSVladimir Oltean 	const struct sja1105_info *info;
217718bad0eSVladimir Oltean 	size_t max_xfer_len;
2188aa9ebccSVladimir Oltean 	struct gpio_desc *reset_gpio;
2198aa9ebccSVladimir Oltean 	struct spi_device *spidev;
2208aa9ebccSVladimir Oltean 	struct dsa_switch *ds;
221ec5ae610SVladimir Oltean 	struct list_head dsa_8021q_vlans;
222ec5ae610SVladimir Oltean 	struct list_head bridge_vlans;
223a6af7763SVladimir Oltean 	struct sja1105_flow_block flow_block;
224*82760d7fSVladimir Oltean 	struct sja1105_port ports[SJA1105_MAX_NUM_PORTS];
225227d07a0SVladimir Oltean 	/* Serializes transmission of management frames so that
226227d07a0SVladimir Oltean 	 * the switch doesn't confuse them with one another.
227227d07a0SVladimir Oltean 	 */
228227d07a0SVladimir Oltean 	struct mutex mgmt_lock;
2295899ee36SVladimir Oltean 	struct dsa_8021q_context *dsa_8021q_ctx;
2307f14937fSVladimir Oltean 	enum sja1105_vlan_state vlan_state;
231bf425b82SVladimir Oltean 	struct devlink_region **regions;
2324d752508SVladimir Oltean 	struct sja1105_cbs_entry *cbs;
233844d7edcSVladimir Oltean 	struct sja1105_tagger_data tagger_data;
234a9d6ed7aSVladimir Oltean 	struct sja1105_ptp_data ptp_data;
235317ab5b8SVladimir Oltean 	struct sja1105_tas_data tas_data;
2368aa9ebccSVladimir Oltean };
2378aa9ebccSVladimir Oltean 
2388aa9ebccSVladimir Oltean #include "sja1105_dynamic_config.h"
2398aa9ebccSVladimir Oltean 
2408aa9ebccSVladimir Oltean struct sja1105_spi_message {
2418aa9ebccSVladimir Oltean 	u64 access;
2428aa9ebccSVladimir Oltean 	u64 read_count;
2438aa9ebccSVladimir Oltean 	u64 address;
2448aa9ebccSVladimir Oltean };
2458aa9ebccSVladimir Oltean 
246317ab5b8SVladimir Oltean /* From sja1105_main.c */
2472eea1fa8SVladimir Oltean enum sja1105_reset_reason {
2482eea1fa8SVladimir Oltean 	SJA1105_VLAN_FILTERING = 0,
2492eea1fa8SVladimir Oltean 	SJA1105_RX_HWTSTAMPING,
2502eea1fa8SVladimir Oltean 	SJA1105_AGEING_TIME,
2512eea1fa8SVladimir Oltean 	SJA1105_SCHEDULING,
252c279c726SVladimir Oltean 	SJA1105_BEST_EFFORT_POLICING,
253dfacc5a2SVladimir Oltean 	SJA1105_VIRTUAL_LINKS,
2542eea1fa8SVladimir Oltean };
2552eea1fa8SVladimir Oltean 
2562eea1fa8SVladimir Oltean int sja1105_static_config_reload(struct sja1105_private *priv,
2572eea1fa8SVladimir Oltean 				 enum sja1105_reset_reason reason);
25889153ed6SVladimir Oltean int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled,
25989153ed6SVladimir Oltean 			   struct netlink_ext_ack *extack);
260aaa270c6SVladimir Oltean void sja1105_frame_memory_partitioning(struct sja1105_private *priv);
261aaa270c6SVladimir Oltean 
2620a7bdbc2SVladimir Oltean /* From sja1105_devlink.c */
2630a7bdbc2SVladimir Oltean int sja1105_devlink_setup(struct dsa_switch *ds);
2640a7bdbc2SVladimir Oltean void sja1105_devlink_teardown(struct dsa_switch *ds);
2650a7bdbc2SVladimir Oltean int sja1105_devlink_param_get(struct dsa_switch *ds, u32 id,
2660a7bdbc2SVladimir Oltean 			      struct devlink_param_gset_ctx *ctx);
2670a7bdbc2SVladimir Oltean int sja1105_devlink_param_set(struct dsa_switch *ds, u32 id,
2680a7bdbc2SVladimir Oltean 			      struct devlink_param_gset_ctx *ctx);
269ff4cf8eaSVladimir Oltean int sja1105_devlink_info_get(struct dsa_switch *ds,
270ff4cf8eaSVladimir Oltean 			     struct devlink_info_req *req,
271ff4cf8eaSVladimir Oltean 			     struct netlink_ext_ack *extack);
2720a7bdbc2SVladimir Oltean 
2738aa9ebccSVladimir Oltean /* From sja1105_spi.c */
2741bd44870SVladimir Oltean int sja1105_xfer_buf(const struct sja1105_private *priv,
2758aa9ebccSVladimir Oltean 		     sja1105_spi_rw_mode_t rw, u64 reg_addr,
27608839c06SVladimir Oltean 		     u8 *buf, size_t len);
277dff79620SVladimir Oltean int sja1105_xfer_u32(const struct sja1105_private *priv,
27834d76e9fSVladimir Oltean 		     sja1105_spi_rw_mode_t rw, u64 reg_addr, u32 *value,
27934d76e9fSVladimir Oltean 		     struct ptp_system_timestamp *ptp_sts);
280dff79620SVladimir Oltean int sja1105_xfer_u64(const struct sja1105_private *priv,
28134d76e9fSVladimir Oltean 		     sja1105_spi_rw_mode_t rw, u64 reg_addr, u64 *value,
28234d76e9fSVladimir Oltean 		     struct ptp_system_timestamp *ptp_sts);
283bf425b82SVladimir Oltean int static_config_buf_prepare_for_upload(struct sja1105_private *priv,
284bf425b82SVladimir Oltean 					 void *config_buf, int buf_len);
2858aa9ebccSVladimir Oltean int sja1105_static_config_upload(struct sja1105_private *priv);
286d114fb04SVladimir Oltean int sja1105_inhibit_tx(const struct sja1105_private *priv,
287d114fb04SVladimir Oltean 		       unsigned long port_bitmap, bool tx_inhibited);
2888aa9ebccSVladimir Oltean 
28913c832a4SVladimir Oltean extern const struct sja1105_info sja1105e_info;
29013c832a4SVladimir Oltean extern const struct sja1105_info sja1105t_info;
29113c832a4SVladimir Oltean extern const struct sja1105_info sja1105p_info;
29213c832a4SVladimir Oltean extern const struct sja1105_info sja1105q_info;
29313c832a4SVladimir Oltean extern const struct sja1105_info sja1105r_info;
29413c832a4SVladimir Oltean extern const struct sja1105_info sja1105s_info;
2958aa9ebccSVladimir Oltean 
2968aa9ebccSVladimir Oltean /* From sja1105_clocking.c */
2978aa9ebccSVladimir Oltean 
2988aa9ebccSVladimir Oltean typedef enum {
2998aa9ebccSVladimir Oltean 	XMII_MAC = 0,
3008aa9ebccSVladimir Oltean 	XMII_PHY = 1,
3018aa9ebccSVladimir Oltean } sja1105_mii_role_t;
3028aa9ebccSVladimir Oltean 
3038aa9ebccSVladimir Oltean typedef enum {
3048aa9ebccSVladimir Oltean 	XMII_MODE_MII		= 0,
3058aa9ebccSVladimir Oltean 	XMII_MODE_RMII		= 1,
3068aa9ebccSVladimir Oltean 	XMII_MODE_RGMII		= 2,
307ffe10e67SVladimir Oltean 	XMII_MODE_SGMII		= 3,
3088aa9ebccSVladimir Oltean } sja1105_phy_interface_t;
3098aa9ebccSVladimir Oltean 
3108aa9ebccSVladimir Oltean typedef enum {
3118aa9ebccSVladimir Oltean 	SJA1105_SPEED_10MBPS	= 3,
3128aa9ebccSVladimir Oltean 	SJA1105_SPEED_100MBPS	= 2,
3138aa9ebccSVladimir Oltean 	SJA1105_SPEED_1000MBPS	= 1,
3148aa9ebccSVladimir Oltean 	SJA1105_SPEED_AUTO	= 0,
3158aa9ebccSVladimir Oltean } sja1105_speed_t;
3168aa9ebccSVladimir Oltean 
317c05ec3d4SVladimir Oltean int sja1105pqrs_setup_rgmii_delay(const void *ctx, int port);
3188aa9ebccSVladimir Oltean int sja1105_clocking_setup_port(struct sja1105_private *priv, int port);
3198aa9ebccSVladimir Oltean int sja1105_clocking_setup(struct sja1105_private *priv);
3208aa9ebccSVladimir Oltean 
32152c34e6eSVladimir Oltean /* From sja1105_ethtool.c */
32252c34e6eSVladimir Oltean void sja1105_get_ethtool_stats(struct dsa_switch *ds, int port, u64 *data);
32352c34e6eSVladimir Oltean void sja1105_get_strings(struct dsa_switch *ds, int port,
32452c34e6eSVladimir Oltean 			 u32 stringset, u8 *data);
32552c34e6eSVladimir Oltean int sja1105_get_sset_count(struct dsa_switch *ds, int port, int sset);
3268aa9ebccSVladimir Oltean 
32752c34e6eSVladimir Oltean /* From sja1105_dynamic_config.c */
3288aa9ebccSVladimir Oltean int sja1105_dynamic_config_read(struct sja1105_private *priv,
3298aa9ebccSVladimir Oltean 				enum sja1105_blk_idx blk_idx,
3308aa9ebccSVladimir Oltean 				int index, void *entry);
3318aa9ebccSVladimir Oltean int sja1105_dynamic_config_write(struct sja1105_private *priv,
3328aa9ebccSVladimir Oltean 				 enum sja1105_blk_idx blk_idx,
3338aa9ebccSVladimir Oltean 				 int index, void *entry, bool keep);
3348aa9ebccSVladimir Oltean 
3351da73821SVladimir Oltean enum sja1105_iotag {
3361da73821SVladimir Oltean 	SJA1105_C_TAG = 0, /* Inner VLAN header */
3371da73821SVladimir Oltean 	SJA1105_S_TAG = 1, /* Outer VLAN header */
3381da73821SVladimir Oltean };
3391da73821SVladimir Oltean 
3409dfa6911SVladimir Oltean u8 sja1105et_fdb_hash(struct sja1105_private *priv, const u8 *addr, u16 vid);
3419dfa6911SVladimir Oltean int sja1105et_fdb_add(struct dsa_switch *ds, int port,
3429dfa6911SVladimir Oltean 		      const unsigned char *addr, u16 vid);
3439dfa6911SVladimir Oltean int sja1105et_fdb_del(struct dsa_switch *ds, int port,
3449dfa6911SVladimir Oltean 		      const unsigned char *addr, u16 vid);
3459dfa6911SVladimir Oltean int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port,
3469dfa6911SVladimir Oltean 			const unsigned char *addr, u16 vid);
3479dfa6911SVladimir Oltean int sja1105pqrs_fdb_del(struct dsa_switch *ds, int port,
3489dfa6911SVladimir Oltean 			const unsigned char *addr, u16 vid);
349291d1e72SVladimir Oltean 
350a6af7763SVladimir Oltean /* From sja1105_flower.c */
351a6af7763SVladimir Oltean int sja1105_cls_flower_del(struct dsa_switch *ds, int port,
352a6af7763SVladimir Oltean 			   struct flow_cls_offload *cls, bool ingress);
353a6af7763SVladimir Oltean int sja1105_cls_flower_add(struct dsa_switch *ds, int port,
354a6af7763SVladimir Oltean 			   struct flow_cls_offload *cls, bool ingress);
355834f8933SVladimir Oltean int sja1105_cls_flower_stats(struct dsa_switch *ds, int port,
356834f8933SVladimir Oltean 			     struct flow_cls_offload *cls, bool ingress);
357a6af7763SVladimir Oltean void sja1105_flower_setup(struct dsa_switch *ds);
358a6af7763SVladimir Oltean void sja1105_flower_teardown(struct dsa_switch *ds);
359dfacc5a2SVladimir Oltean struct sja1105_rule *sja1105_rule_find(struct sja1105_private *priv,
360dfacc5a2SVladimir Oltean 				       unsigned long cookie);
361a6af7763SVladimir Oltean 
3628aa9ebccSVladimir Oltean #endif
363