Commit 18c532e4 authored by Aminuddin Jamaluddin's avatar Aminuddin Jamaluddin Committed by Paolo Abeni
Browse files

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: 020a45af ("net: phy: marvell: add Marvell specific PHY loopback")
Cc: <stable@vger.kernel.org> # 5.15.x
Signed-off-by: default avatarMuhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
Signed-off-by: default avatarAminuddin Jamaluddin <aminuddin.jamaluddin@intel.com>
Link: https://lore.kernel.org/r/20221114065302.10625-1-aminuddin.jamaluddin@intel.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent d349e9be
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -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.
		err = 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.
			 */
		if (phydev->speed == SPEED_1000)
			msleep(1000);

		return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
				  BMCR_LOOPBACK);
		}
		return err;
	} else {
		err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, 0);
		if (err < 0)