Skip to content

phy: apple: t6040: CIO mode, and the T6041 USB4 resources - #1126

Draft
AxxzyWasTaken wants to merge 4 commits into
aurora-silicon:work/conn1-t6040-usb4from
AxxzyWasTaken:t6041-usb4-phy
Draft

AxxzyWasTaken wants to merge 4 commits into
aurora-silicon:work/conn1-t6040-usb4from
AxxzyWasTaken:t6041-usb4-phy

Conversation

@AxxzyWasTaken

Copy link
Copy Markdown
Contributor

Draft, not run on hardware. I don't have a Thunderbolt or USB4 device, so I'm hoping someone with an M4 Pro or M4 Max and a device can test it. Stacked on #1052.

The attach and detach order comes from AppleT6040TypeCPhy mode 2 in the 25G83 kernelcache. It matches #946's T6050 recipe step for step, apart from the AHB clock request at CFG +0x28.

Still missing:

  • The ACIO nodes stay disabled, and no port is wired to them yet.
  • USB3 over the tunnel isn't done. macOS uses PIPE mux 0x11 there, not T6050's 0x21.
  • Sleep with a device attached isn't decoded.
  • The binding for apple,t6041-pmgr-cio and apple,t6041-cio-reset isn't written.

Inferred, please check:

  • The reset slot per port (0, 1, 2) and the LSTX pin function (1).
  • That the reconfig starts the preloaded router firmware, as on T8132. The ADT nub has pre-loaded, running and reconfig-firmware.
  • LSTX timing. macOS sets it before FW_READY, but PCI: apple: draft T6040 USB4 tunnel resources #1052's lstx_after_boot does it after. If FW_READY never comes, try that flag first.

Tested: t6041-j616c.dtb builds, and phy-apple-t6040-usb2.o compiles clean at W=1. The USB path changes are a small refactor, also not booted.

The J616C has the same ACIO, NHI, DART and PCIe-C blocks as T6040 at the
same addresses and interrupts, checked against its ADT. Take the T6040
description and stop deleting the power domains and mailboxes it needs.
Everything stays disabled.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Take the lanes for USB4 or the Thunderbolt alternate mode: the common
tunables and the CIO ones, the crossbar with orientation in one bit, both
lanes released, then the same PHY firmware as USB3. USB3 stays parked until
the lanes come back. The order is AppleT6040TypeCPhy mode 2 from the 25G83
kernelcache and matches the T6050 recipe, except for the AHB clock request
at CFG +0x28.

Not run on hardware.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
Reset: ADT pmgr reg[44] +0x2024, the T6000 layout, as macOS uses it. The
slot per port and the LSTX pin function are inferred.

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for this. Three things for anyone testing it on a J616c:

🤖 Generated with Claude Code

@RyanTheTide

Copy link
Copy Markdown
Contributor

Hardware result for the PHY CIO mode commit (cf72776): it ran on the J616s (M4 Pro) in the linux#1220 proof boot. The CIO PHY came up, the USB4 router linked to an M2 at 2 x 20 Gb/s, and thunderbolt-net reached 18.5 Gbit/s. The commit is carried in #1220 as a cherry-pick with your authorship and Signed-off-by, and with the 'Not run on hardware' note kept as you wrote it. The T6041 DT commits here are untouched; this PR stays open for them.

Take aurora-silicon#1052's fixes, which t6041.dtsi inherits through t6040-usb4.dtsi: the
ACIO sram window is now the router's __DATA segment (e0dac7b), the NHI
ring interrupts are in the right order, and the PCIe adapters are named for
the boot loader. The J616C ADT gives the same __DATA segment on all three
ports (acio-cpuN iop-acioN-nub segment-ranges: cio+0x1080000, 0x26000).

Signed-off-by: AxxzyWasTaken <axxzytte@gmail.com>
@AxxzyWasTaken

Copy link
Copy Markdown
Contributor Author

Thanks. What changed:

Tested: t6041-j616c.dtb builds at W=1 on 9289d18. The only warnings in the USB4 nodes are the underscore alias names that come from t6040-usb4.dtsi. I checked the decompiled dtb for the sram reg and the node status. Nothing was run on J616C hardware. Stays a draft.

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base branch, work/conn1-t6040-usb4, belongs to #1052, which is closed. integration/aurora has moved past it:

  • cf72776 (PHY CIO mode) is in integration/aurora through #1220 (6cf0ab0).
  • integration/aurora's arch/arm64/boot/dts/apple/t6040-usb4.dtsi already has pmgr_cio, cio_reset and the LSTX pins for all three routers, with the reset controller disabled until a board enables its routers.
  • integration/aurora's t6041.dtsi includes t604x.dtsi and not t6040.dtsi, so the /delete-node/ lines this PR removes are not there, and t6041.dtsi conflicts.

Please rebase a6f4e8c and 02e6c3f onto integration/aurora and retarget the PR there. On that base the change is: include t6040-usb4.dtsi (or the T6041 part of it) from t6041.dtsi, make sure the ps_atcN_* power domains it references exist for T6041, and drop the pmgr_cio/LSTX copies that t6040-usb4.dtsi now provides. Then post the t6041-j616c.dtb W=1 build and dtbs_check results again.

@RyanTheTide

Copy link
Copy Markdown
Contributor

For the rebase: the comment on the pmgr reg[44] entry in t6041.dtsi names a macOS method. integration/aurora now words the matching t6040-usb4.dtsi comment as a hardware description (#1625), so please follow that. The description's attach/detach paragraph also names the macOS class and kernelcache build. Please describe the sequence by its steps instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants