Subject: [PATCH net-next v3] net: phy: mxl-gpy: fix delay time required by loopback disable function

From: Xu Liang <[email-masked]>
Date: Wed, 11 Jan 2023 16:22:01 +0800

GPY2xx devices need 3 seconds to fully switch out of loopback mode
before it can safely re-enter loopback mode.

Signed-off-by: Xu Liang <[email-masked]>
---
v2 changes:
 Update comments.

v3 changes:
 Submit for net-next.

 drivers/net/phy/mxl-gpy.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/mxl-gpy.c b/drivers/net/phy/mxl-gpy.c
index 147d7a5a9b35..b682d7fc477c 100644
--- a/drivers/net/phy/mxl-gpy.c
+++ b/drivers/net/phy/mxl-gpy.c
@@ -770,9 +770,11 @@ static int gpy_loopback(struct phy_device *phydev, bool enable)
 			 enable ? BMCR_LOOPBACK : 0);
 	if (!ret) {
 		/* It takes some time for PHY device to switch
-		 * into/out-of loopback mode.
+		 * into/out-of loopback mode. It takes 3 seconds
+		 * to fully switch out of loopback mode before
+		 * it can safely re-enter loopback mode.
 		 */
-		msleep(100);
+		msleep(enable ? 100 : 3000);
 	}
 
 	return ret;
-- 
2.17.1