|
|
@@ -0,0 +1,78 @@
|
|
|
+From patchwork Wed Jan 15 14:43:35 2025
|
|
|
+Content-Type: text/plain; charset="utf-8"
|
|
|
+MIME-Version: 1.0
|
|
|
+Content-Transfer-Encoding: 7bit
|
|
|
+X-Patchwork-Submitter: Daniel Golle <[email protected]>
|
|
|
+X-Patchwork-Id: 13940510
|
|
|
+X-Patchwork-Delegate: [email protected]
|
|
|
+Date: Wed, 15 Jan 2025 14:43:35 +0000
|
|
|
+From: Daniel Golle <[email protected]>
|
|
|
+To: Andrew Lunn <[email protected]>, Heiner Kallweit <[email protected]>,
|
|
|
+ Russell King <[email protected]>,
|
|
|
+ "David S. Miller" <[email protected]>,
|
|
|
+ Eric Dumazet <[email protected]>,
|
|
|
+ Jakub Kicinski <[email protected]>, Paolo Abeni <[email protected]>,
|
|
|
+ Daniel Golle <[email protected]>,
|
|
|
+ "Russell King (Oracle)" <[email protected]>,
|
|
|
+ [email protected], [email protected]
|
|
|
+Subject: [PATCH net 1/3] net: phy: realtek: clear 1000Base-T lpa if link is
|
|
|
+ down
|
|
|
+Message-ID:
|
|
|
+ <67e38eee4c46b921938fb33f5bc86c8979b9aa33.1736951652.git.daniel@makrotopia.org>
|
|
|
+References: <[email protected]>
|
|
|
+Precedence: bulk
|
|
|
+X-Mailing-List: [email protected]
|
|
|
+List-Id: <netdev.vger.kernel.org>
|
|
|
+List-Subscribe: <mailto:[email protected]>
|
|
|
+List-Unsubscribe: <mailto:[email protected]>
|
|
|
+MIME-Version: 1.0
|
|
|
+Content-Disposition: inline
|
|
|
+In-Reply-To: <[email protected]>
|
|
|
+X-Patchwork-Delegate: [email protected]
|
|
|
+
|
|
|
+Only read 1000Base-T link partner advertisement if autonegotiation has
|
|
|
+completed and otherwise 1000Base-T link partner advertisement bits.
|
|
|
+
|
|
|
+This fixes bogus 1000Base-T link partner advertisement after link goes
|
|
|
+down (eg. by disconnecting the wire).
|
|
|
+Fixes: 5cb409b3960e ("net: phy: realtek: clear 1000Base-T link partner advertisement")
|
|
|
+Signed-off-by: Daniel Golle <[email protected]>
|
|
|
+Reviewed-by: Michal Swiatkowski <[email protected]>
|
|
|
+---
|
|
|
+ drivers/net/phy/realtek/realtek_main.c | 19 ++++++++-----------
|
|
|
+ 1 file changed, 8 insertions(+), 11 deletions(-)
|
|
|
+
|
|
|
+--- a/drivers/net/phy/realtek/realtek_main.c
|
|
|
++++ b/drivers/net/phy/realtek/realtek_main.c
|
|
|
+@@ -1068,23 +1068,20 @@ static int rtl822x_c45_read_status(struc
|
|
|
+ {
|
|
|
+ int ret, val;
|
|
|
+
|
|
|
+- ret = genphy_c45_read_status(phydev);
|
|
|
+- if (ret < 0)
|
|
|
+- return ret;
|
|
|
+-
|
|
|
+- if (phydev->autoneg == AUTONEG_DISABLE ||
|
|
|
+- !genphy_c45_aneg_done(phydev))
|
|
|
+- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, 0);
|
|
|
+-
|
|
|
+ /* Vendor register as C45 has no standardized support for 1000BaseT */
|
|
|
+- if (phydev->autoneg == AUTONEG_ENABLE) {
|
|
|
++ if (phydev->autoneg == AUTONEG_ENABLE && genphy_c45_aneg_done(phydev)) {
|
|
|
+ val = phy_read_mmd(phydev, MDIO_MMD_VEND2,
|
|
|
+ RTL822X_VND2_GANLPAR);
|
|
|
+ if (val < 0)
|
|
|
+ return val;
|
|
|
+-
|
|
|
+- mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val);
|
|
|
++ } else {
|
|
|
++ val = 0;
|
|
|
+ }
|
|
|
++ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val);
|
|
|
++
|
|
|
++ ret = genphy_c45_read_status(phydev);
|
|
|
++ if (ret < 0)
|
|
|
++ return ret;
|
|
|
+
|
|
|
+ if (!phydev->link)
|
|
|
+ return 0;
|