950-0500-net-phy-lan87xx-Allow-more-time-for-link-detect.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From eb860f6a2dee9a4c94a7101c1d43194b95fdbc8d Mon Sep 17 00:00:00 2001
  2. From: Phil Elwell <[email protected]>
  3. Date: Wed, 22 Sep 2021 15:38:13 +0100
  4. Subject: [PATCH] net: phy: lan87xx: Allow more time for link detect
  5. With EDPWRDOWN set in idle, it must be cleared before checking for
  6. ENERGYON going high, indicating that a link is being established.
  7. The existing code allows 640ms for ENERGYON to go high, but on
  8. Raspberry Pis that appears not to be enough, causing link detection
  9. to fail.
  10. Increase the polling timeout to 1500ms - with a polling interval of
  11. 10ms it shouldn't cause unnecessary delays.
  12. See: https://github.com/raspberrypi/linux/issues/4393
  13. Signed-off-by: Phil Elwell <[email protected]>
  14. ---
  15. drivers/net/phy/smsc.c | 4 ++--
  16. 1 file changed, 2 insertions(+), 2 deletions(-)
  17. --- a/drivers/net/phy/smsc.c
  18. +++ b/drivers/net/phy/smsc.c
  19. @@ -220,12 +220,12 @@ static int lan87xx_read_status(struct ph
  20. if (rc < 0)
  21. return rc;
  22. - /* Wait max 640 ms to detect energy and the timeout is not
  23. + /* Wait max 1500 ms to detect energy and the timeout is not
  24. * an actual error.
  25. */
  26. read_poll_timeout(phy_read, rc,
  27. rc & MII_LAN83C185_ENERGYON || rc < 0,
  28. - 10000, 640000, true, phydev,
  29. + 10000, 1500000, true, phydev,
  30. MII_LAN83C185_CTRL_STATUS);
  31. if (rc < 0)
  32. return rc;