0001
0002 #include <linux/device.h>
0003 #include <linux/mutex.h>
0004 #include <linux/regmap.h>
0005 #include <linux/workqueue.h>
0006 #include <linux/u64_stats_sync.h>
0007 #include <uapi/linux/if_link.h>
0008
0009 struct xrs700x_info {
0010 unsigned int id;
0011 const char *name;
0012 size_t num_ports;
0013 };
0014
0015 extern const struct xrs700x_info xrs7003e_info;
0016 extern const struct xrs700x_info xrs7003f_info;
0017 extern const struct xrs700x_info xrs7004e_info;
0018 extern const struct xrs700x_info xrs7004f_info;
0019
0020 struct xrs700x_port {
0021 struct mutex mib_mutex;
0022 u64 *mib_data;
0023 struct rtnl_link_stats64 stats64;
0024 struct u64_stats_sync syncp;
0025 };
0026
0027 struct xrs700x {
0028 struct dsa_switch *ds;
0029 struct device *dev;
0030 void *priv;
0031 struct regmap *regmap;
0032 struct regmap_field *ps_forward;
0033 struct regmap_field *ps_management;
0034 struct regmap_field *ps_sel_speed;
0035 struct regmap_field *ps_cur_speed;
0036 struct delayed_work mib_work;
0037 struct xrs700x_port *ports;
0038 };
0039
0040 struct xrs700x *xrs700x_switch_alloc(struct device *base, void *devpriv);
0041 int xrs700x_switch_register(struct xrs700x *priv);
0042 void xrs700x_switch_remove(struct xrs700x *priv);
0043 void xrs700x_switch_shutdown(struct xrs700x *priv);