Skip to content

Commit

Permalink
net: phy: marvell: add sleep time after enabling the loopback bit
Browse files Browse the repository at this point in the history
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: 020a45a ("net: phy: marvell: add Marvell specific PHY loopback")
Cc: <[email protected]> # 5.15.x
Signed-off-by: Muhammad Husaini Zulkifli <[email protected]>
Signed-off-by: Aminuddin Jamaluddin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
aminuddinjamaluddin authored and Paolo Abeni committed Nov 15, 2022
1 parent d349e9b commit 18c532e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions drivers/net/phy/marvell.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 18c532e

Please sign in to comment.