• Home
  • Raw
  • Download

Lines Matching refs:bus

142 int sfp_parse_port(struct sfp_bus *bus, const struct sfp_eeprom_id *id,  in sfp_parse_port()  argument
181 dev_warn(bus->sfp_dev, "SFP: unknown connector id 0x%02x\n", in sfp_parse_port()
211 bool sfp_may_have_phy(struct sfp_bus *bus, const struct sfp_eeprom_id *id) in sfp_may_have_phy() argument
239 void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id, in sfp_parse_support() argument
341 dev_warn(bus->sfp_dev, in sfp_parse_support()
368 if (bus->sfp_quirk) in sfp_parse_support()
369 bus->sfp_quirk->modes(id, modes); in sfp_parse_support()
387 phy_interface_t sfp_select_interface(struct sfp_bus *bus, in sfp_select_interface() argument
408 dev_warn(bus->sfp_dev, "Unable to ascertain link mode\n"); in sfp_select_interface()
417 static const struct sfp_upstream_ops *sfp_get_upstream_ops(struct sfp_bus *bus) in sfp_get_upstream_ops() argument
419 return bus->registered ? bus->upstream_ops : NULL; in sfp_get_upstream_ops()
455 struct sfp_bus *bus = container_of(kref, struct sfp_bus, kref); in sfp_bus_release() local
457 list_del(&bus->node); in sfp_bus_release()
459 kfree(bus); in sfp_bus_release()
469 void sfp_bus_put(struct sfp_bus *bus) in sfp_bus_put() argument
471 if (bus) in sfp_bus_put()
472 kref_put_mutex(&bus->kref, sfp_bus_release, &sfp_mutex); in sfp_bus_put()
476 static int sfp_register_bus(struct sfp_bus *bus) in sfp_register_bus() argument
478 const struct sfp_upstream_ops *ops = bus->upstream_ops; in sfp_register_bus()
483 ops->link_down(bus->upstream); in sfp_register_bus()
484 if (ops->connect_phy && bus->phydev) { in sfp_register_bus()
485 ret = ops->connect_phy(bus->upstream, bus->phydev); in sfp_register_bus()
490 bus->registered = true; in sfp_register_bus()
491 bus->socket_ops->attach(bus->sfp); in sfp_register_bus()
492 if (bus->started) in sfp_register_bus()
493 bus->socket_ops->start(bus->sfp); in sfp_register_bus()
494 bus->upstream_ops->attach(bus->upstream, bus); in sfp_register_bus()
498 static void sfp_unregister_bus(struct sfp_bus *bus) in sfp_unregister_bus() argument
500 const struct sfp_upstream_ops *ops = bus->upstream_ops; in sfp_unregister_bus()
502 if (bus->registered) { in sfp_unregister_bus()
503 bus->upstream_ops->detach(bus->upstream, bus); in sfp_unregister_bus()
504 if (bus->started) in sfp_unregister_bus()
505 bus->socket_ops->stop(bus->sfp); in sfp_unregister_bus()
506 bus->socket_ops->detach(bus->sfp); in sfp_unregister_bus()
507 if (bus->phydev && ops && ops->disconnect_phy) in sfp_unregister_bus()
508 ops->disconnect_phy(bus->upstream); in sfp_unregister_bus()
510 bus->registered = false; in sfp_unregister_bus()
523 int sfp_get_module_info(struct sfp_bus *bus, struct ethtool_modinfo *modinfo) in sfp_get_module_info() argument
525 return bus->socket_ops->module_info(bus->sfp, modinfo); in sfp_get_module_info()
540 int sfp_get_module_eeprom(struct sfp_bus *bus, struct ethtool_eeprom *ee, in sfp_get_module_eeprom() argument
543 return bus->socket_ops->module_eeprom(bus->sfp, ee, data); in sfp_get_module_eeprom()
556 void sfp_upstream_start(struct sfp_bus *bus) in sfp_upstream_start() argument
558 if (bus->registered) in sfp_upstream_start()
559 bus->socket_ops->start(bus->sfp); in sfp_upstream_start()
560 bus->started = true; in sfp_upstream_start()
573 void sfp_upstream_stop(struct sfp_bus *bus) in sfp_upstream_stop() argument
575 if (bus->registered) in sfp_upstream_stop()
576 bus->socket_ops->stop(bus->sfp); in sfp_upstream_stop()
577 bus->started = false; in sfp_upstream_stop()
581 static void sfp_upstream_clear(struct sfp_bus *bus) in sfp_upstream_clear() argument
583 bus->upstream_ops = NULL; in sfp_upstream_clear()
584 bus->upstream = NULL; in sfp_upstream_clear()
608 struct sfp_bus *bus; in sfp_bus_find_fwnode() local
623 bus = sfp_bus_get(ref.fwnode); in sfp_bus_find_fwnode()
625 if (!bus) in sfp_bus_find_fwnode()
628 return bus; in sfp_bus_find_fwnode()
652 int sfp_bus_add_upstream(struct sfp_bus *bus, void *upstream, in sfp_bus_add_upstream() argument
658 if (!bus) in sfp_bus_add_upstream()
662 kref_get(&bus->kref); in sfp_bus_add_upstream()
663 bus->upstream_ops = ops; in sfp_bus_add_upstream()
664 bus->upstream = upstream; in sfp_bus_add_upstream()
666 if (bus->sfp) { in sfp_bus_add_upstream()
667 ret = sfp_register_bus(bus); in sfp_bus_add_upstream()
669 sfp_upstream_clear(bus); in sfp_bus_add_upstream()
676 sfp_bus_put(bus); in sfp_bus_add_upstream()
689 void sfp_bus_del_upstream(struct sfp_bus *bus) in sfp_bus_del_upstream() argument
691 if (bus) { in sfp_bus_del_upstream()
693 if (bus->sfp) in sfp_bus_del_upstream()
694 sfp_unregister_bus(bus); in sfp_bus_del_upstream()
695 sfp_upstream_clear(bus); in sfp_bus_del_upstream()
698 sfp_bus_put(bus); in sfp_bus_del_upstream()
704 int sfp_add_phy(struct sfp_bus *bus, struct phy_device *phydev) in sfp_add_phy() argument
706 const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus); in sfp_add_phy()
710 ret = ops->connect_phy(bus->upstream, phydev); in sfp_add_phy()
713 bus->phydev = phydev; in sfp_add_phy()
719 void sfp_remove_phy(struct sfp_bus *bus) in sfp_remove_phy() argument
721 const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus); in sfp_remove_phy()
724 ops->disconnect_phy(bus->upstream); in sfp_remove_phy()
725 bus->phydev = NULL; in sfp_remove_phy()
729 void sfp_link_up(struct sfp_bus *bus) in sfp_link_up() argument
731 const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus); in sfp_link_up()
734 ops->link_up(bus->upstream); in sfp_link_up()
738 void sfp_link_down(struct sfp_bus *bus) in sfp_link_down() argument
740 const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus); in sfp_link_down()
743 ops->link_down(bus->upstream); in sfp_link_down()
747 int sfp_module_insert(struct sfp_bus *bus, const struct sfp_eeprom_id *id) in sfp_module_insert() argument
749 const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus); in sfp_module_insert()
752 bus->sfp_quirk = sfp_lookup_quirk(id); in sfp_module_insert()
755 ret = ops->module_insert(bus->upstream, id); in sfp_module_insert()
761 void sfp_module_remove(struct sfp_bus *bus) in sfp_module_remove() argument
763 const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus); in sfp_module_remove()
766 ops->module_remove(bus->upstream); in sfp_module_remove()
768 bus->sfp_quirk = NULL; in sfp_module_remove()
772 int sfp_module_start(struct sfp_bus *bus) in sfp_module_start() argument
774 const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus); in sfp_module_start()
778 ret = ops->module_start(bus->upstream); in sfp_module_start()
784 void sfp_module_stop(struct sfp_bus *bus) in sfp_module_stop() argument
786 const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus); in sfp_module_stop()
789 ops->module_stop(bus->upstream); in sfp_module_stop()
793 static void sfp_socket_clear(struct sfp_bus *bus) in sfp_socket_clear() argument
795 bus->sfp_dev = NULL; in sfp_socket_clear()
796 bus->sfp = NULL; in sfp_socket_clear()
797 bus->socket_ops = NULL; in sfp_socket_clear()
803 struct sfp_bus *bus = sfp_bus_get(dev->fwnode); in sfp_register_socket() local
806 if (bus) { in sfp_register_socket()
808 bus->sfp_dev = dev; in sfp_register_socket()
809 bus->sfp = sfp; in sfp_register_socket()
810 bus->socket_ops = ops; in sfp_register_socket()
812 if (bus->upstream_ops) { in sfp_register_socket()
813 ret = sfp_register_bus(bus); in sfp_register_socket()
815 sfp_socket_clear(bus); in sfp_register_socket()
821 sfp_bus_put(bus); in sfp_register_socket()
822 bus = NULL; in sfp_register_socket()
825 return bus; in sfp_register_socket()
829 void sfp_unregister_socket(struct sfp_bus *bus) in sfp_unregister_socket() argument
832 if (bus->upstream_ops) in sfp_unregister_socket()
833 sfp_unregister_bus(bus); in sfp_unregister_socket()
834 sfp_socket_clear(bus); in sfp_unregister_socket()
837 sfp_bus_put(bus); in sfp_unregister_socket()