xref: /openbmc/linux/drivers/net/dsa/xrs700x/xrs700x.h (revision bc33f5e5)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #include <linux/device.h>
3 #include <linux/mutex.h>
4 #include <linux/regmap.h>
5 #include <linux/workqueue.h>
6 #include <linux/u64_stats_sync.h>
7 #include <uapi/linux/if_link.h>
8 
9 struct xrs700x_info {
10 	unsigned int id;
11 	const char *name;
12 	size_t num_ports;
13 };
14 
15 extern const struct xrs700x_info xrs7003e_info;
16 extern const struct xrs700x_info xrs7003f_info;
17 extern const struct xrs700x_info xrs7004e_info;
18 extern const struct xrs700x_info xrs7004f_info;
19 
20 struct xrs700x_port {
21 	struct mutex mib_mutex; /* protects mib_data */
22 	u64 *mib_data;
23 	struct rtnl_link_stats64 stats64;
24 	struct u64_stats_sync syncp;
25 };
26 
27 struct xrs700x {
28 	struct dsa_switch *ds;
29 	struct device *dev;
30 	void *priv;
31 	struct regmap *regmap;
32 	struct regmap_field *ps_forward;
33 	struct regmap_field *ps_management;
34 	struct regmap_field *ps_sel_speed;
35 	struct regmap_field *ps_cur_speed;
36 	struct delayed_work mib_work;
37 	struct xrs700x_port *ports;
38 };
39 
40 struct xrs700x *xrs700x_switch_alloc(struct device *base, void *devpriv);
41 int xrs700x_switch_register(struct xrs700x *priv);
42 void xrs700x_switch_remove(struct xrs700x *priv);
43 void xrs700x_switch_shutdown(struct xrs700x *priv);
44