From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Frank Wunderlich <linux@fw-web.de>,
Stephen Boyd <sboyd@kernel.org>,
Brian Masney <bmasney+clk@redhat.com>,
Jerome Brunet <jbrunet+clk@baylibre.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Mathias Nyman <mathias.nyman@intel.com>,
Chunfeng Yun <chunfeng.yun@mediatek.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Frank Wunderlich <frank.wunderlich@linux.dev>,
Frank Wunderlich <frank-w@public-files.de>,
Daniel Golle <daniel@makrotopia.org>,
Mihai Ordean <research@mihaiordean.com>,
Chen-Yu Tsai <wenst@chromium.org>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH 1/2] clk: mediatek: mt7988: keep combo-lane U3 PHY ref clock enabled
Date: Mon, 21 Sep 2026 11:59:23 +0200 [thread overview]
Message-ID: <a71b6552-ea57-4575-89e1-14d414d53569@collabora.com> (raw)
In-Reply-To: <20260919114744.46777-2-linux@fw-web.de>
On 9/19/26 13:47, Frank Wunderlich wrote:
> From: Mihai Ordean <research@mihaiordean.com>
>
> CLK_INFRA_USB_PIPE is the reference clock of xphyu3port0, the U3/PCIe
> combo serdes. On MT7988 that lane is shared between ssusb0's SuperSpeed
> side and pcie2, but only the consumer that claims the PHY holds the gate.
>
> On the BPI-R4 Pro, ssusb0 is configured USB2-only (u3p-dis-msk=1) and
> pcie2 claims the lane for the CN13/CN15 M.2 slot, so pcie2 is the sole
> holder. u3p-dis-msk does not remove ssusb0's SuperSpeed root hub: that is
> decided by xhci_has_one_roothub(), which keys off usb3_rhub.num_ports
> from the xHCI capability registers, so bus 2 is registered and live
> regardless. When the M.2 slot is empty, pcie2 fails link training (-110)
> and its error path calls phy_power_off()/phy_exit(), which gates this
> clock - and sspxtp_sel with it, as nothing else consumes it. The still
> registered SuperSpeed root hub is then left polling a serdes whose PHY
> reference clock has just stopped,
I'm not sure why said clock cannot be assigned to the USB controller as well
as the PCIe PHY to keep the refcount high, avoiding to gate it?
Cheers,
Angelo
> and asserts the shared SSUSB interrupt
> outside the xHCI event ring; xhci_irq() reads USBSTS with EINT clear and
> returns IRQ_NONE, so the core disables the line ("nobody cared") and the
> next USB teardown blocks forever in xhci_disable_slot().
>
> Boot logs show the storm threshold being crossed 86-107 ms after the
> pcie2 probe failure, while the earlier combo-mux switch to PCIe mode
> (~550 ms before) causes no trouble, pointing at the clock gating rather
> than the mux as the trigger.
>
> Mark the gate CLK_IS_CRITICAL so the combo lane keeps its reference clock.
> Only port 0's gate is affected; ssusb1 uses CLK_INFRA_USB_PIPE_CK_P1.
>
> Signed-off-by: Mihai Ordean <research@mihaiordean.com>
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> ---
> drivers/clk/mediatek/clk-mt7988-infracfg.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/mediatek/clk-mt7988-infracfg.c b/drivers/clk/mediatek/clk-mt7988-infracfg.c
> index 13ffa9d88e24..a8cbcb64d90f 100644
> --- a/drivers/clk/mediatek/clk-mt7988-infracfg.c
> +++ b/drivers/clk/mediatek/clk-mt7988-infracfg.c
> @@ -225,7 +225,17 @@ static const struct mtk_gate infra_clks[] = {
> CLK_IS_CRITICAL),
> GATE_INFRA3_FLAGS(CLK_INFRA_USB_FRMCNT_CK_P1, "infra_usb_frmcnt_ck_p1", "usb_frmcnt_p1_sel",
> 9, CLK_IS_CRITICAL),
> - GATE_INFRA3(CLK_INFRA_USB_PIPE, "infra_usb_pipe", "sspxtp_sel", 10),
> + /*
> + * Reference clock of the U3/PCIe combo serdes (xphyu3port0). The lane
> + * is shared between ssusb0 and pcie2, but only the PHY consumer that
> + * claims it holds this gate. On boards where pcie2 owns the lane, a
> + * failed pcie2 probe (e.g. empty M.2 slot) calls phy_exit() and gates
> + * this clock while ssusb0 still has a live SuperSpeed root hub on the
> + * same PHY, which wedges the shared SSUSB interrupt. CCF cannot model
> + * the cross-IP sharing, so keep the gate on.
> + */
> + GATE_INFRA3_FLAGS(CLK_INFRA_USB_PIPE, "infra_usb_pipe", "sspxtp_sel", 10,
> + CLK_IS_CRITICAL),
> GATE_INFRA3(CLK_INFRA_USB_PIPE_CK_P1, "infra_usb_pipe_ck_p1", "usb_phy_sel", 11),
> GATE_INFRA3(CLK_INFRA_USB_UTMI, "infra_usb_utmi", "top_xtal", 12),
> GATE_INFRA3(CLK_INFRA_USB_UTMI_CK_P1, "infra_usb_utmi_ck_p1", "top_xtal", 13),
next prev parent reply other threads:[~2026-09-21 9:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 11:47 [RFC PATCH 0/2] Fix mt7988 usb with shared phy Frank Wunderlich
2026-09-19 11:47 ` [PATCH 1/2] clk: mediatek: mt7988: keep combo-lane U3 PHY ref clock enabled Frank Wunderlich
2026-09-21 9:59 ` AngeloGioacchino Del Regno [this message]
2026-09-21 11:16 ` Frank Wunderlich
2026-09-19 11:47 ` [PATCH 2/2] usb: xhci-mtk: power down u3 ports skipped by u3p-dis-msk Frank Wunderlich
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=a71b6552-ea57-4575-89e1-14d414d53569@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=bmasney+clk@redhat.com \
--cc=chunfeng.yun@mediatek.com \
--cc=daniel@makrotopia.org \
--cc=frank-w@public-files.de \
--cc=frank.wunderlich@linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=jbrunet+clk@baylibre.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@fw-web.de \
--cc=mathias.nyman@intel.com \
--cc=matthias.bgg@gmail.com \
--cc=research@mihaiordean.com \
--cc=sboyd@kernel.org \
--cc=wenst@chromium.org \
/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
all inboxes | Powered by JetHome®