net: phy: broadcom: Allow enabling or disabling of EEE
authorFlorian Fainelli <f.fainelli@gmail.com>
Tue, 22 Nov 2016 19:40:56 +0000 (11:40 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Nov 2016 20:45:53 +0000 (15:45 -0500)
In preparation for adding support for Wirespeed/downshift, we need to
change bcm_phy_eee_enable() to allow enabling or disabling EEE, so make
the function take an extra enable/disable boolean parameter and rename
it to illustrate it sets EEE, not necessarily just enables it.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/bcm-cygnus.c
drivers/net/phy/bcm-phy-lib.c
drivers/net/phy/bcm-phy-lib.h
drivers/net/phy/bcm7xxx.c

index 49bbc682688356ae89b8ffcc629f017196f4c5ae..196400cddf687f6722867bc93cd214a258be8119 100644 (file)
@@ -104,7 +104,7 @@ static int bcm_cygnus_config_init(struct phy_device *phydev)
                return rc;
 
        /* Advertise EEE */
-       rc = bcm_phy_enable_eee(phydev);
+       rc = bcm_phy_set_eee(phydev, true);
        if (rc)
                return rc;
 
index d742894816f64a6b595a78a064fcce376f67176a..3156ce6d5861b8e8fdbc5add1c8f725a6dea5d62 100644 (file)
@@ -195,7 +195,7 @@ int bcm_phy_enable_apd(struct phy_device *phydev, bool dll_pwr_down)
 }
 EXPORT_SYMBOL_GPL(bcm_phy_enable_apd);
 
-int bcm_phy_enable_eee(struct phy_device *phydev)
+int bcm_phy_set_eee(struct phy_device *phydev, bool enable)
 {
        int val;
 
@@ -205,7 +205,10 @@ int bcm_phy_enable_eee(struct phy_device *phydev)
        if (val < 0)
                return val;
 
-       val |= LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X;
+       if (enable)
+               val |= LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X;
+       else
+               val &= ~(LPI_FEATURE_EN | LPI_FEATURE_EN_DIG1000X);
 
        phy_write_mmd_indirect(phydev, BRCM_CL45VEN_EEE_CONTROL,
                               MDIO_MMD_AN, (u32)val);
@@ -216,14 +219,17 @@ int bcm_phy_enable_eee(struct phy_device *phydev)
        if (val < 0)
                return val;
 
-       val |= (MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T);
+       if (enable)
+               val |= (MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T);
+       else
+               val &= ~(MDIO_AN_EEE_ADV_100TX | MDIO_AN_EEE_ADV_1000T);
 
        phy_write_mmd_indirect(phydev, BCM_CL45VEN_EEE_ADV,
                               MDIO_MMD_AN, (u32)val);
 
        return 0;
 }
-EXPORT_SYMBOL_GPL(bcm_phy_enable_eee);
+EXPORT_SYMBOL_GPL(bcm_phy_set_eee);
 
 int bcm_phy_downshift_get(struct phy_device *phydev, u8 *count)
 {
index 3f492e6290943759d994034beb5a9129d30ef7c9..a117f657c6d781265f396d92e7b1f1296fb9f108 100644 (file)
@@ -36,7 +36,7 @@ int bcm_phy_config_intr(struct phy_device *phydev);
 
 int bcm_phy_enable_apd(struct phy_device *phydev, bool dll_pwr_down);
 
-int bcm_phy_enable_eee(struct phy_device *phydev);
+int bcm_phy_set_eee(struct phy_device *phydev, bool enable);
 
 int bcm_phy_downshift_get(struct phy_device *phydev, u8 *count);
 
index 9636da0b6efc449907025b52e5e9cefaa51df198..b7789e8796704f9adae600173540466018440ce8 100644 (file)
@@ -199,7 +199,7 @@ static int bcm7xxx_28nm_config_init(struct phy_device *phydev)
        if (ret)
                return ret;
 
-       ret = bcm_phy_enable_eee(phydev);
+       ret = bcm_phy_set_eee(phydev, true);
        if (ret)
                return ret;