From nobody Wed Oct 1 22:26:33 2025 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 705522C0274; Sun, 28 Sep 2025 08:59:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759049968; cv=none; b=o15ydPOPS9K8X7qS8n0TndolI+hfkbgh9T47nSqtpymmIJ37w9Hv8txupLBdabB+Lk27fO8LGasV2wkctR/w6iyWcaYzcv1qVTe9MYW1znht3KsaQ6dDxV5fb7p/AmJT0i+hbjgh/MTYMoWlAz4ql36SMmJNRrltLnQtzFWoOx8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759049968; c=relaxed/simple; bh=k8HXsKN2I6Age9nGtZCWSwvJPLDOE9OIXSz0/tiDLhc=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=MZX+bji3COUPiTMOugAse/rhESJT+rWOYrlEvIulCyP9t79dRd3Ghyn+EmvWZ++vPjoyJ1RwjVVxG/kCZBheHxZF8usMriqV8c+gbA8Y31OmvSXK7IVqoo78V+69sk1k9UniYUBprf66+uJ5gBwA8aZkxpt2nc52JVd7ufEiceI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=haAs3jFs; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="haAs3jFs" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2YaJLzurlCfXcfc8Px72NgfNrq2XZEVc2OMspglX/3M=; b=haAs3jFsBNvXmRoBLY8HGisP5R NzxlqpB2TVCJ4Rlqr2c5ATKDVebzg1S6dMWLmF9+2LNwXqT+pCUonHnC7Ksv4/zszou4V4aB7WPAM tbTSRMuKYkwMBEstIH7xzbEqbay7pNroe+gMLBPKS8oAhfWK8RZ6hDGToobRCWtsJbiYVU8fXXBfX 1grsVfazI5iPjTI4G0vq7DeGEAi9XamSLvrEX94zk/XwAP9Jegg9E37sA4kRsMEFiv3IW60gnV7TW sw3Trj91Z4VzlZJyC2qQgrHWTjXdfuo6N8qr0x5oe5CLq96GIrQG29i5nVbhPar+zifAyDL1BaoEM wnljmbjg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:54426 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1v2nFO-000000005BG-2e4q; Sun, 28 Sep 2025 09:59:10 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1v2nFN-00000007jXb-1kj0; Sun, 28 Sep 2025 09:59:09 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit , Florian Fainelli , Gatien Chevallier Cc: Alexandre Torgue , Andrew Lunn , Andrew Lunn , Christophe Roullier , Conor Dooley , "David S. Miller" , devicetree@vger.kernel.org, Eric Dumazet , Heiner Kallweit , Jakub Kicinski , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni , Rob Herring , Simon Horman , Tristram Ha Subject: [PATCH RFC net-next 4/6] net: phylink: add phylink managed wake-on-lan PHY speed control Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Sun, 28 Sep 2025 09:59:09 +0100 Some drivers, e.g. stmmac, use the speed_up()/speed_down() APIs to gain additional power saving during Wake-on-LAN where the PHY is managing the state. Add support to phylink for this, which can be enabled by the MAC driver. Only change the PHY speed if the PHY is configured for wake-up, but without any wake-up on the MAC side, as MAC side means changing the configuration once the negotiation has completed. Signed-off-by: Russell King (Oracle) --- drivers/net/phy/phylink.c | 12 ++++++++++++ include/linux/phylink.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 9a3783e719bc..3e48b0319634 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -2565,6 +2565,12 @@ void phylink_rx_clk_stop_unblock(struct phylink *pl) } EXPORT_SYMBOL_GPL(phylink_rx_clk_stop_unblock); =20 +static bool phylink_phy_pm_speed_ctrl(struct phylink *pl) +{ + return pl->config->wol_phy_speed_ctrl && !pl->wolopts_mac && + pl->phydev && phy_may_wakeup(pl->phydev); +} + /** * phylink_suspend() - handle a network device suspend event * @pl: a pointer to a &struct phylink returned from phylink_create() @@ -2614,6 +2620,9 @@ void phylink_suspend(struct phylink *pl, bool mac_wol) } else { phylink_stop(pl); } + + if (phylink_phy_pm_speed_ctrl(pl)) + phy_speed_down(pl->phydev, false); } EXPORT_SYMBOL_GPL(phylink_suspend); =20 @@ -2653,6 +2662,9 @@ void phylink_resume(struct phylink *pl) { ASSERT_RTNL(); =20 + if (phylink_phy_pm_speed_ctrl(pl)) + phy_speed_up(pl->phydev); + if (test_bit(PHYLINK_DISABLE_MAC_WOL, &pl->phylink_disable_state)) { /* Wake-on-Lan enabled, MAC handling */ =20 diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 59cb58b29d1d..38363e566ac3 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -157,6 +157,7 @@ enum phylink_op_type { * @lpi_timer_default: Default EEE LPI timer setting. * @eee_enabled_default: If set, EEE will be enabled by phylink at creatio= n time * @wol_phy_legacy: Use Wake-on-Lan with PHY even if phy_can_wakeup() is f= alse + * @wol_phy_speed_ctrl: Use phy speed control on suspend/resume * @wol_mac_support: Bitmask of MAC supported %WAKE_* options */ struct phylink_config { @@ -178,6 +179,7 @@ struct phylink_config { =20 /* Wake-on-Lan support */ bool wol_phy_legacy; + bool wol_phy_speed_ctrl; u32 wol_mac_support; }; =20 --=20 2.47.3