Lines Matching +full:half +full:- +full:duplex
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
65 * @duplex: Duplex setting to describe
67 const char *phy_duplex_to_str(unsigned int duplex) in phy_duplex_to_str() argument
69 if (duplex == DUPLEX_HALF) in phy_duplex_to_str()
70 return "Half"; in phy_duplex_to_str()
71 if (duplex == DUPLEX_FULL) in phy_duplex_to_str()
73 if (duplex == DUPLEX_UNKNOWN) 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
156 /* A mapping of all SUPPORTED settings to speed/duplex. This table
158 * - iow, descending speed.
161 #define PHY_SETTING(s, d, b) { .speed = SPEED_ ## s, .duplex = DUPLEX_ ## d, \
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
276 * @duplex: duplex to match
281 * duplex, and which is supported.
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()
301 /* Exact match for speed and 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
442 * speed and duplex. If full duplex was negotiated, extract the pause mode
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()
510 if (fdx_only && settings[i].duplex != DUPLEX_FULL) 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()
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
821 * __phy_modify - Convenience function for modifying a PHY register
842 * phy_modify - Convenience function for modifying a given PHY register
865 * __phy_modify_mmd_changed - Function for modifying a register on MMD
897 * phy_modify_mmd_changed - Function for modifying a register on MMD
924 * __phy_modify_mmd - Convenience function for modifying a register on MMD
947 * phy_modify_mmd - Convenience function for modifying a register on 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
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