* [PATCH] phy: marvell: add link partner advertised modes
@ 2015-09-23 23:07 Russell King
2015-09-24 0:01 ` Florian Fainelli
2015-09-25 19:24 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Russell King @ 2015-09-23 23:07 UTC (permalink / raw)
To: Florian Fainelli, David Miller; +Cc: netdev
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>
---
drivers/net/phy/marvell.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index e6897b6a8a53..5de8d5827536 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -785,6 +785,7 @@ static int marvell_read_status(struct phy_device *phydev)
int adv;
int err;
int lpa;
+ int lpagb;
int status = 0;
/* Update the link, but return if there
@@ -802,10 +803,17 @@ static int marvell_read_status(struct phy_device *phydev)
if (lpa < 0)
return lpa;
+ lpagb = phy_read(phydev, MII_STAT1000);
+ if (lpagb < 0)
+ return lpagb;
+
adv = phy_read(phydev, MII_ADVERTISE);
if (adv < 0)
return adv;
+ phydev->lp_advertising = mii_stat1000_to_ethtool_lpa_t(lpagb) |
+ mii_lpa_to_ethtool_lpa_t(lpa);
+
lpa &= adv;
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->pause = phydev->asym_pause = 0;
+ phydev->lp_advertising = 0;
}
return 0;
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] phy: marvell: add link partner advertised modes
2015-09-23 23:07 [PATCH] phy: marvell: add link partner advertised modes Russell King
@ 2015-09-24 0:01 ` Florian Fainelli
2015-09-25 19:24 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2015-09-24 0:01 UTC (permalink / raw)
To: Russell King, David Miller; +Cc: netdev
On 23/09/15 16:07, Russell King wrote:
> 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>
--
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] phy: marvell: add link partner advertised modes
2015-09-23 23:07 [PATCH] phy: marvell: add link partner advertised modes Russell King
2015-09-24 0:01 ` Florian Fainelli
@ 2015-09-25 19:24 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-09-25 19:24 UTC (permalink / raw)
To: rmk+kernel; +Cc: f.fainelli, netdev
From: Russell King <rmk+kernel@arm.linux.org.uk>
Date: Thu, 24 Sep 2015 00:07:17 +0100
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-25 19:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-23 23:07 [PATCH] phy: marvell: add link partner advertised modes Russell King
2015-09-24 0:01 ` Florian Fainelli
2015-09-25 19:24 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).