From nobody Tue Sep 9 16:21:07 2025 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 2314E86344; Sat, 6 Sep 2025 02:33:35 +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=1757126016; cv=none; b=lBIL4qcKhVuFrj/m5RJCtJ1//UNTyOnfcnfP4I3PrEYpWXHB5JYWBSrEJkNsZslDq4g4tbpCDzPt0O8k5c5KUaWU1XFaJbNsfyuIq4GKlbtN8AiCgu2+P/Lnucli2AXq+FWQriH2LEhlV+ZZW3QJDUOoGOSR3ZSNV8aPse/nOGw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757126016; c=relaxed/simple; bh=CjjGp5mFgs4o3zElKsOPJs9kqVayuia7Wq0hfC2LnOg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=WGhKjidQGWS7yKt/h7aYBOaA0kEzA/E/tej8CKlu+JqLF+f8fdxnmM1ADEuvzU5BuFKtEmqi1rlxUfU9g+G44FvIASBJ2JTbRri4TvPSMe4gUvncoBMIF1swlGuDwuEhfsRBQSxa639xeqJxMqkHNr6bGoP86F/Uhh7sv3xg52o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Txu/5q/A; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Txu/5q/A" Received: by smtp.kernel.org (Postfix) with ESMTPS id 91867C4CEF1; Sat, 6 Sep 2025 02:33:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757126015; bh=CjjGp5mFgs4o3zElKsOPJs9kqVayuia7Wq0hfC2LnOg=; h=From:Date:Subject:To:Cc:Reply-To:From; b=Txu/5q/AjgXJ5y2txBWMUMmu4eBrWrQYTm1cHd12xapRloQ/5/angQJh2Xy+42rJD v5qJ3st1CY6igKSaIioojA7XFfYIms82uCHyiYxfwrGIXZfCRSrT6jcZ2N63TklGnv PQaulmrOc8Q4M++C7+eXaY5eMftuOEfpNWYixy9MsPb8InxQAIed3OZ+oMLg56QYhP cS2p5+PJL/giEwXESuZP1amN/RVUs2s+hFLr0WHb8qnjPbik0IIrCVKdDPT2vTv8D5 dZLVxs2Mj8tlEGvqdMxYAWu9LotoocNPFxFxq2YB7aKYE7A+13vzZp8x9sHdwoLLyB B3Ylno9oniQ2w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CF75CA1016; Sat, 6 Sep 2025 02:33:35 +0000 (UTC) From: Rohan G Thomas via B4 Relay Date: Sat, 06 Sep 2025 10:33:31 +0800 Subject: [PATCH net-next v2] net: phy: marvell: Fix 88e1510 downshift counter errata Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250906-marvell_fix-v2-1-f6efb286937f@altera.com> X-B4-Tracking: v=1; b=H4sIAHudu2gC/22NQQrDIBRErxL+uhY1TUO66j1KKL/6bQSjRUVSg nevZN3lzGPe7JAoWkpw63aIVGyywbcgTx2oBf2bmNUtg+Ry4BOXbMVYyLmnsRvrjcReD8SNQmi LT6RWH7YHeMrM05ZhbmSxKYf4PW6KOPhfYxFMsMm8cMSruIxa39FlinhWYYW51voDH7YhJLEAA AA= X-Change-ID: 20250902-marvell_fix-3f2a3d5e0fca To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Rohan G Thomas , Matthew Gerlach X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757126014; l=2972; i=rohan.g.thomas@altera.com; s=20250815; h=from:subject:message-id; bh=F3FOWm0NbZN4sKFf4+eqpl1A14nM44VDQbAr1h+E1Bg=; b=unzfDhLUk4l296CnIJxfXm9dEr3kmLtzND7dWHQ6lCv6fJDgJR9lmfN192y2t+cZSYV28iRcC m7sr92qYlkIDmbhEkBJOo2XQztbk2t6/2+nHDuuYKCHDsvxlGjEOI/U X-Developer-Key: i=rohan.g.thomas@altera.com; a=ed25519; pk=5yZXkXswhfUILKAQwoIn7m6uSblwgV5oppxqde4g4TY= X-Endpoint-Received: by B4 Relay for rohan.g.thomas@altera.com/20250815 with auth_id=494 X-Original-From: Rohan G Thomas Reply-To: rohan.g.thomas@altera.com From: Rohan G Thomas 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 --- Changes in v2: - Updated commit message and function description. - Link to v1: https://lore.kernel.org/r/20250902-marvell_fix-v1-1-9fba7a614= 7dd@altera.com --- 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 623292948fa706a2b0d8b98919ead8b609bbd949..0ea366c1217eb3a6ddc26a83332= 80c211bd9545c 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -1902,6 +1902,43 @@ static int marvell_resume(struct phy_device *phydev) return err; } =20 +/* m88e1510_resume + * + * The 88e1510 PHY has an erratum where the phy downshift counter is not c= leared + * after phy being suspended(BMCR_PDOWN set) and then later resumed(BMCR_P= DOWN + * cleared). This can cause the link to intermittently downshift to a lowe= r speed. + * + * Disabling and re-enabling the downshift feature clears the counter, all= owing + * the PHY to retry gigabit link negotiation up to the programmed retry co= unt + * before downshifting. This behavior has been observed on copper links. + */ +static int m88e1510_resume(struct phy_device *phydev) +{ + int err; + u8 cnt =3D 0; + + err =3D marvell_resume(phydev); + if (err < 0) + return err; + + /* read downshift counter value */ + err =3D m88e1011_get_downshift(phydev, &cnt); + if (err < 0) + return err; + + if (cnt) { + /* downshift disabled */ + err =3D m88e1011_set_downshift(phydev, 0); + if (err < 0) + return err; + + /* downshift enabled, with previous counter value */ + err =3D m88e1011_set_downshift(phydev, cnt); + } + + return err; +} + static int marvell_aneg_done(struct phy_device *phydev) { int retval =3D phy_read(phydev, MII_M1011_PHY_STATUS); @@ -3923,7 +3960,7 @@ static struct phy_driver marvell_drivers[] =3D { .handle_interrupt =3D marvell_handle_interrupt, .get_wol =3D m88e1318_get_wol, .set_wol =3D m88e1318_set_wol, - .resume =3D marvell_resume, + .resume =3D m88e1510_resume, .suspend =3D marvell_suspend, .read_page =3D marvell_read_page, .write_page =3D marvell_write_page, --- base-commit: 2fd4161d0d2547650d9559d57fc67b4e0a26a9e3 change-id: 20250902-marvell_fix-3f2a3d5e0fca Best regards, --=20 Rohan G Thomas