From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAA37313E33; Wed, 3 Dec 2025 15:36:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764776193; cv=none; b=cmhocZwMa7iDhFjEmuFvvTllIVpLZslVUxzyTazovc7iYBQmVQEkv6vXAa8w4Nv0M5TlqYwqLjnaB1fXbBqqbCuwBp6kCi0hAK8xxd4ZuKAXu1qDn1honJnPYUEJwtJkQOA6pBmJPVJHfGSGqf86SoZej5nx7Qv10o373xrwJL8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764776193; c=relaxed/simple; bh=60UYSVG9xdkjuwOqvewBYqZ+h+HiParSLyrTJW3cJ1k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eBbKiI0yrUiDpMDx3wXFCTCWrKjx7aZbcVN6PAC9gud2tVUU38aQ+CYqsXpX2baExoBL/wzb0Qy4x1XQnqT/JUjaNtQtElRg4OIV+zKy0TRTuGOzK4klZWVQkOC327ryDpB4m59MrL0xwo+99zuYhfKxnCH6n8/NaYMCtHXnZeM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yh3RWfOf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yh3RWfOf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58DA6C4CEF5; Wed, 3 Dec 2025 15:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1764776192; bh=60UYSVG9xdkjuwOqvewBYqZ+h+HiParSLyrTJW3cJ1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yh3RWfOf070lc9I0Ks0M1B10pSgropcpED2ocfw9SRemOQp1H2aG9GM9J0Xfhn9Zu t3dZnphrM/WBYpde45gKUKDVHD1lYq4UvOLXOsoZeTE9WSl4sUibxJajyCOmb0RHeY LXKOPeVG7ln7WdNv+BguVvxnwfAwPlrYfVXAhuTI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rohan G Thomas , Matthew Gerlach , Andrew Lunn , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 109/300] net: phy: marvell: Fix 88e1510 downshift counter errata Date: Wed, 3 Dec 2025 16:25:13 +0100 Message-ID: <20251203152404.660771977@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251203152400.447697997@linuxfoundation.org> References: <20251203152400.447697997@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rohan G Thomas [ Upstream commit deb105f49879dd50d595f7f55207d6e74dec34e6 ] The 88e1510 PHY has an erratum where the phy downshift counter is not cleared after phy being suspended(BMCR_PDOWN set) and then later resumed(BMCR_PDOWN cleared). This can cause the gigabit link to intermittently downshift to a lower speed. Disabling and re-enabling the downshift feature clears the counter, allowing the PHY to retry gigabit link negotiation up to the programmed retry count times before downshifting. This behavior has been observed on copper links. Signed-off-by: Rohan G Thomas Reviewed-by: Matthew Gerlach Reviewed-by: Andrew Lunn Link: https://patch.msgid.link/20250906-marvell_fix-v2-1-f6efb286937f@altera.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/phy/marvell.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 54786712a9913..6504aa0f1889d 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -1596,6 +1596,43 @@ static int marvell_resume(struct phy_device *phydev) return err; } +/* m88e1510_resume + * + * The 88e1510 PHY has an erratum where the phy downshift counter is not cleared + * after phy being suspended(BMCR_PDOWN set) and then later resumed(BMCR_PDOWN + * cleared). This can cause the link to intermittently downshift to a lower speed. + * + * Disabling and re-enabling the downshift feature clears the counter, allowing + * the PHY to retry gigabit link negotiation up to the programmed retry count + * before downshifting. This behavior has been observed on copper links. + */ +static int m88e1510_resume(struct phy_device *phydev) +{ + int err; + u8 cnt = 0; + + err = marvell_resume(phydev); + if (err < 0) + return err; + + /* read downshift counter value */ + err = m88e1011_get_downshift(phydev, &cnt); + if (err < 0) + return err; + + if (cnt) { + /* downshift disabled */ + err = m88e1011_set_downshift(phydev, 0); + if (err < 0) + return err; + + /* downshift enabled, with previous counter value */ + err = m88e1011_set_downshift(phydev, cnt); + } + + return err; +} + static int marvell_aneg_done(struct phy_device *phydev) { int retval = phy_read(phydev, MII_M1011_PHY_STATUS); @@ -2845,7 +2882,7 @@ static struct phy_driver marvell_drivers[] = { .did_interrupt = m88e1121_did_interrupt, .get_wol = m88e1318_get_wol, .set_wol = m88e1318_set_wol, - .resume = marvell_resume, + .resume = m88e1510_resume, .suspend = marvell_suspend, .read_page = marvell_read_page, .write_page = marvell_write_page, -- 2.51.0