hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/drivers/net/dsa/b53/b53_priv.h
....@@ -29,6 +29,7 @@
2929
3030 struct b53_device;
3131 struct net_device;
32
+struct phylink_link_state;
3233
3334 struct b53_io_ops {
3435 int (*read8)(struct b53_device *dev, u8 page, u8 reg, u8 *value);
....@@ -43,7 +44,24 @@
4344 int (*write64)(struct b53_device *dev, u8 page, u8 reg, u64 value);
4445 int (*phy_read16)(struct b53_device *dev, int addr, int reg, u16 *value);
4546 int (*phy_write16)(struct b53_device *dev, int addr, int reg, u16 value);
47
+ int (*irq_enable)(struct b53_device *dev, int port);
48
+ void (*irq_disable)(struct b53_device *dev, int port);
49
+ u8 (*serdes_map_lane)(struct b53_device *dev, int port);
50
+ int (*serdes_link_state)(struct b53_device *dev, int port,
51
+ struct phylink_link_state *state);
52
+ void (*serdes_config)(struct b53_device *dev, int port,
53
+ unsigned int mode,
54
+ const struct phylink_link_state *state);
55
+ void (*serdes_an_restart)(struct b53_device *dev, int port);
56
+ void (*serdes_link_set)(struct b53_device *dev, int port,
57
+ unsigned int mode, phy_interface_t interface,
58
+ bool link_up);
59
+ void (*serdes_phylink_validate)(struct b53_device *dev, int port,
60
+ unsigned long *supported,
61
+ struct phylink_link_state *state);
4662 };
63
+
64
+#define B53_INVALID_LANE 0xff
4765
4866 enum {
4967 BCM5325_DEVICE_ID = 0x25,
....@@ -73,7 +91,6 @@
7391 struct b53_port {
7492 u16 vlan_ctl_mask;
7593 struct ethtool_eee eee;
76
- u16 pvid;
7794 };
7895
7996 struct b53_vlan {
....@@ -99,15 +116,19 @@
99116 u8 jumbo_pm_reg;
100117 u8 jumbo_size_reg;
101118 int reset_gpio;
102
- u8 num_arl_entries;
119
+ u8 num_arl_bins;
120
+ u16 num_arl_buckets;
121
+ enum dsa_tag_protocol tag_protocol;
103122
104123 /* used ports mask */
105124 u16 enabled_ports;
125
+ unsigned int imp_port;
106126 unsigned int cpu_port;
107127
108128 /* connect specific data */
109129 u8 current_page;
110130 struct device *dev;
131
+ u8 serdes_lane;
111132
112133 /* Master MDIO bus we got probed from */
113134 struct mii_bus *bus;
....@@ -120,7 +141,6 @@
120141 unsigned int num_vlans;
121142 struct b53_vlan *vlans;
122143 bool vlan_enabled;
123
- bool vlan_filtering_enabled;
124144 unsigned int num_ports;
125145 struct b53_port *ports;
126146 };
....@@ -193,6 +213,11 @@
193213 #define B53_CPU_PORT_25 5
194214 #define B53_CPU_PORT 8
195215
216
+static inline unsigned int b53_max_arl_entries(struct b53_device *dev)
217
+{
218
+ return dev->num_arl_buckets * dev->num_arl_bins;
219
+}
220
+
196221 struct b53_device *b53_switch_alloc(struct device *base,
197222 const struct b53_io_ops *ops,
198223 void *priv);
....@@ -232,7 +257,7 @@
232257 b53_build_op(write64, u64);
233258
234259 struct b53_arl_entry {
235
- u8 port;
260
+ u16 port;
236261 u8 mac[ETH_ALEN];
237262 u16 vid;
238263 u8 is_valid:1;
....@@ -301,7 +326,30 @@
301326 void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *bridge);
302327 void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state);
303328 void b53_br_fast_age(struct dsa_switch *ds, int port);
304
-int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering);
329
+int b53_br_egress_floods(struct dsa_switch *ds, int port,
330
+ bool unicast, bool multicast);
331
+int b53_setup_devlink_resources(struct dsa_switch *ds);
332
+void b53_port_event(struct dsa_switch *ds, int port);
333
+void b53_phylink_validate(struct dsa_switch *ds, int port,
334
+ unsigned long *supported,
335
+ struct phylink_link_state *state);
336
+int b53_phylink_mac_link_state(struct dsa_switch *ds, int port,
337
+ struct phylink_link_state *state);
338
+void b53_phylink_mac_config(struct dsa_switch *ds, int port,
339
+ unsigned int mode,
340
+ const struct phylink_link_state *state);
341
+void b53_phylink_mac_an_restart(struct dsa_switch *ds, int port);
342
+void b53_phylink_mac_link_down(struct dsa_switch *ds, int port,
343
+ unsigned int mode,
344
+ phy_interface_t interface);
345
+void b53_phylink_mac_link_up(struct dsa_switch *ds, int port,
346
+ unsigned int mode,
347
+ phy_interface_t interface,
348
+ struct phy_device *phydev,
349
+ int speed, int duplex,
350
+ bool tx_pause, bool rx_pause);
351
+int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
352
+ struct switchdev_trans *trans);
305353 int b53_vlan_prepare(struct dsa_switch *ds, int port,
306354 const struct switchdev_obj_port_vlan *vlan);
307355 void b53_vlan_add(struct dsa_switch *ds, int port,
....@@ -314,13 +362,20 @@
314362 const unsigned char *addr, u16 vid);
315363 int b53_fdb_dump(struct dsa_switch *ds, int port,
316364 dsa_fdb_dump_cb_t *cb, void *data);
365
+int b53_mdb_prepare(struct dsa_switch *ds, int port,
366
+ const struct switchdev_obj_port_mdb *mdb);
367
+void b53_mdb_add(struct dsa_switch *ds, int port,
368
+ const struct switchdev_obj_port_mdb *mdb);
369
+int b53_mdb_del(struct dsa_switch *ds, int port,
370
+ const struct switchdev_obj_port_mdb *mdb);
317371 int b53_mirror_add(struct dsa_switch *ds, int port,
318372 struct dsa_mall_mirror_tc_entry *mirror, bool ingress);
319
-enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port);
373
+enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
374
+ enum dsa_tag_protocol mprot);
320375 void b53_mirror_del(struct dsa_switch *ds, int port,
321376 struct dsa_mall_mirror_tc_entry *mirror);
322377 int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy);
323
-void b53_disable_port(struct dsa_switch *ds, int port, struct phy_device *phy);
378
+void b53_disable_port(struct dsa_switch *ds, int port);
324379 void b53_brcm_hdr_setup(struct dsa_switch *ds, int port);
325380 void b53_eee_enable_set(struct dsa_switch *ds, int port, bool enable);
326381 int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy);