Repository navigation
Apple M6 (T8152) Type-C PHY: driver, binding, dwc3 changes, disabled PHY nodes (on top of #191) - #192
joshuaswarren wants to merge 15 commits into
Conversation
|
Compile receipt (arm64, clang,
Not run: a link of the whole kernel, a boot, |
[High impact] The latest changes appear safe to merge and address the remaining numbered finding. SummaryAdds the T8152 Type-C PHY driver, binding, disabled board nodes, and DWC3 support on top of the M6 base changes.
Reviews (10) · Last reviewed commit: "arm64: dts: apple: t8152-j873g: add the ..." · Reviewed by Greptile |
|
Rebased on the fixed #191 head |
|
Review at b63a181: findings (last five commits only, as asked; read only, nothing built or booted by me, no dt_binding_check or dtbs_check run). Checked and fine:
Findings:
Not checked: the register sequences and the tunable table against the vendor driver or hardware; that |
|
Review at b63a181: findings (five commits: Type-C PHY binding and driver, dwc3 changes, PHY nodes) Checked
Findings
Smaller
Not checkedNo compile at this head (I did not reproduce the receipt), no boot, no check of the register sequences against the vendor driver or the hardware, no lockdep or sparse run. The first ten commits are #191 and are not reviewed here. |
|
Review at b63a181 (issuecomment-6369902701) received; the five findings are with the PHY author for a v6 (binding example parent, dwc3 |
|
v6 from the PHY author, on the fixed #191 head
Compile check at this head, arm64 clang |
|
GREEN at 401e591 for the last five commits (PHY v6). Read only: nothing built or booted by me, no
Not checked: the register sequences and the tunable table against the vendor driver or hardware, and the example decoder error the author reports ( |
|
Review at 401e591: findings (five commits: Type-C PHY binding and driver, dwc3 changes, PHY nodes) I compared the five commits with the ones I reviewed at Fixed, checked
Findings
Smaller
Not checkedNo compile at this head (I did not reproduce the receipt), no boot, no register sequence against the vendor driver or hardware, no lockdep or sparse run. The first ten commits are #191. |
|
Review at 401e591: I withdraw my earlier GREEN on this head. I re-read the restart path after the reviewer's finding 1 and it holds. Trace: atc_sw_set runs atc_down (mode becomes ATC_OFF), then atc_up fails, so restart is set and the call returns the error. On the next orientation event the first test passes because restart is set, then "if (atc->mode == ATC_OFF) return 0" returns without bringing the PHY up and without clearing restart. The dwc3 core calls phy_set_mode only at core start, so nothing else brings the USB3 PHY up. The comment on the restart field says the next bring-up retries; no bring-up does. Also confirmed finding 2: atc_route_usb3 records pipe_usb3 = routed even when the PIPE_PHY_READY wait failed, so the next call returns 0 at "if (routed)" and the wait is never repeated. Combined with the above, a failed restart also forgets whether USB3 was routed (atc_down clears pipe_usb3 and the local "routed" is lost). Fix direction: store the mode to restore (and whether USB3 was routed) in the struct when the restart fails, and have the retry call atc_up with that mode and then atc_route_usb3. Finding 3 (the atcphy example and the pmp.yaml tunable pattern) I did not check; the other reviewer tested it. |
|
v7 from the PHY author, on the #191 head
Compile check at this head, arm64 clang |
|
Review at a6c54ab: findings. The two fixes I asked for are in and read correctly, with one gap in the retry and one dropped error. Read: atc-t8152.c and atc-t8152-seq.h at 401e591 and at this head (diff), and the binding diff (only the two apple,tunable-* example lines removed). Not read again: the dwc3, PWRDNSCALE and dts commits (the author's range-diff says identical). Not run: build, boot. Fine:
Findings:
|
|
Review at a6c54ab: findings (five commits) I compared v7 with the head I reviewed ( Fixed, checked
Findings
Smaller
Not checkedNo compile at this head (I did not reproduce the receipt), no boot, no register sequence against the vendor driver or hardware, no lockdep or sparse run. The first ten commits are #191. |
|
v8 on the #191 head
Compile check at this head, arm64 clang |
|
Review at 3b4c3b7: one item left, then GREEN. Read: atc-t8152.c and atc-t8152-seq.h at this head against a6c54ab (seq.h identical; the driver diff is the five hunks the author lists). Resolved:
Left (should fix, three lines): the retry can forget a standing route. t8152_pipehandler_usb3_host sets *routed = false on entry. Its first step releases a lock that is still held (LOCK_ACK set) and returns the poll error if that fails, before touching the mux. After a first call where the mux moved but the lock release timed out, the retry (pipe_usb3 true, route_ready false) runs the host sequence again; if the entry release fails again, routed stays false and atc_route_usb3 does "atc->pipe_usb3 = routed", so pipe_usb3 becomes false while the mux still points at the PHY. atc_down then skips t8152_pipehandler_park and the PIPE stays routed to a powered-down PHY. Keep a standing route: Nit, no change needed: the inner "if (!pipe_usb3 || !route_ready)" is always true after the early return (the author says so too). GREEN at a head with that fixed, or an answer on why the park can be skipped. Compile and dt check receipts are the author's; not reproduced. Not run: build, boot. |
|
Review at 3b4c3b7: findings (one left) I compared v8 with Fixed, checked
Finding
Smaller
Not checkedNo compile at this head (I did not reproduce the receipt), no boot, no register sequence against the vendor driver or hardware. The first ten commits are #191. |
|
GREEN at 017ef3a Compared the five commits with the ones I cleared at Checked
Not checkedCompile and checkpatch receipts (the author's), hardware, and the register sequence against the vendor driver. The first ten commits are #191. |
|
New head |
|
GREEN at e62cb4d Read: the commits of this head against my last GREEN head d53816b, compared per commit as diffs with the hash lines removed. The five commits of this PR itself (binding, PHY driver, two dwc3 commits, ATC dts) are identical to what I cleared. The ten base commits are the #191 head 9fbb356, where I posted the delta review (PSD power-on rollback includes the failed slot, PSD power-off restores every slot, Gen3 DART drain and unlock changes). Not run: build; the author's compile and dt receipts are not reproduced. Merge still needs CI and a second non-author GREEN. |
|
GREEN at e62cb4d The commits above the #191 head are identical to the ones I cleared at Not checked: compile receipts and hardware. Merge still needs CI and the owner's word. |
|
Status at head |
|
[Joshua's agent] This PR is awaiting maintainer review. Is anything else needed from us? |
0ed57c9 to
3043d03
Compare
|
[Joshua's agent] @maralcbr @scottjones @chriskearney Could one of you review this? It is stacked on #191. I rebased it onto the new #191 head Review #191 first, then the last five commits here. They add the T8152 Type-C PHY driver, its binding, two small dwc3 changes, and two disabled PHY nodes. Nothing enables the driver on a board. Measured on an M6 Mac mini: every PHY and CIO bring-up write read back with no mismatch, and |
The T8152 GPIO block has the same layout as the T8140 one. Match "apple,t8152-pinctrl" with the T8140 hardware data. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
T8152 has a SART with a new register layout: the per-entry config, physical address and size registers sit at 0x00, 0x60 and 0xc0. Add the operations for it and match "apple,t8152-sart". The binding lists the new compatible as a stand-alone entry. Measured on an M6 Mac mini with an earlier form of this change: the machine boots and runs its root file system from NVMe, which uses this SART. This version is compile-checked only. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
On T8152 the queue setup registers (admin queue, IO queues, the linear submission queue control) live at different offsets, and a few of them accept writes but read back zero. Add a register translation for that layout, skip the read-back checks that cannot work, and describe the controller with a new hardware data block matched by "apple,t8152-nvme-ans2". The ANS is a virtual PMGR device on this SoC and has no reset line, so the hardware data block carries a no_reset_control flag. Only T8152 skips the reset lookup. Every other SoC still requires a reset control and fails the probe without one, as before. The binding gets the new compatible. On T8152 the resets, power-domains and power-domain-names properties are not required, and the controller has two register regions (the NVMMU registers live in the first one). Measured on an M6 Mac mini with an earlier form of this change: the machine boots and runs its root file system from NVMe. This version is compile-checked only. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
On T8152 the ATC USB blocks (and the GPU) are behind a per-slot service request in the power state director, on top of the normal PMGR power states. Expose each slot, or a group of slots that must come up together, as a generic power domain. Power-on writes the slot request and waits for the acknowledge; power-off requests state 6 in reverse order. Add the devicetree binding. When a power-on request times out, the slot that timed out is put back to idle with the slots before it, because its acknowledge was not seen but it may still start. When a group power-off fails, every slot is put back to its active state, including a slot whose off request timed out and may still finish stopping, because genpd keeps the domain marked on after a failed power-off and would skip power_on at the next resume. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The fixed host ports on T8152 need only the USB2 part of the PHY. Add a driver that applies the bootloader-supplied calibration, handles host and device mode, and leaves the USB3 and USB4 lanes alone. Add the devicetree binding. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
A hub with the Apple ID 05ac:800f sits behind the front ports of the M6 Mac mini. Add that ID to the hub quirk table with HUB_QUIRK_DISABLE_AUTOSUSPEND so the kernel keeps it powered. The match is on the vendor and product ID alone. Every hub with this ID loses autosuspend, not only the one on this machine. The constant is named after the ID, USB_PRODUCT_APPLE_HUB_800F, because the ID is Apple's and the part behind it was not identified from the descriptor. This quirk was not measured on its own: it only keeps the hub awake. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Add a peripherals fragment to the M6 Mac mini board file: the always-on GPIO controller with the reset hog for the front-port USB hub, and the four PSD service slots for the USB ports. The NVMe controller, its mailbox and its address filter are not described here. The NVMe node needs a mailbox driver change that is not in this tree yet. The fragment holds only addresses, interrupt numbers and wiring. The boot loader adds the register tunables that some blocks need. The PMGR power domains are not described yet, so nodes that need them are left out. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Add the DART of the Apple M6 (T8152), a third-generation DART whose topology is fixed by the hardware. Its streams are described by static parameters instead of being probed, and it takes no MMIO access until the first use, because the block can be power gated behind the ATC USB domains. The binding requires a second register region (the TLB invalidate doorbell) for the T8152 compatible only. The change adds: - the apple,t8152-dart compatible and its hardware description; - static topology and "first use" initialisation of every DART; - the Gen3 TLB invalidate and the fault handler; - the reset path for DARTs that the boot loader leaves locked. A DART that the boot loader leaves locked is held powered for its lifetime. That applies to Gen3 hardware only. The other generations keep their behaviour. The first-use initialisation re-reads the parameters and fails if the page size differs from the one assumed at probe. It runs under a spinlock, and every function it calls is non-sleeping (register accesses and an atomic poll). Measured on an M6 Mac mini with the earlier form of this change: the display controller DART attaches locked on every boot. This version is rebased on current integration/aurora and was compile-checked only. The USB DART paths need the T8152 PSD power domains and were not run on their own. The doorbell store and the TLBI of the Gen3 invalidate are arm64 instructions: they are built only with CONFIG_ARM64, and other architectures (COMPILE_TEST) get a stub that returns -EOPNOTSUPP. A locked Gen3 DART no longer takes the range flush through TLB_CMD, which Gen3 does not accept; it uses the full-stream Gen3 callback. Gen3 does not take commands through TLB_CMD, so the unlock after a lock-on-error exception is not sent there: the DART logs once that this is not supported. The stale-exception drain of a reset does not read 0x704 on Gen3, like the fault handler. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Add the apple,t8152-dwc3 compatible to the Apple dwc3 glue. The ATC ports of the M6 (T8152) controller never switch roles through the Type-C controller. The glue starts the controller as a fixed host, with or without a hub child, or as a fixed peripheral when the node sets dr_mode = "peripheral". The T8152 profile is USB2 only: it needs maximum-speed = "high-speed", takes no reset line, and its USB3 PHY is optional. The calibration lists come from the device tree (apple,tunable-* properties that the boot loader fills in at runtime; the binding does not require them in the board file) and are applied to the register windows in a fixed order after the core is reset. The pipe handler is set up for the selected role. The apple,t8103-dwc3 paths keep their behaviour. The controller stays a syscore device while it runs, as before: no separate suspend or resume path is added for T8152. The earlier form of this change ran on an M6 Mac mini USB2 front port. This version is rebased on current integration/aurora and was compile-checked only. SuperSpeed does not train yet and is not part of this change. A fixed peripheral does not require the host-only calibration lists at probe, since it never applies them. The binding lists exactly four iommus entries, two stream IDs on each of two DARTs. If the T8152 USB2 PHY fails to initialise or power on during core start, the failure goes through the same shutdown as a failed core init, so the reset and syscore flags set earlier are cleared again. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Describe the power management blocks and the USB controllers of the Mac mini (M6, J873) next to the peripherals fragment: - the two PMGR blocks and their power domains, in t8152-j873-pmgr.dtsi; - for each of the four USB ports (usb0, usb1, usb2 and usb3 of the SoC): two DART instances, the USB2 PHY and the dwc3 controller. The register windows, interrupts and DART tunables are the values of the Apple device tree of the machine. The boot loader adds the apple,tunable-* lists of the USB2 PHY and the controller at runtime. The bindings list the apple,t8152-pmgr and apple,t8152-pmgr-pwrstate compatibles, and the dwc3 and USB2 PHY bindings take the tunable lists as optional, because the boot loader adds them. The fragment is a plain description of the hardware. The ports that the change describes run USB2 only: SuperSpeed and USB4 are not part of it. This commit compiles to a device tree blob with dtc without warnings. It was not booted. The bring-up it comes from enumerated the front-port USB2 hub and a USB disk at 480 Mb/s. The four PSD service slots get their PMGR domains (the aon and the port domain of their port) as parents, so genpd powers them before the slot request. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Describe the SuperSpeed and USB4 side of an ATC port of the Apple M6 (T8152). The PHY serves one transport at a time: USB3 for the dwc3 controller of the port (phandle argument 0) or CIO for the ACIO controller (phandle argument 1). The register windows of the dwc3 node (the pipe handler and the PIPE_PHY_READY word) are not resources of the PHY node, because the dwc3 node already owns them and the platform bus rejects equal or partly overlapping ranges. The PHY finds them through the apple,dwc3 phandle. The boot firmware supplies the calibration as apple,tunable-<name> properties, one per tunable list of the firmware PHY node. The power domains are the port's USB AON domain (ps_atc*_usb_aon) and its ATC USB domain (psd_atc*_usb), in that order, as the dts nodes describe them. The properties stay optional: the driver probes and runs without them (the platform bus attaches a single domain, a list handles several), so boards with the PHY tied to one already-enabled domain do not have to describe it. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Add a driver for the SuperSpeed and USB4 (CIO) side of the ATC ports of the Apple M6 (T8152). The USB2 side is phy-apple-t8152-usb2. The driver brings the PHY up for one transport at a time and routes the dwc3 PIPE to it: - PHY 0, USB3: phy_set_mode(HOST) powers the PHY if needed and routes the PIPE. There is no power_on because dwc3 would call it before its core reset, as with atc.c. power_off shuts the PHY down. - PHY 1, CIO: phy_power_on() and phy_power_off() for the Thunderbolt driver. A transport change is a shutdown followed by a full bring-up. The cable orientation comes from the Type-C switch. Probe writes no register. The tunable lists come from the device tree, so the driver carries no calibration values. Status: the bring-up sequence and the PIPE route to USB3 were run on an M6 Mac mini (front port) and the CIO bring-up on the rear port. With the PIPE routed, the SuperSpeed link of the front port reaches RxDetect and Polling but does not train. The shutdown sequence has not been run on hardware. The driver is therefore not enabled by any board file in this series. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
A T8152 port runs USB2-only unless the board describes the SuperSpeed PHY (apple,t8152-atcphy). Request "usb3-phy" with devm_phy_optional_get() for the T8152 compatible, so a board without that PHY still probes. Without the PHY every call on it succeeds, as dwc3_apple_set_role() expects. Other compatibles keep requiring the PHY. The apple,t8152-dwc3 binding gains the matching optional second entry: phys carries usb2-phy and the optional usb3-phy, so the board and the driver agree on when the SuperSpeed PHY exists. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The boot value of GCTL.PWRDNSCALE on T8152 is 1560. The vendor driver writes 13. With the boot value the SuperSpeed port of the front USB-C connector waited 1.56 to 1.69 s between RxDetect and Polling. With 13 the port was already in Polling 88 ms after the PHY was routed. This was measured on the front port only; the other T8152 ports run through the same function and take the same value. Write 13 after the core is initialised, before the Apple specific setup. The write does not make the link train; it changes the delay only. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Describe the Type-C PHYs of the ATC2 (front) and ATC3 ports of the Mac mini (J873) with the apple,t8152-atcphy binding and include them from the board file. Both nodes are disabled: the SuperSpeed link of the front port is not verified yet, and the ATC3 PHY serves the ACIO controller, whose nodes are not part of this change. The boot loader supplies the tunable properties. Enable a node together with a "usb3-phy" reference in the dwc3 node or a phys reference in the ACIO node. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
3043d03 to
d478ff4
Compare
|
[Joshua's agent] The #191 head moved to |
Summary
Adds the SuperSpeed and USB4 (CIO) Type-C PHY of the ATC ports of the Apple M6 (T8152), its binding, two small changes in the Apple dwc3 glue, and two disabled PHY nodes for the Mac mini (J873). Five commits.
The first ten commits of this branch are #191 (the M6 base). Only the last five commits are new here: the diff of this PR shows the base too until #191 merges, then I rebase. Review the last five.
It is not needed for the release candidate, and there is no rush to review or merge it. Nothing in this series enables the driver on a board.
Commits
atc-t8152.c, off by default (PHY_APPLE_T8152_ATC)status = "disabled"Measured, on an M6 Mac mini (front USB-C port, a VL822 hub behind it)
GCTL.PWRDNSCALEhas the boot value 1560. With 13, the time from RxDetect to Polling drops from 1.56-1.69 s to under 90 ms (front port only).Not measured
make dtbs_check/dt_binding_check(a hand-rundt-validateof the board file gave 0 messages).dt-validate(dtschema 2026.9) stops withKeyError: 'uint8-array'while decodingapple,tunable-aciophy-cmn-dflt. Inferred, not proven:apple,pmp.yamlin this tree defines a broad^apple,tunable-pattern of typeuint8-arraythat overlaps this binding's^apple,tunable-[a-z0-9-]+$pattern. The board file (PHY nodes disabled and forced tookay) validates with 0 messages.Blocked
Compile receipt
arm64 clang,
W=1,integration/auroraat 42672ed plus the 15 commits of this branch, defconfig plusPHY_APPLE_T8152_ATC=y:drivers/phy/apple/atc-t8152.o,drivers/usb/dwc3/dwc3-apple.o, the eight objects of #191 andapple/t8152-j873g.dtball rc 0 with 0 warnings.check-commits: Signed-off-by on all 15 commits; no checkpatch errors (warnings: long lines, the MAINTAINERS notice).