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
5 In preparation for adding support for Wirespeed/downshift, we need to
6 change bcm_phy_eee_enable() to allow enabling or disabling EEE, so make
7 the function take an extra enable/disable boolean parameter and rename
8 it to illustrate it sets EEE, not necessarily just enables it.
10 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
11 Signed-off-by: David S. Miller <davem@davemloft.net>
14 --- a/drivers/net/phy/bcm7xxx.c
15 +++ b/drivers/net/phy/bcm7xxx.c
16 @@ -199,7 +199,7 @@ static int bcm7xxx_28nm_config_init(stru
20 - ret = bcm_phy_enable_eee(phydev);
21 + ret = bcm_phy_set_eee(phydev, true);
25 --- a/drivers/net/phy/bcm-cygnus.c
26 +++ b/drivers/net/phy/bcm-cygnus.c
27 @@ -104,7 +104,7 @@ static int bcm_cygnus_config_init(struct
31 - rc = bcm_phy_enable_eee(phydev);
32 + rc = bcm_phy_set_eee(phydev, true);
36 --- a/drivers/net/phy/bcm-phy-lib.c
37 +++ b/drivers/net/phy/bcm-phy-lib.c
38 @@ -195,7 +195,7 @@ int bcm_phy_enable_apd(struct phy_device
40 EXPORT_SYMBOL_GPL(bcm_phy_enable_apd);
42 -int bcm_phy_enable_eee(struct phy_device *phydev)
43 +int bcm_phy_set_eee(struct phy_device *phydev, bool enable)
47 @@ -205,7 +205,10 @@ int bcm_phy_enable_eee(struct phy_device
51 - val |= LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X;
53 + val |= LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X;
55 + val &= ~(LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X);
57 phy_write_mmd_indirect(phydev, BRCM_CL45VEN_EEE_CONTROL,
58 MDIO_MMD_AN, (u32)val);
59 @@ -216,14 +219,17 @@ int bcm_phy_enable_eee(struct phy_device
63 - val |= (MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T);
65 + val |= (MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T);
67 + val &= ~(MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T);
69 phy_write_mmd_indirect(phydev, BCM_CL45VEN_EEE_ADV,
70 MDIO_MMD_AN, (u32)val);
74 -EXPORT_SYMBOL_GPL(bcm_phy_enable_eee);
75 +EXPORT_SYMBOL_GPL(bcm_phy_set_eee);
77 MODULE_DESCRIPTION("Broadcom PHY Library");
78 MODULE_LICENSE("GPL v2");
79 --- a/drivers/net/phy/bcm-phy-lib.h
80 +++ b/drivers/net/phy/bcm-phy-lib.h
81 @@ -43,5 +43,5 @@ int bcm_phy_config_intr(struct phy_devic
83 int bcm_phy_enable_apd(struct phy_device *phydev, bool dll_pwr_down);
85 -int bcm_phy_enable_eee(struct phy_device *phydev);
86 +int bcm_phy_set_eee(struct phy_device *phydev, bool enable);
87 #endif /* _LINUX_BCM_PHY_LIB_H */