001-4.12-08-net-phy-Call-bus-reset-after-releasing-PHYs-from-res.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From df0c8d911abf6ba97b2c2fc3c5a12769e0b081a3 Mon Sep 17 00:00:00 2001
  2. From: Florian Fainelli <[email protected]>
  3. Date: Thu, 11 May 2017 11:24:16 -0700
  4. Subject: [PATCH] net: phy: Call bus->reset() after releasing PHYs from reset
  5. The API convention makes it that a given MDIO bus reset should be able
  6. to access PHY devices in its reset() callback and perform additional
  7. MDIO accesses in order to bring the bus and PHYs in a working state.
  8. Commit 69226896ad63 ("mdio_bus: Issue GPIO RESET to PHYs.") broke that
  9. contract by first calling bus->reset() and then release all PHYs from
  10. reset using their shared GPIO line, so restore the expected
  11. functionality here.
  12. Fixes: 69226896ad63 ("mdio_bus: Issue GPIO RESET to PHYs.")
  13. Signed-off-by: Florian Fainelli <[email protected]>
  14. Signed-off-by: David S. Miller <[email protected]>
  15. ---
  16. drivers/net/phy/mdio_bus.c | 6 +++---
  17. 1 file changed, 3 insertions(+), 3 deletions(-)
  18. --- a/drivers/net/phy/mdio_bus.c
  19. +++ b/drivers/net/phy/mdio_bus.c
  20. @@ -331,9 +331,6 @@ int __mdiobus_register(struct mii_bus *b
  21. mutex_init(&bus->mdio_lock);
  22. - if (bus->reset)
  23. - bus->reset(bus);
  24. -
  25. /* de-assert bus level PHY GPIO resets */
  26. if (bus->num_reset_gpios > 0) {
  27. bus->reset_gpiod = devm_kcalloc(&bus->dev,
  28. @@ -363,6 +360,9 @@ int __mdiobus_register(struct mii_bus *b
  29. }
  30. }
  31. + if (bus->reset)
  32. + bus->reset(bus);
  33. +
  34. for (i = 0; i < PHY_MAX_ADDR; i++) {
  35. if ((bus->phy_mask & (1 << i)) == 0) {
  36. struct phy_device *phydev;