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
158 * - iow, descending speed.
274 * phy_lookup_setting - lookup a PHY setting
277 * @mask: allowed link modes
291 phy_lookup_setting(int speed, int duplex, const unsigned long *mask, bool exact) in phy_lookup_setting() argument
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()
323 unsigned long *mask) in phy_speeds() argument
330 test_bit(settings[i].bit, mask) && in phy_speeds()
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
362 * is connected to a 1G PHY. This function allows the MAC to indicate its
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
443 * from the link partner mask.
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()
540 /* Select the Function : DATA with no post increment */ in mmd_phy_indirect()
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
799 * @mask: bit mask of bits to clear
800 * @set: new value of bits set in mask to write to @regnum
808 int phy_modify_changed(struct phy_device *phydev, u32 regnum, u16 mask, u16 set) in phy_modify_changed() argument
813 ret = __phy_modify_changed(phydev, regnum, mask, set); in phy_modify_changed()
821 * __phy_modify - Convenience function for modifying a PHY register
824 * @mask: bit mask of bits to clear
825 * @set: new value of bits set in mask to write to @regnum
831 int __phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set) in __phy_modify() argument
835 ret = __phy_modify_changed(phydev, regnum, mask, set); in __phy_modify()
842 * phy_modify - Convenience function for modifying a given PHY register
845 * @mask: bit mask of bits to clear
846 * @set: new value of bits set in mask to write to @regnum
852 int phy_modify(struct phy_device *phydev, u32 regnum, u16 mask, u16 set) in phy_modify() argument
857 ret = __phy_modify(phydev, regnum, mask, set); in phy_modify()
865 * __phy_modify_mmd_changed - Function for modifying a register on MMD
869 * @mask: bit mask of bits to clear
870 * @set: new value of bits set in mask to write to @regnum
872 * Unlocked helper function which allows a MMD register to be modified as
873 * new register value = (old register value & ~mask) | set
878 u16 mask, u16 set) in __phy_modify_mmd_changed() argument
886 new = (ret & ~mask) | set; in __phy_modify_mmd_changed()
897 * phy_modify_mmd_changed - Function for modifying a register on MMD
901 * @mask: bit mask of bits to clear
902 * @set: new value of bits set in mask to write to @regnum
911 u16 mask, u16 set) in phy_modify_mmd_changed() argument
916 ret = __phy_modify_mmd_changed(phydev, devad, regnum, mask, set); in phy_modify_mmd_changed()
924 * __phy_modify_mmd - Convenience function for modifying a register on MMD
928 * @mask: bit mask of bits to clear
929 * @set: new value of bits set in mask to write to @regnum
936 u16 mask, u16 set) in __phy_modify_mmd() argument
940 ret = __phy_modify_mmd_changed(phydev, devad, regnum, mask, set); in __phy_modify_mmd()
947 * phy_modify_mmd - Convenience function for modifying a register on MMD
951 * @mask: bit mask of bits to clear
952 * @set: new value of bits set in mask to write to @regnum
959 u16 mask, u16 set) in phy_modify_mmd() argument
964 ret = __phy_modify_mmd(phydev, devad, regnum, mask, set); in phy_modify_mmd()
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
1003 * phy_select_page() - take the bus lock, save the current page, and set a page
1032 * phy_restore_page() - restore the page register and release the bus lock
1038 * This function propagates the earliest error code from the group of
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
1116 * @mask: bit mask of bits to clear
1117 * @set: bit mask of bits to set
1122 u16 mask, u16 set) in phy_modify_paged_changed() argument
1128 ret = __phy_modify_changed(phydev, regnum, mask, set); in phy_modify_paged_changed()
1135 * phy_modify_paged() - Convenience function for modifying a paged register
1139 * @mask: bit mask of bits to clear
1140 * @set: bit mask of bits to set
1145 u16 mask, u16 set) in phy_modify_paged() argument
1147 int ret = phy_modify_paged_changed(phydev, page, regnum, mask, set); in phy_modify_paged()