Lines Matching +full:full +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()
71 if (duplex == DUPLEX_FULL) in phy_duplex_to_str()
72 return "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, \
166 PHY_SETTING( 800000, FULL, 800000baseCR8_Full ),
167 PHY_SETTING( 800000, FULL, 800000baseKR8_Full ),
168 PHY_SETTING( 800000, FULL, 800000baseDR8_Full ),
169 PHY_SETTING( 800000, FULL, 800000baseDR8_2_Full ),
170 PHY_SETTING( 800000, FULL, 800000baseSR8_Full ),
171 PHY_SETTING( 800000, FULL, 800000baseVR8_Full ),
173 PHY_SETTING( 400000, FULL, 400000baseCR8_Full ),
174 PHY_SETTING( 400000, FULL, 400000baseKR8_Full ),
175 PHY_SETTING( 400000, FULL, 400000baseLR8_ER8_FR8_Full ),
176 PHY_SETTING( 400000, FULL, 400000baseDR8_Full ),
177 PHY_SETTING( 400000, FULL, 400000baseSR8_Full ),
178 PHY_SETTING( 400000, FULL, 400000baseCR4_Full ),
179 PHY_SETTING( 400000, FULL, 400000baseKR4_Full ),
180 PHY_SETTING( 400000, FULL, 400000baseLR4_ER4_FR4_Full ),
181 PHY_SETTING( 400000, FULL, 400000baseDR4_Full ),
182 PHY_SETTING( 400000, FULL, 400000baseSR4_Full ),
184 PHY_SETTING( 200000, FULL, 200000baseCR4_Full ),
185 PHY_SETTING( 200000, FULL, 200000baseKR4_Full ),
186 PHY_SETTING( 200000, FULL, 200000baseLR4_ER4_FR4_Full ),
187 PHY_SETTING( 200000, FULL, 200000baseDR4_Full ),
188 PHY_SETTING( 200000, FULL, 200000baseSR4_Full ),
189 PHY_SETTING( 200000, FULL, 200000baseCR2_Full ),
190 PHY_SETTING( 200000, FULL, 200000baseKR2_Full ),
191 PHY_SETTING( 200000, FULL, 200000baseLR2_ER2_FR2_Full ),
192 PHY_SETTING( 200000, FULL, 200000baseDR2_Full ),
193 PHY_SETTING( 200000, FULL, 200000baseSR2_Full ),
195 PHY_SETTING( 100000, FULL, 100000baseCR4_Full ),
196 PHY_SETTING( 100000, FULL, 100000baseKR4_Full ),
197 PHY_SETTING( 100000, FULL, 100000baseLR4_ER4_Full ),
198 PHY_SETTING( 100000, FULL, 100000baseSR4_Full ),
199 PHY_SETTING( 100000, FULL, 100000baseCR2_Full ),
200 PHY_SETTING( 100000, FULL, 100000baseKR2_Full ),
201 PHY_SETTING( 100000, FULL, 100000baseLR2_ER2_FR2_Full ),
202 PHY_SETTING( 100000, FULL, 100000baseDR2_Full ),
203 PHY_SETTING( 100000, FULL, 100000baseSR2_Full ),
204 PHY_SETTING( 100000, FULL, 100000baseCR_Full ),
205 PHY_SETTING( 100000, FULL, 100000baseKR_Full ),
206 PHY_SETTING( 100000, FULL, 100000baseLR_ER_FR_Full ),
207 PHY_SETTING( 100000, FULL, 100000baseDR_Full ),
208 PHY_SETTING( 100000, FULL, 100000baseSR_Full ),
210 PHY_SETTING( 56000, FULL, 56000baseCR4_Full ),
211 PHY_SETTING( 56000, FULL, 56000baseKR4_Full ),
212 PHY_SETTING( 56000, FULL, 56000baseLR4_Full ),
213 PHY_SETTING( 56000, FULL, 56000baseSR4_Full ),
215 PHY_SETTING( 50000, FULL, 50000baseCR2_Full ),
216 PHY_SETTING( 50000, FULL, 50000baseKR2_Full ),
217 PHY_SETTING( 50000, FULL, 50000baseSR2_Full ),
218 PHY_SETTING( 50000, FULL, 50000baseCR_Full ),
219 PHY_SETTING( 50000, FULL, 50000baseKR_Full ),
220 PHY_SETTING( 50000, FULL, 50000baseLR_ER_FR_Full ),
221 PHY_SETTING( 50000, FULL, 50000baseDR_Full ),
222 PHY_SETTING( 50000, FULL, 50000baseSR_Full ),
224 PHY_SETTING( 40000, FULL, 40000baseCR4_Full ),
225 PHY_SETTING( 40000, FULL, 40000baseKR4_Full ),
226 PHY_SETTING( 40000, FULL, 40000baseLR4_Full ),
227 PHY_SETTING( 40000, FULL, 40000baseSR4_Full ),
229 PHY_SETTING( 25000, FULL, 25000baseCR_Full ),
230 PHY_SETTING( 25000, FULL, 25000baseKR_Full ),
231 PHY_SETTING( 25000, FULL, 25000baseSR_Full ),
233 PHY_SETTING( 20000, FULL, 20000baseKR2_Full ),
234 PHY_SETTING( 20000, FULL, 20000baseMLD2_Full ),
236 PHY_SETTING( 10000, FULL, 10000baseCR_Full ),
237 PHY_SETTING( 10000, FULL, 10000baseER_Full ),
238 PHY_SETTING( 10000, FULL, 10000baseKR_Full ),
239 PHY_SETTING( 10000, FULL, 10000baseKX4_Full ),
240 PHY_SETTING( 10000, FULL, 10000baseLR_Full ),
241 PHY_SETTING( 10000, FULL, 10000baseLRM_Full ),
242 PHY_SETTING( 10000, FULL, 10000baseR_FEC ),
243 PHY_SETTING( 10000, FULL, 10000baseSR_Full ),
244 PHY_SETTING( 10000, FULL, 10000baseT_Full ),
246 PHY_SETTING( 5000, FULL, 5000baseT_Full ),
248 PHY_SETTING( 2500, FULL, 2500baseT_Full ),
249 PHY_SETTING( 2500, FULL, 2500baseX_Full ),
251 PHY_SETTING( 1000, FULL, 1000baseT_Full ),
253 PHY_SETTING( 1000, FULL, 1000baseT1_Full ),
254 PHY_SETTING( 1000, FULL, 1000baseX_Full ),
255 PHY_SETTING( 1000, FULL, 1000baseKX_Full ),
257 PHY_SETTING( 100, FULL, 100baseT_Full ),
258 PHY_SETTING( 100, FULL, 100baseT1_Full ),
261 PHY_SETTING( 100, FULL, 100baseFX_Full ),
263 PHY_SETTING( 10, FULL, 10baseT_Full ),
265 PHY_SETTING( 10, FULL, 10baseT1L_Full ),
266 PHY_SETTING( 10, FULL, 10baseT1S_Full ),
269 PHY_SETTING( 10, FULL, 10baseT1BRR_Full ),
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