Skip to contentSkip to conversation

net: phy: marvell: add sleep time after enabling the loopback bit

PATCH Applied Aminuddin Jamaluddin 2 participants 2 messages Nov 14, 2022 – Nov 15, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 net: phy: marvell: add sleep time after enabling the loopback bit

Sleep time is added to ensure the phy to be ready after loopback bit was set. This to prevent the phy loopback test from failing.

Fixes 020a45aff119 ("net: phy: marvell: add Marvell specific PHY loopback")
Cc <[email protected]> # 5.15.x

---
V2 -> V3: Fix review comments from Jakub
V1: https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/
---

---
 drivers/net/phy/marvell.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/net/phy/marvell.c +9 -7
index a3e810705ce2..860610ba4d00 100644
@@ -2015,14 +2015,16 @@ static int m88e1510_loopback(struct phy_device *phydev, bool enable)
 		if (err < 0)
 			return err;
 
-		/* FIXME: Based on trial and error test, it seem 1G need to have
-		 * delay between soft reset and loopback enablement.
-		 */
-		if (phydev->speed == SPEED_1000)
-			msleep(1000);
+		err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
+				 BMCR_LOOPBACK);
 
-		return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
-				  BMCR_LOOPBACK);
+		if (!err) {
+			/* It takes some time for PHY device to switch
+			 * into/out-of loopback mode.
+			 */
+			msleep(1000);
+		}
+		return err;
 	} else {
 		err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, 0);
 		if (err < 0)
Signature · 1 line
2.17.1
#1 lore raw
This patch was applied to netdev/net.git (master) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Mon, 14 Nov 2022 14:53:02 +0800 you wrote:

Sleep time is added to ensure the phy to be ready after loopback bit was set. This to prevent the phy loopback test from failing.

Fixes 020a45aff119 ("net: phy: marvell: add Marvell specific PHY loopback")
Cc <[email protected]> # 5.15.x

[...]

Here is the summary with links:
- [net,v3] net: phy: marvell: add sleep time after enabling the loopback bit

    https://git.kernel.org/netdev/net/c/18c532e44939

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html