7068-dpaa_ethernet-fix-link-state-detect-for-10G-interfac.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. From f77f25498902f84d53a64a6397db2fa4b0d0dd4b Mon Sep 17 00:00:00 2001
  2. From: Shaohui Xie <Shaohui.Xie@nxp.com>
  3. Date: Thu, 31 Mar 2016 10:53:06 +0800
  4. Subject: [PATCH 68/70] dpaa_ethernet: fix link state detect for 10G interface
  5. There are drivers to support 10G PHYs with copper interface, so we
  6. change binding between MAC and 10G PHY to use phy_state_machine to
  7. detect link state.
  8. Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>
  9. ---
  10. drivers/net/ethernet/freescale/sdk_dpaa/mac-api.c | 20 ++++++++------------
  11. 1 file changed, 8 insertions(+), 12 deletions(-)
  12. --- a/drivers/net/ethernet/freescale/sdk_dpaa/mac-api.c
  13. +++ b/drivers/net/ethernet/freescale/sdk_dpaa/mac-api.c
  14. @@ -279,20 +279,15 @@ static int __cold start(struct mac_devic
  15. _errno = fm_mac_enable(mac_dev->get_mac_handle(mac_dev));
  16. - if (!_errno && phy_dev) {
  17. - if (macdev2enetinterface(mac_dev) != e_ENET_MODE_XGMII_10000)
  18. - phy_start(phy_dev);
  19. - else if (phy_dev->drv->read_status)
  20. - phy_dev->drv->read_status(phy_dev);
  21. - }
  22. + if (!_errno && phy_dev)
  23. + phy_start(phy_dev);
  24. return _errno;
  25. }
  26. static int __cold stop(struct mac_device *mac_dev)
  27. {
  28. - if (mac_dev->phy_dev &&
  29. - (macdev2enetinterface(mac_dev) != e_ENET_MODE_XGMII_10000))
  30. + if (mac_dev->phy_dev)
  31. phy_stop(mac_dev->phy_dev);
  32. return fm_mac_disable(mac_dev->get_mac_handle(mac_dev));
  33. @@ -477,8 +472,8 @@ static int xgmac_init_phy(struct net_dev
  34. phy_dev = phy_attach(net_dev, mac_dev->fixed_bus_id,
  35. mac_dev->phy_if);
  36. else
  37. - phy_dev = of_phy_attach(net_dev, mac_dev->phy_node, 0,
  38. - mac_dev->phy_if);
  39. + phy_dev = of_phy_connect(net_dev, mac_dev->phy_node,
  40. + &adjust_link, 0, mac_dev->phy_if);
  41. if (unlikely(phy_dev == NULL) || IS_ERR(phy_dev)) {
  42. netdev_err(net_dev, "Could not attach to PHY %s\n",
  43. mac_dev->phy_node ?
  44. @@ -510,8 +505,9 @@ static int memac_init_phy(struct net_dev
  45. mac_dev->phy_dev = NULL;
  46. return 0;
  47. } else
  48. - phy_dev = of_phy_attach(net_dev, mac_dev->phy_node, 0,
  49. - mac_dev->phy_if);
  50. + phy_dev = of_phy_connect(net_dev, mac_dev->phy_node,
  51. + &adjust_link, 0,
  52. + mac_dev->phy_if);
  53. } else {
  54. if (!mac_dev->phy_node)
  55. phy_dev = phy_connect(net_dev, mac_dev->fixed_bus_id,