050-net-emac-fix-fixed-link-setup-for-the-RTL8363SB-swit.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From 08e39982ef64f800fd1f9b9b92968d14d5fafa82 Mon Sep 17 00:00:00 2001
  2. From: Christian Lamparter <[email protected]>
  3. Date: Mon, 17 Sep 2018 17:22:40 +0200
  4. Subject: net: emac: fix fixed-link setup for the RTL8363SB switch
  5. On the Netgear WNDAP620, the emac ethernet isn't receiving nor
  6. xmitting any frames from/to the RTL8363SB (identifies itself
  7. as a RTL8367RB).
  8. This is caused by the emac hardware not knowing the forced link
  9. parameters for speed, duplex, pause, etc.
  10. This begs the question, how this was working on the original
  11. driver code, when it was necessary to set the phy_address and
  12. phy_map to 0xffffffff. But I guess without access to the old
  13. PPC405/440/460 hardware, it's not possible to know.
  14. Signed-off-by: Christian Lamparter <[email protected]>
  15. Signed-off-by: David S. Miller <[email protected]>
  16. ---
  17. drivers/net/ethernet/ibm/emac/core.c | 15 ++++++++++-----
  18. 1 file changed, 10 insertions(+), 5 deletions(-)
  19. --- a/drivers/net/ethernet/ibm/emac/core.c
  20. +++ b/drivers/net/ethernet/ibm/emac/core.c
  21. @@ -2671,12 +2671,17 @@ static int emac_init_phy(struct emac_ins
  22. if (of_phy_is_fixed_link(np)) {
  23. int res = emac_dt_mdio_probe(dev);
  24. - if (!res) {
  25. - res = of_phy_register_fixed_link(np);
  26. - if (res)
  27. - mdiobus_unregister(dev->mii_bus);
  28. + if (res)
  29. + return res;
  30. +
  31. + res = of_phy_register_fixed_link(np);
  32. + dev->phy_dev = of_phy_find_device(np);
  33. + if (res || !dev->phy_dev) {
  34. + mdiobus_unregister(dev->mii_bus);
  35. + return res ? res : -EINVAL;
  36. }
  37. - return res;
  38. + emac_adjust_link(dev->ndev);
  39. + put_device(&dev->phy_dev->mdio.dev);
  40. }
  41. return 0;
  42. }