• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Microchip KSZ8XXX series register access
4  *
5  * Copyright (C) 2020 Pengutronix, Michael Grzeschik <kernel@pengutronix.de>
6  */
7 
8 #ifndef __KSZ8XXX_H
9 #define __KSZ8XXX_H
10 
11 #include <linux/types.h>
12 #include <net/dsa.h>
13 #include "ksz_common.h"
14 
15 int ksz8_setup(struct dsa_switch *ds);
16 u32 ksz8_get_port_addr(int port, int offset);
17 void ksz8_cfg_port_member(struct ksz_device *dev, int port, u8 member);
18 void ksz8_flush_dyn_mac_table(struct ksz_device *dev, int port);
19 void ksz8_port_setup(struct ksz_device *dev, int port, bool cpu_port);
20 int ksz8_r_phy(struct ksz_device *dev, u16 phy, u16 reg, u16 *val);
21 int ksz8_w_phy(struct ksz_device *dev, u16 phy, u16 reg, u16 val);
22 int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
23 			 u8 *fid, u8 *src_port, u8 *timestamp, u16 *entries);
24 void ksz8_w_sta_mac_table(struct ksz_device *dev, u16 addr,
25 			  struct alu_struct *alu);
26 void ksz8_r_mib_cnt(struct ksz_device *dev, int port, u16 addr, u64 *cnt);
27 void ksz8_r_mib_pkt(struct ksz_device *dev, int port, u16 addr,
28 		    u64 *dropped, u64 *cnt);
29 void ksz8_freeze_mib(struct ksz_device *dev, int port, bool freeze);
30 void ksz8_port_init_cnt(struct ksz_device *dev, int port);
31 int ksz8_fdb_dump(struct ksz_device *dev, int port,
32 		  dsa_fdb_dump_cb_t *cb, void *data);
33 int ksz8_mdb_add(struct ksz_device *dev, int port,
34 		 const struct switchdev_obj_port_mdb *mdb, struct dsa_db db);
35 int ksz8_mdb_del(struct ksz_device *dev, int port,
36 		 const struct switchdev_obj_port_mdb *mdb, struct dsa_db db);
37 int ksz8_port_vlan_filtering(struct ksz_device *dev, int port, bool flag,
38 			     struct netlink_ext_ack *extack);
39 int ksz8_port_vlan_add(struct ksz_device *dev, int port,
40 		       const struct switchdev_obj_port_vlan *vlan,
41 		       struct netlink_ext_ack *extack);
42 int ksz8_port_vlan_del(struct ksz_device *dev, int port,
43 		       const struct switchdev_obj_port_vlan *vlan);
44 int ksz8_port_mirror_add(struct ksz_device *dev, int port,
45 			 struct dsa_mall_mirror_tc_entry *mirror,
46 			 bool ingress, struct netlink_ext_ack *extack);
47 void ksz8_port_mirror_del(struct ksz_device *dev, int port,
48 			  struct dsa_mall_mirror_tc_entry *mirror);
49 int ksz8_get_stp_reg(void);
50 void ksz8_get_caps(struct ksz_device *dev, int port,
51 		   struct phylink_config *config);
52 void ksz8_config_cpu_port(struct dsa_switch *ds);
53 int ksz8_enable_stp_addr(struct ksz_device *dev);
54 int ksz8_reset_switch(struct ksz_device *dev);
55 int ksz8_switch_detect(struct ksz_device *dev);
56 int ksz8_switch_init(struct ksz_device *dev);
57 void ksz8_switch_exit(struct ksz_device *dev);
58 
59 #endif
60