Lines Matching +full:g +full:- +full:link
1 // SPDX-License-Identifier: GPL-2.0-only
12 * genphy_c45_setup_forced - configures a forced speed
20 if (phydev->duplex != DUPLEX_FULL) in genphy_c45_pma_setup_forced()
21 return -EINVAL; in genphy_c45_pma_setup_forced()
34 * in 802.3-2012 and 802.3-2015. in genphy_c45_pma_setup_forced()
38 switch (phydev->speed) { in genphy_c45_pma_setup_forced()
48 /* Assume 1000base-T */ in genphy_c45_pma_setup_forced()
53 /* Assume 2.5Gbase-T */ in genphy_c45_pma_setup_forced()
58 /* Assume 5Gbase-T */ in genphy_c45_pma_setup_forced()
63 /* Assume 10Gbase-T */ in genphy_c45_pma_setup_forced()
67 return -EINVAL; in genphy_c45_pma_setup_forced()
83 * genphy_c45_an_config_aneg - configure advertisement registers
86 * Configure advertisement registers based on modes set in phydev->advertising
96 linkmode_and(phydev->advertising, phydev->advertising, in genphy_c45_an_config_aneg()
97 phydev->supported); in genphy_c45_an_config_aneg()
101 adv = linkmode_adv_to_mii_adv_t(phydev->advertising); in genphy_c45_an_config_aneg()
112 adv = linkmode_adv_to_mii_10gbt_adv_t(phydev->advertising); in genphy_c45_an_config_aneg()
128 * genphy_c45_an_disable_aneg - disable auto-negotiation
131 * Disable auto-negotiation in the Clause 45 PHY. The link parameters
145 * genphy_c45_restart_aneg - Enable and restart auto-negotiation
148 * This assumes that the auto-negotiation MMD is present.
150 * Enable and restart auto-negotiation.
160 * genphy_c45_check_and_restart_aneg - Enable and restart auto-negotiation
164 * This assumes that the auto-negotiation MMD is present.
166 * Check, and restart auto-negotiation if needed.
190 * genphy_c45_aneg_done - return auto-negotiation complete status
193 * This assumes that the auto-negotiation MMD is present.
195 * Reads the status register from the auto-negotiation MMD, returning:
196 * - positive if auto-negotiation is complete
197 * - negative errno code on error
198 * - zero otherwise
209 * genphy_c45_read_link - read the overall link status from the MMDs
212 * Read the link status from the specified MMDs, and if they all indicate
213 * that the link is up, set phydev->link to 1. If an error is encountered,
220 bool link = true; in genphy_c45_read_link() local
222 if (phydev->c45_ids.mmds_present & MDIO_DEVS_AN) { in genphy_c45_read_link()
228 * link status and report link as down. in genphy_c45_read_link()
231 phydev->link = 0; in genphy_c45_read_link()
236 while (mmd_mask && link) { in genphy_c45_read_link()
240 /* The link state is latched low so that momentary link in genphy_c45_read_link()
241 * drops can be detected. Do not double-read the status in genphy_c45_read_link()
242 * in polling mode to detect such short link drops except in genphy_c45_read_link()
243 * the link was already down. in genphy_c45_read_link()
245 if (!phy_polling_mode(phydev) || !phydev->link) { in genphy_c45_read_link()
258 link = false; in genphy_c45_read_link()
261 phydev->link = link; in genphy_c45_read_link()
268 * genphy_c45_read_lpa - read the link partner advertisement and pause
271 * Read the Clause 45 defined base (7.19) and 10G (7.33) status registers,
272 * filling in the link partner advertisement, pause and asym_pause members
273 * in @phydev. This assumes that the auto-negotiation MMD is present, and
275 * to fill in the remainder of the link partner advert from vendor registers.
287 phydev->lp_advertising); in genphy_c45_read_lpa()
288 mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); in genphy_c45_read_lpa()
289 mii_adv_mod_linkmode_adv_t(phydev->lp_advertising, 0); in genphy_c45_read_lpa()
290 phydev->pause = 0; in genphy_c45_read_lpa()
291 phydev->asym_pause = 0; in genphy_c45_read_lpa()
296 linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->lp_advertising, in genphy_c45_read_lpa()
299 /* Read the link partner's base page advertisement */ in genphy_c45_read_lpa()
304 mii_adv_mod_linkmode_adv_t(phydev->lp_advertising, val); in genphy_c45_read_lpa()
305 phydev->pause = val & LPA_PAUSE_CAP ? 1 : 0; in genphy_c45_read_lpa()
306 phydev->asym_pause = val & LPA_PAUSE_ASYM ? 1 : 0; in genphy_c45_read_lpa()
308 /* Read the link partner's 10G advertisement */ in genphy_c45_read_lpa()
313 mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, val); in genphy_c45_read_lpa()
320 * genphy_c45_read_pma - read link speed etc from PMA
327 linkmode_zero(phydev->lp_advertising); in genphy_c45_read_pma()
335 phydev->speed = SPEED_10; in genphy_c45_read_pma()
338 phydev->speed = SPEED_100; in genphy_c45_read_pma()
341 phydev->speed = SPEED_1000; in genphy_c45_read_pma()
344 phydev->speed = SPEED_2500; in genphy_c45_read_pma()
347 phydev->speed = SPEED_5000; in genphy_c45_read_pma()
350 phydev->speed = SPEED_10000; in genphy_c45_read_pma()
353 phydev->speed = SPEED_UNKNOWN; in genphy_c45_read_pma()
357 phydev->duplex = DUPLEX_FULL; in genphy_c45_read_pma()
364 * genphy_c45_read_mdix - read mdix status from PMA
371 if (phydev->speed == SPEED_10000) { in genphy_c45_read_mdix()
379 phydev->mdix = ETH_TP_MDI; in genphy_c45_read_mdix()
383 phydev->mdix = ETH_TP_MDI_X; in genphy_c45_read_mdix()
387 phydev->mdix = ETH_TP_MDI_INVALID; in genphy_c45_read_mdix()
397 * genphy_c45_pma_read_abilities - read supported link modes from PMA
400 * Read the supported link modes from the PMA Status 2 (1.8) register. If bit
402 * PMA Extended Abilities (1.11) register, indicating 1000BASET an 10G related
404 * in the 2.5G/5G PMA Extended register (1.21), indicating if 2.5GBASET and
411 linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported); in genphy_c45_pma_read_abilities()
412 if (phydev->c45_ids.mmds_present & MDIO_DEVS_AN) { in genphy_c45_pma_read_abilities()
419 phydev->supported); in genphy_c45_pma_read_abilities()
427 phydev->supported, in genphy_c45_pma_read_abilities()
431 phydev->supported, in genphy_c45_pma_read_abilities()
435 phydev->supported, in genphy_c45_pma_read_abilities()
444 phydev->supported, in genphy_c45_pma_read_abilities()
447 phydev->supported, in genphy_c45_pma_read_abilities()
450 phydev->supported, in genphy_c45_pma_read_abilities()
453 phydev->supported, in genphy_c45_pma_read_abilities()
456 phydev->supported, in genphy_c45_pma_read_abilities()
459 phydev->supported, in genphy_c45_pma_read_abilities()
463 phydev->supported, in genphy_c45_pma_read_abilities()
466 phydev->supported, in genphy_c45_pma_read_abilities()
470 phydev->supported, in genphy_c45_pma_read_abilities()
473 phydev->supported, in genphy_c45_pma_read_abilities()
483 phydev->supported, in genphy_c45_pma_read_abilities()
487 phydev->supported, in genphy_c45_pma_read_abilities()
497 * genphy_c45_read_status - read PHY status
510 phydev->speed = SPEED_UNKNOWN; in genphy_c45_read_status()
511 phydev->duplex = DUPLEX_UNKNOWN; in genphy_c45_read_status()
512 phydev->pause = 0; in genphy_c45_read_status()
513 phydev->asym_pause = 0; in genphy_c45_read_status()
515 if (phydev->autoneg == AUTONEG_ENABLE) { in genphy_c45_read_status()
530 * genphy_c45_config_aneg - restart auto-negotiation or forced setup
533 * Description: If auto-negotiation is enabled, we configure the
534 * advertising, and then restart auto-negotiation. If it is not
542 if (phydev->autoneg == AUTONEG_DISABLE) in genphy_c45_config_aneg()