linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] ravb: assert PHY reset during probe
@ 2023-03-21 10:33 Wolfram Sang
  0 siblings, 0 replies; only message in thread
From: Wolfram Sang @ 2023-03-21 10:33 UTC (permalink / raw)
  To: netdev
  Cc: linux-renesas-soc, Florian Fainelli, Heiner Kallweit,
	Wolfram Sang, Sergey Shtylyov, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel

The problem: Kernel+initramfs got loaded via TFTP by the bootloader,
thus the PHY reset is deasserted during boot. When suspend is entered
without bringing the interface up before, PHY reset is still deasserted.
Our KSZ9031 PHY doesn't like being suspended with reset deasserted, at
all. When resuming and trying to bring the interface up, we get MDIO bus
timeouts or stalled PHYs, depending on the board.

Once the interface was up once, reset handling is correct. PHY reset is
asserted before suspending. But if it wasn't up, there is this problem.

First, I tried to have a full reset cycle in phy_hw_init() like [1]. But
as expressed there, I had also worries about regressions for other PHYs.

This patch here assumes that the MAC should take care of it after it
claimed responsibility for the PHY PM by setting 'mac_managed_pm'. I am
not sure this is the right layer, though? But I am not sure where to put
it otherwise. Maybe we need something like phy_reset_after_power_on() as
proposed in [2] after all? I'd like to avoid pushing the responsibility
to the firmware but rather let Linux be more robust.

This patch depends on v6.3-rc3 or 7f5ebf5dae42 ("ravb: avoid PHY being
resumed when interface is not up").

Really looking forward to comments or pointers!

Thanks in advance and happy hacking,

   Wolfram

[1] https://patchwork.kernel.org/project/netdevbpf/patch/20211211130146.357794-1-francesco.dolcini@toradex.com/
[2] https://patchwork.kernel.org/project/netdevbpf/list/?series=595347&state=*

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 894e2690c643..d26944c0d4c8 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2404,6 +2404,7 @@ static int ravb_mdio_init(struct ravb_private *priv)
 	phydev = of_phy_find_device(pn);
 	if (phydev) {
 		phydev->mac_managed_pm = true;
+		phy_device_reset(phydev, 1);
 		put_device(&phydev->mdio.dev);
 	}
 	of_node_put(pn);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-21 10:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 10:33 [RFC PATCH] ravb: assert PHY reset during probe Wolfram Sang

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).