From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
biju.das.jz@bp.renesas.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH net v2 1/2] net: phylink: call phy_init_hw() in phylink resume path
Date: Thu, 9 Apr 2026 11:42:55 +0100 [thread overview]
Message-ID: <adeCry1EptL2gJH0@shell.armlinux.org.uk> (raw)
In-Reply-To: <20260409095633.70973-2-ovidiu.panait.rb@renesas.com>
On Thu, Apr 09, 2026 at 09:56:32AM +0000, Ovidiu Panait wrote:
> When mac_managed_pm flag is set, mdio_bus_phy_resume() is skipped,
> so phy_init_hw(), which performs soft_reset and config_init, is not
> called during resume.
>
> This is inconsistent with the non-mac_managed_pm path, where
> mdio_bus_phy_resume() calls phy_init_hw() before phy_resume()
> on every resume.
>
> Add phy_init_hw() calls in both phylink_prepare_resume() and
> phylink_resume(), to ensure that the PHY state is the same as
> when the PHY is resumed via the MDIO bus.
>
> Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
> ---
> drivers/net/phy/phylink.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 087ac63f9193..c302126009f6 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -2669,8 +2669,10 @@ void phylink_prepare_resume(struct phylink *pl)
> * then resume the PHY. Note that 802.3 allows PHYs 500ms before
> * the clock meets requirements. We do not implement this delay.
> */
> - if (pl->config->mac_requires_rxc && phydev && phydev->suspended)
> + if (pl->config->mac_requires_rxc && phydev && phydev->suspended) {
> + phy_init_hw(phydev);
> phy_resume(phydev);
I'm going to make an alternative suggestion - should we combine
phy_init_hw() and phy_resume() to ensure that all MAC drivers that
call phy_resume() correctly initialise the PHY first?
Looking at the callers of phy_resume():
- drivers/net/ethernet/nxp/lpc_eth.c - calls phy_resume() from
lpc_eth_open() but no call to phy_init_hw(). Not used in
suspend/resume paths, so presumably uses the built-in phylib
handling that does call phy_init_hw() before phy_resume().
- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c - suspends
and then immediately resumes the PHY before enabling loopback. Seems
like a PHY workaround that should've been handled in the PHY driver.
Suspends the PHY when loopback is disabled (which looks buggy.)
- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c - resumes the PHY
when enabling loopback and suspends the PHY when loopback is
disabled. (what if the netdev is already up? Also looks buggy to me.)
- drivers/net/ethernet/broadcom/genet/bcmgenet.c - bcmgenet_resume()
calls phy_init_hw() before a conditional call to phy_resume(). I
don't see a matching call to phy_suspend(). If the bcmgenet device
may wakeup the system, then wouldn't the PHY configuration be
preserved over suspend/resume making the call to phy_init_hw() also
unnecessary if device_may_wakeup(d) returns true?
- drivers/net/ethernet/broadcom/bcmsysport.c - no call to phy_init_hw()
before phy_resume().
- drivers/net/ethernet/realtek/r8169_main.c - calls phy_init_hw()
immediately before phy_resume().
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2026-04-09 10:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-09 9:56 [PATCH net v2 0/2] net: phylink: fix PHY reinitialization on resume Ovidiu Panait
2026-04-09 9:56 ` [PATCH net v2 1/2] net: phylink: call phy_init_hw() in phylink resume path Ovidiu Panait
2026-04-09 10:42 ` Russell King (Oracle) [this message]
2026-04-09 9:56 ` [PATCH net v2 2/2] net: phy: micrel: remove ksz9131_resume() Ovidiu Panait
2026-04-09 10:13 ` Biju Das
2026-04-09 10:29 ` Russell King (Oracle)
2026-04-09 10:52 ` Biju Das
2026-04-09 11:05 ` Russell King (Oracle)
2026-04-09 11:19 ` Biju Das
2026-04-09 11:30 ` Russell King (Oracle)
2026-04-09 11:58 ` Biju Das
2026-04-09 12:33 ` Russell King (Oracle)
2026-04-09 12:44 ` Andrew Lunn
2026-04-09 13:25 ` Biju Das
2026-04-09 12:58 ` Ovidiu Panait
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=adeCry1EptL2gJH0@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=biju.das.jz@bp.renesas.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ovidiu.panait.rb@renesas.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.