Similar to genphy_read_status() for Clause 22 add a generic read_status function for Clause 45.
Unified · Split
| @@ -454,6 +454,39 @@ int genphy_c45_pma_read_abilities(struct phy_device *phydev) · 453 unmodified lines | |||
| 454 | } | 454 | } |
| 455 | EXPORT_SYMBOL_GPL(genphy_c45_pma_read_abilities); | 455 | EXPORT_SYMBOL_GPL(genphy_c45_pma_read_abilities); |
| 456 | 456 | ||
| 457 | /** | ||
| 458 | * genphy_c45_read_status - read PHY status | ||
| 459 | * @phydev: target phy_device struct | ||
| 460 | * | ||
| 461 | * Reads status from PHY and sets phy_device members accordingly. | ||
| 462 | */ | ||
| 463 | int genphy_c45_read_status(struct phy_device *phydev) | ||
| 464 | { | ||
| 465 | int ret; | ||
| 466 | |||
| 467 | ret = genphy_c45_read_link(phydev); | ||
| 468 | if (ret) | ||
| 469 | return ret; | ||
| 470 | |||
| 471 | phydev->speed = SPEED_UNKNOWN; | ||
| 472 | phydev->duplex = DUPLEX_UNKNOWN; | ||
| 473 | phydev->pause = 0; | ||
| 474 | phydev->asym_pause = 0; | ||
| 475 | |||
| 476 | if (phydev->autoneg == AUTONEG_ENABLE) { | ||
| 477 | ret = genphy_c45_read_lpa(phydev); | ||
| 478 | if (ret) | ||
| 479 | return ret; | ||
| 480 | |||
| 481 | phy_resolve_aneg_linkmode(phydev); | ||
| 482 | } else { | ||
| 483 | ret = genphy_c45_read_pma(phydev); | ||
| 484 | } | ||
| 485 | |||
| 486 | return ret; | ||
| 487 | } | ||
| 488 | EXPORT_SYMBOL_GPL(genphy_c45_read_status); | ||
| 489 | |||
| 457 | /* The gen10g_* functions are the old Clause 45 stub */ | 490 | /* The gen10g_* functions are the old Clause 45 stub */ |
| 458 | 491 | ||
| 459 | int gen10g_config_aneg(struct phy_device *phydev) | 492 | int gen10g_config_aneg(struct phy_device *phydev) |
| @@ -1107,6 +1107,7 @@ int genphy_c45_an_config_aneg(struct phy_device *phydev); · 1106 unmodified lines | |||
| 1107 | int genphy_c45_an_disable_aneg(struct phy_device *phydev); | 1107 | int genphy_c45_an_disable_aneg(struct phy_device *phydev); |
| 1108 | int genphy_c45_read_mdix(struct phy_device *phydev); | 1108 | int genphy_c45_read_mdix(struct phy_device *phydev); |
| 1109 | int genphy_c45_pma_read_abilities(struct phy_device *phydev); | 1109 | int genphy_c45_pma_read_abilities(struct phy_device *phydev); |
| 1110 | int genphy_c45_read_status(struct phy_device *phydev); | ||
| 1110 | 1111 | ||
| 1111 | /* The gen10g_* functions are the old Clause 45 stub */ | 1112 | /* The gen10g_* functions are the old Clause 45 stub */ |
| 1112 | int gen10g_config_aneg(struct phy_device *phydev); | 1113 | int gen10g_config_aneg(struct phy_device *phydev); |