18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Copyright (c) 2018, Sensor-Technik Wiedemann GmbH
38c2ecf20Sopenharmony_ci * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#ifndef _SJA1105_H
68c2ecf20Sopenharmony_ci#define _SJA1105_H
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/ptp_clock_kernel.h>
98c2ecf20Sopenharmony_ci#include <linux/timecounter.h>
108c2ecf20Sopenharmony_ci#include <linux/dsa/sja1105.h>
118c2ecf20Sopenharmony_ci#include <linux/dsa/8021q.h>
128c2ecf20Sopenharmony_ci#include <net/dsa.h>
138c2ecf20Sopenharmony_ci#include <linux/mutex.h>
148c2ecf20Sopenharmony_ci#include "sja1105_static_config.h"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define SJA1105_NUM_PORTS		5
178c2ecf20Sopenharmony_ci#define SJA1105_NUM_TC			8
188c2ecf20Sopenharmony_ci#define SJA1105ET_FDB_BIN_SIZE		4
198c2ecf20Sopenharmony_ci/* The hardware value is in multiples of 10 ms.
208c2ecf20Sopenharmony_ci * The passed parameter is in multiples of 1 ms.
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci#define SJA1105_AGEING_TIME_MS(ms)	((ms) / 10)
238c2ecf20Sopenharmony_ci#define SJA1105_NUM_L2_POLICERS		45
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_citypedef enum {
268c2ecf20Sopenharmony_ci	SPI_READ = 0,
278c2ecf20Sopenharmony_ci	SPI_WRITE = 1,
288c2ecf20Sopenharmony_ci} sja1105_spi_rw_mode_t;
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#include "sja1105_tas.h"
318c2ecf20Sopenharmony_ci#include "sja1105_ptp.h"
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/* Keeps the different addresses between E/T and P/Q/R/S */
348c2ecf20Sopenharmony_cistruct sja1105_regs {
358c2ecf20Sopenharmony_ci	u64 device_id;
368c2ecf20Sopenharmony_ci	u64 prod_id;
378c2ecf20Sopenharmony_ci	u64 status;
388c2ecf20Sopenharmony_ci	u64 port_control;
398c2ecf20Sopenharmony_ci	u64 rgu;
408c2ecf20Sopenharmony_ci	u64 vl_status;
418c2ecf20Sopenharmony_ci	u64 config;
428c2ecf20Sopenharmony_ci	u64 sgmii;
438c2ecf20Sopenharmony_ci	u64 rmii_pll1;
448c2ecf20Sopenharmony_ci	u64 ptppinst;
458c2ecf20Sopenharmony_ci	u64 ptppindur;
468c2ecf20Sopenharmony_ci	u64 ptp_control;
478c2ecf20Sopenharmony_ci	u64 ptpclkval;
488c2ecf20Sopenharmony_ci	u64 ptpclkrate;
498c2ecf20Sopenharmony_ci	u64 ptpclkcorp;
508c2ecf20Sopenharmony_ci	u64 ptpsyncts;
518c2ecf20Sopenharmony_ci	u64 ptpschtm;
528c2ecf20Sopenharmony_ci	u64 ptpegr_ts[SJA1105_NUM_PORTS];
538c2ecf20Sopenharmony_ci	u64 pad_mii_tx[SJA1105_NUM_PORTS];
548c2ecf20Sopenharmony_ci	u64 pad_mii_rx[SJA1105_NUM_PORTS];
558c2ecf20Sopenharmony_ci	u64 pad_mii_id[SJA1105_NUM_PORTS];
568c2ecf20Sopenharmony_ci	u64 cgu_idiv[SJA1105_NUM_PORTS];
578c2ecf20Sopenharmony_ci	u64 mii_tx_clk[SJA1105_NUM_PORTS];
588c2ecf20Sopenharmony_ci	u64 mii_rx_clk[SJA1105_NUM_PORTS];
598c2ecf20Sopenharmony_ci	u64 mii_ext_tx_clk[SJA1105_NUM_PORTS];
608c2ecf20Sopenharmony_ci	u64 mii_ext_rx_clk[SJA1105_NUM_PORTS];
618c2ecf20Sopenharmony_ci	u64 rgmii_tx_clk[SJA1105_NUM_PORTS];
628c2ecf20Sopenharmony_ci	u64 rmii_ref_clk[SJA1105_NUM_PORTS];
638c2ecf20Sopenharmony_ci	u64 rmii_ext_tx_clk[SJA1105_NUM_PORTS];
648c2ecf20Sopenharmony_ci	u64 mac[SJA1105_NUM_PORTS];
658c2ecf20Sopenharmony_ci	u64 mac_hl1[SJA1105_NUM_PORTS];
668c2ecf20Sopenharmony_ci	u64 mac_hl2[SJA1105_NUM_PORTS];
678c2ecf20Sopenharmony_ci	u64 ether_stats[SJA1105_NUM_PORTS];
688c2ecf20Sopenharmony_ci	u64 qlevel[SJA1105_NUM_PORTS];
698c2ecf20Sopenharmony_ci};
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistruct sja1105_info {
728c2ecf20Sopenharmony_ci	u64 device_id;
738c2ecf20Sopenharmony_ci	/* Needed for distinction between P and R, and between Q and S
748c2ecf20Sopenharmony_ci	 * (since the parts with/without SGMII share the same
758c2ecf20Sopenharmony_ci	 * switch core and device_id)
768c2ecf20Sopenharmony_ci	 */
778c2ecf20Sopenharmony_ci	u64 part_no;
788c2ecf20Sopenharmony_ci	/* E/T and P/Q/R/S have partial timestamps of different sizes.
798c2ecf20Sopenharmony_ci	 * They must be reconstructed on both families anyway to get the full
808c2ecf20Sopenharmony_ci	 * 64-bit values back.
818c2ecf20Sopenharmony_ci	 */
828c2ecf20Sopenharmony_ci	int ptp_ts_bits;
838c2ecf20Sopenharmony_ci	/* Also SPI commands are of different sizes to retrieve
848c2ecf20Sopenharmony_ci	 * the egress timestamps.
858c2ecf20Sopenharmony_ci	 */
868c2ecf20Sopenharmony_ci	int ptpegr_ts_bytes;
878c2ecf20Sopenharmony_ci	int num_cbs_shapers;
888c2ecf20Sopenharmony_ci	const struct sja1105_dynamic_table_ops *dyn_ops;
898c2ecf20Sopenharmony_ci	const struct sja1105_table_ops *static_ops;
908c2ecf20Sopenharmony_ci	const struct sja1105_regs *regs;
918c2ecf20Sopenharmony_ci	/* Both E/T and P/Q/R/S have quirks when it comes to popping the S-Tag
928c2ecf20Sopenharmony_ci	 * from double-tagged frames. E/T will pop it only when it's equal to
938c2ecf20Sopenharmony_ci	 * TPID from the General Parameters Table, while P/Q/R/S will only
948c2ecf20Sopenharmony_ci	 * pop it when it's equal to TPID2.
958c2ecf20Sopenharmony_ci	 */
968c2ecf20Sopenharmony_ci	u16 qinq_tpid;
978c2ecf20Sopenharmony_ci	int (*reset_cmd)(struct dsa_switch *ds);
988c2ecf20Sopenharmony_ci	int (*setup_rgmii_delay)(const void *ctx, int port);
998c2ecf20Sopenharmony_ci	/* Prototypes from include/net/dsa.h */
1008c2ecf20Sopenharmony_ci	int (*fdb_add_cmd)(struct dsa_switch *ds, int port,
1018c2ecf20Sopenharmony_ci			   const unsigned char *addr, u16 vid);
1028c2ecf20Sopenharmony_ci	int (*fdb_del_cmd)(struct dsa_switch *ds, int port,
1038c2ecf20Sopenharmony_ci			   const unsigned char *addr, u16 vid);
1048c2ecf20Sopenharmony_ci	void (*ptp_cmd_packing)(u8 *buf, struct sja1105_ptp_cmd *cmd,
1058c2ecf20Sopenharmony_ci				enum packing_op op);
1068c2ecf20Sopenharmony_ci	const char *name;
1078c2ecf20Sopenharmony_ci};
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_cienum sja1105_key_type {
1108c2ecf20Sopenharmony_ci	SJA1105_KEY_BCAST,
1118c2ecf20Sopenharmony_ci	SJA1105_KEY_TC,
1128c2ecf20Sopenharmony_ci	SJA1105_KEY_VLAN_UNAWARE_VL,
1138c2ecf20Sopenharmony_ci	SJA1105_KEY_VLAN_AWARE_VL,
1148c2ecf20Sopenharmony_ci};
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_cistruct sja1105_key {
1178c2ecf20Sopenharmony_ci	enum sja1105_key_type type;
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci	union {
1208c2ecf20Sopenharmony_ci		/* SJA1105_KEY_TC */
1218c2ecf20Sopenharmony_ci		struct {
1228c2ecf20Sopenharmony_ci			int pcp;
1238c2ecf20Sopenharmony_ci		} tc;
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci		/* SJA1105_KEY_VLAN_UNAWARE_VL */
1268c2ecf20Sopenharmony_ci		/* SJA1105_KEY_VLAN_AWARE_VL */
1278c2ecf20Sopenharmony_ci		struct {
1288c2ecf20Sopenharmony_ci			u64 dmac;
1298c2ecf20Sopenharmony_ci			u16 vid;
1308c2ecf20Sopenharmony_ci			u16 pcp;
1318c2ecf20Sopenharmony_ci		} vl;
1328c2ecf20Sopenharmony_ci	};
1338c2ecf20Sopenharmony_ci};
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_cienum sja1105_rule_type {
1368c2ecf20Sopenharmony_ci	SJA1105_RULE_BCAST_POLICER,
1378c2ecf20Sopenharmony_ci	SJA1105_RULE_TC_POLICER,
1388c2ecf20Sopenharmony_ci	SJA1105_RULE_VL,
1398c2ecf20Sopenharmony_ci};
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_cienum sja1105_vl_type {
1428c2ecf20Sopenharmony_ci	SJA1105_VL_NONCRITICAL,
1438c2ecf20Sopenharmony_ci	SJA1105_VL_RATE_CONSTRAINED,
1448c2ecf20Sopenharmony_ci	SJA1105_VL_TIME_TRIGGERED,
1458c2ecf20Sopenharmony_ci};
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_cistruct sja1105_rule {
1488c2ecf20Sopenharmony_ci	struct list_head list;
1498c2ecf20Sopenharmony_ci	unsigned long cookie;
1508c2ecf20Sopenharmony_ci	unsigned long port_mask;
1518c2ecf20Sopenharmony_ci	struct sja1105_key key;
1528c2ecf20Sopenharmony_ci	enum sja1105_rule_type type;
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci	/* Action */
1558c2ecf20Sopenharmony_ci	union {
1568c2ecf20Sopenharmony_ci		/* SJA1105_RULE_BCAST_POLICER */
1578c2ecf20Sopenharmony_ci		struct {
1588c2ecf20Sopenharmony_ci			int sharindx;
1598c2ecf20Sopenharmony_ci		} bcast_pol;
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci		/* SJA1105_RULE_TC_POLICER */
1628c2ecf20Sopenharmony_ci		struct {
1638c2ecf20Sopenharmony_ci			int sharindx;
1648c2ecf20Sopenharmony_ci		} tc_pol;
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci		/* SJA1105_RULE_VL */
1678c2ecf20Sopenharmony_ci		struct {
1688c2ecf20Sopenharmony_ci			enum sja1105_vl_type type;
1698c2ecf20Sopenharmony_ci			unsigned long destports;
1708c2ecf20Sopenharmony_ci			int sharindx;
1718c2ecf20Sopenharmony_ci			int maxlen;
1728c2ecf20Sopenharmony_ci			int ipv;
1738c2ecf20Sopenharmony_ci			u64 base_time;
1748c2ecf20Sopenharmony_ci			u64 cycle_time;
1758c2ecf20Sopenharmony_ci			int num_entries;
1768c2ecf20Sopenharmony_ci			struct action_gate_entry *entries;
1778c2ecf20Sopenharmony_ci			struct flow_stats stats;
1788c2ecf20Sopenharmony_ci		} vl;
1798c2ecf20Sopenharmony_ci	};
1808c2ecf20Sopenharmony_ci};
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_cistruct sja1105_flow_block {
1838c2ecf20Sopenharmony_ci	struct list_head rules;
1848c2ecf20Sopenharmony_ci	bool l2_policer_used[SJA1105_NUM_L2_POLICERS];
1858c2ecf20Sopenharmony_ci	int num_virtual_links;
1868c2ecf20Sopenharmony_ci};
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_cistruct sja1105_bridge_vlan {
1898c2ecf20Sopenharmony_ci	struct list_head list;
1908c2ecf20Sopenharmony_ci	int port;
1918c2ecf20Sopenharmony_ci	u16 vid;
1928c2ecf20Sopenharmony_ci	bool pvid;
1938c2ecf20Sopenharmony_ci	bool untagged;
1948c2ecf20Sopenharmony_ci};
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_cienum sja1105_vlan_state {
1978c2ecf20Sopenharmony_ci	SJA1105_VLAN_UNAWARE,
1988c2ecf20Sopenharmony_ci	SJA1105_VLAN_BEST_EFFORT,
1998c2ecf20Sopenharmony_ci	SJA1105_VLAN_FILTERING_FULL,
2008c2ecf20Sopenharmony_ci};
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_cistruct sja1105_private {
2038c2ecf20Sopenharmony_ci	struct sja1105_static_config static_config;
2048c2ecf20Sopenharmony_ci	bool rgmii_rx_delay[SJA1105_NUM_PORTS];
2058c2ecf20Sopenharmony_ci	bool rgmii_tx_delay[SJA1105_NUM_PORTS];
2068c2ecf20Sopenharmony_ci	bool best_effort_vlan_filtering;
2078c2ecf20Sopenharmony_ci	const struct sja1105_info *info;
2088c2ecf20Sopenharmony_ci	struct gpio_desc *reset_gpio;
2098c2ecf20Sopenharmony_ci	struct spi_device *spidev;
2108c2ecf20Sopenharmony_ci	struct dsa_switch *ds;
2118c2ecf20Sopenharmony_ci	struct list_head dsa_8021q_vlans;
2128c2ecf20Sopenharmony_ci	struct list_head bridge_vlans;
2138c2ecf20Sopenharmony_ci	struct sja1105_flow_block flow_block;
2148c2ecf20Sopenharmony_ci	struct sja1105_port ports[SJA1105_NUM_PORTS];
2158c2ecf20Sopenharmony_ci	/* Serializes transmission of management frames so that
2168c2ecf20Sopenharmony_ci	 * the switch doesn't confuse them with one another.
2178c2ecf20Sopenharmony_ci	 */
2188c2ecf20Sopenharmony_ci	struct mutex mgmt_lock;
2198c2ecf20Sopenharmony_ci	struct dsa_8021q_context *dsa_8021q_ctx;
2208c2ecf20Sopenharmony_ci	enum sja1105_vlan_state vlan_state;
2218c2ecf20Sopenharmony_ci	struct devlink_region **regions;
2228c2ecf20Sopenharmony_ci	struct sja1105_cbs_entry *cbs;
2238c2ecf20Sopenharmony_ci	struct sja1105_tagger_data tagger_data;
2248c2ecf20Sopenharmony_ci	struct sja1105_ptp_data ptp_data;
2258c2ecf20Sopenharmony_ci	struct sja1105_tas_data tas_data;
2268c2ecf20Sopenharmony_ci};
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci#include "sja1105_dynamic_config.h"
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_cistruct sja1105_spi_message {
2318c2ecf20Sopenharmony_ci	u64 access;
2328c2ecf20Sopenharmony_ci	u64 read_count;
2338c2ecf20Sopenharmony_ci	u64 address;
2348c2ecf20Sopenharmony_ci};
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci/* From sja1105_main.c */
2378c2ecf20Sopenharmony_cienum sja1105_reset_reason {
2388c2ecf20Sopenharmony_ci	SJA1105_VLAN_FILTERING = 0,
2398c2ecf20Sopenharmony_ci	SJA1105_RX_HWTSTAMPING,
2408c2ecf20Sopenharmony_ci	SJA1105_AGEING_TIME,
2418c2ecf20Sopenharmony_ci	SJA1105_SCHEDULING,
2428c2ecf20Sopenharmony_ci	SJA1105_BEST_EFFORT_POLICING,
2438c2ecf20Sopenharmony_ci	SJA1105_VIRTUAL_LINKS,
2448c2ecf20Sopenharmony_ci};
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ciint sja1105_static_config_reload(struct sja1105_private *priv,
2478c2ecf20Sopenharmony_ci				 enum sja1105_reset_reason reason);
2488c2ecf20Sopenharmony_ciint sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled,
2498c2ecf20Sopenharmony_ci			   struct switchdev_trans *trans);
2508c2ecf20Sopenharmony_civoid sja1105_frame_memory_partitioning(struct sja1105_private *priv);
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci/* From sja1105_devlink.c */
2538c2ecf20Sopenharmony_ciint sja1105_devlink_setup(struct dsa_switch *ds);
2548c2ecf20Sopenharmony_civoid sja1105_devlink_teardown(struct dsa_switch *ds);
2558c2ecf20Sopenharmony_ciint sja1105_devlink_param_get(struct dsa_switch *ds, u32 id,
2568c2ecf20Sopenharmony_ci			      struct devlink_param_gset_ctx *ctx);
2578c2ecf20Sopenharmony_ciint sja1105_devlink_param_set(struct dsa_switch *ds, u32 id,
2588c2ecf20Sopenharmony_ci			      struct devlink_param_gset_ctx *ctx);
2598c2ecf20Sopenharmony_ciint sja1105_devlink_info_get(struct dsa_switch *ds,
2608c2ecf20Sopenharmony_ci			     struct devlink_info_req *req,
2618c2ecf20Sopenharmony_ci			     struct netlink_ext_ack *extack);
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci/* From sja1105_spi.c */
2648c2ecf20Sopenharmony_ciint sja1105_xfer_buf(const struct sja1105_private *priv,
2658c2ecf20Sopenharmony_ci		     sja1105_spi_rw_mode_t rw, u64 reg_addr,
2668c2ecf20Sopenharmony_ci		     u8 *buf, size_t len);
2678c2ecf20Sopenharmony_ciint sja1105_xfer_u32(const struct sja1105_private *priv,
2688c2ecf20Sopenharmony_ci		     sja1105_spi_rw_mode_t rw, u64 reg_addr, u32 *value,
2698c2ecf20Sopenharmony_ci		     struct ptp_system_timestamp *ptp_sts);
2708c2ecf20Sopenharmony_ciint sja1105_xfer_u64(const struct sja1105_private *priv,
2718c2ecf20Sopenharmony_ci		     sja1105_spi_rw_mode_t rw, u64 reg_addr, u64 *value,
2728c2ecf20Sopenharmony_ci		     struct ptp_system_timestamp *ptp_sts);
2738c2ecf20Sopenharmony_ciint static_config_buf_prepare_for_upload(struct sja1105_private *priv,
2748c2ecf20Sopenharmony_ci					 void *config_buf, int buf_len);
2758c2ecf20Sopenharmony_ciint sja1105_static_config_upload(struct sja1105_private *priv);
2768c2ecf20Sopenharmony_ciint sja1105_inhibit_tx(const struct sja1105_private *priv,
2778c2ecf20Sopenharmony_ci		       unsigned long port_bitmap, bool tx_inhibited);
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ciextern const struct sja1105_info sja1105e_info;
2808c2ecf20Sopenharmony_ciextern const struct sja1105_info sja1105t_info;
2818c2ecf20Sopenharmony_ciextern const struct sja1105_info sja1105p_info;
2828c2ecf20Sopenharmony_ciextern const struct sja1105_info sja1105q_info;
2838c2ecf20Sopenharmony_ciextern const struct sja1105_info sja1105r_info;
2848c2ecf20Sopenharmony_ciextern const struct sja1105_info sja1105s_info;
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci/* From sja1105_clocking.c */
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_citypedef enum {
2898c2ecf20Sopenharmony_ci	XMII_MAC = 0,
2908c2ecf20Sopenharmony_ci	XMII_PHY = 1,
2918c2ecf20Sopenharmony_ci} sja1105_mii_role_t;
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_citypedef enum {
2948c2ecf20Sopenharmony_ci	XMII_MODE_MII		= 0,
2958c2ecf20Sopenharmony_ci	XMII_MODE_RMII		= 1,
2968c2ecf20Sopenharmony_ci	XMII_MODE_RGMII		= 2,
2978c2ecf20Sopenharmony_ci	XMII_MODE_SGMII		= 3,
2988c2ecf20Sopenharmony_ci} sja1105_phy_interface_t;
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_citypedef enum {
3018c2ecf20Sopenharmony_ci	SJA1105_SPEED_10MBPS	= 3,
3028c2ecf20Sopenharmony_ci	SJA1105_SPEED_100MBPS	= 2,
3038c2ecf20Sopenharmony_ci	SJA1105_SPEED_1000MBPS	= 1,
3048c2ecf20Sopenharmony_ci	SJA1105_SPEED_AUTO	= 0,
3058c2ecf20Sopenharmony_ci} sja1105_speed_t;
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ciint sja1105pqrs_setup_rgmii_delay(const void *ctx, int port);
3088c2ecf20Sopenharmony_ciint sja1105_clocking_setup_port(struct sja1105_private *priv, int port);
3098c2ecf20Sopenharmony_ciint sja1105_clocking_setup(struct sja1105_private *priv);
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci/* From sja1105_ethtool.c */
3128c2ecf20Sopenharmony_civoid sja1105_get_ethtool_stats(struct dsa_switch *ds, int port, u64 *data);
3138c2ecf20Sopenharmony_civoid sja1105_get_strings(struct dsa_switch *ds, int port,
3148c2ecf20Sopenharmony_ci			 u32 stringset, u8 *data);
3158c2ecf20Sopenharmony_ciint sja1105_get_sset_count(struct dsa_switch *ds, int port, int sset);
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci/* From sja1105_dynamic_config.c */
3188c2ecf20Sopenharmony_ciint sja1105_dynamic_config_read(struct sja1105_private *priv,
3198c2ecf20Sopenharmony_ci				enum sja1105_blk_idx blk_idx,
3208c2ecf20Sopenharmony_ci				int index, void *entry);
3218c2ecf20Sopenharmony_ciint sja1105_dynamic_config_write(struct sja1105_private *priv,
3228c2ecf20Sopenharmony_ci				 enum sja1105_blk_idx blk_idx,
3238c2ecf20Sopenharmony_ci				 int index, void *entry, bool keep);
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_cienum sja1105_iotag {
3268c2ecf20Sopenharmony_ci	SJA1105_C_TAG = 0, /* Inner VLAN header */
3278c2ecf20Sopenharmony_ci	SJA1105_S_TAG = 1, /* Outer VLAN header */
3288c2ecf20Sopenharmony_ci};
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ciu8 sja1105et_fdb_hash(struct sja1105_private *priv, const u8 *addr, u16 vid);
3318c2ecf20Sopenharmony_ciint sja1105et_fdb_add(struct dsa_switch *ds, int port,
3328c2ecf20Sopenharmony_ci		      const unsigned char *addr, u16 vid);
3338c2ecf20Sopenharmony_ciint sja1105et_fdb_del(struct dsa_switch *ds, int port,
3348c2ecf20Sopenharmony_ci		      const unsigned char *addr, u16 vid);
3358c2ecf20Sopenharmony_ciint sja1105pqrs_fdb_add(struct dsa_switch *ds, int port,
3368c2ecf20Sopenharmony_ci			const unsigned char *addr, u16 vid);
3378c2ecf20Sopenharmony_ciint sja1105pqrs_fdb_del(struct dsa_switch *ds, int port,
3388c2ecf20Sopenharmony_ci			const unsigned char *addr, u16 vid);
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci/* From sja1105_flower.c */
3418c2ecf20Sopenharmony_ciint sja1105_cls_flower_del(struct dsa_switch *ds, int port,
3428c2ecf20Sopenharmony_ci			   struct flow_cls_offload *cls, bool ingress);
3438c2ecf20Sopenharmony_ciint sja1105_cls_flower_add(struct dsa_switch *ds, int port,
3448c2ecf20Sopenharmony_ci			   struct flow_cls_offload *cls, bool ingress);
3458c2ecf20Sopenharmony_ciint sja1105_cls_flower_stats(struct dsa_switch *ds, int port,
3468c2ecf20Sopenharmony_ci			     struct flow_cls_offload *cls, bool ingress);
3478c2ecf20Sopenharmony_civoid sja1105_flower_setup(struct dsa_switch *ds);
3488c2ecf20Sopenharmony_civoid sja1105_flower_teardown(struct dsa_switch *ds);
3498c2ecf20Sopenharmony_cistruct sja1105_rule *sja1105_rule_find(struct sja1105_private *priv,
3508c2ecf20Sopenharmony_ci				       unsigned long cookie);
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci#endif
353