xref: /linux/drivers/net/dsa/b53/b53_priv.h (revision 91ec2035134982b98fab0609a9fd8480e8217dc1)
1 /*
2  * B53 common definitions
3  *
4  * Copyright (C) 2011-2013 Jonas Gorski <jogo@openwrt.org>
5  *
6  * Permission to use, copy, modify, and/or distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef __B53_PRIV_H
20 #define __B53_PRIV_H
21 
22 #include <linux/kernel.h>
23 #include <linux/mutex.h>
24 #include <linux/phylink.h>
25 #include <linux/etherdevice.h>
26 #include <linux/gpio/consumer.h>
27 #include <net/dsa.h>
28 
29 #include "b53_regs.h"
30 
31 struct b53_device;
32 struct net_device;
33 
34 struct b53_io_ops {
35 	int (*read8)(struct b53_device *dev, u8 page, u8 reg, u8 *value);
36 	int (*read16)(struct b53_device *dev, u8 page, u8 reg, u16 *value);
37 	int (*read32)(struct b53_device *dev, u8 page, u8 reg, u32 *value);
38 	int (*read48)(struct b53_device *dev, u8 page, u8 reg, u64 *value);
39 	int (*read64)(struct b53_device *dev, u8 page, u8 reg, u64 *value);
40 	int (*write8)(struct b53_device *dev, u8 page, u8 reg, u8 value);
41 	int (*write16)(struct b53_device *dev, u8 page, u8 reg, u16 value);
42 	int (*write32)(struct b53_device *dev, u8 page, u8 reg, u32 value);
43 	int (*write48)(struct b53_device *dev, u8 page, u8 reg, u64 value);
44 	int (*write64)(struct b53_device *dev, u8 page, u8 reg, u64 value);
45 	int (*phy_read16)(struct b53_device *dev, int addr, int reg, u16 *value);
46 	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 	void (*phy_enable)(struct b53_device *dev, int port);
50 	void (*phy_disable)(struct b53_device *dev, int port);
51 	void (*phylink_get_caps)(struct b53_device *dev, int port,
52 				 struct phylink_config *config);
53 	struct phylink_pcs *(*phylink_mac_select_pcs)(struct b53_device *dev,
54 						      int port,
55 						      phy_interface_t interface);
56 	u8 (*serdes_map_lane)(struct b53_device *dev, int port);
57 	void (*serdes_link_set)(struct b53_device *dev, int port,
58 				unsigned int mode, phy_interface_t interface,
59 				bool link_up);
60 };
61 
62 struct b53_arl_entry;
63 
64 struct b53_arl_ops {
65 	void (*arl_read_entry)(struct b53_device *dev,
66 			       struct b53_arl_entry *ent, u8 idx);
67 	void (*arl_write_entry)(struct b53_device *dev,
68 				const struct b53_arl_entry *ent, u8 idx);
69 	void (*arl_search_read)(struct b53_device *dev, u8 idx,
70 				struct b53_arl_entry *ent);
71 };
72 
73 #define B53_INVALID_LANE	0xff
74 
75 enum {
76 	BCM4908_DEVICE_ID = 0x4908,
77 	BCM5325_DEVICE_ID = 0x25,
78 	BCM5365_DEVICE_ID = 0x65,
79 	BCM5389_DEVICE_ID = 0x89,
80 	BCM5395_DEVICE_ID = 0x95,
81 	BCM5397_DEVICE_ID = 0x97,
82 	BCM5398_DEVICE_ID = 0x98,
83 	BCM53101_DEVICE_ID = 0x53101,
84 	BCM53115_DEVICE_ID = 0x53115,
85 	BCM53125_DEVICE_ID = 0x53125,
86 	BCM53128_DEVICE_ID = 0x53128,
87 	BCM63XX_DEVICE_ID = 0x6300,
88 	BCM6318_DEVICE_ID = 0x6318,
89 	BCM6328_DEVICE_ID = 0x6328,
90 	BCM6362_DEVICE_ID = 0x6362,
91 	BCM6368_DEVICE_ID = 0x6368,
92 	BCM63268_DEVICE_ID = 0x63268,
93 	BCM53010_DEVICE_ID = 0x53010,
94 	BCM53011_DEVICE_ID = 0x53011,
95 	BCM53012_DEVICE_ID = 0x53012,
96 	BCM53018_DEVICE_ID = 0x53018,
97 	BCM53019_DEVICE_ID = 0x53019,
98 	BCM58XX_DEVICE_ID = 0x5800,
99 	BCM583XX_DEVICE_ID = 0x58300,
100 	BCM7445_DEVICE_ID = 0x7445,
101 	BCM7278_DEVICE_ID = 0x7278,
102 	BCM53134_DEVICE_ID = 0x5075,
103 };
104 
105 enum b53_variant_id {
106 	B53_VARIANT_NONE = 0,
107 	B53_VARIANT_5325E,
108 	B53_VARIANT_5325M,
109 };
110 
111 struct b53_pcs {
112 	struct phylink_pcs pcs;
113 	struct b53_device *dev;
114 	u8 lane;
115 };
116 
117 #define B53_N_PORTS	9
118 #define B53_N_PORTS_25	6
119 #define B53_N_PCS	2
120 
121 struct b53_port {
122 	u16		vlan_ctl_mask;
123 	u16		pvid;
124 	struct ethtool_keee eee;
125 };
126 
127 struct b53_vlan {
128 	u16 members;
129 	u16 untag;
130 	bool valid;
131 };
132 
133 struct b53_device {
134 	struct dsa_switch *ds;
135 	struct b53_platform_data *pdata;
136 	const char *name;
137 
138 	struct mutex reg_mutex;
139 	struct mutex stats_mutex;
140 	struct mutex arl_mutex;
141 	const struct b53_io_ops *ops;
142 	const struct b53_arl_ops *arl_ops;
143 
144 	/* chip specific data */
145 	u32 chip_id;
146 	enum b53_variant_id variant_id;
147 	u8 core_rev;
148 	u8 vta_regs[3];
149 	u8 duplex_reg;
150 	u8 jumbo_pm_reg;
151 	u8 jumbo_size_reg;
152 	struct gpio_desc *reset_gpio;
153 	u8 num_arl_bins;
154 	u16 num_arl_buckets;
155 	enum dsa_tag_protocol tag_protocol;
156 
157 	/* used ports mask */
158 	u16 enabled_ports;
159 	unsigned int imp_port;
160 
161 	/* connect specific data */
162 	u8 current_page;
163 	struct device *dev;
164 	u8 serdes_lane;
165 
166 	/* Master MDIO bus we got probed from */
167 	struct mii_bus *bus;
168 
169 	void *priv;
170 
171 	/* run time configuration */
172 	bool enable_jumbo;
173 
174 	unsigned int num_vlans;
175 	struct b53_vlan *vlans;
176 	bool vlan_enabled;
177 	bool vlan_filtering;
178 	unsigned int num_ports;
179 	struct b53_port *ports;
180 
181 	struct b53_pcs pcs[B53_N_PCS];
182 };
183 
184 #define b53_for_each_port(dev, i) \
185 	for (i = 0; i < B53_N_PORTS; i++) \
186 		if (dev->enabled_ports & BIT(i))
187 
188 
is5325(struct b53_device * dev)189 static inline int is5325(struct b53_device *dev)
190 {
191 	return dev->chip_id == BCM5325_DEVICE_ID;
192 }
193 
is5325e(struct b53_device * dev)194 static inline int is5325e(struct b53_device *dev)
195 {
196 	return is5325(dev) &&
197 		dev->variant_id == B53_VARIANT_5325E;
198 }
199 
is5325m(struct b53_device * dev)200 static inline int is5325m(struct b53_device *dev)
201 {
202 	return is5325(dev) &&
203 		dev->variant_id == B53_VARIANT_5325M;
204 }
205 
is5365(struct b53_device * dev)206 static inline int is5365(struct b53_device *dev)
207 {
208 #ifdef CONFIG_BCM47XX
209 	return dev->chip_id == BCM5365_DEVICE_ID;
210 #else
211 	return 0;
212 #endif
213 }
214 
is5397_98(struct b53_device * dev)215 static inline int is5397_98(struct b53_device *dev)
216 {
217 	return dev->chip_id == BCM5397_DEVICE_ID ||
218 		dev->chip_id == BCM5398_DEVICE_ID;
219 }
220 
is539x(struct b53_device * dev)221 static inline int is539x(struct b53_device *dev)
222 {
223 	return dev->chip_id == BCM5395_DEVICE_ID ||
224 		dev->chip_id == BCM5397_DEVICE_ID ||
225 		dev->chip_id == BCM5398_DEVICE_ID;
226 }
227 
is531x5(struct b53_device * dev)228 static inline int is531x5(struct b53_device *dev)
229 {
230 	return dev->chip_id == BCM53115_DEVICE_ID ||
231 		dev->chip_id == BCM53125_DEVICE_ID ||
232 		dev->chip_id == BCM53101_DEVICE_ID ||
233 		dev->chip_id == BCM53128_DEVICE_ID ||
234 		dev->chip_id == BCM53134_DEVICE_ID;
235 }
236 
is63xx(struct b53_device * dev)237 static inline int is63xx(struct b53_device *dev)
238 {
239 	return dev->chip_id == BCM63XX_DEVICE_ID ||
240 		dev->chip_id == BCM6318_DEVICE_ID ||
241 		dev->chip_id == BCM6328_DEVICE_ID ||
242 		dev->chip_id == BCM6362_DEVICE_ID ||
243 		dev->chip_id == BCM6368_DEVICE_ID ||
244 		dev->chip_id == BCM63268_DEVICE_ID;
245 }
246 
is6318_268(struct b53_device * dev)247 static inline int is6318_268(struct b53_device *dev)
248 {
249 	return dev->chip_id == BCM6318_DEVICE_ID ||
250 		dev->chip_id == BCM63268_DEVICE_ID;
251 }
252 
is5301x(struct b53_device * dev)253 static inline int is5301x(struct b53_device *dev)
254 {
255 	return dev->chip_id == BCM53010_DEVICE_ID ||
256 		dev->chip_id == BCM53011_DEVICE_ID ||
257 		dev->chip_id == BCM53012_DEVICE_ID ||
258 		dev->chip_id == BCM53018_DEVICE_ID ||
259 		dev->chip_id == BCM53019_DEVICE_ID;
260 }
261 
is58xx(struct b53_device * dev)262 static inline int is58xx(struct b53_device *dev)
263 {
264 	return dev->chip_id == BCM58XX_DEVICE_ID ||
265 		dev->chip_id == BCM583XX_DEVICE_ID ||
266 		dev->chip_id == BCM7445_DEVICE_ID ||
267 		dev->chip_id == BCM7278_DEVICE_ID ||
268 		dev->chip_id == BCM53134_DEVICE_ID;
269 }
270 
271 #define B53_63XX_RGMII0	4
272 #define B53_CPU_PORT_25	5
273 #define B53_CPU_PORT	8
274 
b53_max_arl_entries(struct b53_device * dev)275 static inline unsigned int b53_max_arl_entries(struct b53_device *dev)
276 {
277 	return dev->num_arl_buckets * dev->num_arl_bins;
278 }
279 
280 struct b53_device *b53_switch_alloc(struct device *base,
281 				    const struct b53_io_ops *ops,
282 				    void *priv);
283 
284 int b53_switch_detect(struct b53_device *dev);
285 
286 int b53_switch_register(struct b53_device *dev);
287 
b53_switch_remove(struct b53_device * dev)288 static inline void b53_switch_remove(struct b53_device *dev)
289 {
290 	dsa_unregister_switch(dev->ds);
291 }
292 
b53_switch_shutdown(struct b53_device * dev)293 static inline void b53_switch_shutdown(struct b53_device *dev)
294 {
295 	dsa_switch_shutdown(dev->ds);
296 }
297 
298 #define b53_build_op(type_op_size, val_type)				\
299 static inline int b53_##type_op_size(struct b53_device *dev, u8 page,	\
300 				     u8 reg, val_type val)		\
301 {									\
302 	int ret;							\
303 									\
304 	mutex_lock(&dev->reg_mutex);					\
305 	ret = dev->ops->type_op_size(dev, page, reg, val);		\
306 	mutex_unlock(&dev->reg_mutex);					\
307 									\
308 	return ret;							\
309 }
310 
311 b53_build_op(read8, u8 *);
312 b53_build_op(read16, u16 *);
313 b53_build_op(read32, u32 *);
314 b53_build_op(read48, u64 *);
315 b53_build_op(read64, u64 *);
316 
317 b53_build_op(write8, u8);
318 b53_build_op(write16, u16);
319 b53_build_op(write32, u32);
320 b53_build_op(write48, u64);
321 b53_build_op(write64, u64);
322 
323 struct b53_arl_entry {
324 	u16 port;
325 	u8 mac[ETH_ALEN];
326 	u16 vid;
327 	u8 is_valid:1;
328 	u8 is_age:1;
329 	u8 is_static:1;
330 };
331 
b53_arl_to_entry(struct b53_arl_entry * ent,u64 mac_vid,u32 fwd_entry)332 static inline void b53_arl_to_entry(struct b53_arl_entry *ent,
333 				    u64 mac_vid, u32 fwd_entry)
334 {
335 	memset(ent, 0, sizeof(*ent));
336 	ent->port = fwd_entry & ARLTBL_DATA_PORT_ID_MASK;
337 	ent->is_valid = !!(fwd_entry & ARLTBL_VALID);
338 	ent->is_age = !!(fwd_entry & ARLTBL_AGE);
339 	ent->is_static = !!(fwd_entry & ARLTBL_STATIC);
340 	u64_to_ether_addr(mac_vid, ent->mac);
341 	ent->vid = mac_vid >> ARLTBL_VID_S;
342 }
343 
b53_arl_to_entry_25(struct b53_arl_entry * ent,u64 mac_vid,u8 vid_entry)344 static inline void b53_arl_to_entry_25(struct b53_arl_entry *ent,
345 				       u64 mac_vid, u8 vid_entry)
346 {
347 	memset(ent, 0, sizeof(*ent));
348 	ent->is_valid = !!(mac_vid & ARLTBL_VALID_25);
349 	ent->is_age = !!(mac_vid & ARLTBL_AGE_25);
350 	ent->is_static = !!(mac_vid & ARLTBL_STATIC_25);
351 	u64_to_ether_addr(mac_vid, ent->mac);
352 	ent->port = (mac_vid & ARLTBL_DATA_PORT_ID_MASK_25) >>
353 		     ARLTBL_DATA_PORT_ID_S_25;
354 	if (is_unicast_ether_addr(ent->mac) && ent->port == B53_CPU_PORT)
355 		ent->port = B53_CPU_PORT_25;
356 	ent->vid = vid_entry;
357 }
358 
b53_arl_to_entry_89(struct b53_arl_entry * ent,u64 mac_vid,u16 fwd_entry)359 static inline void b53_arl_to_entry_89(struct b53_arl_entry *ent,
360 				       u64 mac_vid, u16 fwd_entry)
361 {
362 	memset(ent, 0, sizeof(*ent));
363 	ent->port = fwd_entry & ARLTBL_DATA_PORT_ID_MASK_89;
364 	ent->is_valid = !!(fwd_entry & ARLTBL_VALID_89);
365 	ent->is_age = !!(fwd_entry & ARLTBL_AGE_89);
366 	ent->is_static = !!(fwd_entry & ARLTBL_STATIC_89);
367 	u64_to_ether_addr(mac_vid, ent->mac);
368 	ent->vid = mac_vid >> ARLTBL_VID_S;
369 }
370 
b53_arl_from_entry(u64 * mac_vid,u32 * fwd_entry,const struct b53_arl_entry * ent)371 static inline void b53_arl_from_entry(u64 *mac_vid, u32 *fwd_entry,
372 				      const struct b53_arl_entry *ent)
373 {
374 	*mac_vid = ether_addr_to_u64(ent->mac);
375 	*mac_vid |= (u64)(ent->vid & ARLTBL_VID_MASK) << ARLTBL_VID_S;
376 	*fwd_entry = ent->port & ARLTBL_DATA_PORT_ID_MASK;
377 	if (ent->is_valid)
378 		*fwd_entry |= ARLTBL_VALID;
379 	if (ent->is_static)
380 		*fwd_entry |= ARLTBL_STATIC;
381 	if (ent->is_age)
382 		*fwd_entry |= ARLTBL_AGE;
383 }
384 
b53_arl_from_entry_25(u64 * mac_vid,u8 * vid_entry,const struct b53_arl_entry * ent)385 static inline void b53_arl_from_entry_25(u64 *mac_vid, u8 *vid_entry,
386 					 const struct b53_arl_entry *ent)
387 {
388 	*mac_vid = ether_addr_to_u64(ent->mac);
389 	if (is_unicast_ether_addr(ent->mac) && ent->port == B53_CPU_PORT_25)
390 		*mac_vid |= (u64)B53_CPU_PORT << ARLTBL_DATA_PORT_ID_S_25;
391 	else
392 		*mac_vid |= ((u64)ent->port << ARLTBL_DATA_PORT_ID_S_25) &
393 			    ARLTBL_DATA_PORT_ID_MASK_25;
394 	if (ent->is_valid)
395 		*mac_vid |= ARLTBL_VALID_25;
396 	if (ent->is_static)
397 		*mac_vid |= ARLTBL_STATIC_25;
398 	if (ent->is_age)
399 		*mac_vid |= ARLTBL_AGE_25;
400 	*vid_entry = ent->vid;
401 }
402 
b53_arl_from_entry_89(u64 * mac_vid,u32 * fwd_entry,const struct b53_arl_entry * ent)403 static inline void b53_arl_from_entry_89(u64 *mac_vid, u32 *fwd_entry,
404 					 const struct b53_arl_entry *ent)
405 {
406 	*mac_vid = ether_addr_to_u64(ent->mac);
407 	*mac_vid |= (u64)(ent->vid & ARLTBL_VID_MASK) << ARLTBL_VID_S;
408 	*fwd_entry = ent->port & ARLTBL_DATA_PORT_ID_MASK_89;
409 	if (ent->is_valid)
410 		*fwd_entry |= ARLTBL_VALID_89;
411 	if (ent->is_static)
412 		*fwd_entry |= ARLTBL_STATIC_89;
413 	if (ent->is_age)
414 		*fwd_entry |= ARLTBL_AGE_89;
415 }
416 
b53_arl_search_to_entry_25(struct b53_arl_entry * ent,u64 mac_vid,u8 ext)417 static inline void b53_arl_search_to_entry_25(struct b53_arl_entry *ent,
418 					      u64 mac_vid, u8 ext)
419 {
420 	memset(ent, 0, sizeof(*ent));
421 	ent->is_valid = !!(mac_vid & ARLTBL_VALID_25);
422 	ent->is_age = !!(mac_vid & ARLTBL_AGE_25);
423 	ent->is_static = !!(mac_vid & ARLTBL_STATIC_25);
424 	u64_to_ether_addr(mac_vid, ent->mac);
425 	ent->vid = (mac_vid & ARL_SRCH_RSLT_VID_MASK_25) >>
426 		   ARL_SRCH_RSLT_VID_S_25;
427 	ent->port = (mac_vid & ARL_SRCH_RSLT_PORT_ID_MASK_25) >>
428 		    ARL_SRCH_RSLT_PORT_ID_S_25;
429 	if (is_multicast_ether_addr(ent->mac) && (ext & ARL_SRCH_RSLT_EXT_MC_MII))
430 		ent->port |= BIT(B53_CPU_PORT_25);
431 	else if (!is_multicast_ether_addr(ent->mac) && ent->port == B53_CPU_PORT)
432 		ent->port = B53_CPU_PORT_25;
433 }
434 
b53_arl_search_to_entry_63xx(struct b53_arl_entry * ent,u64 mac_vid,u16 fwd_entry)435 static inline void b53_arl_search_to_entry_63xx(struct b53_arl_entry *ent,
436 						u64 mac_vid, u16 fwd_entry)
437 {
438 	memset(ent, 0, sizeof(*ent));
439 	u64_to_ether_addr(mac_vid, ent->mac);
440 	ent->vid = mac_vid >> ARLTBL_VID_S;
441 
442 	ent->port = fwd_entry & ARL_SRST_PORT_ID_MASK_63XX;
443 	ent->port >>= 1;
444 
445 	ent->is_age = !!(fwd_entry & ARL_SRST_AGE_63XX);
446 	ent->is_static = !!(fwd_entry & ARL_SRST_STATIC_63XX);
447 	ent->is_valid = 1;
448 }
449 
b53_arl_read_entry(struct b53_device * dev,struct b53_arl_entry * ent,u8 idx)450 static inline void b53_arl_read_entry(struct b53_device *dev,
451 				      struct b53_arl_entry *ent, u8 idx)
452 {
453 	dev->arl_ops->arl_read_entry(dev, ent, idx);
454 }
455 
b53_arl_write_entry(struct b53_device * dev,const struct b53_arl_entry * ent,u8 idx)456 static inline void b53_arl_write_entry(struct b53_device *dev,
457 				       const struct b53_arl_entry *ent, u8 idx)
458 {
459 	dev->arl_ops->arl_write_entry(dev, ent, idx);
460 }
461 
b53_arl_search_read(struct b53_device * dev,u8 idx,struct b53_arl_entry * ent)462 static inline void b53_arl_search_read(struct b53_device *dev, u8 idx,
463 				       struct b53_arl_entry *ent)
464 {
465 	dev->arl_ops->arl_search_read(dev, idx, ent);
466 }
467 
468 #ifdef CONFIG_BCM47XX
469 
470 #include <linux/bcm47xx_nvram.h>
471 #include <linux/gpio/legacy.h>
472 #include <bcm47xx_board.h>
b53_switch_get_reset_gpio(struct b53_device * dev)473 static inline struct gpio_desc *b53_switch_get_reset_gpio(struct b53_device *dev)
474 {
475 	enum bcm47xx_board board = bcm47xx_board_get();
476 	int gpio, ret;
477 
478 	switch (board) {
479 	case BCM47XX_BOARD_LINKSYS_WRT300NV11:
480 	case BCM47XX_BOARD_LINKSYS_WRT310NV1:
481 		gpio = 8;
482 		break;
483 	default:
484 		gpio = bcm47xx_nvram_gpio_pin("robo_reset");
485 	}
486 
487 	if (!gpio_is_valid(gpio))
488 		return ERR_PTR(-EINVAL);
489 
490 	ret = devm_gpio_request_one(dev->dev, gpio,
491 				    GPIOF_OUT_INIT_HIGH, "robo_reset");
492 	if (ret)
493 		return ERR_PTR(ret);
494 
495 	return gpio_to_desc(gpio);
496 }
497 #else
b53_switch_get_reset_gpio(struct b53_device * dev)498 static inline struct gpio_desc *b53_switch_get_reset_gpio(struct b53_device *dev)
499 {
500 	return ERR_PTR(-ENODEV);
501 }
502 #endif
503 
504 /* Exported functions towards other drivers */
505 void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port);
506 int b53_configure_vlan(struct dsa_switch *ds);
507 void b53_get_strings(struct dsa_switch *ds, int port, u32 stringset,
508 		     uint8_t *data);
509 void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);
510 int b53_get_sset_count(struct dsa_switch *ds, int port, int sset);
511 void b53_get_ethtool_phy_stats(struct dsa_switch *ds, int port, uint64_t *data);
512 int b53_set_ageing_time(struct dsa_switch *ds, unsigned int msecs);
513 int b53_br_join(struct dsa_switch *ds, int port, struct dsa_bridge bridge,
514 		bool *tx_fwd_offload, struct netlink_ext_ack *extack);
515 void b53_br_leave(struct dsa_switch *ds, int port, struct dsa_bridge bridge);
516 void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state);
517 void b53_br_fast_age(struct dsa_switch *ds, int port);
518 int b53_br_flags_pre(struct dsa_switch *ds, int port,
519 		     struct switchdev_brport_flags flags,
520 		     struct netlink_ext_ack *extack);
521 int b53_br_flags(struct dsa_switch *ds, int port,
522 		 struct switchdev_brport_flags flags,
523 		 struct netlink_ext_ack *extack);
524 int b53_setup_devlink_resources(struct dsa_switch *ds);
525 void b53_port_event(struct dsa_switch *ds, int port);
526 int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
527 		       struct netlink_ext_ack *extack);
528 int b53_vlan_add(struct dsa_switch *ds, int port,
529 		 const struct switchdev_obj_port_vlan *vlan,
530 		 struct netlink_ext_ack *extack);
531 int b53_vlan_del(struct dsa_switch *ds, int port,
532 		 const struct switchdev_obj_port_vlan *vlan);
533 int b53_fdb_add(struct dsa_switch *ds, int port,
534 		const unsigned char *addr, u16 vid,
535 		struct dsa_db db);
536 int b53_fdb_del(struct dsa_switch *ds, int port,
537 		const unsigned char *addr, u16 vid,
538 		struct dsa_db db);
539 int b53_fdb_dump(struct dsa_switch *ds, int port,
540 		 dsa_fdb_dump_cb_t *cb, void *data);
541 int b53_mdb_add(struct dsa_switch *ds, int port,
542 		const struct switchdev_obj_port_mdb *mdb,
543 		struct dsa_db db);
544 int b53_mdb_del(struct dsa_switch *ds, int port,
545 		const struct switchdev_obj_port_mdb *mdb,
546 		struct dsa_db db);
547 int b53_mirror_add(struct dsa_switch *ds, int port,
548 		   struct dsa_mall_mirror_tc_entry *mirror, bool ingress,
549 		   struct netlink_ext_ack *extack);
550 enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
551 					   enum dsa_tag_protocol mprot);
552 void b53_mirror_del(struct dsa_switch *ds, int port,
553 		    struct dsa_mall_mirror_tc_entry *mirror);
554 int b53_setup_port(struct dsa_switch *ds, int port);
555 int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy);
556 void b53_disable_port(struct dsa_switch *ds, int port);
557 void b53_brcm_hdr_setup(struct dsa_switch *ds, int port);
558 int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy);
559 bool b53_support_eee(struct dsa_switch *ds, int port);
560 int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e);
561 
562 #endif
563