From: Sven Peter <sven@kernel.org>
To: Janne Grunau <j@jannau.net>, Neal Gompa <neal@gompa.dev>,
Vinod Koul <vkoul@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>
Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org,
Sven Peter <sven@kernel.org>
Subject: [PATCH 3/3] phy: apple: atc: Implement the USB4 pipehandler state
Date: Fri, 21 Aug 2026 15:50:29 +0200 [thread overview]
Message-ID: <20260821-b4-atcphy-usb4-v1-3-45c0b741e0c0@kernel.org> (raw)
In-Reply-To: <20260821-b4-atcphy-usb4-v1-0-45c0b741e0c0@kernel.org>
USB3 tunneled via USB4 requires dwc3's PIPE interface to be switched to
the USB4 NHI which will take care of the tunneling. Add the required
bringup sequence such that USB3 tunnels work once the USB4 NHI is
upstream.
Signed-off-by: Sven Peter <sven@kernel.org>
---
drivers/phy/apple/atc.c | 41 +++++++++++++++++++++++++++++++++++++----
1 file changed, 37 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/apple/atc.c b/drivers/phy/apple/atc.c
index 96158d348656..613bcd0ae886 100644
--- a/drivers/phy/apple/atc.c
+++ b/drivers/phy/apple/atc.c
@@ -1084,6 +1084,41 @@ static int atcphy_configure_pipehandler_usb3(struct apple_atcphy *atcphy, bool h
return 0;
}
+static int atcphy_configure_pipehandler_usb4(struct apple_atcphy *atcphy)
+{
+ int ret;
+
+ ret = atcphy_pipehandler_check(atcphy);
+ if (ret)
+ return ret;
+
+ /* Force disable link detection */
+ clear32(atcphy->regs.pipehandler + PIPEHANDLER_OVERRIDE_VALUES,
+ PIPEHANDLER_OVERRIDE_VAL_RXDETECT0 | PIPEHANDLER_OVERRIDE_VAL_RXDETECT1);
+ set32(atcphy->regs.pipehandler + PIPEHANDLER_OVERRIDE, PIPEHANDLER_OVERRIDE_RXVALID);
+ set32(atcphy->regs.pipehandler + PIPEHANDLER_OVERRIDE, PIPEHANDLER_OVERRIDE_RXDETECT);
+
+ ret = atcphy_pipehandler_lock(atcphy);
+ if (ret) {
+ dev_err(atcphy->dev, "Failed to lock pipehandler\n");
+ return ret;
+ }
+
+ /* Configure PIPE mux to the USB4/Thunderbolt controller */
+ atcphy_pipehandler_set_mux(atcphy, PIPEHANDLER_MUX_CTRL_DATA_USB4,
+ PIPEHANDLER_MUX_CTRL_CLK_USB4);
+
+ /* Remove link detection override */
+ clear32(atcphy->regs.pipehandler + PIPEHANDLER_OVERRIDE, PIPEHANDLER_OVERRIDE_RXVALID);
+ clear32(atcphy->regs.pipehandler + PIPEHANDLER_OVERRIDE, PIPEHANDLER_OVERRIDE_RXDETECT);
+
+ ret = atcphy_pipehandler_unlock(atcphy);
+ if (ret)
+ dev_warn(atcphy->dev, "Failed to unlock pipehandler\n");
+
+ return 0;
+}
+
static int atcphy_configure_pipehandler_dummy(struct apple_atcphy *atcphy)
{
int ret;
@@ -1130,10 +1165,8 @@ static int atcphy_configure_pipehandler(struct apple_atcphy *atcphy, bool host)
atcphy->pipehandler_up = true;
break;
case ATCPHY_PIPEHANDLER_STATE_USB4:
- dev_warn(atcphy->dev,
- "ATCPHY_PIPEHANDLER_STATE_USB4 not implemented; falling back to USB2\n");
- ret = atcphy_configure_pipehandler_dummy(atcphy);
- atcphy->pipehandler_up = false;
+ ret = atcphy_configure_pipehandler_usb4(atcphy);
+ atcphy->pipehandler_up = true;
break;
case ATCPHY_PIPEHANDLER_STATE_DUMMY:
ret = atcphy_configure_pipehandler_dummy(atcphy);
--
2.55.0
next prev parent reply other threads:[~2026-08-21 13:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 13:50 [PATCH 0/3] phy: apple: atc: Prepare USB3-via-4 tunneling Sven Peter
2026-08-21 13:50 ` [PATCH 1/3] phy: apple: atc: Support DUMMY PIPEHANDLER state in configure_pipehandler Sven Peter
2026-08-21 13:50 ` [PATCH 2/3] phy: apple: atc: Factor out the PIPE mux sequence Sven Peter
2026-08-21 13:50 ` Sven Peter [this message]
2026-09-07 10:45 ` [PATCH 0/3] phy: apple: atc: Prepare USB3-via-4 tunneling Janne Grunau
2026-10-03 15:25 ` Vinod Koul
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=20260821-b4-atcphy-usb4-v1-3-45c0b741e0c0@kernel.org \
--to=sven@kernel.org \
--cc=asahi@lists.linux.dev \
--cc=j@jannau.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neal@gompa.dev \
--cc=neil.armstrong@linaro.org \
--cc=vkoul@kernel.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®