Commit b188ce30 authored by Jerome Brunet's avatar Jerome Brunet Committed by Greg Kroah-Hartman

net: stmmac: enable EEE in MII, GMII or RGMII only


[ Upstream commit 879626e3 ]

Note in the databook - Section 4.4 - EEE :
" The EEE feature is not supported when the MAC is configured to use the
TBI, RTBI, SMII, RMII or SGMII single PHY interface. Even if the MAC
supports multiple PHY interfaces, you should activate the EEE mode only
when the MAC is operating with GMII, MII, or RGMII interface."

Applying this restriction solves a stability issue observed on Amlogic
gxl platforms operating with RMII interface and the internal PHY.

Fixes: 83bf79b6 ("stmmac: disable at run-time the EEE if not supported")
Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Tested-by: default avatarArnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f574e2e8
...@@ -272,8 +272,14 @@ bool stmmac_eee_init(struct stmmac_priv *priv) ...@@ -272,8 +272,14 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
{ {
char *phy_bus_name = priv->plat->phy_bus_name; char *phy_bus_name = priv->plat->phy_bus_name;
unsigned long flags; unsigned long flags;
int interface = priv->plat->interface;
bool ret = false; bool ret = false;
if ((interface != PHY_INTERFACE_MODE_MII) &&
(interface != PHY_INTERFACE_MODE_GMII) &&
!phy_interface_mode_is_rgmii(interface))
goto out;
/* Using PCS we cannot dial with the phy registers at this stage /* Using PCS we cannot dial with the phy registers at this stage
* so we do not support extra feature like EEE. * so we do not support extra feature like EEE.
*/ */
......
...@@ -682,6 +682,17 @@ static inline bool phy_is_internal(struct phy_device *phydev) ...@@ -682,6 +682,17 @@ static inline bool phy_is_internal(struct phy_device *phydev)
return phydev->is_internal; return phydev->is_internal;
} }
/**
* phy_interface_mode_is_rgmii - Convenience function for testing if a
* PHY interface mode is RGMII (all variants)
* @mode: the phy_interface_t enum
*/
static inline bool phy_interface_mode_is_rgmii(phy_interface_t mode)
{
return mode >= PHY_INTERFACE_MODE_RGMII &&
mode <= PHY_INTERFACE_MODE_RGMII_TXID;
};
/** /**
* phy_interface_is_rgmii - Convenience function for testing if a PHY interface * phy_interface_is_rgmii - Convenience function for testing if a PHY interface
* is RGMII (all variants) * is RGMII (all variants)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment