Repository navigation
arm64: dts: apple: t604x: USB4/Thunderbolt on the M4 Max (J614c, J616c, J575c) - #2312
Draft
RyanTheTide wants to merge 7 commits into
Draft
RyanTheTide wants to merge 7 commits into
RyanTheTide wants to merge 7 commits into
Conversation
…routers The links from each Type-C connector to the USB4 router behind the same ATC PHY lived in a file only the M4 Pro MacBook Pros included. The Mac mini (J773s) has the same wiring: its ADT pairs acio0-2 with atc-phy0-2 and with the port controllers hpm0-2 (back middle, back left, back right), which the board already names typec0-2, and the router, DART and lstx GPIO addresses match the laptops'. Rename t604x-j614-j616-usb4.dtsi to t6040-usb4-typec.dtsi and include it from the J773s as well. The routers stay disabled, and a port controller skips a link to a disabled router, so nothing changes at runtime yet. The J614s, J616s and J616s-tether DTBs are byte-identical. Signed-off-by: Ryan <ryan@aurorasilicon.org>
… every board The port controller finds the PHY it switches between USB3, DP alt mode and USB4/Thunderbolt by the PHY's mode-switch property. Only the M4 Pro MacBook Pros set it, from their external display file, so on the Mac mini (J773s) the port controllers never get a mux and a USB4 link could not come up even with the routers enabled. Move the three mode-switch properties into t6040-usb4-typec.dtsi next to the connector links, which every T6040 board includes. The J614s, J616s and J616s-tether DTBs are byte-identical; the J773s gains mode-switch on atcphy0-2. Signed-off-by: Ryan <ryan@aurorasilicon.org>
The J614s and J616s each carried an identical block enabling ACIO0-2, their DARTs, NHIs, mailboxes, the CIO reconfiguration block and the ATC power domains, while the Mac mini (J773s), which has the same three routers behind its three back Thunderbolt ports, had none of it. Its ADT has the same acio0-2, dart-acio0-2 (same vm-base) and acio-cpu0-2 at the same addresses, with the same lstx GPIOs. Enable them once in the SoC files instead: the router, DART, NHI and CIO reconfiguration nodes in t6040-usb4.dtsi with the router DART DMA window, the mailboxes in t6040.dtsi, and the power domains at the end of t6040-usb4.dtsi. PCIe tunnels stay off as before: rather than every board deleting apple,pcie-tunnel, the routers no longer carry it. The J614s, J616s and J616s-tether DTBs are unchanged apart from phandle numbering and property order. The J773s gains the three routers. Signed-off-by: Ryan <ryan@aurorasilicon.org>
The M4 Max has the M4 Pro's three USB4 routers behind ATC0-2: the J614c, J616c and J575c ADTs list acio0-2, dart-acio0-2, acio-cpu0-2 and apciec0-2 at the same addresses and interrupts as the J614s, J616s and J773s ADTs, with the same lstx GPIOs and DART vm-base, and the PMGR lists the ATCn_CIO, ATCn_PCIE, ATCn_CIO_PCIE and ATCn_CIO_USB power states at the same offsets. Each port controller names the router behind its ATC PHY (hpmN acio-parent = acioN), and every board calls that connector typecN. T6041 had none of this, so its Thunderbolt ports only ran USB3 and DisplayPort. Make the T6040 description the T604x one instead of copying it: - the CIO and PCIe-C power domains of ATC0-3 move from t6040-pmgr.dtsi to t604x-pmgr.dtsi, - the routers' coprocessor mailboxes move from t6040.dtsi to the USB4 file, - t6040-usb4.dtsi becomes t604x-usb4.dtsi, included by t604x.dtsi, so the routers are enabled on every T604x board, - t6040-usb4-typec.dtsi becomes t604x-usb4-typec.dtsi, and the J614c, J616c and J575c include it next to the M4 Pro boards. The T604x ATC PHYs already are their connectors' mode switches on the T6041 boards (t6041-j616c-usbc.dtsi, t6041-j575c-usbc.dtsi). The T6040 DTBs are unchanged: the sorted, label-resolved sources of the J614s, J616s, J616s tether and J773s are identical before and after. The T6041 boards gain the routers on ATC0-2 and their links. Not run on M4 Max hardware yet. Suggested-by: AxxzyWasTaken <98161954+AxxzyWasTaken@users.noreply.github.com> Link: #1126 Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The CIO reconfiguration register has a request and a busy bit per router, and the PMGR lists four reconfiguration clocks (CIO0-RECONFIG to CIO3-RECONFIG) on every T6040 and T6041 board. The controller only registered three resets, so a fourth router could not take its reset. The Mac Studio (M4 Max, J575c) wires that fourth router (ADT acio3) to its fourth back Thunderbolt port. Register four resets. The laptops do not reference the fourth one, so nothing changes for them. The bit positions for port 3 follow the layout of ports 0-2 (request bit 3, busy bit 19); they are not yet confirmed on hardware. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The T6040 PCIe-C hosts share one MSI window, and each tunnel bridge owns a 32-vector slice selected by its ECAM aperture. The check selected that table with the machine compatible "apple,t6040", so the same controller on an M4 Max (T6041) fell through to "invalid MSI slice". Select it by the controller's own match data (t6040_pciec_hw, compatible "apple,t6040-pciec"), which T6041 uses for the same block, and add the fourth bridge the Mac Studio (M4 Max) has (ADT apciec3, ECAM 0x1c80000000, vector base 0x80, AIC 2199). No board enables a T604x PCIe tunnel yet, so this changes nothing today. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The Mac Studio (M4 Max) has four back Thunderbolt ports. ATC0-2 have the shared routers of t604x-usb4.dtsi. The fourth port, behind ATC3, has a fourth router that the laptops lack (they use ATC3 for HDMI): ADT acio3, dart-acio3, acio-cpu3, apciec3 and dart-apciec3, the same blocks as ACIO0-2 at 0x8000000 above ACIO2, with their own interrupts, LSTX pin (AOP 55) and CIO reset slot 3. Its port controller hpm3 (back left, typec3) names acio3 as its router. Add t6041-j575c-usb4.dtsi: it describes and enables the fourth router, its mailbox and power domains, and links it to typec3. Its PCIe tunnel is described but stays disabled, like the other three. Not run on hardware yet. Link: #1498 Link: #1126 Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #2284. This branch is stacked on it (
spec-m3m4/j773s-usb4, bff7312). Only the last four commits are new here.Problem
The M4 Max boards (J614c, J616c, J575c) have no USB4 router description, so their Thunderbolt 5 ports only run USB3 and DisplayPort alt mode. #2284 enables the routers on every M4 Pro, but it does that in
t6040-usb4.dtsi,t6040.dtsiandt6040-pmgr.dtsi, andt6041.dtsiincludes none of them.The ADTs show the routers are the same hardware. The J614c, J616c and J575c list
acio0-2,dart-acio0-2,acio-cpu0-2andapciec0-2at the same addresses and interrupts as the J614s, J616s and J773s. The lstx GPIOs and DART vm-base match too, and the PMGR lists theATCn_CIO,ATCn_PCIE,ATCn_CIO_PCIEandATCn_CIO_USBstates at the same offsets. On every one of these boards, port controllerhpmNnamesacioNas its router, and the board calls that connectortypecN. The J575c also has a fourth router (acio3) behind ATC3, for its fourth back port. The laptops use ATC3 for HDMI and have noacio3.Change
t6040-pmgr.dtsitot604x-pmgr.dtsi.t6040.dtsiinto the USB4 file.t6040-usb4.dtsibecomest604x-usb4.dtsi, included byt604x.dtsi. The routers on ATC0-2 are now the SoC default on both chips.t6040-usb4-typec.dtsibecomest604x-usb4-typec.dtsi. The J614c, J616c and J575c include it, as the M4 Pro boards do.t6041-j616c-usbc.dtsi,t6041-j575c-usbc.dtsi), so CIO entry has what arm64: dts: apple: t6040: Thunderbolt/USB4 on the Mac mini M4 Pro, router enables shared by every M4 Pro #2284 found it needs.t6041-j575c-usb4.dtsidescribes and enables ACIO3 with its DART, NHI, mailbox, power domains, LSTX pin (AOP 55) and CIO reset slot 3, and links it totypec3. Its PCIe tunnel is described but stays disabled, like the other three.t6041-cio-reconfigregisters four resets instead of three. The PMGR has CIO0-3-RECONFIG on every T604x board.pcie-applepicks the T6040 PCIe-C MSI slice table by its controller match (apple,t6040-pciec) instead of the machine compatibleapple,t6040, and adds the fourth bridge. No T604x board enables a PCIe tunnel yet, so nothing changes today.No thunderbolt or ATC PHY driver change is needed. They match
apple,t6040-usb4-acio,apple,t6040-usb4-nhiandapple,t6040-atcphy, which T6041 uses, and their only machine checks are for T6050 boards. The PHY CIO mode from #1126 is already inintegration/aurorathrough #1220. The boot loader copies the router tuning and DROM for every ADTacioN(acio,v2included), so it needs no change either.This replaces the T6041 device tree part of #1126, which no longer applies to
integration/aurora. The idea and the first T6041 description are from @AxxzyWasTaken.Testing
drivers/pmdomain/apple/t6041-cio-reconfig.oanddrivers/pci/controller/build with W=1 and no warnings.--strictis clean, apart from the MAINTAINERS note for renamed or new dtsi files.Still to run
Hardware rows on a J616c or J614c and on a J575c, with a USB4 or Thunderbolt partner on each port. The partner can be another Mac for host-to-host, or a TB3/TB4 dock. Exact steps and pass criteria are below.
Hardware rows
Boot the kernel from this branch with the matching Stage 2 DTB (
t6041-j616c.dtb,t6041-j614c.dtbort6041-j575c.dtb) and the current aura.dmesg | grep -iE 'thunderbolt|acio|nhi|cio-reconfig'shows no probe errors.ls /sys/bus/thunderbolt/devices/listsdomain0,domain1anddomain2(anddomain3on the J575c), each with its host router.modprobe thunderbolt-net; the peer shows up as/sys/bus/thunderbolt/devices/*-1.cat .../*-1/rx_speed .../*-1/rx_lanes: pass is 20 Gb/s x 2 or better.iperf3over the thunderbolt interface: pass is above 10 Gbit/s (the J616s reached 18.5).boltctl list(or/sys/bus/thunderbolt/devices/*-1/{vendor_name,device_name,authorized}) shows the device, andboltctl authorizesucceeds.lsusb -t).acio/nhitimeouts in dmesg.cio-reconfigtimeout on that port means the slot-3 bit positions are wrong.Assisted-by: LLM (Claude:Opus 5.5)