162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * B53 common definitions
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (C) 2011-2013 Jonas Gorski <jogo@openwrt.org>
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
762306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
862306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1162306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1262306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1362306a36Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1462306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1562306a36Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1662306a36Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1762306a36Sopenharmony_ci */
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#ifndef __B53_PRIV_H
2062306a36Sopenharmony_ci#define __B53_PRIV_H
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#include <linux/kernel.h>
2362306a36Sopenharmony_ci#include <linux/mutex.h>
2462306a36Sopenharmony_ci#include <linux/phylink.h>
2562306a36Sopenharmony_ci#include <linux/etherdevice.h>
2662306a36Sopenharmony_ci#include <net/dsa.h>
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#include "b53_regs.h"
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_cistruct b53_device;
3162306a36Sopenharmony_cistruct net_device;
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_cistruct b53_io_ops {
3462306a36Sopenharmony_ci	int (*read8)(struct b53_device *dev, u8 page, u8 reg, u8 *value);
3562306a36Sopenharmony_ci	int (*read16)(struct b53_device *dev, u8 page, u8 reg, u16 *value);
3662306a36Sopenharmony_ci	int (*read32)(struct b53_device *dev, u8 page, u8 reg, u32 *value);
3762306a36Sopenharmony_ci	int (*read48)(struct b53_device *dev, u8 page, u8 reg, u64 *value);
3862306a36Sopenharmony_ci	int (*read64)(struct b53_device *dev, u8 page, u8 reg, u64 *value);
3962306a36Sopenharmony_ci	int (*write8)(struct b53_device *dev, u8 page, u8 reg, u8 value);
4062306a36Sopenharmony_ci	int (*write16)(struct b53_device *dev, u8 page, u8 reg, u16 value);
4162306a36Sopenharmony_ci	int (*write32)(struct b53_device *dev, u8 page, u8 reg, u32 value);
4262306a36Sopenharmony_ci	int (*write48)(struct b53_device *dev, u8 page, u8 reg, u64 value);
4362306a36Sopenharmony_ci	int (*write64)(struct b53_device *dev, u8 page, u8 reg, u64 value);
4462306a36Sopenharmony_ci	int (*phy_read16)(struct b53_device *dev, int addr, int reg, u16 *value);
4562306a36Sopenharmony_ci	int (*phy_write16)(struct b53_device *dev, int addr, int reg, u16 value);
4662306a36Sopenharmony_ci	int (*irq_enable)(struct b53_device *dev, int port);
4762306a36Sopenharmony_ci	void (*irq_disable)(struct b53_device *dev, int port);
4862306a36Sopenharmony_ci	void (*phylink_get_caps)(struct b53_device *dev, int port,
4962306a36Sopenharmony_ci				 struct phylink_config *config);
5062306a36Sopenharmony_ci	struct phylink_pcs *(*phylink_mac_select_pcs)(struct b53_device *dev,
5162306a36Sopenharmony_ci						      int port,
5262306a36Sopenharmony_ci						      phy_interface_t interface);
5362306a36Sopenharmony_ci	u8 (*serdes_map_lane)(struct b53_device *dev, int port);
5462306a36Sopenharmony_ci	void (*serdes_link_set)(struct b53_device *dev, int port,
5562306a36Sopenharmony_ci				unsigned int mode, phy_interface_t interface,
5662306a36Sopenharmony_ci				bool link_up);
5762306a36Sopenharmony_ci};
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci#define B53_INVALID_LANE	0xff
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_cienum {
6262306a36Sopenharmony_ci	BCM4908_DEVICE_ID = 0x4908,
6362306a36Sopenharmony_ci	BCM5325_DEVICE_ID = 0x25,
6462306a36Sopenharmony_ci	BCM5365_DEVICE_ID = 0x65,
6562306a36Sopenharmony_ci	BCM5389_DEVICE_ID = 0x89,
6662306a36Sopenharmony_ci	BCM5395_DEVICE_ID = 0x95,
6762306a36Sopenharmony_ci	BCM5397_DEVICE_ID = 0x97,
6862306a36Sopenharmony_ci	BCM5398_DEVICE_ID = 0x98,
6962306a36Sopenharmony_ci	BCM53115_DEVICE_ID = 0x53115,
7062306a36Sopenharmony_ci	BCM53125_DEVICE_ID = 0x53125,
7162306a36Sopenharmony_ci	BCM53128_DEVICE_ID = 0x53128,
7262306a36Sopenharmony_ci	BCM63XX_DEVICE_ID = 0x6300,
7362306a36Sopenharmony_ci	BCM63268_DEVICE_ID = 0x63268,
7462306a36Sopenharmony_ci	BCM53010_DEVICE_ID = 0x53010,
7562306a36Sopenharmony_ci	BCM53011_DEVICE_ID = 0x53011,
7662306a36Sopenharmony_ci	BCM53012_DEVICE_ID = 0x53012,
7762306a36Sopenharmony_ci	BCM53018_DEVICE_ID = 0x53018,
7862306a36Sopenharmony_ci	BCM53019_DEVICE_ID = 0x53019,
7962306a36Sopenharmony_ci	BCM58XX_DEVICE_ID = 0x5800,
8062306a36Sopenharmony_ci	BCM583XX_DEVICE_ID = 0x58300,
8162306a36Sopenharmony_ci	BCM7445_DEVICE_ID = 0x7445,
8262306a36Sopenharmony_ci	BCM7278_DEVICE_ID = 0x7278,
8362306a36Sopenharmony_ci	BCM53134_DEVICE_ID = 0x5075,
8462306a36Sopenharmony_ci};
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_cistruct b53_pcs {
8762306a36Sopenharmony_ci	struct phylink_pcs pcs;
8862306a36Sopenharmony_ci	struct b53_device *dev;
8962306a36Sopenharmony_ci	u8 lane;
9062306a36Sopenharmony_ci};
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci#define B53_N_PORTS	9
9362306a36Sopenharmony_ci#define B53_N_PORTS_25	6
9462306a36Sopenharmony_ci#define B53_N_PCS	2
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_cistruct b53_port {
9762306a36Sopenharmony_ci	u16		vlan_ctl_mask;
9862306a36Sopenharmony_ci	struct ethtool_eee eee;
9962306a36Sopenharmony_ci};
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_cistruct b53_vlan {
10262306a36Sopenharmony_ci	u16 members;
10362306a36Sopenharmony_ci	u16 untag;
10462306a36Sopenharmony_ci	bool valid;
10562306a36Sopenharmony_ci};
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_cistruct b53_device {
10862306a36Sopenharmony_ci	struct dsa_switch *ds;
10962306a36Sopenharmony_ci	struct b53_platform_data *pdata;
11062306a36Sopenharmony_ci	const char *name;
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci	struct mutex reg_mutex;
11362306a36Sopenharmony_ci	struct mutex stats_mutex;
11462306a36Sopenharmony_ci	struct mutex arl_mutex;
11562306a36Sopenharmony_ci	const struct b53_io_ops *ops;
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci	/* chip specific data */
11862306a36Sopenharmony_ci	u32 chip_id;
11962306a36Sopenharmony_ci	u8 core_rev;
12062306a36Sopenharmony_ci	u8 vta_regs[3];
12162306a36Sopenharmony_ci	u8 duplex_reg;
12262306a36Sopenharmony_ci	u8 jumbo_pm_reg;
12362306a36Sopenharmony_ci	u8 jumbo_size_reg;
12462306a36Sopenharmony_ci	int reset_gpio;
12562306a36Sopenharmony_ci	u8 num_arl_bins;
12662306a36Sopenharmony_ci	u16 num_arl_buckets;
12762306a36Sopenharmony_ci	enum dsa_tag_protocol tag_protocol;
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci	/* used ports mask */
13062306a36Sopenharmony_ci	u16 enabled_ports;
13162306a36Sopenharmony_ci	unsigned int imp_port;
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci	/* connect specific data */
13462306a36Sopenharmony_ci	u8 current_page;
13562306a36Sopenharmony_ci	struct device *dev;
13662306a36Sopenharmony_ci	u8 serdes_lane;
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci	/* Master MDIO bus we got probed from */
13962306a36Sopenharmony_ci	struct mii_bus *bus;
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci	void *priv;
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ci	/* run time configuration */
14462306a36Sopenharmony_ci	bool enable_jumbo;
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci	unsigned int num_vlans;
14762306a36Sopenharmony_ci	struct b53_vlan *vlans;
14862306a36Sopenharmony_ci	bool vlan_enabled;
14962306a36Sopenharmony_ci	unsigned int num_ports;
15062306a36Sopenharmony_ci	struct b53_port *ports;
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci	struct b53_pcs pcs[B53_N_PCS];
15362306a36Sopenharmony_ci};
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci#define b53_for_each_port(dev, i) \
15662306a36Sopenharmony_ci	for (i = 0; i < B53_N_PORTS; i++) \
15762306a36Sopenharmony_ci		if (dev->enabled_ports & BIT(i))
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_cistatic inline int is5325(struct b53_device *dev)
16162306a36Sopenharmony_ci{
16262306a36Sopenharmony_ci	return dev->chip_id == BCM5325_DEVICE_ID;
16362306a36Sopenharmony_ci}
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_cistatic inline int is5365(struct b53_device *dev)
16662306a36Sopenharmony_ci{
16762306a36Sopenharmony_ci#ifdef CONFIG_BCM47XX
16862306a36Sopenharmony_ci	return dev->chip_id == BCM5365_DEVICE_ID;
16962306a36Sopenharmony_ci#else
17062306a36Sopenharmony_ci	return 0;
17162306a36Sopenharmony_ci#endif
17262306a36Sopenharmony_ci}
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_cistatic inline int is5397_98(struct b53_device *dev)
17562306a36Sopenharmony_ci{
17662306a36Sopenharmony_ci	return dev->chip_id == BCM5397_DEVICE_ID ||
17762306a36Sopenharmony_ci		dev->chip_id == BCM5398_DEVICE_ID;
17862306a36Sopenharmony_ci}
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_cistatic inline int is539x(struct b53_device *dev)
18162306a36Sopenharmony_ci{
18262306a36Sopenharmony_ci	return dev->chip_id == BCM5395_DEVICE_ID ||
18362306a36Sopenharmony_ci		dev->chip_id == BCM5397_DEVICE_ID ||
18462306a36Sopenharmony_ci		dev->chip_id == BCM5398_DEVICE_ID;
18562306a36Sopenharmony_ci}
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_cistatic inline int is531x5(struct b53_device *dev)
18862306a36Sopenharmony_ci{
18962306a36Sopenharmony_ci	return dev->chip_id == BCM53115_DEVICE_ID ||
19062306a36Sopenharmony_ci		dev->chip_id == BCM53125_DEVICE_ID ||
19162306a36Sopenharmony_ci		dev->chip_id == BCM53128_DEVICE_ID ||
19262306a36Sopenharmony_ci		dev->chip_id == BCM53134_DEVICE_ID;
19362306a36Sopenharmony_ci}
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_cistatic inline int is63xx(struct b53_device *dev)
19662306a36Sopenharmony_ci{
19762306a36Sopenharmony_ci	return dev->chip_id == BCM63XX_DEVICE_ID ||
19862306a36Sopenharmony_ci		dev->chip_id == BCM63268_DEVICE_ID;
19962306a36Sopenharmony_ci}
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_cistatic inline int is63268(struct b53_device *dev)
20262306a36Sopenharmony_ci{
20362306a36Sopenharmony_ci	return dev->chip_id == BCM63268_DEVICE_ID;
20462306a36Sopenharmony_ci}
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_cistatic inline int is5301x(struct b53_device *dev)
20762306a36Sopenharmony_ci{
20862306a36Sopenharmony_ci	return dev->chip_id == BCM53010_DEVICE_ID ||
20962306a36Sopenharmony_ci		dev->chip_id == BCM53011_DEVICE_ID ||
21062306a36Sopenharmony_ci		dev->chip_id == BCM53012_DEVICE_ID ||
21162306a36Sopenharmony_ci		dev->chip_id == BCM53018_DEVICE_ID ||
21262306a36Sopenharmony_ci		dev->chip_id == BCM53019_DEVICE_ID;
21362306a36Sopenharmony_ci}
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_cistatic inline int is58xx(struct b53_device *dev)
21662306a36Sopenharmony_ci{
21762306a36Sopenharmony_ci	return dev->chip_id == BCM58XX_DEVICE_ID ||
21862306a36Sopenharmony_ci		dev->chip_id == BCM583XX_DEVICE_ID ||
21962306a36Sopenharmony_ci		dev->chip_id == BCM7445_DEVICE_ID ||
22062306a36Sopenharmony_ci		dev->chip_id == BCM7278_DEVICE_ID ||
22162306a36Sopenharmony_ci		dev->chip_id == BCM53134_DEVICE_ID;
22262306a36Sopenharmony_ci}
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ci#define B53_63XX_RGMII0	4
22562306a36Sopenharmony_ci#define B53_CPU_PORT_25	5
22662306a36Sopenharmony_ci#define B53_CPU_PORT	8
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_cistatic inline unsigned int b53_max_arl_entries(struct b53_device *dev)
22962306a36Sopenharmony_ci{
23062306a36Sopenharmony_ci	return dev->num_arl_buckets * dev->num_arl_bins;
23162306a36Sopenharmony_ci}
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_cistruct b53_device *b53_switch_alloc(struct device *base,
23462306a36Sopenharmony_ci				    const struct b53_io_ops *ops,
23562306a36Sopenharmony_ci				    void *priv);
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ciint b53_switch_detect(struct b53_device *dev);
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ciint b53_switch_register(struct b53_device *dev);
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_cistatic inline void b53_switch_remove(struct b53_device *dev)
24262306a36Sopenharmony_ci{
24362306a36Sopenharmony_ci	dsa_unregister_switch(dev->ds);
24462306a36Sopenharmony_ci}
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_cistatic inline void b53_switch_shutdown(struct b53_device *dev)
24762306a36Sopenharmony_ci{
24862306a36Sopenharmony_ci	dsa_switch_shutdown(dev->ds);
24962306a36Sopenharmony_ci}
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci#define b53_build_op(type_op_size, val_type)				\
25262306a36Sopenharmony_cistatic inline int b53_##type_op_size(struct b53_device *dev, u8 page,	\
25362306a36Sopenharmony_ci				     u8 reg, val_type val)		\
25462306a36Sopenharmony_ci{									\
25562306a36Sopenharmony_ci	int ret;							\
25662306a36Sopenharmony_ci									\
25762306a36Sopenharmony_ci	mutex_lock(&dev->reg_mutex);					\
25862306a36Sopenharmony_ci	ret = dev->ops->type_op_size(dev, page, reg, val);		\
25962306a36Sopenharmony_ci	mutex_unlock(&dev->reg_mutex);					\
26062306a36Sopenharmony_ci									\
26162306a36Sopenharmony_ci	return ret;							\
26262306a36Sopenharmony_ci}
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_cib53_build_op(read8, u8 *);
26562306a36Sopenharmony_cib53_build_op(read16, u16 *);
26662306a36Sopenharmony_cib53_build_op(read32, u32 *);
26762306a36Sopenharmony_cib53_build_op(read48, u64 *);
26862306a36Sopenharmony_cib53_build_op(read64, u64 *);
26962306a36Sopenharmony_ci
27062306a36Sopenharmony_cib53_build_op(write8, u8);
27162306a36Sopenharmony_cib53_build_op(write16, u16);
27262306a36Sopenharmony_cib53_build_op(write32, u32);
27362306a36Sopenharmony_cib53_build_op(write48, u64);
27462306a36Sopenharmony_cib53_build_op(write64, u64);
27562306a36Sopenharmony_ci
27662306a36Sopenharmony_cistruct b53_arl_entry {
27762306a36Sopenharmony_ci	u16 port;
27862306a36Sopenharmony_ci	u8 mac[ETH_ALEN];
27962306a36Sopenharmony_ci	u16 vid;
28062306a36Sopenharmony_ci	u8 is_valid:1;
28162306a36Sopenharmony_ci	u8 is_age:1;
28262306a36Sopenharmony_ci	u8 is_static:1;
28362306a36Sopenharmony_ci};
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_cistatic inline void b53_arl_to_entry(struct b53_arl_entry *ent,
28662306a36Sopenharmony_ci				    u64 mac_vid, u32 fwd_entry)
28762306a36Sopenharmony_ci{
28862306a36Sopenharmony_ci	memset(ent, 0, sizeof(*ent));
28962306a36Sopenharmony_ci	ent->port = fwd_entry & ARLTBL_DATA_PORT_ID_MASK;
29062306a36Sopenharmony_ci	ent->is_valid = !!(fwd_entry & ARLTBL_VALID);
29162306a36Sopenharmony_ci	ent->is_age = !!(fwd_entry & ARLTBL_AGE);
29262306a36Sopenharmony_ci	ent->is_static = !!(fwd_entry & ARLTBL_STATIC);
29362306a36Sopenharmony_ci	u64_to_ether_addr(mac_vid, ent->mac);
29462306a36Sopenharmony_ci	ent->vid = mac_vid >> ARLTBL_VID_S;
29562306a36Sopenharmony_ci}
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_cistatic inline void b53_arl_from_entry(u64 *mac_vid, u32 *fwd_entry,
29862306a36Sopenharmony_ci				      const struct b53_arl_entry *ent)
29962306a36Sopenharmony_ci{
30062306a36Sopenharmony_ci	*mac_vid = ether_addr_to_u64(ent->mac);
30162306a36Sopenharmony_ci	*mac_vid |= (u64)(ent->vid & ARLTBL_VID_MASK) << ARLTBL_VID_S;
30262306a36Sopenharmony_ci	*fwd_entry = ent->port & ARLTBL_DATA_PORT_ID_MASK;
30362306a36Sopenharmony_ci	if (ent->is_valid)
30462306a36Sopenharmony_ci		*fwd_entry |= ARLTBL_VALID;
30562306a36Sopenharmony_ci	if (ent->is_static)
30662306a36Sopenharmony_ci		*fwd_entry |= ARLTBL_STATIC;
30762306a36Sopenharmony_ci	if (ent->is_age)
30862306a36Sopenharmony_ci		*fwd_entry |= ARLTBL_AGE;
30962306a36Sopenharmony_ci}
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_ci#ifdef CONFIG_BCM47XX
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ci#include <linux/bcm47xx_nvram.h>
31462306a36Sopenharmony_ci#include <bcm47xx_board.h>
31562306a36Sopenharmony_cistatic inline int b53_switch_get_reset_gpio(struct b53_device *dev)
31662306a36Sopenharmony_ci{
31762306a36Sopenharmony_ci	enum bcm47xx_board board = bcm47xx_board_get();
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci	switch (board) {
32062306a36Sopenharmony_ci	case BCM47XX_BOARD_LINKSYS_WRT300NV11:
32162306a36Sopenharmony_ci	case BCM47XX_BOARD_LINKSYS_WRT310NV1:
32262306a36Sopenharmony_ci		return 8;
32362306a36Sopenharmony_ci	default:
32462306a36Sopenharmony_ci		return bcm47xx_nvram_gpio_pin("robo_reset");
32562306a36Sopenharmony_ci	}
32662306a36Sopenharmony_ci}
32762306a36Sopenharmony_ci#else
32862306a36Sopenharmony_cistatic inline int b53_switch_get_reset_gpio(struct b53_device *dev)
32962306a36Sopenharmony_ci{
33062306a36Sopenharmony_ci	return -ENOENT;
33162306a36Sopenharmony_ci}
33262306a36Sopenharmony_ci#endif
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ci/* Exported functions towards other drivers */
33562306a36Sopenharmony_civoid b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port);
33662306a36Sopenharmony_ciint b53_configure_vlan(struct dsa_switch *ds);
33762306a36Sopenharmony_civoid b53_get_strings(struct dsa_switch *ds, int port, u32 stringset,
33862306a36Sopenharmony_ci		     uint8_t *data);
33962306a36Sopenharmony_civoid b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);
34062306a36Sopenharmony_ciint b53_get_sset_count(struct dsa_switch *ds, int port, int sset);
34162306a36Sopenharmony_civoid b53_get_ethtool_phy_stats(struct dsa_switch *ds, int port, uint64_t *data);
34262306a36Sopenharmony_ciint b53_br_join(struct dsa_switch *ds, int port, struct dsa_bridge bridge,
34362306a36Sopenharmony_ci		bool *tx_fwd_offload, struct netlink_ext_ack *extack);
34462306a36Sopenharmony_civoid b53_br_leave(struct dsa_switch *ds, int port, struct dsa_bridge bridge);
34562306a36Sopenharmony_civoid b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state);
34662306a36Sopenharmony_civoid b53_br_fast_age(struct dsa_switch *ds, int port);
34762306a36Sopenharmony_ciint b53_br_flags_pre(struct dsa_switch *ds, int port,
34862306a36Sopenharmony_ci		     struct switchdev_brport_flags flags,
34962306a36Sopenharmony_ci		     struct netlink_ext_ack *extack);
35062306a36Sopenharmony_ciint b53_br_flags(struct dsa_switch *ds, int port,
35162306a36Sopenharmony_ci		 struct switchdev_brport_flags flags,
35262306a36Sopenharmony_ci		 struct netlink_ext_ack *extack);
35362306a36Sopenharmony_ciint b53_setup_devlink_resources(struct dsa_switch *ds);
35462306a36Sopenharmony_civoid b53_port_event(struct dsa_switch *ds, int port);
35562306a36Sopenharmony_civoid b53_phylink_mac_config(struct dsa_switch *ds, int port,
35662306a36Sopenharmony_ci			    unsigned int mode,
35762306a36Sopenharmony_ci			    const struct phylink_link_state *state);
35862306a36Sopenharmony_civoid b53_phylink_mac_link_down(struct dsa_switch *ds, int port,
35962306a36Sopenharmony_ci			       unsigned int mode,
36062306a36Sopenharmony_ci			       phy_interface_t interface);
36162306a36Sopenharmony_civoid b53_phylink_mac_link_up(struct dsa_switch *ds, int port,
36262306a36Sopenharmony_ci			     unsigned int mode,
36362306a36Sopenharmony_ci			     phy_interface_t interface,
36462306a36Sopenharmony_ci			     struct phy_device *phydev,
36562306a36Sopenharmony_ci			     int speed, int duplex,
36662306a36Sopenharmony_ci			     bool tx_pause, bool rx_pause);
36762306a36Sopenharmony_ciint b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
36862306a36Sopenharmony_ci		       struct netlink_ext_ack *extack);
36962306a36Sopenharmony_ciint b53_vlan_add(struct dsa_switch *ds, int port,
37062306a36Sopenharmony_ci		 const struct switchdev_obj_port_vlan *vlan,
37162306a36Sopenharmony_ci		 struct netlink_ext_ack *extack);
37262306a36Sopenharmony_ciint b53_vlan_del(struct dsa_switch *ds, int port,
37362306a36Sopenharmony_ci		 const struct switchdev_obj_port_vlan *vlan);
37462306a36Sopenharmony_ciint b53_fdb_add(struct dsa_switch *ds, int port,
37562306a36Sopenharmony_ci		const unsigned char *addr, u16 vid,
37662306a36Sopenharmony_ci		struct dsa_db db);
37762306a36Sopenharmony_ciint b53_fdb_del(struct dsa_switch *ds, int port,
37862306a36Sopenharmony_ci		const unsigned char *addr, u16 vid,
37962306a36Sopenharmony_ci		struct dsa_db db);
38062306a36Sopenharmony_ciint b53_fdb_dump(struct dsa_switch *ds, int port,
38162306a36Sopenharmony_ci		 dsa_fdb_dump_cb_t *cb, void *data);
38262306a36Sopenharmony_ciint b53_mdb_add(struct dsa_switch *ds, int port,
38362306a36Sopenharmony_ci		const struct switchdev_obj_port_mdb *mdb,
38462306a36Sopenharmony_ci		struct dsa_db db);
38562306a36Sopenharmony_ciint b53_mdb_del(struct dsa_switch *ds, int port,
38662306a36Sopenharmony_ci		const struct switchdev_obj_port_mdb *mdb,
38762306a36Sopenharmony_ci		struct dsa_db db);
38862306a36Sopenharmony_ciint b53_mirror_add(struct dsa_switch *ds, int port,
38962306a36Sopenharmony_ci		   struct dsa_mall_mirror_tc_entry *mirror, bool ingress,
39062306a36Sopenharmony_ci		   struct netlink_ext_ack *extack);
39162306a36Sopenharmony_cienum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
39262306a36Sopenharmony_ci					   enum dsa_tag_protocol mprot);
39362306a36Sopenharmony_civoid b53_mirror_del(struct dsa_switch *ds, int port,
39462306a36Sopenharmony_ci		    struct dsa_mall_mirror_tc_entry *mirror);
39562306a36Sopenharmony_ciint b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy);
39662306a36Sopenharmony_civoid b53_disable_port(struct dsa_switch *ds, int port);
39762306a36Sopenharmony_civoid b53_brcm_hdr_setup(struct dsa_switch *ds, int port);
39862306a36Sopenharmony_civoid b53_eee_enable_set(struct dsa_switch *ds, int port, bool enable);
39962306a36Sopenharmony_ciint b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy);
40062306a36Sopenharmony_ciint b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e);
40162306a36Sopenharmony_ciint b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e);
40262306a36Sopenharmony_ci
40362306a36Sopenharmony_ci#endif
404