From: Andrew Lunn <andrew@lunn.ch>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: linux-phy@lists.infradead.org, netdev@vger.kernel.org,
Ioana Ciornei <ioana.ciornei@nxp.com>,
Vinod Koul <vkoul@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Josua Mayer <josua@solid-run.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH phy-next 1/3] phy: lynx-28g: use timeouts when waiting for lane halt and reset
Date: Sat, 21 Mar 2026 16:48:28 +0100 [thread overview]
Message-ID: <3d9b524b-bb61-4e64-a655-3fa70d8b64ef@lunn.ch> (raw)
In-Reply-To: <20260321011451.1557091-2-vladimir.oltean@nxp.com>
On Sat, Mar 21, 2026 at 03:14:49AM +0200, Vladimir Oltean wrote:
> There are various circumstances in which a lane halt, or a lane reset,
> will fail to complete. If this happens, it will hang the kernel, which
> only implements a busy loop with no timeout.
>
> The circumstances in which this will happen are all bugs in nature:
> - if we try to power off a powered off lane
> - if we try to power off a lane that uses a PLL locked onto the wrong
> refclk frequency (wrong RCW, but SoC boots anyway)
>
> Actually, unbounded loops in the kernel are a bad practice, so let's use
> read_poll_timeout() with a custom function that reads both LNaTRSTCTL
> (lane transmit control register) and LNaRRSTCTL (lane receive control
> register) and returns true when the request is done in both directions.
>
> The HLT_REQ bit has to clear, whereas the RST_DONE bit has to get set.
>
> Any time such an error happens, it is catastrophic and there is no point
> in trying to propagate it to our callers:
> - if lynx_28g_set_mode() -> lynx_28g_power_on() times out, we have
> already reconfigured the lane, but returning an error would tell the
> caller that we didn't
> - if lynx_28g_power_off() times out, again not much for the consumer to
> do to help get out of this situation - the phy_power_off() call is
> probably made from a context that the consumer can't cancel, or it is
> making it to return to a known state from a previous failure.
>
> So just print an error if timeouts happen and let the driver control
> flow continue. The entire point is just to not let the kernel freeze.
>
> Suggested-by: Josua Mayer <josua@solid-run.com>
> Link: https://lore.kernel.org/lkml/d0c8bbf8-a0c5-469f-a148-de2235948c0f@solid-run.com/
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
next prev parent reply other threads:[~2026-03-21 15:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-21 1:14 [PATCH phy-next 0/3] Lynx 28G: better init(), exit(), power_on(), power_off() Vladimir Oltean
2026-03-21 1:14 ` [PATCH phy-next 1/3] phy: lynx-28g: use timeouts when waiting for lane halt and reset Vladimir Oltean
2026-03-21 15:48 ` Andrew Lunn [this message]
2026-03-21 1:14 ` [PATCH phy-next 2/3] phy: lynx-28g: truly power the lanes up or down Vladimir Oltean
2026-03-21 1:14 ` [PATCH phy-next 3/3] phy: lynx-28g: implement phy_exit() operation Vladimir Oltean
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=3d9b524b-bb61-4e64-a655-3fa70d8b64ef@lunn.ch \
--to=andrew@lunn.ch \
--cc=ioana.ciornei@nxp.com \
--cc=josua@solid-run.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=vkoul@kernel.org \
--cc=vladimir.oltean@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox