xref: /linux/drivers/net/phy/sfp.h (revision c36461825469a9ceee2346a2e89286c522525da7)
1 #ifndef SFP_H
2 #define SFP_H
3 
4 #include <linux/ethtool.h>
5 #include <linux/sfp.h>
6 
7 struct sfp;
8 
9 struct sfp_quirk {
10 	const char *vendor;
11 	const char *part;
12 	void (*support)(const struct sfp_eeprom_id *id,
13 			struct sfp_module_caps *caps);
14 	void (*fixup)(struct sfp *sfp);
15 	bool part_prefix_match;
16 };
17 
18 struct sfp_socket_ops {
19 	void (*attach)(struct sfp *sfp);
20 	void (*detach)(struct sfp *sfp);
21 	void (*start)(struct sfp *sfp);
22 	void (*stop)(struct sfp *sfp);
23 	void (*set_signal_rate)(struct sfp *sfp, unsigned int rate_kbd);
24 	int (*module_info)(struct sfp *sfp, struct ethtool_modinfo *modinfo);
25 	int (*module_eeprom)(struct sfp *sfp, struct ethtool_eeprom *ee,
26 			     u8 *data);
27 	int (*module_eeprom_by_page)(struct sfp *sfp,
28 				     const struct ethtool_module_eeprom *page,
29 				     struct netlink_ext_ack *extack);
30 };
31 
32 int sfp_add_phy(struct sfp_bus *bus, struct phy_device *phydev);
33 void sfp_remove_phy(struct sfp_bus *bus);
34 void sfp_link_up(struct sfp_bus *bus);
35 void sfp_link_down(struct sfp_bus *bus);
36 int sfp_module_insert(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
37 		      const struct sfp_quirk *quirk);
38 void sfp_module_remove(struct sfp_bus *bus);
39 int sfp_module_start(struct sfp_bus *bus);
40 void sfp_module_stop(struct sfp_bus *bus);
41 struct sfp_bus *sfp_register_socket(struct device *dev, struct sfp *sfp,
42 				    const struct sfp_socket_ops *ops);
43 void sfp_unregister_socket(struct sfp_bus *bus);
44 
45 #endif
46