Lines Matching full:phydev
250 void phy_device_free(struct phy_device *phydev) in phy_device_free() argument
252 put_device(&phydev->mdio.dev); in phy_device_free()
258 struct phy_device *phydev; in phy_mdio_device_free() local
260 phydev = container_of(mdiodev, struct phy_device, mdio); in phy_mdio_device_free()
261 phy_device_free(phydev); in phy_mdio_device_free()
272 struct phy_device *phydev; in phy_mdio_device_remove() local
274 phydev = container_of(mdiodev, struct phy_device, mdio); in phy_mdio_device_remove()
275 phy_device_remove(phydev); in phy_mdio_device_remove()
283 static bool phy_drv_wol_enabled(struct phy_device *phydev) in phy_drv_wol_enabled() argument
287 phy_ethtool_get_wol(phydev, &wol); in phy_drv_wol_enabled()
292 static bool mdio_bus_phy_may_suspend(struct phy_device *phydev) in mdio_bus_phy_may_suspend() argument
294 struct device_driver *drv = phydev->mdio.dev.driver; in mdio_bus_phy_may_suspend()
296 struct net_device *netdev = phydev->attached_dev; in mdio_bus_phy_may_suspend()
304 if (!netdev && phy_drv_wol_enabled(phydev)) in mdio_bus_phy_may_suspend()
334 return !phydev->suspended; in mdio_bus_phy_may_suspend()
339 struct phy_device *phydev = to_phy_device(dev); in mdio_bus_phy_suspend() local
341 if (phydev->mac_managed_pm) in mdio_bus_phy_suspend()
348 if (phy_interrupt_is_valid(phydev)) { in mdio_bus_phy_suspend()
349 phydev->irq_suspended = 1; in mdio_bus_phy_suspend()
350 synchronize_irq(phydev->irq); in mdio_bus_phy_suspend()
354 * control, possibly with the phydev->lock held. Upon resume, netdev in mdio_bus_phy_suspend()
358 if (phydev->attached_dev && phydev->adjust_link) in mdio_bus_phy_suspend()
359 phy_stop_machine(phydev); in mdio_bus_phy_suspend()
361 if (!mdio_bus_phy_may_suspend(phydev)) in mdio_bus_phy_suspend()
364 phydev->suspended_by_mdio_bus = 1; in mdio_bus_phy_suspend()
366 return phy_suspend(phydev); in mdio_bus_phy_suspend()
371 struct phy_device *phydev = to_phy_device(dev); in mdio_bus_phy_resume() local
374 if (phydev->mac_managed_pm) in mdio_bus_phy_resume()
377 if (!phydev->suspended_by_mdio_bus) in mdio_bus_phy_resume()
380 phydev->suspended_by_mdio_bus = 0; in mdio_bus_phy_resume()
387 WARN_ON(phydev->state != PHY_HALTED && phydev->state != PHY_READY && in mdio_bus_phy_resume()
388 phydev->state != PHY_UP); in mdio_bus_phy_resume()
390 ret = phy_init_hw(phydev); in mdio_bus_phy_resume()
394 ret = phy_resume(phydev); in mdio_bus_phy_resume()
398 if (phy_interrupt_is_valid(phydev)) { in mdio_bus_phy_resume()
399 phydev->irq_suspended = 0; in mdio_bus_phy_resume()
400 synchronize_irq(phydev->irq); in mdio_bus_phy_resume()
405 if (phydev->irq_rerun) { in mdio_bus_phy_resume()
406 phydev->irq_rerun = 0; in mdio_bus_phy_resume()
407 enable_irq(phydev->irq); in mdio_bus_phy_resume()
408 irq_wake_thread(phydev->irq, phydev); in mdio_bus_phy_resume()
412 if (phydev->attached_dev && phydev->adjust_link) in mdio_bus_phy_resume()
413 phy_start_machine(phydev); in mdio_bus_phy_resume()
423 * @bus_id: A string which matches phydev->mdio.dev.bus_id (or PHY_ANY_ID)
424 * @phy_uid: Used to match against phydev->phy_id (the UID of the PHY)
426 * @phy_uid_mask: Applied to phydev->phy_id and fixup->phy_uid before
513 /* Returns 1 if fixup matches phydev in bus_id and phy_uid.
516 static int phy_needs_fixup(struct phy_device *phydev, struct phy_fixup *fixup) in phy_needs_fixup() argument
518 if (strcmp(fixup->bus_id, phydev_name(phydev)) != 0) in phy_needs_fixup()
522 if (!phy_id_compare(phydev->phy_id, fixup->phy_uid, in phy_needs_fixup()
530 /* Runs any matching fixups for this phydev */
531 static int phy_scan_fixups(struct phy_device *phydev) in phy_scan_fixups() argument
537 if (phy_needs_fixup(phydev, fixup)) { in phy_scan_fixups()
538 int err = fixup->run(phydev); in phy_scan_fixups()
544 phydev->has_fixups = true; in phy_scan_fixups()
554 struct phy_device *phydev = to_phy_device(dev); in phy_bus_match() local
556 const int num_ids = ARRAY_SIZE(phydev->c45_ids.device_ids); in phy_bus_match()
563 return phydrv->match_phy_device(phydev); in phy_bus_match()
565 if (phydev->is_c45) { in phy_bus_match()
567 if (phydev->c45_ids.device_ids[i] == 0xffffffff) in phy_bus_match()
570 if (phy_id_compare(phydev->c45_ids.device_ids[i], in phy_bus_match()
576 return phy_id_compare(phydev->phy_id, phydrv->phy_id, in phy_bus_match()
584 struct phy_device *phydev = to_phy_device(dev); in phy_id_show() local
586 return sysfs_emit(buf, "0x%.8lx\n", (unsigned long)phydev->phy_id); in phy_id_show()
593 struct phy_device *phydev = to_phy_device(dev); in phy_interface_show() local
596 if (phy_is_internal(phydev)) in phy_interface_show()
599 mode = phy_modes(phydev->interface); in phy_interface_show()
609 struct phy_device *phydev = to_phy_device(dev); in phy_has_fixups_show() local
611 return sysfs_emit(buf, "%d\n", phydev->has_fixups); in phy_has_fixups_show()
619 struct phy_device *phydev = to_phy_device(dev); in phy_dev_flags_show() local
621 return sysfs_emit(buf, "0x%08x\n", phydev->dev_flags); in phy_dev_flags_show()
1013 * @phydev: phy_device structure to be added to the MDIO bus
1015 int phy_device_register(struct phy_device *phydev) in phy_device_register() argument
1019 err = mdiobus_register_device(&phydev->mdio); in phy_device_register()
1024 phy_device_reset(phydev, 0); in phy_device_register()
1027 err = phy_scan_fixups(phydev); in phy_device_register()
1029 phydev_err(phydev, "failed to initialize\n"); in phy_device_register()
1033 err = device_add(&phydev->mdio.dev); in phy_device_register()
1035 phydev_err(phydev, "failed to add\n"); in phy_device_register()
1043 phy_device_reset(phydev, 1); in phy_device_register()
1045 mdiobus_unregister_device(&phydev->mdio); in phy_device_register()
1052 * @phydev: phy_device structure to remove
1058 void phy_device_remove(struct phy_device *phydev) in phy_device_remove() argument
1060 unregister_mii_timestamper(phydev->mii_ts); in phy_device_remove()
1061 pse_control_put(phydev->psec); in phy_device_remove()
1063 device_del(&phydev->mdio.dev); in phy_device_remove()
1066 phy_device_reset(phydev, 1); in phy_device_remove()
1068 mdiobus_unregister_device(&phydev->mdio); in phy_device_remove()
1074 * @phydev: phy_device structure to read 802.3-c45 IDs
1079 int phy_get_c45_ids(struct phy_device *phydev) in phy_get_c45_ids() argument
1081 return get_phy_c45_ids(phydev->mdio.bus, phydev->mdio.addr, in phy_get_c45_ids()
1082 &phydev->c45_ids); in phy_get_c45_ids()
1092 struct phy_device *phydev; in phy_find_first() local
1096 phydev = mdiobus_get_phy(bus, addr); in phy_find_first()
1097 if (phydev) in phy_find_first()
1098 return phydev; in phy_find_first()
1104 static void phy_link_change(struct phy_device *phydev, bool up) in phy_link_change() argument
1106 struct net_device *netdev = phydev->attached_dev; in phy_link_change()
1112 phydev->adjust_link(netdev); in phy_link_change()
1113 if (phydev->mii_ts && phydev->mii_ts->link_state) in phy_link_change()
1114 phydev->mii_ts->link_state(phydev->mii_ts, phydev); in phy_link_change()
1119 * @phydev: target phy_device struct
1129 static void phy_prepare_link(struct phy_device *phydev, in phy_prepare_link() argument
1132 phydev->adjust_link = handler; in phy_prepare_link()
1138 * @phydev: the pointer to the phy device
1142 int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, in phy_connect_direct() argument
1151 rc = phy_attach_direct(dev, phydev, phydev->dev_flags, interface); in phy_connect_direct()
1155 phy_prepare_link(phydev, handler); in phy_connect_direct()
1156 if (phy_interrupt_is_valid(phydev)) in phy_connect_direct()
1157 phy_request_interrupt(phydev); in phy_connect_direct()
1182 struct phy_device *phydev; in phy_connect() local
1194 phydev = to_phy_device(d); in phy_connect()
1196 rc = phy_connect_direct(dev, phydev, handler, interface); in phy_connect()
1201 return phydev; in phy_connect()
1208 * @phydev: target phy_device struct
1210 void phy_disconnect(struct phy_device *phydev) in phy_disconnect() argument
1212 if (phy_is_started(phydev)) in phy_disconnect()
1213 phy_stop(phydev); in phy_disconnect()
1215 if (phy_interrupt_is_valid(phydev)) in phy_disconnect()
1216 phy_free_interrupt(phydev); in phy_disconnect()
1218 phydev->adjust_link = NULL; in phy_disconnect()
1220 phy_detach(phydev); in phy_disconnect()
1226 * @phydev: The PHY device to poll
1242 static int phy_poll_reset(struct phy_device *phydev) in phy_poll_reset() argument
1247 ret = phy_read_poll_timeout(phydev, MII_BMCR, val, !(val & BMCR_RESET), in phy_poll_reset()
1258 int phy_init_hw(struct phy_device *phydev) in phy_init_hw() argument
1263 phy_device_reset(phydev, 0); in phy_init_hw()
1265 if (!phydev->drv) in phy_init_hw()
1268 if (phydev->drv->soft_reset) { in phy_init_hw()
1269 ret = phydev->drv->soft_reset(phydev); in phy_init_hw()
1274 phydev->suspended = 0; in phy_init_hw()
1277 ret = phy_scan_fixups(phydev); in phy_init_hw()
1281 phy_interface_zero(phydev->possible_interfaces); in phy_init_hw()
1283 if (phydev->drv->config_init) { in phy_init_hw()
1284 ret = phydev->drv->config_init(phydev); in phy_init_hw()
1289 if (phydev->drv->config_intr) { in phy_init_hw()
1290 ret = phydev->drv->config_intr(phydev); in phy_init_hw()
1299 void phy_attached_info(struct phy_device *phydev) in phy_attached_info() argument
1301 phy_attached_print(phydev, NULL); in phy_attached_info()
1306 char *phy_attached_info_irq(struct phy_device *phydev) in phy_attached_info_irq() argument
1311 switch(phydev->irq) { in phy_attached_info_irq()
1319 snprintf(irq_num, sizeof(irq_num), "%d", phydev->irq); in phy_attached_info_irq()
1328 void phy_attached_print(struct phy_device *phydev, const char *fmt, ...) in phy_attached_print() argument
1330 const char *unbound = phydev->drv ? "" : "[unbound] "; in phy_attached_print()
1331 char *irq_str = phy_attached_info_irq(phydev); in phy_attached_print()
1334 phydev_info(phydev, ATTACHED_FMT "\n", unbound, in phy_attached_print()
1335 phydev_name(phydev), irq_str); in phy_attached_print()
1339 phydev_info(phydev, ATTACHED_FMT, unbound, in phy_attached_print()
1340 phydev_name(phydev), irq_str); in phy_attached_print()
1350 static void phy_sysfs_create_links(struct phy_device *phydev) in phy_sysfs_create_links() argument
1352 struct net_device *dev = phydev->attached_dev; in phy_sysfs_create_links()
1358 err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj, in phy_sysfs_create_links()
1364 &phydev->mdio.dev.kobj, in phy_sysfs_create_links()
1365 "phydev"); in phy_sysfs_create_links()
1368 kobject_name(&phydev->mdio.dev.kobj), in phy_sysfs_create_links()
1375 phydev->sysfs_links = true; in phy_sysfs_create_links()
1382 struct phy_device *phydev = to_phy_device(dev); in phy_standalone_show() local
1384 return sysfs_emit(buf, "%d\n", !phydev->attached_dev); in phy_standalone_show()
1400 struct phy_device *phydev = upstream; in phy_sfp_connect_phy() local
1401 struct net_device *dev = phydev->attached_dev; in phy_sfp_connect_phy()
1404 return phy_link_topo_add_phy(dev, phy, PHY_UPSTREAM_PHY, phydev); in phy_sfp_connect_phy()
1422 struct phy_device *phydev = upstream; in phy_sfp_disconnect_phy() local
1423 struct net_device *dev = phydev->attached_dev; in phy_sfp_disconnect_phy()
1439 struct phy_device *phydev = upstream; in phy_sfp_attach() local
1441 if (phydev->attached_dev) in phy_sfp_attach()
1442 phydev->attached_dev->sfp_bus = bus; in phy_sfp_attach()
1443 phydev->sfp_bus_attached = true; in phy_sfp_attach()
1456 struct phy_device *phydev = upstream; in phy_sfp_detach() local
1458 if (phydev->attached_dev) in phy_sfp_detach()
1459 phydev->attached_dev->sfp_bus = NULL; in phy_sfp_detach()
1460 phydev->sfp_bus_attached = false; in phy_sfp_detach()
1466 * @phydev: Pointer to phy_device
1469 int phy_sfp_probe(struct phy_device *phydev, in phy_sfp_probe() argument
1475 if (phydev->mdio.dev.fwnode) { in phy_sfp_probe()
1476 bus = sfp_bus_find_fwnode(phydev->mdio.dev.fwnode); in phy_sfp_probe()
1480 phydev->sfp_bus = bus; in phy_sfp_probe()
1482 ret = sfp_bus_add_upstream(bus, phydev, ops); in phy_sfp_probe()
1497 * @phydev: Pointer to phy_device to attach
1509 int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, in phy_attach_direct() argument
1512 struct mii_bus *bus = phydev->mdio.bus; in phy_attach_direct()
1513 struct device *d = &phydev->mdio.dev; in phy_attach_direct()
1526 phydev_err(phydev, "failed to get the bus module\n"); in phy_attach_direct()
1536 if (phydev->is_c45) in phy_attach_direct()
1545 phydev_err(phydev, "failed to get the device driver module\n"); in phy_attach_direct()
1559 if (phydev->attached_dev) { in phy_attach_direct()
1565 phydev->phy_link_change = phy_link_change; in phy_attach_direct()
1567 phydev->attached_dev = dev; in phy_attach_direct()
1568 dev->phydev = phydev; in phy_attach_direct()
1570 if (phydev->sfp_bus_attached) in phy_attach_direct()
1571 dev->sfp_bus = phydev->sfp_bus; in phy_attach_direct()
1573 err = phy_link_topo_add_phy(dev, phydev, PHY_UPSTREAM_MAC, dev); in phy_attach_direct()
1586 phydev->sysfs_links = false; in phy_attach_direct()
1588 phy_sysfs_create_links(phydev); in phy_attach_direct()
1590 if (!phydev->attached_dev) { in phy_attach_direct()
1591 err = sysfs_create_file(&phydev->mdio.dev.kobj, in phy_attach_direct()
1594 phydev_err(phydev, "error creating 'phy_standalone' sysfs entry\n"); in phy_attach_direct()
1597 phydev->dev_flags |= flags; in phy_attach_direct()
1599 phydev->interface = interface; in phy_attach_direct()
1601 phydev->state = PHY_READY; in phy_attach_direct()
1603 phydev->interrupts = PHY_INTERRUPT_DISABLED; in phy_attach_direct()
1609 if (phydev->dev_flags & PHY_F_NO_IRQ) in phy_attach_direct()
1610 phydev->irq = PHY_POLL; in phy_attach_direct()
1612 if (!phy_drv_supports_irq(phydev->drv) && phy_interrupt_is_valid(phydev)) in phy_attach_direct()
1613 phydev->irq = PHY_POLL; in phy_attach_direct()
1621 phydev->port = PORT_MII; in phy_attach_direct()
1627 netif_carrier_off(phydev->attached_dev); in phy_attach_direct()
1633 err = phy_init_hw(phydev); in phy_attach_direct()
1637 phy_resume(phydev); in phy_attach_direct()
1638 if (!phydev->is_on_sfp_module) in phy_attach_direct()
1639 phy_led_triggers_register(phydev); in phy_attach_direct()
1646 if (dev && phydev->mdio.bus->parent && dev->dev.parent != phydev->mdio.bus->parent) in phy_attach_direct()
1647 phydev->devlink = device_link_add(dev->dev.parent, &phydev->mdio.dev, in phy_attach_direct()
1654 phy_detach(phydev); in phy_attach_direct()
1680 struct phy_device *phydev; in phy_attach() local
1695 phydev = to_phy_device(d); in phy_attach()
1697 rc = phy_attach_direct(dev, phydev, phydev->dev_flags, interface); in phy_attach()
1702 return phydev; in phy_attach()
1706 static bool phy_driver_is_genphy_kind(struct phy_device *phydev, in phy_driver_is_genphy_kind() argument
1709 struct device *d = &phydev->mdio.dev; in phy_driver_is_genphy_kind()
1712 if (!phydev->drv) in phy_driver_is_genphy_kind()
1722 bool phy_driver_is_genphy(struct phy_device *phydev) in phy_driver_is_genphy() argument
1724 return phy_driver_is_genphy_kind(phydev, in phy_driver_is_genphy()
1729 bool phy_driver_is_genphy_10g(struct phy_device *phydev) in phy_driver_is_genphy_10g() argument
1731 return phy_driver_is_genphy_kind(phydev, in phy_driver_is_genphy_10g()
1738 * @phydev: target phy_device struct
1756 * This will set the shared pointer of the phydev to the shared storage.
1764 int phy_package_join(struct phy_device *phydev, int base_addr, size_t priv_size) in phy_package_join() argument
1766 struct mii_bus *bus = phydev->mdio.bus; in phy_package_join()
1798 phydev->shared = shared; in phy_package_join()
1812 * @phydev: target phy_device struct
1817 * The parent node of the @phydev is checked as a valid PHY package node
1830 int of_phy_package_join(struct phy_device *phydev, size_t priv_size) in of_phy_package_join() argument
1832 struct device_node *node = phydev->mdio.dev.of_node; in of_phy_package_join()
1854 ret = phy_package_join(phydev, base_addr, priv_size); in of_phy_package_join()
1858 phydev->shared->np = package_node; in of_phy_package_join()
1869 * @phydev: target phy_device struct
1871 * This leaves a PHY group created by phy_package_join(). If this phydev
1873 * freed. Resets the phydev->shared pointer to NULL.
1875 void phy_package_leave(struct phy_device *phydev) in phy_package_leave() argument
1877 struct phy_package_shared *shared = phydev->shared; in phy_package_leave()
1878 struct mii_bus *bus = phydev->mdio.bus; in phy_package_leave()
1894 phydev->shared = NULL; in phy_package_leave()
1906 * @phydev: target phy_device struct
1915 int devm_phy_package_join(struct device *dev, struct phy_device *phydev, in devm_phy_package_join() argument
1926 ret = phy_package_join(phydev, base_addr, priv_size); in devm_phy_package_join()
1929 *ptr = phydev; in devm_phy_package_join()
1942 * @phydev: target phy_device struct
1949 int devm_of_phy_package_join(struct device *dev, struct phy_device *phydev, in devm_of_phy_package_join() argument
1960 ret = of_phy_package_join(phydev, priv_size); in devm_of_phy_package_join()
1963 *ptr = phydev; in devm_of_phy_package_join()
1975 * @phydev: target phy_device struct
1980 void phy_detach(struct phy_device *phydev) in phy_detach() argument
1982 struct net_device *dev = phydev->attached_dev; in phy_detach()
1986 if (phydev->devlink) in phy_detach()
1987 device_link_del(phydev->devlink); in phy_detach()
1989 if (phydev->sysfs_links) { in phy_detach()
1991 sysfs_remove_link(&dev->dev.kobj, "phydev"); in phy_detach()
1992 sysfs_remove_link(&phydev->mdio.dev.kobj, "attached_dev"); in phy_detach()
1995 if (!phydev->attached_dev) in phy_detach()
1996 sysfs_remove_file(&phydev->mdio.dev.kobj, in phy_detach()
1999 phy_suspend(phydev); in phy_detach()
2001 phydev->attached_dev->phydev = NULL; in phy_detach()
2002 phydev->attached_dev = NULL; in phy_detach()
2003 phy_link_topo_del_phy(dev, phydev); in phy_detach()
2005 phydev->phylink = NULL; in phy_detach()
2007 if (!phydev->is_on_sfp_module) in phy_detach()
2008 phy_led_triggers_unregister(phydev); in phy_detach()
2010 if (phydev->mdio.dev.driver) in phy_detach()
2011 module_put(phydev->mdio.dev.driver->owner); in phy_detach()
2018 if (phy_driver_is_genphy(phydev) || in phy_detach()
2019 phy_driver_is_genphy_10g(phydev)) in phy_detach()
2020 device_release_driver(&phydev->mdio.dev); in phy_detach()
2023 phy_device_reset(phydev, 1); in phy_detach()
2026 * The phydev might go away on the put_device() below, so avoid in phy_detach()
2029 bus = phydev->mdio.bus; in phy_detach()
2031 put_device(&phydev->mdio.dev); in phy_detach()
2039 int phy_suspend(struct phy_device *phydev) in phy_suspend() argument
2041 struct net_device *netdev = phydev->attached_dev; in phy_suspend()
2042 const struct phy_driver *phydrv = phydev->drv; in phy_suspend()
2045 if (phydev->suspended || !phydrv) in phy_suspend()
2048 phydev->wol_enabled = phy_drv_wol_enabled(phydev) || in phy_suspend()
2051 if (phydev->wol_enabled && !(phydrv->flags & PHY_ALWAYS_CALL_SUSPEND)) in phy_suspend()
2057 ret = phydrv->suspend(phydev); in phy_suspend()
2059 phydev->suspended = true; in phy_suspend()
2065 int __phy_resume(struct phy_device *phydev) in __phy_resume() argument
2067 const struct phy_driver *phydrv = phydev->drv; in __phy_resume()
2070 lockdep_assert_held(&phydev->lock); in __phy_resume()
2075 ret = phydrv->resume(phydev); in __phy_resume()
2077 phydev->suspended = false; in __phy_resume()
2083 int phy_resume(struct phy_device *phydev) in phy_resume() argument
2087 mutex_lock(&phydev->lock); in phy_resume()
2088 ret = __phy_resume(phydev); in phy_resume()
2089 mutex_unlock(&phydev->lock); in phy_resume()
2095 int phy_loopback(struct phy_device *phydev, bool enable) in phy_loopback() argument
2099 if (!phydev->drv) in phy_loopback()
2102 mutex_lock(&phydev->lock); in phy_loopback()
2104 if (enable && phydev->loopback_enabled) { in phy_loopback()
2109 if (!enable && !phydev->loopback_enabled) { in phy_loopback()
2114 if (phydev->drv->set_loopback) in phy_loopback()
2115 ret = phydev->drv->set_loopback(phydev, enable); in phy_loopback()
2117 ret = genphy_loopback(phydev, enable); in phy_loopback()
2122 phydev->loopback_enabled = enable; in phy_loopback()
2125 mutex_unlock(&phydev->lock); in phy_loopback()
2132 * @phydev: target phy_device struct
2139 int phy_reset_after_clk_enable(struct phy_device *phydev) in phy_reset_after_clk_enable() argument
2141 if (!phydev || !phydev->drv) in phy_reset_after_clk_enable()
2144 if (phydev->drv->flags & PHY_RST_AFTER_CLK_EN) { in phy_reset_after_clk_enable()
2145 phy_device_reset(phydev, 1); in phy_reset_after_clk_enable()
2146 phy_device_reset(phydev, 0); in phy_reset_after_clk_enable()
2158 * @phydev: target phy_device struct
2166 static int genphy_config_advert(struct phy_device *phydev, in genphy_config_advert() argument
2175 err = phy_modify_changed(phydev, MII_ADVERTISE, in genphy_config_advert()
2184 bmsr = phy_read(phydev, MII_BMSR); in genphy_config_advert()
2197 err = phy_modify_changed(phydev, MII_CTRL1000, in genphy_config_advert()
2210 * @phydev: target phy_device struct
2218 static int genphy_c37_config_advert(struct phy_device *phydev) in genphy_c37_config_advert() argument
2223 linkmode_and(phydev->advertising, phydev->advertising, in genphy_c37_config_advert()
2224 phydev->supported); in genphy_c37_config_advert()
2227 phydev->advertising)) in genphy_c37_config_advert()
2230 phydev->advertising)) in genphy_c37_config_advert()
2233 phydev->advertising)) in genphy_c37_config_advert()
2236 return phy_modify_changed(phydev, MII_ADVERTISE, in genphy_c37_config_advert()
2244 * @phydev: target phy_device struct
2250 int genphy_config_eee_advert(struct phy_device *phydev) in genphy_config_eee_advert() argument
2255 if (!phydev->eee_broken_modes) in genphy_config_eee_advert()
2258 err = phy_modify_mmd_changed(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV, in genphy_config_eee_advert()
2259 phydev->eee_broken_modes, 0); in genphy_config_eee_advert()
2266 * genphy_setup_forced - configures/forces speed/duplex from @phydev
2267 * @phydev: target phy_device struct
2270 * to the values in phydev. Assumes that the values are valid.
2273 int genphy_setup_forced(struct phy_device *phydev) in genphy_setup_forced() argument
2277 phydev->pause = 0; in genphy_setup_forced()
2278 phydev->asym_pause = 0; in genphy_setup_forced()
2280 ctl = mii_bmcr_encode_fixed(phydev->speed, phydev->duplex); in genphy_setup_forced()
2282 return phy_modify(phydev, MII_BMCR, in genphy_setup_forced()
2287 static int genphy_setup_master_slave(struct phy_device *phydev) in genphy_setup_master_slave() argument
2291 if (!phydev->is_gigabit_capable) in genphy_setup_master_slave()
2294 switch (phydev->master_slave_set) { in genphy_setup_master_slave()
2310 phydev_warn(phydev, "Unsupported Master/Slave mode\n"); in genphy_setup_master_slave()
2314 return phy_modify_changed(phydev, MII_CTRL1000, in genphy_setup_master_slave()
2319 int genphy_read_master_slave(struct phy_device *phydev) in genphy_read_master_slave() argument
2324 phydev->master_slave_get = MASTER_SLAVE_CFG_UNKNOWN; in genphy_read_master_slave()
2325 phydev->master_slave_state = MASTER_SLAVE_STATE_UNKNOWN; in genphy_read_master_slave()
2327 val = phy_read(phydev, MII_CTRL1000); in genphy_read_master_slave()
2343 val = phy_read(phydev, MII_STAT1000); in genphy_read_master_slave()
2349 } else if (phydev->link) { in genphy_read_master_slave()
2359 phydev->master_slave_get = cfg; in genphy_read_master_slave()
2360 phydev->master_slave_state = state; in genphy_read_master_slave()
2368 * @phydev: target phy_device struct
2370 int genphy_restart_aneg(struct phy_device *phydev) in genphy_restart_aneg() argument
2373 return phy_modify(phydev, MII_BMCR, BMCR_ISOLATE, in genphy_restart_aneg()
2380 * @phydev: target phy_device struct
2385 int genphy_check_and_restart_aneg(struct phy_device *phydev, bool restart) in genphy_check_and_restart_aneg() argument
2393 ret = phy_read(phydev, MII_BMCR); in genphy_check_and_restart_aneg()
2402 return genphy_restart_aneg(phydev); in genphy_check_and_restart_aneg()
2410 * @phydev: target phy_device struct
2417 int __genphy_config_aneg(struct phy_device *phydev, bool changed) in __genphy_config_aneg() argument
2424 err = genphy_c45_an_config_eee_aneg(phydev); in __genphy_config_aneg()
2430 err = genphy_setup_master_slave(phydev); in __genphy_config_aneg()
2436 if (phydev->autoneg == AUTONEG_ENABLE) { in __genphy_config_aneg()
2438 linkmode_and(phydev->advertising, phydev->advertising, in __genphy_config_aneg()
2439 phydev->supported); in __genphy_config_aneg()
2440 advert = phydev->advertising; in __genphy_config_aneg()
2441 } else if (phydev->speed < SPEED_1000) { in __genphy_config_aneg()
2442 return genphy_setup_forced(phydev); in __genphy_config_aneg()
2446 set = phy_lookup_setting(phydev->speed, phydev->duplex, in __genphy_config_aneg()
2447 phydev->supported, true); in __genphy_config_aneg()
2454 err = genphy_config_advert(phydev, advert); in __genphy_config_aneg()
2460 return genphy_check_and_restart_aneg(phydev, changed); in __genphy_config_aneg()
2466 * @phydev: target phy_device struct
2473 int genphy_c37_config_aneg(struct phy_device *phydev) in genphy_c37_config_aneg() argument
2477 if (phydev->autoneg != AUTONEG_ENABLE) in genphy_c37_config_aneg()
2478 return genphy_setup_forced(phydev); in genphy_c37_config_aneg()
2480 err = phy_modify(phydev, MII_BMCR, BMCR_SPEED1000 | BMCR_SPEED100, in genphy_c37_config_aneg()
2485 changed = genphy_c37_config_advert(phydev); in genphy_c37_config_aneg()
2493 int ctl = phy_read(phydev, MII_BMCR); in genphy_c37_config_aneg()
2506 return genphy_restart_aneg(phydev); in genphy_c37_config_aneg()
2514 * @phydev: target phy_device struct
2520 int genphy_aneg_done(struct phy_device *phydev) in genphy_aneg_done() argument
2522 int retval = phy_read(phydev, MII_BMSR); in genphy_aneg_done()
2529 * genphy_update_link - update link status in @phydev
2530 * @phydev: target phy_device struct
2532 * Description: Update the value in phydev->link to reflect the
2536 int genphy_update_link(struct phy_device *phydev) in genphy_update_link() argument
2540 bmcr = phy_read(phydev, MII_BMCR); in genphy_update_link()
2555 if (!phy_polling_mode(phydev) || !phydev->link) { in genphy_update_link()
2556 status = phy_read(phydev, MII_BMSR); in genphy_update_link()
2564 status = phy_read(phydev, MII_BMSR); in genphy_update_link()
2568 phydev->link = status & BMSR_LSTATUS ? 1 : 0; in genphy_update_link()
2569 phydev->autoneg_complete = status & BMSR_ANEGCOMPLETE ? 1 : 0; in genphy_update_link()
2574 if (phydev->autoneg == AUTONEG_ENABLE && !phydev->autoneg_complete) in genphy_update_link()
2575 phydev->link = 0; in genphy_update_link()
2581 int genphy_read_lpa(struct phy_device *phydev) in genphy_read_lpa() argument
2585 if (phydev->autoneg == AUTONEG_ENABLE) { in genphy_read_lpa()
2586 if (!phydev->autoneg_complete) { in genphy_read_lpa()
2587 mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, in genphy_read_lpa()
2589 mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, 0); in genphy_read_lpa()
2593 if (phydev->is_gigabit_capable) { in genphy_read_lpa()
2594 lpagb = phy_read(phydev, MII_STAT1000); in genphy_read_lpa()
2599 int adv = phy_read(phydev, MII_CTRL1000); in genphy_read_lpa()
2605 phydev_err(phydev, "Master/Slave resolution failed, maybe conflicting manual settings?\n"); in genphy_read_lpa()
2607 phydev_err(phydev, "Master/Slave resolution failed\n"); in genphy_read_lpa()
2611 mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, in genphy_read_lpa()
2615 lpa = phy_read(phydev, MII_LPA); in genphy_read_lpa()
2619 mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa); in genphy_read_lpa()
2621 linkmode_zero(phydev->lp_advertising); in genphy_read_lpa()
2630 * @phydev: target phy_device struct
2635 int genphy_read_status_fixed(struct phy_device *phydev) in genphy_read_status_fixed() argument
2637 int bmcr = phy_read(phydev, MII_BMCR); in genphy_read_status_fixed()
2643 phydev->duplex = DUPLEX_FULL; in genphy_read_status_fixed()
2645 phydev->duplex = DUPLEX_HALF; in genphy_read_status_fixed()
2648 phydev->speed = SPEED_1000; in genphy_read_status_fixed()
2650 phydev->speed = SPEED_100; in genphy_read_status_fixed()
2652 phydev->speed = SPEED_10; in genphy_read_status_fixed()
2660 * @phydev: target phy_device struct
2667 int genphy_read_status(struct phy_device *phydev) in genphy_read_status() argument
2669 int err, old_link = phydev->link; in genphy_read_status()
2672 err = genphy_update_link(phydev); in genphy_read_status()
2677 if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) in genphy_read_status()
2680 phydev->master_slave_get = MASTER_SLAVE_CFG_UNSUPPORTED; in genphy_read_status()
2681 phydev->master_slave_state = MASTER_SLAVE_STATE_UNSUPPORTED; in genphy_read_status()
2682 phydev->speed = SPEED_UNKNOWN; in genphy_read_status()
2683 phydev->duplex = DUPLEX_UNKNOWN; in genphy_read_status()
2684 phydev->pause = 0; in genphy_read_status()
2685 phydev->asym_pause = 0; in genphy_read_status()
2687 if (phydev->is_gigabit_capable) { in genphy_read_status()
2688 err = genphy_read_master_slave(phydev); in genphy_read_status()
2693 err = genphy_read_lpa(phydev); in genphy_read_status()
2697 if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) { in genphy_read_status()
2698 phy_resolve_aneg_linkmode(phydev); in genphy_read_status()
2699 } else if (phydev->autoneg == AUTONEG_DISABLE) { in genphy_read_status()
2700 err = genphy_read_status_fixed(phydev); in genphy_read_status()
2711 * @phydev: target phy_device struct
2720 int genphy_c37_read_status(struct phy_device *phydev, bool *changed) in genphy_c37_read_status() argument
2722 int lpa, err, old_link = phydev->link; in genphy_c37_read_status()
2725 err = genphy_update_link(phydev); in genphy_c37_read_status()
2730 if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) { in genphy_c37_read_status()
2737 phydev->duplex = DUPLEX_UNKNOWN; in genphy_c37_read_status()
2738 phydev->pause = 0; in genphy_c37_read_status()
2739 phydev->asym_pause = 0; in genphy_c37_read_status()
2741 if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) { in genphy_c37_read_status()
2742 lpa = phy_read(phydev, MII_LPA); in genphy_c37_read_status()
2747 phydev->lp_advertising, lpa & LPA_LPACK); in genphy_c37_read_status()
2749 phydev->lp_advertising, lpa & LPA_1000XFULL); in genphy_c37_read_status()
2751 phydev->lp_advertising, lpa & LPA_1000XPAUSE); in genphy_c37_read_status()
2753 phydev->lp_advertising, in genphy_c37_read_status()
2756 phy_resolve_aneg_linkmode(phydev); in genphy_c37_read_status()
2757 } else if (phydev->autoneg == AUTONEG_DISABLE) { in genphy_c37_read_status()
2758 int bmcr = phy_read(phydev, MII_BMCR); in genphy_c37_read_status()
2764 phydev->duplex = DUPLEX_FULL; in genphy_c37_read_status()
2766 phydev->duplex = DUPLEX_HALF; in genphy_c37_read_status()
2775 * @phydev: target phy_device struct
2782 int genphy_soft_reset(struct phy_device *phydev) in genphy_soft_reset() argument
2787 if (phydev->autoneg == AUTONEG_ENABLE) in genphy_soft_reset()
2790 ret = phy_modify(phydev, MII_BMCR, BMCR_ISOLATE, res); in genphy_soft_reset()
2798 phydev->suspended = 0; in genphy_soft_reset()
2800 ret = phy_poll_reset(phydev); in genphy_soft_reset()
2805 if (phydev->autoneg == AUTONEG_DISABLE) in genphy_soft_reset()
2806 ret = genphy_setup_forced(phydev); in genphy_soft_reset()
2812 irqreturn_t genphy_handle_interrupt_no_ack(struct phy_device *phydev) in genphy_handle_interrupt_no_ack() argument
2819 phy_trigger_machine(phydev); in genphy_handle_interrupt_no_ack()
2827 * @phydev: target phy_device struct
2830 * phydev->supported accordingly.
2834 int genphy_read_abilities(struct phy_device *phydev) in genphy_read_abilities() argument
2840 phydev->supported); in genphy_read_abilities()
2842 val = phy_read(phydev, MII_BMSR); in genphy_read_abilities()
2846 linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported, in genphy_read_abilities()
2849 linkmode_mod_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, phydev->supported, in genphy_read_abilities()
2851 linkmode_mod_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, phydev->supported, in genphy_read_abilities()
2853 linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, phydev->supported, in genphy_read_abilities()
2855 linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, phydev->supported, in genphy_read_abilities()
2859 val = phy_read(phydev, MII_ESTATUS); in genphy_read_abilities()
2864 phydev->supported, val & ESTATUS_1000_TFULL); in genphy_read_abilities()
2866 phydev->supported, val & ESTATUS_1000_THALF); in genphy_read_abilities()
2868 phydev->supported, val & ESTATUS_1000_XFULL); in genphy_read_abilities()
2874 genphy_c45_read_eee_abilities(phydev); in genphy_read_abilities()
2897 int genphy_suspend(struct phy_device *phydev) in genphy_suspend() argument
2899 return phy_set_bits(phydev, MII_BMCR, BMCR_PDOWN); in genphy_suspend()
2903 int genphy_resume(struct phy_device *phydev) in genphy_resume() argument
2905 return phy_clear_bits(phydev, MII_BMCR, BMCR_PDOWN); in genphy_resume()
2909 int genphy_loopback(struct phy_device *phydev, bool enable) in genphy_loopback() argument
2915 ctl |= mii_bmcr_encode_fixed(phydev->speed, phydev->duplex); in genphy_loopback()
2917 phy_modify(phydev, MII_BMCR, ~0, ctl); in genphy_loopback()
2919 ret = phy_read_poll_timeout(phydev, MII_BMSR, val, in genphy_loopback()
2925 phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, 0); in genphy_loopback()
2927 phy_config_aneg(phydev); in genphy_loopback()
2936 * @phydev: phy_device structure to remove link mode from
2943 void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode) in phy_remove_link_mode() argument
2945 linkmode_clear_bit(link_mode, phydev->supported); in phy_remove_link_mode()
2946 phy_advertise_supported(phydev); in phy_remove_link_mode()
2960 * @phydev: target phy_device struct
2965 void phy_advertise_supported(struct phy_device *phydev) in phy_advertise_supported() argument
2969 linkmode_copy(new, phydev->supported); in phy_advertise_supported()
2970 phy_copy_pause_bits(new, phydev->advertising); in phy_advertise_supported()
2971 linkmode_copy(phydev->advertising, new); in phy_advertise_supported()
2977 * @phydev: target phy_device struct
2985 void phy_advertise_eee_all(struct phy_device *phydev) in phy_advertise_eee_all() argument
2987 linkmode_copy(phydev->advertising_eee, phydev->supported_eee); in phy_advertise_eee_all()
2993 * @phydev: Target phy_device struct
3011 void phy_support_eee(struct phy_device *phydev) in phy_support_eee() argument
3013 linkmode_copy(phydev->advertising_eee, phydev->supported_eee); in phy_support_eee()
3014 phydev->eee_cfg.tx_lpi_enabled = true; in phy_support_eee()
3015 phydev->eee_cfg.eee_enabled = true; in phy_support_eee()
3021 * @phydev: target phy_device struct
3026 void phy_support_sym_pause(struct phy_device *phydev) in phy_support_sym_pause() argument
3028 linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev->supported); in phy_support_sym_pause()
3029 phy_copy_pause_bits(phydev->advertising, phydev->supported); in phy_support_sym_pause()
3035 * @phydev: target phy_device struct
3039 void phy_support_asym_pause(struct phy_device *phydev) in phy_support_asym_pause() argument
3041 phy_copy_pause_bits(phydev->advertising, phydev->supported); in phy_support_asym_pause()
3047 * @phydev: target phy_device struct
3056 void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx, in phy_set_sym_pause() argument
3059 linkmode_clear_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev->supported); in phy_set_sym_pause()
3063 phydev->supported); in phy_set_sym_pause()
3065 linkmode_copy(phydev->advertising, phydev->supported); in phy_set_sym_pause()
3071 * @phydev: target phy_device struct
3080 void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx) in phy_set_asym_pause() argument
3084 linkmode_copy(oldadv, phydev->advertising); in phy_set_asym_pause()
3085 linkmode_set_pause(phydev->advertising, tx, rx); in phy_set_asym_pause()
3087 if (!linkmode_equal(oldadv, phydev->advertising) && in phy_set_asym_pause()
3088 phydev->autoneg) in phy_set_asym_pause()
3089 phy_start_aneg(phydev); in phy_set_asym_pause()
3095 * @phydev: phy_device struct
3102 bool phy_validate_pause(struct phy_device *phydev, in phy_validate_pause() argument
3106 phydev->supported) && pp->rx_pause) in phy_validate_pause()
3110 phydev->supported) && in phy_validate_pause()
3120 * @phydev: phy_device struct
3130 void phy_get_pause(struct phy_device *phydev, bool *tx_pause, bool *rx_pause) in phy_get_pause() argument
3132 if (phydev->duplex != DUPLEX_FULL) { in phy_get_pause()
3138 return linkmode_resolve_pause(phydev->advertising, in phy_get_pause()
3139 phydev->lp_advertising, in phy_get_pause()
3165 * @phydev: phy_device struct
3179 s32 phy_get_internal_delay(struct phy_device *phydev, struct device *dev, in phy_get_internal_delay() argument
3188 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || in phy_get_internal_delay()
3189 phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) in phy_get_internal_delay()
3198 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || in phy_get_internal_delay()
3199 phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) in phy_get_internal_delay()
3213 phydev_err(phydev, "Delay %d is out of range\n", delay); in phy_get_internal_delay()
3235 phydev_err(phydev, "error finding internal delay index for %d\n", in phy_get_internal_delay()
3246 struct phy_device *phydev = phyled->phydev; in phy_led_set_brightness() local
3249 mutex_lock(&phydev->lock); in phy_led_set_brightness()
3250 err = phydev->drv->led_brightness_set(phydev, phyled->index, value); in phy_led_set_brightness()
3251 mutex_unlock(&phydev->lock); in phy_led_set_brightness()
3261 struct phy_device *phydev = phyled->phydev; in phy_led_blink_set() local
3264 mutex_lock(&phydev->lock); in phy_led_blink_set()
3265 err = phydev->drv->led_blink_set(phydev, phyled->index, in phy_led_blink_set()
3267 mutex_unlock(&phydev->lock); in phy_led_blink_set()
3276 struct phy_device *phydev = phyled->phydev; in phy_led_hw_control_get_device() local
3278 if (phydev->attached_dev) in phy_led_hw_control_get_device()
3279 return &phydev->attached_dev->dev; in phy_led_hw_control_get_device()
3288 struct phy_device *phydev = phyled->phydev; in phy_led_hw_control_get() local
3291 mutex_lock(&phydev->lock); in phy_led_hw_control_get()
3292 err = phydev->drv->led_hw_control_get(phydev, phyled->index, rules); in phy_led_hw_control_get()
3293 mutex_unlock(&phydev->lock); in phy_led_hw_control_get()
3303 struct phy_device *phydev = phyled->phydev; in phy_led_hw_control_set() local
3306 mutex_lock(&phydev->lock); in phy_led_hw_control_set()
3307 err = phydev->drv->led_hw_control_set(phydev, phyled->index, rules); in phy_led_hw_control_set()
3308 mutex_unlock(&phydev->lock); in phy_led_hw_control_set()
3317 struct phy_device *phydev = phyled->phydev; in phy_led_hw_is_supported() local
3320 mutex_lock(&phydev->lock); in phy_led_hw_is_supported()
3321 err = phydev->drv->led_hw_is_supported(phydev, phyled->index, rules); in phy_led_hw_is_supported()
3322 mutex_unlock(&phydev->lock); in phy_led_hw_is_supported()
3327 static void phy_leds_unregister(struct phy_device *phydev) in phy_leds_unregister() argument
3331 list_for_each_entry_safe(phyled, tmp, &phydev->leds, list) { in phy_leds_unregister()
3337 static int of_phy_led(struct phy_device *phydev, in of_phy_led() argument
3340 struct device *dev = &phydev->mdio.dev; in of_phy_led()
3353 phyled->phydev = phydev; in of_phy_led()
3368 if (!phydev->drv->led_polarity_set) in of_phy_led()
3371 err = phydev->drv->led_polarity_set(phydev, index, modes); in of_phy_led()
3377 if (phydev->drv->led_brightness_set) in of_phy_led()
3379 if (phydev->drv->led_blink_set) in of_phy_led()
3383 if (phydev->drv->led_hw_is_supported && in of_phy_led()
3384 phydev->drv->led_hw_control_set && in of_phy_led()
3385 phydev->drv->led_hw_control_get) { in of_phy_led()
3395 init_data.devicename = dev_name(&phydev->mdio.dev); in of_phy_led()
3403 list_add(&phyled->list, &phydev->leds); in of_phy_led()
3408 static int of_phy_leds(struct phy_device *phydev) in of_phy_leds() argument
3410 struct device_node *node = phydev->mdio.dev.of_node; in of_phy_leds()
3425 err = of_phy_led(phydev, led); in of_phy_leds()
3428 phy_leds_unregister(phydev); in of_phy_leds()
3529 struct phy_device *phydev = to_phy_device(dev); in phy_probe() local
3530 struct device_driver *drv = phydev->mdio.dev.driver; in phy_probe()
3534 phydev->drv = phydrv; in phy_probe()
3539 if (!phy_drv_supports_irq(phydrv) && phy_interrupt_is_valid(phydev)) in phy_probe()
3540 phydev->irq = PHY_POLL; in phy_probe()
3543 phydev->is_internal = true; in phy_probe()
3546 phy_device_reset(phydev, 0); in phy_probe()
3548 if (phydev->drv->probe) { in phy_probe()
3549 err = phydev->drv->probe(phydev); in phy_probe()
3554 phy_disable_interrupts(phydev); in phy_probe()
3561 linkmode_copy(phydev->supported, phydrv->features); in phy_probe()
3562 genphy_c45_read_eee_abilities(phydev); in phy_probe()
3565 err = phydrv->get_features(phydev); in phy_probe()
3566 else if (phydev->is_c45) in phy_probe()
3567 err = genphy_c45_pma_read_abilities(phydev); in phy_probe()
3569 err = genphy_read_abilities(phydev); in phy_probe()
3575 phydev->supported)) in phy_probe()
3576 phydev->autoneg = 0; in phy_probe()
3579 phydev->supported)) in phy_probe()
3580 phydev->is_gigabit_capable = 1; in phy_probe()
3582 phydev->supported)) in phy_probe()
3583 phydev->is_gigabit_capable = 1; in phy_probe()
3585 of_set_phy_supported(phydev); in phy_probe()
3586 phy_advertise_supported(phydev); in phy_probe()
3591 err = genphy_c45_read_eee_adv(phydev, phydev->advertising_eee); in phy_probe()
3598 phydev->eee_enabled = !linkmode_empty(phydev->advertising_eee); in phy_probe()
3603 if (phydev->eee_enabled) in phy_probe()
3604 linkmode_and(phydev->advertising_eee, phydev->supported_eee, in phy_probe()
3605 phydev->advertising_eee); in phy_probe()
3610 of_set_phy_eee_broken(phydev); in phy_probe()
3623 if (!test_bit(ETHTOOL_LINK_MODE_Pause_BIT, phydev->supported) && in phy_probe()
3624 !test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, phydev->supported)) { in phy_probe()
3626 phydev->supported); in phy_probe()
3628 phydev->supported); in phy_probe()
3632 phydev->state = PHY_READY; in phy_probe()
3638 err = of_phy_leds(phydev); in phy_probe()
3643 phy_device_reset(phydev, 1); in phy_probe()
3650 struct phy_device *phydev = to_phy_device(dev); in phy_remove() local
3652 cancel_delayed_work_sync(&phydev->state_queue); in phy_remove()
3655 phy_leds_unregister(phydev); in phy_remove()
3657 phydev->state = PHY_DOWN; in phy_remove()
3659 sfp_bus_del_upstream(phydev->sfp_bus); in phy_remove()
3660 phydev->sfp_bus = NULL; in phy_remove()
3662 if (phydev->drv && phydev->drv->remove) in phy_remove()
3663 phydev->drv->remove(phydev); in phy_remove()
3666 phy_device_reset(phydev, 1); in phy_remove()
3668 phydev->drv = NULL; in phy_remove()
3694 * make out-of-bounds accesses and lockup in phydev->lock. in phy_driver_register()