162306a36Sopenharmony_ci#ifndef SFP_H 262306a36Sopenharmony_ci#define SFP_H 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#include <linux/ethtool.h> 562306a36Sopenharmony_ci#include <linux/sfp.h> 662306a36Sopenharmony_ci 762306a36Sopenharmony_cistruct sfp; 862306a36Sopenharmony_ci 962306a36Sopenharmony_cistruct sfp_quirk { 1062306a36Sopenharmony_ci const char *vendor; 1162306a36Sopenharmony_ci const char *part; 1262306a36Sopenharmony_ci void (*modes)(const struct sfp_eeprom_id *id, unsigned long *modes, 1362306a36Sopenharmony_ci unsigned long *interfaces); 1462306a36Sopenharmony_ci void (*fixup)(struct sfp *sfp); 1562306a36Sopenharmony_ci}; 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_cistruct sfp_socket_ops { 1862306a36Sopenharmony_ci void (*attach)(struct sfp *sfp); 1962306a36Sopenharmony_ci void (*detach)(struct sfp *sfp); 2062306a36Sopenharmony_ci void (*start)(struct sfp *sfp); 2162306a36Sopenharmony_ci void (*stop)(struct sfp *sfp); 2262306a36Sopenharmony_ci void (*set_signal_rate)(struct sfp *sfp, unsigned int rate_kbd); 2362306a36Sopenharmony_ci int (*module_info)(struct sfp *sfp, struct ethtool_modinfo *modinfo); 2462306a36Sopenharmony_ci int (*module_eeprom)(struct sfp *sfp, struct ethtool_eeprom *ee, 2562306a36Sopenharmony_ci u8 *data); 2662306a36Sopenharmony_ci int (*module_eeprom_by_page)(struct sfp *sfp, 2762306a36Sopenharmony_ci const struct ethtool_module_eeprom *page, 2862306a36Sopenharmony_ci struct netlink_ext_ack *extack); 2962306a36Sopenharmony_ci}; 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ciint sfp_add_phy(struct sfp_bus *bus, struct phy_device *phydev); 3262306a36Sopenharmony_civoid sfp_remove_phy(struct sfp_bus *bus); 3362306a36Sopenharmony_civoid sfp_link_up(struct sfp_bus *bus); 3462306a36Sopenharmony_civoid sfp_link_down(struct sfp_bus *bus); 3562306a36Sopenharmony_ciint sfp_module_insert(struct sfp_bus *bus, const struct sfp_eeprom_id *id, 3662306a36Sopenharmony_ci const struct sfp_quirk *quirk); 3762306a36Sopenharmony_civoid sfp_module_remove(struct sfp_bus *bus); 3862306a36Sopenharmony_ciint sfp_module_start(struct sfp_bus *bus); 3962306a36Sopenharmony_civoid sfp_module_stop(struct sfp_bus *bus); 4062306a36Sopenharmony_cistruct sfp_bus *sfp_register_socket(struct device *dev, struct sfp *sfp, 4162306a36Sopenharmony_ci const struct sfp_socket_ops *ops); 4262306a36Sopenharmony_civoid sfp_unregister_socket(struct sfp_bus *bus); 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#endif 45