From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.246.85.4 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382468; b=pxXLGl50vJuG3zrdpBdNrsQZzSw6MM2hVvFpXYywo0JpYfNnU0JlNlgESxcAaT0yQG7Z erXQUY+KDILERhgL6FqbnLMeNWNKBK7SMg8UiZlhK1FUQrGmgid5xMO5uTNOsRmsXQ8b9 z0q4MsOwws0Xsen8KYeKv498ynpXgn+EJzE+ihj51BWT1tKx7l56A9iKY9Eo+eruBcn62 2WzXeuGmQaopRRVbeCVHVYkub9b6sDe3i4p3Xk3GhvwsWeyfC8e3OgHq8z/eBbH4L/v29 AuhmEamsWlwaTITnXpRt4kPZR8rGyHOfayLmLkuzagzALhWHM6jkVdVUndx4vaGSO6A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382468; h=DMARC-Filter:Received:Received:Received:DKIM-Signature:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Last-TLS-Session-Version; bh=Uorag8LR926WUddDcJuXFFJReErbubNSLxk26Lf9W+Y=; b=K6uSCcewhkMOAo4R+rjD57e8UfasuxfUCQx/XI/y/5tuPgjq8ejxnd4iPG0+RJoJMsLk YjU3kewsQolY6W+JgAdzhXz3FsEEqnpKYrZZT10lebL5IXPXsNJ/v+PJQef+yIiJzOj7/ Jly9/R1MjO8rLMhDbcVz6fL/s5pEbRkGYRvjwUPtErEv0Ts/5nxswFvNVgHdeZdDPbzQh E4xGKb+8c2xdv8F8FT9c2TMJufXFBYAFkubOML69b6jFLrrcaKsi+eB3ivw+Z/6b7QZbE BYWpMzxLn/5B8vUgIAiBEkyVtUbIIQM7337iq4f/4ftGe0nPnnjkFtsQ1zDxWSm1HIQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=EWggkElF; arc=none smtp.remote-ip=185.246.85.4 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81FF8606A32C for ; Fri, 4 Dec 2026 11:07:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 81FF8606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=EWggkElF Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 401FF4E4185D; Fri, 4 Dec 2026 11:07:46 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id E2DCE6088A; Fri, 4 Dec 2026 11:07:45 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6861111EA18ED; Fri, 04 Dec 2026 12:07:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796382462; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=Uorag8LR926WUddDcJuXFFJReErbubNSLxk26Lf9W+Y=; b=EWggkElF65/1tPNjummAkcf975EPXxgVixG6uhGnLrVYPs8GEwAsJBkNnVnksx5pevKNWf 4/1+plwe2zh+jwhr68Ln2vXXUC66q+J+iWz5wkHr/QiXWck++SmdteQSoYfZF7F+EUJhz3 fv/v2kzfvA7tWFjcbEkcUKiPg/T3H9yEJ0/4EH8+XytSCmHnOTCEfQIhgfYjNy21FQ850i NjZ1/J63mFDIL8KzhW/KVDfq6534M5eOpNlyZ31u4VjgICwEANxuDJVx90JCG2zuhVNZ+K 5enSn8aEXwUTT3fhn3NTSmhX/P+lU7xkYALIHUPbmkToLEsLlYIn5q9W7pwgdw== From: Maxime Chevallier To: davem@davemloft.net, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Willem de Bruijn , Paolo Abeni , Russell King , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Sebastian Hesselbarth , Gregory Clement , Heiner Kallweit Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@bootlin.com, devicetree@vger.kernel.org, Conor Dooley , Krzysztof Kozlowski , Rob Herring , Christophe Leroy , Herve Codina , Florian Fainelli , Vladimir Oltean , =?UTF-8?q?K=C3=B6ry=20Maincent?= , Oleksij Rempel , =?UTF-8?q?Nicol=C3=B2=20Veronese?= , Simon Horman , marcin.s.wojtas@gmail.com, Daniel Golle , Dimitri Fedrau , Frank Wunderlich , Pietro Ameruoso , Aleksei Sviridkin Subject: [PATCH net-next 08/12] net: phy: phy_mux: Add phy_mux_set_mac_managed_pm() Date: Fri, 4 Dec 2026 12:06:17 +0100 Message-ID: <20261204110622.1106492-9-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204110622.1106492-1-maxime.chevallier@bootlin.com> References: <20261204110622.1106492-1-maxime.chevallier@bootlin.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 MAC drivers that deal with the suspend/resume of their PHY on their own say so with the mac_managed_pm flag, that ends-up being set on the PHY when the MAC connects to it. With a mux, the PHYs are attached by the mux and the parent only gets to see the PHY of the selected port. The flag is needed on all of them though, as they are all attached to the netdev. Add a helper for the mux's parent to set the flag on all the PHYs behind the mux. Signed-off-by: Maxime Chevallier --- drivers/net/phy/phy_mux.c | 15 +++++++++++++++ include/linux/phy_mux.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/drivers/net/phy/phy_mux.c b/drivers/net/phy/phy_mux.c index de3336970bd9..ed0bb8a3f429 100644 --- a/drivers/net/phy/phy_mux.c +++ b/drivers/net/phy/phy_mux.c @@ -413,6 +413,21 @@ void phy_mux_detach(struct phy_mux *mux) } EXPORT_SYMBOL_GPL(phy_mux_detach); +/** + * phy_mux_set_mac_managed_pm() - Leave the PM of the PHYs to the MAC driver + * @mux: The mux, attached + */ +void phy_mux_set_mac_managed_pm(struct phy_mux *mux) +{ + struct phy_mux_port *port; + unsigned long id; + + xa_for_each(&mux->ports, id, port) + if (port->attached) + port->phydev->mac_managed_pm = true; +} +EXPORT_SYMBOL_GPL(phy_mux_set_mac_managed_pm); + /** * phy_mux_start() - Start selecting ports * @mux: The mux, attached diff --git a/include/linux/phy_mux.h b/include/linux/phy_mux.h index 77cf389b8c77..00703371eea8 100644 --- a/include/linux/phy_mux.h +++ b/include/linux/phy_mux.h @@ -94,6 +94,7 @@ int fwnode_phy_mux_attach(const struct fwnode_handle *fwnode, void phy_mux_detach(struct phy_mux *mux); void phy_mux_start(struct phy_mux *mux); void phy_mux_stop(struct phy_mux *mux); +void phy_mux_set_mac_managed_pm(struct phy_mux *mux); struct fwnode_handle * fwnode_phy_mux_find_sfp_port(const struct fwnode_handle *fwnode); struct phy_mux_port *phy_mux_get_sfp_port(struct phy_mux *mux); @@ -121,6 +122,10 @@ static inline void phy_mux_stop(struct phy_mux *mux) { } +static inline void phy_mux_set_mac_managed_pm(struct phy_mux *mux) +{ +} + static inline struct fwnode_handle * fwnode_phy_mux_find_sfp_port(const struct fwnode_handle *fwnode) { -- 2.56.1