mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] amd-xgbe: read link status twice to avoid inconsistencies
@ 2025-05-14 19:41 Raju Rangoju
  2025-05-15  0:07 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Raju Rangoju @ 2025-05-14 19:41 UTC (permalink / raw)
  To: andrew+netdev, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, Shyam-sundar.S-k, Raju Rangoju

The link status is latched low, so read the register twice to get the
current status and avoid link inconsistencies.

As per IEEE 802.3 "Table 22-8 - Status register bit definitions"
1.2  Link Status  1 = link is up    0 = link is down    RO/LL

Fixes: 4f3b20bfbb75 ("amd-xgbe: add support for rx-adaptation")
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 268399dfcf22..d233e3faa1a9 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -2914,6 +2914,10 @@ static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart)
 		}
 
 		/* check again for the link and adaptation status */
+		/* Link status is latched low, so read once to clear
+		 * and then read again to get current state
+		 */
+		reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
 		reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
 		if ((reg & MDIO_STAT1_LSTATUS) && pdata->rx_adapt_done)
 			return 1;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-25  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-14 19:41 [PATCH net] amd-xgbe: read link status twice to avoid inconsistencies Raju Rangoju
2025-05-15  0:07 ` Andrew Lunn
2025-06-25  9:42   ` Rangoju, Raju

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®