net: phy: allow phy_init_eee() to work with internal PHYs
authorFlorian Fainelli <f.fainelli@gmail.com>
Sat, 23 Aug 2014 01:55:44 +0000 (18:55 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 23 Aug 2014 18:39:09 +0000 (11:39 -0700)
Internal PHYs do not have any specific phy_interface_t defined because
they are within an Ethernet MAC or a larger IC, they will fail the early
check in phy_init_eee(). Allow these PHYs to proceed with EEE
initialization and report error/success by checking the standard C45
EEE-related registers.

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

index e7a5893f32ff785fa56ae0b6daa38fa58ff60312..932190e04d0854aeb59341e9c3d7b9b22f82b520 100644 (file)
@@ -1019,12 +1019,14 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
 {
        /* According to 802.3az,the EEE is supported only in full duplex-mode.
         * Also EEE feature is active when core is operating with MII, GMII
-        * or RGMII.
+        * or RGMII. Internal PHYs are also allowed to proceed and should
+        * return an error if they do not support EEE.
         */
        if ((phydev->duplex == DUPLEX_FULL) &&
            ((phydev->interface == PHY_INTERFACE_MODE_MII) ||
            (phydev->interface == PHY_INTERFACE_MODE_GMII) ||
-           (phydev->interface == PHY_INTERFACE_MODE_RGMII))) {
+           (phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
+            phy_is_internal(phydev))) {
                int eee_lp, eee_cap, eee_adv;
                u32 lp, cap, adv;
                int status;