History

net: phy: add genphy_c45_read_status

Similar to genphy_read_status() for Clause 22 add a generic read_status function for Clause 45.

Heiner Kallweit committed 7 years ago

Commit 70fa3a91 parent 3b845d82 files · +34 −0Browse files

Unified · Split

2 files
  1. drivers/net/phy/phy-c45.c +33 −0
  2. include/linux/phy.h +1 −0
drivers/net/phy/phy-c45.c+33−0
@@ -454,6 +454,39 @@ int genphy_c45_pma_read_abilities(struct phy_device *phydev) · 453 unmodified lines
454454 }
455455 EXPORT_SYMBOL_GPL(genphy_c45_pma_read_abilities);
456456
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+
457490 /* The gen10g_* functions are the old Clause 45 stub */
458491
459492 int gen10g_config_aneg(struct phy_device *phydev)
include/linux/phy.h+1−0
@@ -1107,6 +1107,7 @@ int genphy_c45_an_config_aneg(struct phy_device *phydev); · 1106 unmodified lines
11071107 int genphy_c45_an_disable_aneg(struct phy_device *phydev);
11081108 int genphy_c45_read_mdix(struct phy_device *phydev);
11091109 int genphy_c45_pma_read_abilities(struct phy_device *phydev);
1110+int genphy_c45_read_status(struct phy_device *phydev);
11101111
11111112 /* The gen10g_* functions are the old Clause 45 stub */
11121113 int gen10g_config_aneg(struct phy_device *phydev);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t