Skip to content

Commit c9cc1c8

Browse files
Russell Kingdavem330
authored andcommitted
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: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a585c03 commit c9cc1c8

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

drivers/net/phy/marvell10g.c

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,18 @@ static int mv3310_hwmon_probe(struct phy_device *phydev)
227227
}
228228
#endif
229229

230+
static int mv3310_power_down(struct phy_device *phydev)
231+
{
232+
return phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL,
233+
MV_V2_PORT_CTRL_PWRDOWN);
234+
}
235+
236+
static int mv3310_power_up(struct phy_device *phydev)
237+
{
238+
return phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL,
239+
MV_V2_PORT_CTRL_PWRDOWN);
240+
}
241+
230242
static int mv3310_reset(struct phy_device *phydev, u32 unit)
231243
{
232244
int retries, val, err;
@@ -348,6 +360,11 @@ static int mv3310_probe(struct phy_device *phydev)
348360

349361
dev_set_drvdata(&phydev->mdio.dev, priv);
350362

363+
/* Powering down the port when not in use saves about 600mW */
364+
ret = mv3310_power_down(phydev);
365+
if (ret)
366+
return ret;
367+
351368
ret = mv3310_hwmon_probe(phydev);
352369
if (ret)
353370
return ret;
@@ -357,16 +374,14 @@ static int mv3310_probe(struct phy_device *phydev)
357374

358375
static int mv3310_suspend(struct phy_device *phydev)
359376
{
360-
return phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL,
361-
MV_V2_PORT_CTRL_PWRDOWN);
377+
return mv3310_power_down(phydev);
362378
}
363379

364380
static int mv3310_resume(struct phy_device *phydev)
365381
{
366382
int ret;
367383

368-
ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL,
369-
MV_V2_PORT_CTRL_PWRDOWN);
384+
ret = mv3310_power_up(phydev);
370385
if (ret)
371386
return ret;
372387

@@ -392,6 +407,8 @@ static bool mv3310_has_pma_ngbaset_quirk(struct phy_device *phydev)
392407

393408
static int mv3310_config_init(struct phy_device *phydev)
394409
{
410+
int err;
411+
395412
/* Check that the PHY interface type is compatible */
396413
if (phydev->interface != PHY_INTERFACE_MODE_SGMII &&
397414
phydev->interface != PHY_INTERFACE_MODE_2500BASEX &&
@@ -402,6 +419,11 @@ static int mv3310_config_init(struct phy_device *phydev)
402419

403420
phydev->mdix_ctrl = ETH_TP_MDI_AUTO;
404421

422+
/* Power up so reset works */
423+
err = mv3310_power_up(phydev);
424+
if (err)
425+
return err;
426+
405427
/* Enable EDPD mode - saving 600mW */
406428
return mv3310_set_edpd(phydev, ETHTOOL_PHY_EDPD_DFLT_TX_MSECS);
407429
}

0 commit comments

Comments
 (0)