xref: /linux/drivers/net/phy/sfp.h (revision cf21f328fcafacf4f96e7a30ef9dceede1076378)
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 (*modes)(const struct sfp_eeprom_id *id, unsigned long *modes,
13 		      unsigned long *interfaces);
14 	void (*fixup)(struct sfp *sfp);
15 };
16 
17 struct sfp_socket_ops {
18 	void (*attach)(struct sfp *sfp);
19 	void (*detach)(struct sfp *sfp);
20 	void (*start)(struct sfp *sfp);
21 	void (*stop)(struct sfp *sfp);
22 	int (*module_info)(struct sfp *sfp, struct ethtool_modinfo *modinfo);
23 	int (*module_eeprom)(struct sfp *sfp, struct ethtool_eeprom *ee,
24 			     u8 *data);
25 	int (*module_eeprom_by_page)(struct sfp *sfp,
26 				     const struct ethtool_module_eeprom *page,
27 				     struct netlink_ext_ack *extack);
28 };
29 
30 int sfp_add_phy(struct sfp_bus *bus, struct phy_device *phydev);
31 void sfp_remove_phy(struct sfp_bus *bus);
32 void sfp_link_up(struct sfp_bus *bus);
33 void sfp_link_down(struct sfp_bus *bus);
34 int sfp_module_insert(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
35 		      const struct sfp_quirk *quirk);
36 void sfp_module_remove(struct sfp_bus *bus);
37 int sfp_module_start(struct sfp_bus *bus);
38 void sfp_module_stop(struct sfp_bus *bus);
39 int sfp_link_configure(struct sfp_bus *bus, const struct sfp_eeprom_id *id);
40 struct sfp_bus *sfp_register_socket(struct device *dev, struct sfp *sfp,
41 				    const struct sfp_socket_ops *ops);
42 void sfp_unregister_socket(struct sfp_bus *bus);
43 
44 #endif
45