netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: mvpp2: cycle comphy to power it down
@ 2019-12-17 15:47 Russell King
  2019-12-17 18:04 ` Antoine Tenart
  2019-12-20  1:27 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Russell King @ 2019-12-17 15:47 UTC (permalink / raw)
  To: Antoine Tenart, maxime.chevallier; +Cc: Willy Tarreau, David S. Miller, netdev

Presently, at boot time, the comphys are enabled. For firmware
compatibility reasons, the comphy driver does not power down the
comphys at boot. Consequently, the ethernet comphys are left active
until the network interfaces are brought through an up/down cycle.

If the port is never used, the port wastes power needlessly. Arrange
for the ethernet comphys to be cycled by the mvpp2 driver as if the
interface went through an up/down cycle during driver probe, thereby
powering them down.

This saves:
  270mW per 10G SFP+ port on the Macchiatobin Single Shot (eth0/eth1)
  370mW per 10G PHY port on the Macchiatobin Double Shot (eth0/eth1)
  160mW on the SFP port on either Macchiatobin flavour (eth3)

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index c17b6cafef07..88a475606f19 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -5546,6 +5546,16 @@ static int mvpp2_port_probe(struct platform_device *pdev,
 		port->phylink = NULL;
 	}
 
+	/* Cycle the comphy to power it down, saving 270mW per port -
+	 * don't worry about an error powering it up. When the comphy
+	 * driver does this, we can remove this code.
+	 */
+	if (port->comphy) {
+		err = mvpp22_comphy_init(port);
+		if (err == 0)
+			phy_power_off(port->comphy);
+	}
+
 	err = register_netdev(dev);
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to register netdev\n");
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: mvpp2: cycle comphy to power it down
  2019-12-17 15:47 [PATCH net-next] net: mvpp2: cycle comphy to power it down Russell King
@ 2019-12-17 18:04 ` Antoine Tenart
  2019-12-20  1:27 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Antoine Tenart @ 2019-12-17 18:04 UTC (permalink / raw)
  To: Russell King
  Cc: Antoine Tenart, maxime.chevallier, Willy Tarreau,
	David S. Miller, netdev

Hi Russell,

On Tue, Dec 17, 2019 at 03:47:36PM +0000, Russell King wrote:
> Presently, at boot time, the comphys are enabled. For firmware
> compatibility reasons, the comphy driver does not power down the
> comphys at boot. Consequently, the ethernet comphys are left active
> until the network interfaces are brought through an up/down cycle.
> 
> If the port is never used, the port wastes power needlessly. Arrange
> for the ethernet comphys to be cycled by the mvpp2 driver as if the
> interface went through an up/down cycle during driver probe, thereby
> powering them down.
> 
> This saves:
>   270mW per 10G SFP+ port on the Macchiatobin Single Shot (eth0/eth1)
>   370mW per 10G PHY port on the Macchiatobin Double Shot (eth0/eth1)
>   160mW on the SFP port on either Macchiatobin flavour (eth3)
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

Acked-by: Antoine Tenart <antoine.tenart@bootlin.com>

Thanks!
Antoine

> ---
>  drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index c17b6cafef07..88a475606f19 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -5546,6 +5546,16 @@ static int mvpp2_port_probe(struct platform_device *pdev,
>  		port->phylink = NULL;
>  	}
>  
> +	/* Cycle the comphy to power it down, saving 270mW per port -
> +	 * don't worry about an error powering it up. When the comphy
> +	 * driver does this, we can remove this code.
> +	 */
> +	if (port->comphy) {
> +		err = mvpp22_comphy_init(port);
> +		if (err == 0)
> +			phy_power_off(port->comphy);
> +	}
> +
>  	err = register_netdev(dev);
>  	if (err < 0) {
>  		dev_err(&pdev->dev, "failed to register netdev\n");
> -- 
> 2.20.1
> 

-- 
Antoine Ténart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: mvpp2: cycle comphy to power it down
  2019-12-17 15:47 [PATCH net-next] net: mvpp2: cycle comphy to power it down Russell King
  2019-12-17 18:04 ` Antoine Tenart
@ 2019-12-20  1:27 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-12-20  1:27 UTC (permalink / raw)
  To: rmk+kernel; +Cc: antoine.tenart, maxime.chevallier, w, netdev

From: Russell King <rmk+kernel@armlinux.org.uk>
Date: Tue, 17 Dec 2019 15:47:36 +0000

> Presently, at boot time, the comphys are enabled. For firmware
> compatibility reasons, the comphy driver does not power down the
> comphys at boot. Consequently, the ethernet comphys are left active
> until the network interfaces are brought through an up/down cycle.
> 
> If the port is never used, the port wastes power needlessly. Arrange
> for the ethernet comphys to be cycled by the mvpp2 driver as if the
> interface went through an up/down cycle during driver probe, thereby
> powering them down.
> 
> This saves:
>   270mW per 10G SFP+ port on the Macchiatobin Single Shot (eth0/eth1)
>   370mW per 10G PHY port on the Macchiatobin Double Shot (eth0/eth1)
>   160mW on the SFP port on either Macchiatobin flavour (eth3)
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-20  1:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17 15:47 [PATCH net-next] net: mvpp2: cycle comphy to power it down Russell King
2019-12-17 18:04 ` Antoine Tenart
2019-12-20  1:27 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).