Skip to content

Commit 6dac8f1

Browse files
committed
net: phy: marvell: add sleep time after enabling the loopback bit
Author: Aminuddin Jamaluddin <aminuddin.jamaluddin@intel.com> 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: <stable@vger.kernel.org> # 5.15.x Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com> Signed-off-by: Aminuddin Jamaluddin <aminuddin.jamaluddin@intel.com> Link: https://lore.kernel.org/r/20221114065302.10625-1-aminuddin.jamaluddin@intel.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> (cherry picked from commit 18c532e) Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2100606 Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
1 parent eae494c commit 6dac8f1

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

drivers/net/phy/marvell.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,14 +1960,16 @@ static int m88e1510_loopback(struct phy_device *phydev, bool enable)
19601960
if (err < 0)
19611961
return err;
19621962

1963-
/* FIXME: Based on trial and error test, it seem 1G need to have
1964-
* delay between soft reset and loopback enablement.
1965-
*/
1966-
if (phydev->speed == SPEED_1000)
1967-
msleep(1000);
1963+
err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
1964+
BMCR_LOOPBACK);
19681965

1969-
return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
1970-
BMCR_LOOPBACK);
1966+
if (!err) {
1967+
/* It takes some time for PHY device to switch
1968+
* into/out-of loopback mode.
1969+
*/
1970+
msleep(1000);
1971+
}
1972+
return err;
19711973
} else {
19721974
err = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, 0);
19731975
if (err < 0)

0 commit comments

Comments
 (0)