076-v4.11-0001-net-phy-broadcom-Allow-enabling-or-disabling-of-EEE.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. From: Florian Fainelli <f.fainelli@gmail.com>
  2. Date: Tue, 22 Nov 2016 11:40:56 -0800
  3. Subject: [PATCH] net: phy: broadcom: Allow enabling or disabling of EEE
  4. In preparation for adding support for Wirespeed/downshift, we need to
  5. change bcm_phy_eee_enable() to allow enabling or disabling EEE, so make
  6. the function take an extra enable/disable boolean parameter and rename
  7. it to illustrate it sets EEE, not necessarily just enables it.
  8. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
  9. Signed-off-by: David S. Miller <davem@davemloft.net>
  10. ---
  11. --- a/drivers/net/phy/bcm7xxx.c
  12. +++ b/drivers/net/phy/bcm7xxx.c
  13. @@ -199,7 +199,7 @@ static int bcm7xxx_28nm_config_init(stru
  14. if (ret)
  15. return ret;
  16. - ret = bcm_phy_enable_eee(phydev);
  17. + ret = bcm_phy_set_eee(phydev, true);
  18. if (ret)
  19. return ret;
  20. --- a/drivers/net/phy/bcm-cygnus.c
  21. +++ b/drivers/net/phy/bcm-cygnus.c
  22. @@ -104,7 +104,7 @@ static int bcm_cygnus_config_init(struct
  23. return rc;
  24. /* Advertise EEE */
  25. - rc = bcm_phy_enable_eee(phydev);
  26. + rc = bcm_phy_set_eee(phydev, true);
  27. if (rc)
  28. return rc;
  29. --- a/drivers/net/phy/bcm-phy-lib.c
  30. +++ b/drivers/net/phy/bcm-phy-lib.c
  31. @@ -195,7 +195,7 @@ int bcm_phy_enable_apd(struct phy_device
  32. }
  33. EXPORT_SYMBOL_GPL(bcm_phy_enable_apd);
  34. -int bcm_phy_enable_eee(struct phy_device *phydev)
  35. +int bcm_phy_set_eee(struct phy_device *phydev, bool enable)
  36. {
  37. int val;
  38. @@ -205,7 +205,10 @@ int bcm_phy_enable_eee(struct phy_device
  39. if (val < 0)
  40. return val;
  41. - val |= LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X;
  42. + if (enable)
  43. + val |= LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X;
  44. + else
  45. + val &= ~(LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X);
  46. phy_write_mmd_indirect(phydev, BRCM_CL45VEN_EEE_CONTROL,
  47. MDIO_MMD_AN, (u32)val);
  48. @@ -216,14 +219,17 @@ int bcm_phy_enable_eee(struct phy_device
  49. if (val < 0)
  50. return val;
  51. - val |= (MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T);
  52. + if (enable)
  53. + val |= (MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T);
  54. + else
  55. + val &= ~(MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T);
  56. phy_write_mmd_indirect(phydev, BCM_CL45VEN_EEE_ADV,
  57. MDIO_MMD_AN, (u32)val);
  58. return 0;
  59. }
  60. -EXPORT_SYMBOL_GPL(bcm_phy_enable_eee);
  61. +EXPORT_SYMBOL_GPL(bcm_phy_set_eee);
  62. MODULE_DESCRIPTION("Broadcom PHY Library");
  63. MODULE_LICENSE("GPL v2");
  64. --- a/drivers/net/phy/bcm-phy-lib.h
  65. +++ b/drivers/net/phy/bcm-phy-lib.h
  66. @@ -43,5 +43,5 @@ int bcm_phy_config_intr(struct phy_devic
  67. int bcm_phy_enable_apd(struct phy_device *phydev, bool dll_pwr_down);
  68. -int bcm_phy_enable_eee(struct phy_device *phydev);
  69. +int bcm_phy_set_eee(struct phy_device *phydev, bool enable);
  70. #endif /* _LINUX_BCM_PHY_LIB_H */