Lines Matching +full:half +full:- +full:bus
1 // SPDX-License-Identifier: GPL-2.0+
10 * phy_speed_to_str - Return a string representing the PHY link speed
57 return "Unsupported (update phy-core.c)"; in phy_speed_to_str()
63 * phy_duplex_to_str - Return string describing the duplex
70 return "Half"; in phy_duplex_to_str()
75 return "Unsupported (update phy-core.c)"; in phy_duplex_to_str()
80 * phy_rate_matching_to_str - Return a string describing the rate matching
94 return "open-loop"; in phy_rate_matching_to_str()
96 return "Unsupported (update phy-core.c)"; in phy_rate_matching_to_str()
101 * phy_interface_num_ports - Return the number of links that can be carried by
102 * a given MAC-PHY physical link. Returns 0 if this is
158 * - iow, descending speed.
252 PHY_SETTING( 1000, HALF, 1000baseT_Half ),
259 PHY_SETTING( 100, HALF, 100baseT_Half ),
260 PHY_SETTING( 100, HALF, 100baseFX_Half ),
264 PHY_SETTING( 10, HALF, 10baseT_Half ),
267 PHY_SETTING( 10, HALF, 10baseT1S_Half ),
268 PHY_SETTING( 10, HALF, 10baseT1S_P2MP_Half ),
274 * phy_lookup_setting - lookup a PHY setting
297 if (p->bit < __ETHTOOL_LINK_MODE_MASK_NBITS && in phy_lookup_setting()
298 test_bit(p->bit, mask)) { in phy_lookup_setting()
300 if (p->speed == speed && p->duplex == duplex) { in phy_lookup_setting()
305 if (!match && p->speed <= speed) in phy_lookup_setting()
309 if (p->speed < speed) in phy_lookup_setting()
331 (count == 0 || speeds[count - 1] != settings[i].speed)) in phy_speeds()
343 if (p->speed > max_speed) in __set_linkmode_max_speed()
344 linkmode_clear_bit(p->bit, addr); in __set_linkmode_max_speed()
352 __set_linkmode_max_speed(max_speed, phydev->supported); in __set_phy_supported()
356 * phy_set_max_speed - Set the maximum speed the PHY should support
375 struct device_node *node = phydev->mdio.dev.of_node; in of_set_phy_supported()
384 if (!of_property_read_u32(node, "max-speed", &max_speed)) in of_set_phy_supported()
390 struct device_node *node = phydev->mdio.dev.of_node; in of_set_phy_eee_broken()
399 if (of_property_read_bool(node, "eee-broken-100tx")) in of_set_phy_eee_broken()
401 if (of_property_read_bool(node, "eee-broken-1000t")) in of_set_phy_eee_broken()
403 if (of_property_read_bool(node, "eee-broken-10gt")) in of_set_phy_eee_broken()
405 if (of_property_read_bool(node, "eee-broken-1000kx")) in of_set_phy_eee_broken()
407 if (of_property_read_bool(node, "eee-broken-10gkx4")) in of_set_phy_eee_broken()
409 if (of_property_read_bool(node, "eee-broken-10gkr")) in of_set_phy_eee_broken()
412 phydev->eee_broken_modes = broken; in of_set_phy_eee_broken()
416 * phy_resolve_aneg_pause - Determine pause autoneg results
427 if (phydev->duplex == DUPLEX_FULL) { in phy_resolve_aneg_pause()
428 phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, in phy_resolve_aneg_pause()
429 phydev->lp_advertising); in phy_resolve_aneg_pause()
430 phydev->asym_pause = linkmode_test_bit( in phy_resolve_aneg_pause()
432 phydev->lp_advertising); in phy_resolve_aneg_pause()
438 * phy_resolve_aneg_linkmode - resolve the advertisements into PHY settings
450 linkmode_and(common, phydev->lp_advertising, phydev->advertising); in phy_resolve_aneg_linkmode()
454 phydev->speed = settings[i].speed; in phy_resolve_aneg_linkmode()
455 phydev->duplex = settings[i].duplex; in phy_resolve_aneg_linkmode()
464 * phy_check_downshift - check whether downshift occurred
470 * read_status callback and sets phydev->speed to the actual link speed.
477 phydev->downshifted_rate = 0; in phy_check_downshift()
479 if (phydev->autoneg == AUTONEG_DISABLE || in phy_check_downshift()
480 phydev->speed == SPEED_UNKNOWN) in phy_check_downshift()
483 linkmode_and(common, phydev->lp_advertising, phydev->advertising); in phy_check_downshift()
491 if (speed == SPEED_UNKNOWN || phydev->speed >= speed) in phy_check_downshift()
495 phy_speed_to_str(speed), phy_speed_to_str(phydev->speed)); in phy_check_downshift()
497 phydev->downshifted_rate = 1; in phy_check_downshift()
506 linkmode_and(common, phydev->lp_advertising, phydev->advertising); in phy_resolve_min_speed()
508 while (--i >= 0) { in phy_resolve_min_speed()
524 return -EINVAL; in phy_speed_down_core()
526 __set_linkmode_max_speed(min_common_speed, phydev->advertising); in phy_speed_down_core()
531 static void mmd_phy_indirect(struct mii_bus *bus, int phy_addr, int devad, in mmd_phy_indirect() argument
535 __mdiobus_write(bus, phy_addr, MII_MMD_CTRL, devad); in mmd_phy_indirect()
538 __mdiobus_write(bus, phy_addr, MII_MMD_DATA, regnum); in mmd_phy_indirect()
541 __mdiobus_write(bus, phy_addr, MII_MMD_CTRL, in mmd_phy_indirect()
545 static int mmd_phy_read(struct mii_bus *bus, int phy_addr, bool is_c45, in mmd_phy_read() argument
549 return __mdiobus_c45_read(bus, phy_addr, devad, regnum); in mmd_phy_read()
551 mmd_phy_indirect(bus, phy_addr, devad, regnum); in mmd_phy_read()
553 return __mdiobus_read(bus, phy_addr, MII_MMD_DATA); in mmd_phy_read()
556 static int mmd_phy_write(struct mii_bus *bus, int phy_addr, bool is_c45, in mmd_phy_write() argument
560 return __mdiobus_c45_write(bus, phy_addr, devad, regnum, val); in mmd_phy_write()
562 mmd_phy_indirect(bus, phy_addr, devad, regnum); in mmd_phy_write()
564 return __mdiobus_write(bus, phy_addr, MII_MMD_DATA, val); in mmd_phy_write()
568 * __phy_read_mmd - Convenience function for reading a register
579 return -EINVAL; in __phy_read_mmd()
581 if (phydev->drv && phydev->drv->read_mmd) in __phy_read_mmd()
582 return phydev->drv->read_mmd(phydev, devad, regnum); in __phy_read_mmd()
584 return mmd_phy_read(phydev->mdio.bus, phydev->mdio.addr, in __phy_read_mmd()
585 phydev->is_c45, devad, regnum); in __phy_read_mmd()
590 * phy_read_mmd - Convenience function for reading a register
611 * __phy_write_mmd - Convenience function for writing a register
623 return -EINVAL; in __phy_write_mmd()
625 if (phydev->drv && phydev->drv->write_mmd) in __phy_write_mmd()
626 return phydev->drv->write_mmd(phydev, devad, regnum, val); in __phy_write_mmd()
628 return mmd_phy_write(phydev->mdio.bus, phydev->mdio.addr, in __phy_write_mmd()
629 phydev->is_c45, devad, regnum, val); in __phy_write_mmd()
634 * phy_write_mmd - Convenience function for writing a register
656 * __phy_package_read_mmd - read MMD reg relative to PHY package base addr
680 return -EINVAL; in __phy_package_read_mmd()
682 return mmd_phy_read(phydev->mdio.bus, addr, phydev->is_c45, devad, in __phy_package_read_mmd()
688 * phy_package_read_mmd - read MMD reg relative to PHY package base addr
713 return -EINVAL; in phy_package_read_mmd()
716 val = mmd_phy_read(phydev->mdio.bus, addr, phydev->is_c45, devad, in phy_package_read_mmd()
725 * __phy_package_write_mmd - write MMD reg relative to PHY package base addr
750 return -EINVAL; in __phy_package_write_mmd()
752 return mmd_phy_write(phydev->mdio.bus, addr, phydev->is_c45, devad, in __phy_package_write_mmd()
758 * phy_package_write_mmd - write MMD reg relative to PHY package base addr
784 return -EINVAL; in phy_package_write_mmd()
787 ret = mmd_phy_write(phydev->mdio.bus, addr, phydev->is_c45, devad, in phy_package_write_mmd()
796 * phy_modify_changed - Function for modifying a PHY register
803 * because the bus read/write functions may wait for an interrupt
821 * __phy_modify - Convenience function for modifying a PHY register
828 * because the bus read/write functions may wait for an interrupt
842 * phy_modify - Convenience function for modifying a given PHY register
849 * because the bus read/write functions may wait for an interrupt
865 * __phy_modify_mmd_changed - Function for modifying a register on MMD
897 * phy_modify_mmd_changed - Function for modifying a register on MMD
905 * because the bus read/write functions may wait for an interrupt
924 * __phy_modify_mmd - Convenience function for modifying a register on MMD
932 * because the bus read/write functions may wait for an interrupt
947 * phy_modify_mmd - Convenience function for modifying a register on MMD
955 * because the bus read/write functions may wait for an interrupt
973 …if (WARN_ONCE(!phydev->drv->read_page, "read_page callback not available, PHY driver not loaded?\n… in __phy_read_page()
974 return -EOPNOTSUPP; in __phy_read_page()
976 return phydev->drv->read_page(phydev); in __phy_read_page()
981 …if (WARN_ONCE(!phydev->drv->write_page, "write_page callback not available, PHY driver not loaded?… in __phy_write_page()
982 return -EOPNOTSUPP; in __phy_write_page()
984 return phydev->drv->write_page(phydev, page); in __phy_write_page()
988 * phy_save_page() - take the bus lock and save the current page
991 * Take the MDIO bus lock, and return the current page number. On error,
1003 * phy_select_page() - take the bus lock, save the current page, and set a page
1007 * Take the MDIO bus lock to protect against concurrent access, save the
1032 * phy_restore_page() - restore the page register and release the bus lock
1037 * Release the MDIO bus lock, restoring @oldpage if it is a valid page.
1071 * phy_read_paged() - Convenience function for reading a paged register
1091 * phy_write_paged() - Convenience function for writing a paged register
1112 * phy_modify_paged_changed() - Function for modifying a paged register
1135 * phy_modify_paged() - Convenience function for modifying a paged register