xref: /openbmc/linux/drivers/net/phy/sfp.h (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
1ce0aa27fSRussell King #ifndef SFP_H
2ce0aa27fSRussell King #define SFP_H
3ce0aa27fSRussell King 
4ce0aa27fSRussell King #include <linux/ethtool.h>
5ce0aa27fSRussell King #include <linux/sfp.h>
6ce0aa27fSRussell King 
7ce0aa27fSRussell King struct sfp;
8ce0aa27fSRussell King 
923571c7bSRussell King (Oracle) struct sfp_quirk {
1023571c7bSRussell King (Oracle) 	const char *vendor;
1123571c7bSRussell King (Oracle) 	const char *part;
12fd580c98SRussell King 	void (*modes)(const struct sfp_eeprom_id *id, unsigned long *modes,
13fd580c98SRussell King 		      unsigned long *interfaces);
1427541675SRussell King (Oracle) 	void (*fixup)(struct sfp *sfp);
1523571c7bSRussell King (Oracle) };
1623571c7bSRussell King (Oracle) 
17ce0aa27fSRussell King struct sfp_socket_ops {
18b5bfc21aSRussell King 	void (*attach)(struct sfp *sfp);
19b5bfc21aSRussell King 	void (*detach)(struct sfp *sfp);
20ce0aa27fSRussell King 	void (*start)(struct sfp *sfp);
21ce0aa27fSRussell King 	void (*stop)(struct sfp *sfp);
22*dc185822SRussell King (Oracle) 	void (*set_signal_rate)(struct sfp *sfp, unsigned int rate_kbd);
23ce0aa27fSRussell King 	int (*module_info)(struct sfp *sfp, struct ethtool_modinfo *modinfo);
24ce0aa27fSRussell King 	int (*module_eeprom)(struct sfp *sfp, struct ethtool_eeprom *ee,
25ce0aa27fSRussell King 			     u8 *data);
26d740513fSAndrew Lunn 	int (*module_eeprom_by_page)(struct sfp *sfp,
27d740513fSAndrew Lunn 				     const struct ethtool_module_eeprom *page,
28d740513fSAndrew Lunn 				     struct netlink_ext_ack *extack);
29ce0aa27fSRussell King };
30ce0aa27fSRussell King 
31ce0aa27fSRussell King int sfp_add_phy(struct sfp_bus *bus, struct phy_device *phydev);
32ce0aa27fSRussell King void sfp_remove_phy(struct sfp_bus *bus);
33ce0aa27fSRussell King void sfp_link_up(struct sfp_bus *bus);
34ce0aa27fSRussell King void sfp_link_down(struct sfp_bus *bus);
3523571c7bSRussell King (Oracle) int sfp_module_insert(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
3623571c7bSRussell King (Oracle) 		      const struct sfp_quirk *quirk);
37ce0aa27fSRussell King void sfp_module_remove(struct sfp_bus *bus);
3874c551caSRussell King int sfp_module_start(struct sfp_bus *bus);
3974c551caSRussell King void sfp_module_stop(struct sfp_bus *bus);
40ce0aa27fSRussell King struct sfp_bus *sfp_register_socket(struct device *dev, struct sfp *sfp,
41ce0aa27fSRussell King 				    const struct sfp_socket_ops *ops);
42ce0aa27fSRussell King void sfp_unregister_socket(struct sfp_bus *bus);
43ce0aa27fSRussell King 
44ce0aa27fSRussell King #endif
45