phy: marvell: add link partner advertised modes
Read the standard link partner advertisment registers and store it in phydev->lp_advertising, so ethtool can report this information to userspace via ethtool. Zero it as per genphy if autonegotiation is disabled. Tested with a Marvell 88E1512 PHY. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b626ef0128
commit
357cd64c18
1 changed files with 9 additions and 0 deletions
|
@ -785,6 +785,7 @@ static int marvell_read_status(struct phy_device *phydev)
|
||||||
int adv;
|
int adv;
|
||||||
int err;
|
int err;
|
||||||
int lpa;
|
int lpa;
|
||||||
|
int lpagb;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
/* Update the link, but return if there
|
/* Update the link, but return if there
|
||||||
|
@ -802,10 +803,17 @@ static int marvell_read_status(struct phy_device *phydev)
|
||||||
if (lpa < 0)
|
if (lpa < 0)
|
||||||
return lpa;
|
return lpa;
|
||||||
|
|
||||||
|
lpagb = phy_read(phydev, MII_STAT1000);
|
||||||
|
if (lpagb < 0)
|
||||||
|
return lpagb;
|
||||||
|
|
||||||
adv = phy_read(phydev, MII_ADVERTISE);
|
adv = phy_read(phydev, MII_ADVERTISE);
|
||||||
if (adv < 0)
|
if (adv < 0)
|
||||||
return adv;
|
return adv;
|
||||||
|
|
||||||
|
phydev->lp_advertising = mii_stat1000_to_ethtool_lpa_t(lpagb) |
|
||||||
|
mii_lpa_to_ethtool_lpa_t(lpa);
|
||||||
|
|
||||||
lpa &= adv;
|
lpa &= adv;
|
||||||
|
|
||||||
if (status & MII_M1011_PHY_STATUS_FULLDUPLEX)
|
if (status & MII_M1011_PHY_STATUS_FULLDUPLEX)
|
||||||
|
@ -853,6 +861,7 @@ static int marvell_read_status(struct phy_device *phydev)
|
||||||
phydev->speed = SPEED_10;
|
phydev->speed = SPEED_10;
|
||||||
|
|
||||||
phydev->pause = phydev->asym_pause = 0;
|
phydev->pause = phydev->asym_pause = 0;
|
||||||
|
phydev->lp_advertising = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue