1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Microchip KSZ9477 series Header file 4 * 5 * Copyright (C) 2017-2022 Microchip Technology Inc. 6 */ 7 8 #ifndef __KSZ9477_H 9 #define __KSZ9477_H 10 11 #include <net/dsa.h> 12 #include "ksz_common.h" 13 14 int ksz9477_setup(struct dsa_switch *ds); 15 u32 ksz9477_get_port_addr(int port, int offset); 16 void ksz9477_cfg_port_member(struct ksz_device *dev, int port, u8 member); 17 void ksz9477_flush_dyn_mac_table(struct ksz_device *dev, int port); 18 void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port); 19 void ksz9477_r_phy(struct ksz_device *dev, u16 addr, u16 reg, u16 *data); 20 void ksz9477_w_phy(struct ksz_device *dev, u16 addr, u16 reg, u16 val); 21 void ksz9477_r_mib_cnt(struct ksz_device *dev, int port, u16 addr, u64 *cnt); 22 void ksz9477_r_mib_pkt(struct ksz_device *dev, int port, u16 addr, 23 u64 *dropped, u64 *cnt); 24 void ksz9477_freeze_mib(struct ksz_device *dev, int port, bool freeze); 25 void ksz9477_port_init_cnt(struct ksz_device *dev, int port); 26 int ksz9477_port_vlan_filtering(struct ksz_device *dev, int port, 27 bool flag, struct netlink_ext_ack *extack); 28 int ksz9477_port_vlan_add(struct ksz_device *dev, int port, 29 const struct switchdev_obj_port_vlan *vlan, 30 struct netlink_ext_ack *extack); 31 int ksz9477_port_vlan_del(struct ksz_device *dev, int port, 32 const struct switchdev_obj_port_vlan *vlan); 33 int ksz9477_port_mirror_add(struct ksz_device *dev, int port, 34 struct dsa_mall_mirror_tc_entry *mirror, 35 bool ingress, struct netlink_ext_ack *extack); 36 void ksz9477_port_mirror_del(struct ksz_device *dev, int port, 37 struct dsa_mall_mirror_tc_entry *mirror); 38 int ksz9477_get_stp_reg(void); 39 void ksz9477_get_caps(struct ksz_device *dev, int port, 40 struct phylink_config *config); 41 int ksz9477_fdb_dump(struct ksz_device *dev, int port, 42 dsa_fdb_dump_cb_t *cb, void *data); 43 int ksz9477_fdb_add(struct ksz_device *dev, int port, 44 const unsigned char *addr, u16 vid, struct dsa_db db); 45 int ksz9477_fdb_del(struct ksz_device *dev, int port, 46 const unsigned char *addr, u16 vid, struct dsa_db db); 47 int ksz9477_mdb_add(struct ksz_device *dev, int port, 48 const struct switchdev_obj_port_mdb *mdb, struct dsa_db db); 49 int ksz9477_mdb_del(struct ksz_device *dev, int port, 50 const struct switchdev_obj_port_mdb *mdb, struct dsa_db db); 51 int ksz9477_change_mtu(struct ksz_device *dev, int port, int mtu); 52 int ksz9477_max_mtu(struct ksz_device *dev, int port); 53 void ksz9477_config_cpu_port(struct dsa_switch *ds); 54 int ksz9477_enable_stp_addr(struct ksz_device *dev); 55 int ksz9477_reset_switch(struct ksz_device *dev); 56 int ksz9477_dsa_init(struct ksz_device *dev); 57 int ksz9477_switch_init(struct ksz_device *dev); 58 void ksz9477_switch_exit(struct ksz_device *dev); 59 60 #endif 61