From: Sven Peter <sven@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Felipe Balbi <balbi@kernel.org>, Janne Grunau <j@jannau.net>,
Alyssa Rosenzweig <alyssa@rosenzweig.io>,
Neal Gompa <neal@gompa.dev>, Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, asahi@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-phy@lists.infradead.org, Sven Peter <sven@kernel.org>,
Hector Martin <marcan@marcan.st>,
stable@kernel.org
Subject: [PATCH RFC 00/22] Apple Silicon USB3 support
Date: Thu, 21 Aug 2025 15:38:52 +0000 [thread overview]
Message-ID: <20250821-atcphy-6-17-v1-0-172beda182b8@kernel.org> (raw)
Hi,
This series includes changes to dwc3, tipd and a new phy driver to enable
USB3 on these machines. There's also some preparations to eventually enable
DisplayPort AltMode and Thunderbolt but those need future work.
Overall, this entire setup is quite a mess and we've tried to make it work
for quite a while now and finally came up with this solution here.
The USB3 controller is a very special kind of broken: It never sees any port
plug/unplug events that should normally arrive directly at dwc3.
Additionally, it needs to go through a full hard reset for every new connection
and most mode change. Details on why this is required are in the commit
description.
On top of that we need to keep the Type-C PHY bringup and dwc3 bringup tightly
synchronized. If there's a race between the two systems at best the port stops
working until a system reboot and at worst there's a watchdog somewhere that
forcefully resets the entire SoC after ~5 seconds. I've only seen the latter
when bringing up thunderbolt so far but wouldn't be surprised if it happens
with just usb3 as well.
The entire bringup/bringup is orchestrated by a TIPD variant called CD321x
found on these machines. Unlike the original chips we however get no control
over which mode is negotiated or are even able to see the PDOs or VDOs. We only
get to know once the mode has been negotiated and have to act accordingly. I
even went as far as dumping the firmware from the chip to confirm this [1][2].
Hector wrote another summary of this early in January as well [3] and this
series is the only way we've been able to bring these ports up reliably.
It's not pretty in some places but I have no other idea how to implement this,
hence the RFC tag. Happy to discuss other approaches as well.
Both the PHY and the TIPD driver already include changes for DisplayPort
AltMode and USB4/Thunderbolt. These need additional work though but
since we can't control the mode devices end up in we can already merge
them now.
I used phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml as a template for the dt-binding
for atcphy (especially the ports). That was the most recent binding I found for
a PHY with similar features.
In order to test this you need to run the latest m1n1 master [4] because the
1.5.0 release does not include the code that lifts the tunables from Apple's
device tree. A kernel tree for testing is also tagged as apple-usb3-v1 at [5].
If the overall approach here is fine and no one can think of a better way to
support this SoC I'll drop the RFC and include the dts changes for the other
M1 and M2 machines as well.
Best,
Sven
[1] https://social.treehouse.systems/@sven/111092587315536174
[2] https://social.treehouse.systems/@sven/111096589846468888
[3] https://lore.kernel.org/all/fda8b831-1ffc-4087-8e7b-d97779b3ecc5@marcan.st/
[4] https://github.com/AsahiLinux/m1n1
[5] https://git.kernel.org/pub/scm/linux/kernel/git/sven/linux.git
Signed-off-by: Sven Peter <sven@kernel.org>
---
Hector Martin (7):
usb: dwc3: apple: Use synchronous role switch for apple
usb: dwc3: apple: Adjust vendor-specific registers during init
usb: typec: tipd: Update partner identity when power status was updated
usb: typec: tipd: Use read_power_status function in probe
usb: typec: tipd: Read data status in probe and cache its value
usb: typec: mux: Introduce data_role to mux state
usb: typec: tipd: Handle mode transitions for CD321x
Janne Grunau (1):
usb: dwc3: apple: Do not use host-vbus-glitches workaround
Sven Peter (14):
dt-bindings: usb: snps,dwc3: Allow multiple iommus
dt-bindings: usb: Add Apple dwc3
dt-bindings: phy: Add Apple Type-C PHY
usb: dwc3: apple: Reset dwc3 during role switches
usb: typec: tipd: Clear interrupts first
usb: typec: tipd: Move initial irq mask to tipd_data
usb: typec: tipd: Move switch_power_state to tipd_data
usb: typec: tipd: Trace data status for CD321x correctly
usb: typec: tipd: Add cd321x struct with separate size
usb: typec: tipd: Read USB4, Thunderbolt and DisplayPort status for cd321x
usb: typec: tipd: Register DisplayPort and Thunderbolt altmodes for cd321x
soc: apple: Add hardware tunable support
phy: apple: Add Apple Type-C PHY
arm64: dts: apple: t8103: Add Apple Type-C PHY and dwc3 nodes
.../devicetree/bindings/phy/apple,atcphy.yaml | 210 ++
.../devicetree/bindings/usb/apple,dwc3.yaml | 82 +
.../devicetree/bindings/usb/snps,dwc3.yaml | 2 +-
MAINTAINERS | 3 +
arch/arm64/boot/dts/apple/t8103-j274.dts | 12 +
arch/arm64/boot/dts/apple/t8103-j293.dts | 12 +
arch/arm64/boot/dts/apple/t8103-j313.dts | 12 +
arch/arm64/boot/dts/apple/t8103-j456.dts | 12 +
arch/arm64/boot/dts/apple/t8103-j457.dts | 12 +
arch/arm64/boot/dts/apple/t8103-jxxx.dtsi | 137 ++
arch/arm64/boot/dts/apple/t8103.dtsi | 105 +
drivers/phy/Kconfig | 1 +
drivers/phy/Makefile | 1 +
drivers/phy/apple/Kconfig | 14 +
drivers/phy/apple/Makefile | 4 +
drivers/phy/apple/atc.c | 2537 ++++++++++++++++++++
drivers/soc/apple/Kconfig | 4 +
drivers/soc/apple/Makefile | 3 +
drivers/soc/apple/tunable.c | 77 +
drivers/usb/dwc3/core.c | 85 +-
drivers/usb/dwc3/core.h | 26 +
drivers/usb/dwc3/drd.c | 11 +-
drivers/usb/dwc3/host.c | 8 +-
drivers/usb/typec/tipd/core.c | 569 ++++-
drivers/usb/typec/tipd/tps6598x.h | 5 +
drivers/usb/typec/tipd/trace.h | 39 +
include/linux/soc/apple/tunable.h | 64 +
include/linux/usb/typec_mux.h | 1 +
28 files changed, 3987 insertions(+), 61 deletions(-)
---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250820-atcphy-6-17-b7eaf23be17c
Best regards,
--
Sven Peter <sven@kernel.org>
next reply other threads:[~2025-08-21 15:40 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-21 15:38 Sven Peter [this message]
2025-08-21 15:38 ` [PATCH RFC 01/22] dt-bindings: usb: snps,dwc3: Allow multiple iommus Sven Peter
2025-08-21 22:39 ` Rob Herring (Arm)
2025-08-22 7:22 ` Krzysztof Kozlowski
2025-08-24 8:31 ` Krzysztof Kozlowski
2025-08-27 16:07 ` Sven Peter
2025-08-28 6:54 ` Krzysztof Kozlowski
2025-08-21 15:38 ` [PATCH RFC 02/22] dt-bindings: usb: Add Apple dwc3 Sven Peter
2025-08-21 22:39 ` Rob Herring (Arm)
2025-08-22 7:24 ` Krzysztof Kozlowski
2025-08-24 15:30 ` Sven Peter
2025-08-21 15:38 ` [PATCH RFC 03/22] dt-bindings: phy: Add Apple Type-C PHY Sven Peter
2025-08-21 16:33 ` Janne Grunau
2025-08-21 23:00 ` Rob Herring
2025-08-24 15:33 ` Sven Peter
2025-08-21 22:39 ` Rob Herring (Arm)
2025-08-21 15:38 ` [PATCH RFC 04/22] usb: dwc3: apple: Reset dwc3 during role switches Sven Peter
2025-08-21 23:25 ` Thinh Nguyen
2025-08-24 13:18 ` Janne Grunau
2025-08-28 23:07 ` Thinh Nguyen
2025-08-24 15:24 ` Sven Peter
2025-08-28 23:14 ` Thinh Nguyen
2025-08-21 15:38 ` [PATCH RFC 05/22] usb: dwc3: apple: Do not use host-vbus-glitches workaround Sven Peter
2025-08-21 22:28 ` Thinh Nguyen
2025-08-23 11:42 ` Sven Peter
2025-08-28 23:06 ` Thinh Nguyen
2025-08-21 15:38 ` [PATCH RFC 06/22] usb: dwc3: apple: Use synchronous role switch for apple Sven Peter
2025-08-21 15:38 ` [PATCH RFC 07/22] usb: dwc3: apple: Adjust vendor-specific registers during init Sven Peter
2025-08-21 22:18 ` Thinh Nguyen
2025-08-23 9:32 ` Sven Peter
2025-08-28 22:51 ` Thinh Nguyen
2025-08-21 15:39 ` [PATCH RFC 08/22] usb: typec: tipd: Clear interrupts first Sven Peter
2025-08-29 9:37 ` Heikki Krogerus
2025-08-21 15:39 ` [PATCH RFC 09/22] usb: typec: tipd: Move initial irq mask to tipd_data Sven Peter
2025-08-21 15:39 ` [PATCH RFC 10/22] usb: typec: tipd: Move switch_power_state " Sven Peter
2025-08-21 15:39 ` [PATCH RFC 11/22] usb: typec: tipd: Trace data status for CD321x correctly Sven Peter
2025-08-21 15:39 ` [PATCH RFC 12/22] usb: typec: tipd: Add cd321x struct with separate size Sven Peter
2025-08-21 15:39 ` [PATCH RFC 13/22] usb: typec: tipd: Read USB4, Thunderbolt and DisplayPort status for cd321x Sven Peter
2025-08-21 16:46 ` Janne Grunau
2025-08-21 15:39 ` [PATCH RFC 14/22] usb: typec: tipd: Register DisplayPort and Thunderbolt altmodes " Sven Peter
2025-08-21 15:39 ` [PATCH RFC 15/22] usb: typec: tipd: Update partner identity when power status was updated Sven Peter
2025-08-21 15:39 ` [PATCH RFC 16/22] usb: typec: tipd: Use read_power_status function in probe Sven Peter
2025-08-21 15:39 ` [PATCH RFC 17/22] usb: typec: tipd: Read data status in probe and cache its value Sven Peter
2025-08-21 15:39 ` [PATCH RFC 18/22] usb: typec: mux: Introduce data_role to mux state Sven Peter
2025-08-21 15:39 ` [PATCH RFC 19/22] usb: typec: tipd: Handle mode transitions for CD321x Sven Peter
2025-08-21 15:39 ` [PATCH RFC 20/22] soc: apple: Add hardware tunable support Sven Peter
2025-08-21 15:39 ` [PATCH RFC 21/22] phy: apple: Add Apple Type-C PHY Sven Peter
2025-08-21 15:39 ` [PATCH RFC 22/22] arm64: dts: apple: t8103: Add Apple Type-C PHY and dwc3 nodes Sven Peter
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=20250821-atcphy-6-17-v1-0-172beda182b8@kernel.org \
--to=sven@kernel.org \
--cc=Thinh.Nguyen@synopsys.com \
--cc=alyssa@rosenzweig.io \
--cc=asahi@lists.linux.dev \
--cc=balbi@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=j@jannau.net \
--cc=kishon@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=neal@gompa.dev \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=stable@kernel.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;
as well as URLs for NNTP newsgroup(s).