Commit c9cc1c81 authored by Russell King's avatar Russell King Committed by David S. Miller

net: phy: marvell10g: place in powersave mode at probe

Place the 88x3310 into powersaving mode when probing, which saves 600mW
per PHY. For both PHYs on the Macchiatobin double-shot, this saves
about 10% of the board idle power.
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a585c03e
...@@ -227,6 +227,18 @@ static int mv3310_hwmon_probe(struct phy_device *phydev) ...@@ -227,6 +227,18 @@ static int mv3310_hwmon_probe(struct phy_device *phydev)
} }
#endif #endif
static int mv3310_power_down(struct phy_device *phydev)
{
return phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL,
MV_V2_PORT_CTRL_PWRDOWN);
}
static int mv3310_power_up(struct phy_device *phydev)
{
return phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL,
MV_V2_PORT_CTRL_PWRDOWN);
}
static int mv3310_reset(struct phy_device *phydev, u32 unit) static int mv3310_reset(struct phy_device *phydev, u32 unit)
{ {
int retries, val, err; int retries, val, err;
...@@ -348,6 +360,11 @@ static int mv3310_probe(struct phy_device *phydev) ...@@ -348,6 +360,11 @@ static int mv3310_probe(struct phy_device *phydev)
dev_set_drvdata(&phydev->mdio.dev, priv); dev_set_drvdata(&phydev->mdio.dev, priv);
/* Powering down the port when not in use saves about 600mW */
ret = mv3310_power_down(phydev);
if (ret)
return ret;
ret = mv3310_hwmon_probe(phydev); ret = mv3310_hwmon_probe(phydev);
if (ret) if (ret)
return ret; return ret;
...@@ -357,16 +374,14 @@ static int mv3310_probe(struct phy_device *phydev) ...@@ -357,16 +374,14 @@ static int mv3310_probe(struct phy_device *phydev)
static int mv3310_suspend(struct phy_device *phydev) static int mv3310_suspend(struct phy_device *phydev)
{ {
return phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL, return mv3310_power_down(phydev);
MV_V2_PORT_CTRL_PWRDOWN);
} }
static int mv3310_resume(struct phy_device *phydev) static int mv3310_resume(struct phy_device *phydev)
{ {
int ret; int ret;
ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL, ret = mv3310_power_up(phydev);
MV_V2_PORT_CTRL_PWRDOWN);
if (ret) if (ret)
return ret; return ret;
...@@ -392,6 +407,8 @@ static bool mv3310_has_pma_ngbaset_quirk(struct phy_device *phydev) ...@@ -392,6 +407,8 @@ static bool mv3310_has_pma_ngbaset_quirk(struct phy_device *phydev)
static int mv3310_config_init(struct phy_device *phydev) static int mv3310_config_init(struct phy_device *phydev)
{ {
int err;
/* Check that the PHY interface type is compatible */ /* Check that the PHY interface type is compatible */
if (phydev->interface != PHY_INTERFACE_MODE_SGMII && if (phydev->interface != PHY_INTERFACE_MODE_SGMII &&
phydev->interface != PHY_INTERFACE_MODE_2500BASEX && phydev->interface != PHY_INTERFACE_MODE_2500BASEX &&
...@@ -402,6 +419,11 @@ static int mv3310_config_init(struct phy_device *phydev) ...@@ -402,6 +419,11 @@ static int mv3310_config_init(struct phy_device *phydev)
phydev->mdix_ctrl = ETH_TP_MDI_AUTO; phydev->mdix_ctrl = ETH_TP_MDI_AUTO;
/* Power up so reset works */
err = mv3310_power_up(phydev);
if (err)
return err;
/* Enable EDPD mode - saving 600mW */ /* Enable EDPD mode - saving 600mW */
return mv3310_set_edpd(phydev, ETHTOOL_PHY_EDPD_DFLT_TX_MSECS); return mv3310_set_edpd(phydev, ETHTOOL_PHY_EDPD_DFLT_TX_MSECS);
} }
......
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