Lines Matching +full:function +full:- +full:mask

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
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
157 * - iow, descending speed.
272 * phy_lookup_setting - lookup a PHY setting
275 * @mask: allowed link modes
289 phy_lookup_setting(int speed, int duplex, const unsigned long *mask, bool exact) in phy_lookup_setting() argument
295 if (p->bit < __ETHTOOL_LINK_MODE_MASK_NBITS && in phy_lookup_setting()
296 test_bit(p->bit, mask)) { in phy_lookup_setting()
298 if (p->speed == speed && p->duplex == duplex) { in phy_lookup_setting()
303 if (!match && p->speed <= speed) in phy_lookup_setting()
307 if (p->speed < speed) in phy_lookup_setting()
321 unsigned long *mask) in phy_speeds() argument
328 test_bit(settings[i].bit, mask) && in phy_speeds()
329 (count == 0 || speeds[count - 1] != settings[i].speed)) in phy_speeds()
341 if (p->speed > max_speed) in __set_linkmode_max_speed()
342 linkmode_clear_bit(p->bit, addr); in __set_linkmode_max_speed()
350 __set_linkmode_max_speed(max_speed, phydev->supported); in __set_phy_supported()
354 * phy_set_max_speed - Set the maximum speed the PHY should support
360 * is connected to a 1G PHY. This function allows the MAC to indicate its
373 struct device_node *node = phydev->mdio.dev.of_node; in of_set_phy_supported()
382 if (!of_property_read_u32(node, "max-speed", &max_speed)) in of_set_phy_supported()
388 struct device_node *node = phydev->mdio.dev.of_node; in of_set_phy_eee_broken()
397 if (of_property_read_bool(node, "eee-broken-100tx")) in of_set_phy_eee_broken()
399 if (of_property_read_bool(node, "eee-broken-1000t")) in of_set_phy_eee_broken()
401 if (of_property_read_bool(node, "eee-broken-10gt")) in of_set_phy_eee_broken()
403 if (of_property_read_bool(node, "eee-broken-1000kx")) in of_set_phy_eee_broken()
405 if (of_property_read_bool(node, "eee-broken-10gkx4")) in of_set_phy_eee_broken()
407 if (of_property_read_bool(node, "eee-broken-10gkr")) in of_set_phy_eee_broken()
410 phydev->eee_broken_modes = broken; in of_set_phy_eee_broken()
414 * phy_resolve_aneg_pause - Determine pause autoneg results
425 if (phydev->duplex == DUPLEX_FULL) { in phy_resolve_aneg_pause()
426 phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, in phy_resolve_aneg_pause()
427 phydev->lp_advertising); in phy_resolve_aneg_pause()
428 phydev->asym_pause = linkmode_test_bit( in phy_resolve_aneg_pause()
430 phydev->lp_advertising); in phy_resolve_aneg_pause()
436 * phy_resolve_aneg_linkmode - resolve the advertisements into PHY settings
441 * from the link partner mask.
448 linkmode_and(common, phydev->lp_advertising, phydev->advertising); in phy_resolve_aneg_linkmode()
452 phydev->speed = settings[i].speed; in phy_resolve_aneg_linkmode()
453 phydev->duplex = settings[i].duplex; in phy_resolve_aneg_linkmode()
462 * phy_check_downshift - check whether downshift occurred
468 * read_status callback and sets phydev->speed to the actual link speed.
475 phydev->downshifted_rate = 0; in phy_check_downshift()
477 if (phydev->autoneg == AUTONEG_DISABLE || in phy_check_downshift()
478 phydev->speed == SPEED_UNKNOWN) in phy_check_downshift()
481 linkmode_and(common, phydev->lp_advertising, phydev->advertising); in phy_check_downshift()
489 if (speed == SPEED_UNKNOWN || phydev->speed >= speed) in phy_check_downshift()
493 phy_speed_to_str(speed), phy_speed_to_str(phydev->speed)); in phy_check_downshift()
495 phydev->downshifted_rate = 1; in phy_check_downshift()
504 linkmode_and(common, phydev->lp_advertising, phydev->advertising); in phy_resolve_min_speed()
506 while (--i >= 0) { in phy_resolve_min_speed()
522 return -EINVAL; in phy_speed_down_core()
524 __set_linkmode_max_speed(min_common_speed, phydev->advertising); in phy_speed_down_core()
538 /* Select the Function : DATA with no post increment */ in mmd_phy_indirect()
544 * __phy_read_mmd - Convenience function for reading a register
557 return -EINVAL; in __phy_read_mmd()
559 if (phydev->drv && phydev->drv->read_mmd) { in __phy_read_mmd()
560 val = phydev->drv->read_mmd(phydev, devad, regnum); in __phy_read_mmd()
561 } else if (phydev->is_c45) { in __phy_read_mmd()
562 val = __mdiobus_c45_read(phydev->mdio.bus, phydev->mdio.addr, in __phy_read_mmd()
565 struct mii_bus *bus = phydev->mdio.bus; in __phy_read_mmd()
566 int phy_addr = phydev->mdio.addr; in __phy_read_mmd()
578 * phy_read_mmd - Convenience function for reading a register
599 * __phy_write_mmd - Convenience function for writing a register
613 return -EINVAL; in __phy_write_mmd()
615 if (phydev->drv && phydev->drv->write_mmd) { in __phy_write_mmd()
616 ret = phydev->drv->write_mmd(phydev, devad, regnum, val); in __phy_write_mmd()
617 } else if (phydev->is_c45) { in __phy_write_mmd()
618 ret = __mdiobus_c45_write(phydev->mdio.bus, phydev->mdio.addr, in __phy_write_mmd()
621 struct mii_bus *bus = phydev->mdio.bus; in __phy_write_mmd()
622 int phy_addr = phydev->mdio.addr; in __phy_write_mmd()
636 * phy_write_mmd - Convenience function for writing a register
658 * phy_modify_changed - Function for modifying a PHY register
661 * @mask: bit mask of bits to clear
662 * @set: new value of bits set in mask to write to @regnum
670 int phy_modify_changed(struct phy_device *phydev, u32 regnum, u16 mask, u16 set) in phy_modify_changed() argument
675 ret = __phy_modify_changed(phydev, regnum, mask, set); in phy_modify_changed()
683 * __phy_modify - Convenience function for modifying a PHY register
686 * @mask: bit mask of bits to clear
687 * @set: new value of bits set in mask to write to @regnum
693 int __phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set) in __phy_modify() argument
697 ret = __phy_modify_changed(phydev, regnum, mask, set); in __phy_modify()
704 * phy_modify - Convenience function for modifying a given PHY register
707 * @mask: bit mask of bits to clear
708 * @set: new value of bits set in mask to write to @regnum
714 int phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set) in phy_modify() argument
719 ret = __phy_modify(phydev, regnum, mask, set); in phy_modify()
727 * __phy_modify_mmd_changed - Function for modifying a register on MMD
731 * @mask: bit mask of bits to clear
732 * @set: new value of bits set in mask to write to @regnum
734 * Unlocked helper function which allows a MMD register to be modified as
735 * new register value = (old register value & ~mask) | set
740 u16 mask, u16 set) in __phy_modify_mmd_changed() argument
748 new = (ret & ~mask) | set; in __phy_modify_mmd_changed()
759 * phy_modify_mmd_changed - Function for modifying a register on MMD
763 * @mask: bit mask of bits to clear
764 * @set: new value of bits set in mask to write to @regnum
773 u16 mask, u16 set) in phy_modify_mmd_changed() argument
778 ret = __phy_modify_mmd_changed(phydev, devad, regnum, mask, set); in phy_modify_mmd_changed()
786 * __phy_modify_mmd - Convenience function for modifying a register on MMD
790 * @mask: bit mask of bits to clear
791 * @set: new value of bits set in mask to write to @regnum
798 u16 mask, u16 set) in __phy_modify_mmd() argument
802 ret = __phy_modify_mmd_changed(phydev, devad, regnum, mask, set); in __phy_modify_mmd()
809 * phy_modify_mmd - Convenience function for modifying a register on MMD
813 * @mask: bit mask of bits to clear
814 * @set: new value of bits set in mask to write to @regnum
821 u16 mask, u16 set) in phy_modify_mmd() argument
826 ret = __phy_modify_mmd(phydev, devad, regnum, mask, set); in phy_modify_mmd()
835 …if (WARN_ONCE(!phydev->drv->read_page, "read_page callback not available, PHY driver not loaded?\n… in __phy_read_page()
836 return -EOPNOTSUPP; in __phy_read_page()
838 return phydev->drv->read_page(phydev); in __phy_read_page()
843 …if (WARN_ONCE(!phydev->drv->write_page, "write_page callback not available, PHY driver not loaded?… in __phy_write_page()
844 return -EOPNOTSUPP; in __phy_write_page()
846 return phydev->drv->write_page(phydev, page); in __phy_write_page()
850 * phy_save_page() - take the bus lock and save the current page
865 * phy_select_page() - take the bus lock, save the current page, and set a page
894 * phy_restore_page() - restore the page register and release the bus lock
900 * This function propagates the earliest error code from the group of
933 * phy_read_paged() - Convenience function for reading a paged register
953 * phy_write_paged() - Convenience function for writing a paged register
974 * phy_modify_paged_changed() - Function for modifying a paged register
978 * @mask: bit mask of bits to clear
979 * @set: bit mask of bits to set
984 u16 mask, u16 set) in phy_modify_paged_changed() argument
990 ret = __phy_modify_changed(phydev, regnum, mask, set); in phy_modify_paged_changed()
997 * phy_modify_paged() - Convenience function for modifying a paged register
1001 * @mask: bit mask of bits to clear
1002 * @set: bit mask of bits to set
1007 u16 mask, u16 set) in phy_modify_paged() argument
1009 int ret = phy_modify_paged_changed(phydev, page, regnum, mask, set); in phy_modify_paged()