Skip to contentSkip to conversation

net: phy: Use 'autoneg' flag from phydev

PATCH In review amessier.tyco at gmail.com 3 participants 3 messages Jan 22, 2016 – Jan 29, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: Use 'autoneg' flag from phydev

From: Alexandre Messier <[email protected]>

Use the 'autoneg' flag available in phydev when checking if autoneg is in use.

The previous implementation was checking directly in the PHY if autoneg was supported. Some PHYs will report that autoneg is supported, even when it is disabled. Thus it is not possible to use that bit to determine if autoneg is currently in use or not.

---
 drivers/net/phy/phy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/phy/phy.c +3 -2
index 1d8eed5..10a7b30 100644
@@ -223,7 +223,8 @@ int genphy_update_link(struct phy_device *phydev)
 	if (phydev->link && mii_reg & BMSR_LSTATUS)
 		return 0;
 
-	if ((mii_reg & BMSR_ANEGCAPABLE) && !(mii_reg & BMSR_ANEGCOMPLETE)) {
+	if ((phydev->autoneg == AUTONEG_ENABLE) &&
+	    !(mii_reg & BMSR_ANEGCOMPLETE)) {
 		int i = 0;
 
 		printf("%s Waiting for PHY auto negotiation to complete",
@@ -279,7 +280,7 @@ int genphy_parse_link(struct phy_device *phydev)
 	int mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);
 
 	/* We're using autonegotiation */
-	if (phydev->supported & SUPPORTED_Autoneg) {
+	if (phydev->autoneg == AUTONEG_ENABLE) {
 		u32 lpa = 0;
 		int gblpa = 0;
 		u32 estatus = 0;
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 net: phy: Use 'autoneg' flag from phydev

Quoted 5 lines · On Fri, Jan 22, 2016 at 1:16 PM, <[email protected]> wrote:

From: Alexandre Messier <[email protected]>

Use the 'autoneg' flag available in phydev when checking if autoneg is in use.

Quoted 7 lines

The previous implementation was checking directly in the PHY if autoneg was supported. Some PHYs will report that autoneg is supported, even when it is disabled. Thus it is not possible to use that bit to determine if autoneg is currently in use or not.