From 6c56ed3c52019f535802a203c8f2fc98eb64f24a Mon Sep 17 00:00:00 2001 From: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> Date: Sun, 15 Nov 2026 11:44:27 -0700 Subject: [PATCH 01/10] arm64: dts: apple: t6050-j714s: describe the left-back USB-C port The J714s's third USB-C port, the left-back one next to MagSafe (ATC0), has no description, so nothing plugged into it works. Add its USB 2/3 chain: the SN201202x hpm0 on nub-spmi-a0 at 0xc with its connector, the combo PHY with its firmware mailbox, usb-drd0 and its two DARTs, and the ATC0 power domains. The values are the left-front port's (ATC1) moved to ATC0: register blocks less 0x8000000, interrupts less 32 (the PHY mailbox's less 10). They match the J714sAP ADT, J716c's ATC0 and the T6050 inventory, whose usb_drd0, usb0_dart, usb0_dart1 and ps_atc0_* nodes this enables; the DRD's tunables are the same on every port. The PHY's DP clock source register, which the ADT does not give per port, is ATC1's less 0x10, as on J716c. The inventory makes the FAB3 SoC domain ATC0_COMMON's parent. That domain is not described on J714s, and ATC1's and ATC2's common domains have no parent here, so drop it rather than hand FAB3 to Linux (J716c enables ps_fab3_soc instead, which puts it under genpd's unused power-off). The connector is typec2, after the right (typec0) and left-front (typec1) ones. hpm0 joins the other port controllers in t6050-j714s-sleep.dtsi with apple,sleep-ssps. This is the debug (DFU) port, as the ADT marks it (hpm0 has uart-hpm-rids, usb-drd0 the NCM debug gadget's settings), and the boot loader's debug link: the console on serial0 (the dockchannel UART) and, on request, its USB proxy, whose USB2 route it sets with one DVEn action in a short DBMa session. The boot loader has so far kept the port out of the DT on purpose ("Port 0 carries aura's debug link: never describe it"); this hands it to Linux. tipd, the PHY and the DRD's role switch then decide what the USB2 pair carries, and the port's domains and DARTs are Linux's, including genpd's power-off when unused. The boot loader exports the PHY's tunables for ports 1-5 only, so this port's are in the DT, from the J714sAP ADT's atc-phy0 (and usb-drd0's PIPE handler table). They are ATC1's except in axi2af, aus40cmn-shm and cio4pll. Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> --- .../boot/dts/apple/t6050-j714s-left-back.dtsi | 359 ++++++++++++++++++ .../boot/dts/apple/t6050-j714s-sleep.dtsi | 4 + arch/arm64/boot/dts/apple/t6050-j714s.dts | 8 +- 3 files changed, 369 insertions(+), 2 deletions(-) create mode 100644 arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi diff --git a/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi b/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi new file mode 100644 index 0000000000000..89ec3623c443d --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi @@ -0,0 +1,359 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * J714s left-back USB-C port (ATC0), next to MagSafe: USB 2/3 and the PD controller. + * + * ADT /arm-io/nub-spmi-a0/hpm0 (SN201202x at 0xc), atc-phy0, acio-phy-cpu0, usb-drd0 and + * dart-usb0. They are the left-front port's (ATC1) at its addresses and interrupts, as J716c + * describes its ATC0 (t6050-j716c-left-usb4.dtsi) and as in the T6050 inventory + * (t6050-peripherals.dtsi): every ATC0 register block is ATC1's less 0x8000000, every + * interrupt ATC1's less 32 (the PHY mailbox's less 10). + * + * This is Apple's debug (DFU) port, as the ADT marks it (hpm0's uart-hpm-rids, usb-drd0's NCM + * debug gadget settings), and the boot loader's debug link: the console (serial0, the + * dockchannel UART) and, on request, its USB proxy, whose USB2 route it sets with one DVEn + * action in a short DBMa session. Describing the port hands it to Linux: tipd, the PHY and the + * DRD's role switch then decide what the USB2 pair carries, and genpd may power the port's + * domains off while unused. The boot loader leaves the PHY without tunables on this port (the + * only one it skips, as its debug link's), so this file carries them. + */ + +/* + * The inventory gives ATC0_COMMON the FAB3 SoC domain as a parent, which is not described here. + * ATC1's and ATC2's common domains have none: do the same. J716c enables ps_fab3_soc instead, + * which would hand that fabric domain, and its other undescribed users, to genpd's unused + * power-off; left out, it stays as the boot loader leaves it, on. + */ +&ps_atc0_common { + /delete-property/ power-domains; + status = "okay"; +}; + +&ps_atc0_usb_aon { + status = "okay"; +}; + +&ps_atc0_usb { + status = "okay"; +}; + +&ps_atc0_phymxwrap { + status = "okay"; +}; + +&{/soc@200000000} { + /* acio-phy-cpu0 reg[0]: the PHY firmware's mailbox (it runs, pre-loaded by iBoot) */ + atc0_phy_mbox: mailbox@2a3148000 { + compatible = "apple,t6050-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x2 0xa3148000 0x0 0x4000>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + }; + + /* + * atc-phy0 regs [2] [0] usb-drd0[4] [39] [40] [41] [42] [43] [38] [37] usb-drd0[3], and + * the DP clock source register: ATC1's (0x58) less 0x10, as J716c's atc0_phy (the ADT + * does not give the per-port address). + */ + atc0_phy: phy@2a3000000 { + compatible = "apple,t6050-combo-phy"; + reg = <0x2 0xa3000000 0x0 0x2c000>, + <0x2 0xa2a90000 0x0 0x4000>, + <0x2 0xa2800000 0x0 0x4000>, + <0x2 0xa3200000 0x0 0x4000>, + <0x2 0xa3244000 0x0 0x4000>, + <0x2 0xa0000000 0x0 0x8000>, + <0x2 0xa0020000 0x0 0x4000>, + <0x2 0xa3250000 0x0 0x4000>, + <0x2 0xa3140000 0x0 0x4000>, + <0x2 0xa30c0000 0x0 0x10000>, + <0x2 0xa2a84000 0x0 0x4000>, + <0x2 0x80000048 0x0 0x10>; + reg-names = "core", "usb2phy", "usb2-digital", "reset", "fabric", "axi2af", "lioa", + "common-cfg", "usb-control", "firmware-data", "pipehandler", + "dp-clock-source"; + #phy-cells = <1>; + #reset-cells = <1>; + apple,port-index = <0>; + /* The binding's name for "no other owner"; nothing else drives this port here. */ + apple,guest-port-reserved; + mode-switch; + orientation-switch; + mboxes = <&atc0_phy_mbox>; + power-domains = <&ps_atc0_usb_aon>, <&ps_atc0_common>, <&ps_atc0_phymxwrap>, + <&ps_atc0_usb>; + power-domain-names = "usb-aon", "common", "wrapper", "usb"; + + port { + atc0_phy_typec: endpoint { + remote-endpoint = <&typec2_ss>; + }; + }; + }; +}; + +/* /arm-io/dart-usb0 reg[0] and reg[1], interrupt 1423; vm-base 0x10000004000 +0xffff0000 */ +&usb0_dart { + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + status = "okay"; +}; + +&usb0_dart1 { + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + status = "okay"; +}; + +/* + * /arm-io/usb-drd0: the inventory's registers and interrupt (1419), with usb-drd1's setup and + * tunables (the DRD tables are the same on every port, as on J716c). + */ +&usb_drd0 { + dr_mode = "otg"; + usb-role-switch; + role-switch-default-mode = "host"; + resets = <&atc0_phy 0>; + phys = <&atc0_phy PHY_TYPE_USB2>, <&atc0_phy PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; + apple,tunable-gbl-default = <0x64 0x2 0x0>, <0x10 0xfff80000 0x00680000>; + apple,tunable-gbl-host = <0x4 0x0001ef00 0x00002f00>, <0x1c 0x00000100 0x0>, + <0x2c 0x000a07ff 0x000800c8>, <0x100 0x02000100 0x02000100>, + <0x504 0x00001000 0x0>, <0x528 0xff0000ff 0x06000006>, + <0x52c 0xff0000ff 0x08000008>, <0x580 0xffffffff 0x6f000006>, + <0x584 0xffffffff 0x00060000>; + apple,tunable-dbg = <0x0 0x8 0x8>; + apple,tunable-cfg-host = <0x20 0xff 0x1b>; + apple,tunable-link = <0x10 0xff000000 0xff000000>, <0x20 0x7ff00000 0x4e900000>, + <0x24 0x001f8000 0x000b8000>, <0x60 0x0003ffff 0x00000600>; + apple,tunable-cio = <0x20 0x00ff0000 0x001e0000>; + status = "okay"; + + port { + usb_drd0_hs: endpoint { + remote-endpoint = <&typec2_hs>; + }; + }; +}; + +/* + * typec2: the third connector, after the right (typec0) and left-front (typec1) ports, so + * those keep their names. + */ +&nub_spmi_a0 { + hpm0: usb-pd@c { + compatible = "apple,sn201202x"; + reg = <0xc SPMI_USID>; + + typec2: connector { + compatible = "usb-c-connector"; + label = "USB-C Left-back"; + power-role = "dual"; + data-role = "dual"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + typec2_hs: endpoint { + remote-endpoint = <&usb_drd0_hs>; + }; + }; + + port@1 { + reg = <1>; + typec2_ss: endpoint { + remote-endpoint = <&atc0_phy_typec>; + }; + }; + }; + }; + }; +}; + +/* + * The PHY's tunables, which the boot loader exports for ports 1-5 only: the J714sAP ADT's + * tunable_* tables of /arm-io/atc-phy0 and tunable_PIPE_HANDLER_DEFAULT of usb-drd0, under the + * names the boot loader gives them on the other ports. They are ATC1's except in axi2af, + * aus40cmn-shm and cio4pll. + */ +&atc0_phy { + apple,tunable-axi2af = <0x0 0x800000ff 0x80000024>, + <0x4 0x80ff00ff 0x80240002>, + <0x8 0x80ff00ff 0x80240002>, + <0xc 0x80ff00ff 0x80240006>, + <0x10 0x80ff00ff 0x80240002>, + <0x14 0x80ff00ff 0x80220004>, + <0x18 0x80ff00ff 0x80240002>, + <0x1c 0x80ff00ff 0x80240002>, + <0x20 0x80ff00ff 0x80240002>, + <0x24 0x800000ff 0x8000001b>, + <0x28 0x800000ff 0x80000048>, + <0x2c 0x80ff00ff 0x80480004>, + <0x30 0x80ff00ff 0x80480004>, + <0x34 0x80ff00ff 0x80440008>, + <0x38 0x80ff00ff 0x80480004>, + <0x3c 0x80ff00ff 0x80480004>, + <0x40 0x800000ff 0x8000001b>, + <0x44 0x800000ff 0x8000001b>, + <0x48 0x800000ff 0x8000001e>, + <0x100 0xff 0xff>, + <0x104 0x3 0x3>, + <0x300 0x3 0x1>, + <0x304 0x3f3f0000 0x4040000>, + <0x308 0x3ff 0xd>, + <0x30c 0x700003ff 0xc>, + <0x310 0x80001f 0x800001>, + <0x314 0x8080001f 0x80800001>, + <0x318 0x80001f 0x800001>, + <0x31c 0x8080001f 0x80800001>, + <0x320 0x80001f 0x800003>, + <0x324 0x8080001f 0x80800003>, + <0x328 0x80001f 0x800003>, + <0x32c 0x8080001f 0x80800003>, + <0x330 0x80001f 0x800003>, + <0x334 0x8080001f 0x80800003>, + <0x338 0x80001f 0x800003>, + <0x33c 0x80001f 0x800003>, + <0x340 0x80001f 0x800003>, + <0x344 0x80001f 0x800003>, + <0x348 0x80001f 0x800003>, + <0x34c 0x80001f 0x800003>, + <0x350 0x80001f 0x800003>, + <0x404 0xffff0023 0x1e0021>, + <0x408 0x3ff 0xd>, + <0x40c 0x700003ff 0xc>, + <0x410 0x8000001f 0x80000001>, + <0x414 0x8000001f 0x80000001>, + <0x418 0x8000001f 0x80000001>, + <0x41c 0x8000001f 0x80000001>, + <0x420 0x8000001f 0x80000003>, + <0x424 0x8000001f 0x80000003>, + <0x428 0x8000001f 0x80000003>, + <0x42c 0x8000001f 0x80000003>, + <0x430 0x8000001f 0x80000003>, + <0x434 0x8000001f 0x80000003>, + <0x438 0x8000001f 0x80000003>, + <0x43c 0x8000001f 0x80000003>, + <0x440 0x8000001f 0x80000003>, + <0x444 0x8000001f 0x80000003>, + <0x448 0x8000001f 0x80000003>, + <0x44c 0x8000001f 0x80000003>, + <0x450 0x8000001f 0x80000003>, + <0x948 0x7ff07ff 0x280000>, + <0xa48 0x7ff07ff 0x400040>, + <0xb48 0x7ff07ff 0xb8010e>, + <0xc48 0x7ff07ff 0x400020>, + <0xd48 0x7ff07ff 0x8a008a>, + <0x1000 0xffffffff 0x7fffffff>, + <0x1004 0x100 0x100>, + <0x4008 0x1 0x1>, + <0x400c 0x1 0x1>, + <0x4014 0x1 0x1>, + <0x4018 0x1 0x0>, + <0x401c 0x1 0x1>, + <0x108 0xffff0007 0x100001>; + apple,tunable-fabric = <0x4 0x3f003f 0x200020>, + <0xc 0xf1 0xa1>, + <0x10 0x801f 0x4>, + <0x18 0x3f003f 0x200020>, + <0x20 0xf1 0xa1>, + <0x24 0x801f 0x4>, + <0x2c 0xff00ff 0x960096>, + <0x34 0xf1 0x71>, + <0x38 0x801f 0x4>, + <0x40 0x3f 0x20>, + <0x48 0x801f 0x4>, + <0x50 0x7f007f 0x450045>, + <0x58 0x801f 0x4>, + <0x60 0x3f 0x20>, + <0x68 0x801f 0x4>, + <0x70 0x1 0x1>, + <0x74 0x801f 0x4>, + <0x7c 0x7f007f 0x400040>, + <0x80 0xf1 0x11>, + <0x84 0x1 0x1>, + <0x88 0x1 0x1>, + <0x8c 0x801f 0x4>, + <0x94 0x3f003f 0x240024>, + <0x98 0xf1 0x11>, + <0x9c 0x801f 0x4>, + <0xa4 0x1ff 0x1e0>, + <0xa8 0x801f 0x4>, + <0xb0 0x3f 0x20>, + <0xb8 0x801f 0x4>, + <0xc0 0x3f 0x20>, + <0xc8 0x801f 0x4>, + <0xd0 0x1f001f 0x100010>, + <0xd8 0x1 0x1>, + <0xdc 0x1 0x1>, + <0xe0 0x801f 0x4>, + <0xe8 0xf 0x8>, + <0xec 0x801f 0x4>, + <0xf4 0xffffffff 0x1010101>, + <0xf8 0x801f 0x4>, + <0x100 0x1 0x1>, + <0x104 0x1 0x1>, + <0x108 0x801f 0x4>, + <0x110 0x801f 0x4>, + <0x118 0x801f 0x4>, + <0x120 0x1 0x1>, + <0x124 0x1 0x1>, + <0x128 0x801f 0x4>, + <0x130 0xffffffff 0x1010101>, + <0x134 0x801f 0x4>, + <0x13c 0x1 0x1>, + <0x140 0x1 0x1>, + <0x144 0x801f 0x4>, + <0x14c 0x1 0x1>, + <0x150 0x1 0x1>, + <0x154 0x801f 0x4>, + <0x15c 0x801f 0x4>, + <0x164 0xffffffff 0x1010101>, + <0x168 0xffff 0x101>, + <0x16c 0x801f 0x4>, + <0x174 0x1 0x1>, + <0x178 0x1 0x1>, + <0x17c 0x801f 0x4>, + <0x184 0x1 0x1>, + <0x188 0x1 0x1>, + <0x18c 0x801f 0x4>; + apple,tunable-common-cfg = <0x8 0x1 0x1>; + apple,tunable-lioa = <0x28 0xfc2f 0x0>, + <0x2c 0x7 0x0>, + <0x30 0xff 0x0>, + <0x34 0x3ff 0x0>, + <0x58 0x30b 0x0>; + apple,tunable-lane0-rx-clock = <0x94 0x80000 0x80000>, + <0x98 0x80000 0x80000>, + <0xa4 0x800000 0x800000>, + <0xa8 0x200000 0x200000>; + apple,tunable-lane1-rx-clock = <0x94 0x80000 0x80000>, + <0x98 0x80000 0x80000>, + <0xa4 0x800000 0x800000>, + <0xa8 0x200000 0x200000>; + apple,tunable-lane0-rx-eq = <0x698 0x7e00000 0x4400000>, + <0x69c 0x7e00000 0x3800000>, + <0x6a0 0x7e00000 0x3800000>; + apple,tunable-lane1-rx-eq = <0x698 0x7e00000 0x4400000>, + <0x69c 0x7e00000 0x3800000>, + <0x6a0 0x7e00000 0x3800000>; + apple,tunable-auspll = <0x24 0xc00 0x800>, + <0x30 0x1f 0xf>, + <0x40 0x7d8007f 0x4000039>, + <0xb0 0xb800000 0x1800000>, + <0xe8 0x60001 0x40001>, + <0x138 0xf800000 0x7800000>; + apple,tunable-aus40cmn-shm = <0x4 0x7c 0x48>; + apple,tunable-cio4pll = <0x30 0x1f 0xf>, + <0x4c 0xfe7f 0x4e1e>, + <0xb0 0x700000 0x300000>, + <0xe8 0x60000 0x20000>; + apple,tunable-usb2-default = <0x8 0x7003 0x3>, + <0x18 0x703 0x103>; + apple,tunable-usb2-host = <0x8 0x7003 0x7003>; + apple,tunable-pipe-default = <0x44 0x4 0x4>; +}; diff --git a/arch/arm64/boot/dts/apple/t6050-j714s-sleep.dtsi b/arch/arm64/boot/dts/apple/t6050-j714s-sleep.dtsi index c6391bcb1b81a..9f5098d072b89 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s-sleep.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-j714s-sleep.dtsi @@ -141,6 +141,10 @@ }; /* The port controllers put in system power state S3 before the commit, then SLEEP */ +&hpm0 { + apple,sleep-ssps; +}; + &hpm1 { apple,sleep-ssps; }; diff --git a/arch/arm64/boot/dts/apple/t6050-j714s.dts b/arch/arm64/boot/dts/apple/t6050-j714s.dts index 383ec08bedbe2..f94dbf1a70236 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714s.dts @@ -296,12 +296,13 @@ /* * Type-C, from the ADT: - * ATC0 usb-drd0 left-back hpm0 nub-spmi-a0 0x0c (the debug port, not described) + * ATC0 usb-drd0 left-back hpm0 nub-spmi-a0 0x0c (the debug port) * ATC1 usb-drd1 left-front hpm1 nub-spmi-a0 0x0a * ATC2 usb-drd2 right hpm2 nub-spmi-a1 0x0c * hpm5 nub-spmi-a0 0x08 (MagSafe 3, power in only: no connector node) * There is no usb-drd3 and no nub-spmi-a2, so ATC3's USB chain and that bus stay - * off. Both described ports are wired as on J716s. + * off. The left-front and right ports are wired as on J716s; the left-back port is in + * t6050-j714s-left-back.dtsi. */ &atc3_phy_mbox { status = "disabled"; @@ -424,6 +425,9 @@ /* Left-front port (ATC1): the USB4/Thunderbolt router and its PCIe tunnel */ #include "t6050-j714s-left-usb4.dtsi" +/* Left-back port (ATC0) */ +#include "t6050-j714s-left-back.dtsi" + /* * The PMP (ADT pmp0, /chosen, /arm-io/pmgr). iBoot loads its firmware and the driver starts it * with these boot arguments and the firmware properties below. Its report tells it which devices From b4cc471a132019b418fc63a40de2623d6f735232 Mon Sep 17 00:00:00 2001 From: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> Date: Sun, 15 Nov 2026 11:46:10 -0700 Subject: [PATCH 02/10] arm64: dts: apple: t6050-j714s: add the left-back port's USB4 router Add the left-back port's (ATC0) USB4/Thunderbolt router and its PCIe tunnel, so a USB4 or Thunderbolt dock works there as on the other two ports: acio0 with its CPU mailbox, DART and NHI, the PCIe-C root port apciec0 and its DART, their power domains, the LSTX pin, the CIO reconfig reset and the link from hpm0's connector. Every address and interrupt is the left-front router's (t6050-j714s-left-usb4.dtsi) moved to ATC0, and the result is the same as J716c's ATC0 router and tunnel (t6050-j716c-left-usb4.dtsi), including the LSTX pin (AOP GPIO 77, now exposed with 79 and 81), the PCIe windows, MSI slice 128-159 and PCI domain 1, which nothing else uses here. The inventory's apciec0_dart gives way to the tunnel's, as for ATC1. The AOP GPIOs' reserved ranges, which leave only the routers' LSTX pins, move from t6050-j714s-left-usb4.dtsi to the board file, the one place that knows all three. The router, NHI, DART and tunnel tunables are ATC1's: they are the same on ATC1 and ATC2 here and on J716c's ATC0 and ATC1. The router also gets its four DP IN interrupts (AIC 1603, 1604, 1609, 1610; the inventory's atc0-dpin0..3, as on J716c), so DP IN events need not be polled once a display pipeline is routed to this port. The host DROM and the PHY's CIO80 RX_TOP tunables are the J714sAP ADT's (acio0 thunderbolt-drom, atc-phy0 tunable_LN0/LN1_RX_TOP_CIO_DFLT). The ADT's acio0, acio-cpu0, dart-acio0, apciec0, dart-apciec0 and atc0-dpin0..3 registers, interrupts, LSTX pin (77) and PCIe ranges and domain agree with the values above. Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> --- .../boot/dts/apple/t6050-j714s-left-back.dtsi | 505 +++++++++++++++++- .../boot/dts/apple/t6050-j714s-left-usb4.dtsi | 5 - arch/arm64/boot/dts/apple/t6050-j714s.dts | 5 + .../boot/dts/apple/t6050-peripherals.dtsi | 2 +- 4 files changed, 508 insertions(+), 9 deletions(-) diff --git a/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi b/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi index 89ec3623c443d..969a7f0f9eff1 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi @@ -1,12 +1,14 @@ // SPDX-License-Identifier: GPL-2.0+ OR MIT /* - * J714s left-back USB-C port (ATC0), next to MagSafe: USB 2/3 and the PD controller. + * J714s left-back USB-C port (ATC0), next to MagSafe: USB 2/3, the PD controller, and the + * USB4/Thunderbolt router and its PCIe tunnel. * * ADT /arm-io/nub-spmi-a0/hpm0 (SN201202x at 0xc), atc-phy0, acio-phy-cpu0, usb-drd0 and - * dart-usb0. They are the left-front port's (ATC1) at its addresses and interrupts, as J716c + * dart-usb0; acio0, acio-cpu0, dart-acio0, apciec0 and dart-apciec0. They are the left-front + * port's (ATC1, t6050-j714s-left-usb4.dtsi) at its addresses and interrupts, as J716c * describes its ATC0 (t6050-j716c-left-usb4.dtsi) and as in the T6050 inventory * (t6050-peripherals.dtsi): every ATC0 register block is ATC1's less 0x8000000, every - * interrupt ATC1's less 32 (the PHY mailbox's less 10). + * interrupt ATC1's less 32 (the PHY's and the router CPU's mailboxes' less 10). * * This is Apple's debug (DFU) port, as the ADT marks it (hpm0's uart-hpm-rids, usb-drd0's NCM * debug gadget settings), and the boot loader's debug link: the console (serial0, the @@ -357,3 +359,500 @@ apple,tunable-usb2-host = <0x8 0x7003 0x7003>; apple,tunable-pipe-default = <0x44 0x4 0x4>; }; + +/* ==== The USB4/Thunderbolt router and its PCIe tunnel ==== */ + +&ps_atc0_cio { + power-domains = <&ps_atc0_common>; + status = "okay"; +}; + +&ps_atc0_cio_pcie { + power-domains = <&ps_atc0_cio>; + status = "okay"; +}; + +&ps_atc0_cio_usb { + power-domains = <&ps_atc0_cio>; + status = "okay"; +}; + +&ps_atc0_cio_auss { + power-domains = <&ps_atc0_cio>, <&ps_auss>; + status = "okay"; +}; + +/* With the ATC0 USB always-on clock gate, as ATC1_PCIE and ATC2_PCIE */ +&ps_atc0_pcie { + power-domains = <&ps_atc0_common>, <&ps_atc0_usb_aon>; + status = "okay"; +}; + +/* LSTX: AOP GPIO pin 77 (0x4d), function 1 for the router, as J716c's acio0 */ +&pinctrl_aop { + acio0_lstx_pins: acio0-lstx-pins { + pinmux = <0x1004d>; /* APPLE_PINMUX(77, 1) */ + }; +}; + +&{/soc@200000000} { + /* /arm-io/acio-cpu0 reg[0]: the router CPU's mailbox, inside its wrapper */ + acio0_mbox: mailbox@2a1108000 { + compatible = "apple,t6050-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x2 0xa1108000 0x0 0x4000>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + }; + + acio0: acio@2a1ac0000 { + compatible = "apple,t6050-usb4-acio"; + reg = <0x2 0xa1ac0000 0x0 0xc000>, + <0x2 0xa1080000 0x0 0x26000>, + <0x2 0xa1e44000 0x0 0x4000>, + <0x2 0xa1100000 0x0 0x4000>, + <0x2 0xa1c80000 0x0 0x4000>; + reg-names = "rc", "sram", "pcie-adapter", "cpu", "router-ap-fw"; + mboxes = <&acio0_mbox>; + resets = <&cio_reconfig0 0>; + /* ATC0_PCIE last: the PCIe tunnel root port, set up before it is populated */ + power-domains = <&ps_atc0_cio>, <&ps_atc0_cio_pcie>, + <&ps_atc0_cio_usb>, <&ps_atc0_cio_auss>, <&ps_atc0_pcie>; + thunderbolt-switch; + apple,pcie-tunnel = <&acio0_pcie_tunnel>; + pinctrl-0 = <&acio0_lstx_pins>; + pinctrl-names = "lstx"; + lstx-gpios = <&pinctrl_aop 77 GPIO_ACTIVE_HIGH>; + + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x2 0xa1000000 0x1000000>; + nonposted-mmio; + + acio0_dart: iommu@a80000 { + compatible = "apple,t6050-dart", "apple,t8110-dart"; + reg = <0xa80000 0xc000>; + interrupts = ; + power-domains = <&ps_atc0_cio>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; + apple,bypass-sids = <15>; + apple,full-error-reporting; + apple,ctc-flush; + }; + + /* Interrupts 0x62b.. (1579) are the TX rings and 0x637.. (1591) the RX rings */ + acio0_nhi: nhi@f00000 { + compatible = "apple,t6050-usb4-nhi"; + reg = <0xf00000 0x100000>; + reg-names = "nhi"; + interrupts = , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + ; + interrupt-names = "txring0", "txring1", "txring2", "txring3", + "txring4", "txring5", "txring6", "txring7", + "txring8", "txring9", "txring10", "txring11", + "rxring0", "rxring1", "rxring2", "rxring3", + "rxring4", "rxring5", "rxring6", "rxring7", + "rxring8", "rxring9", "rxring10", "rxring11", + "parity"; + iommus = <&acio0_dart 0>, + <&acio0_dart 1>, + <&acio0_dart 2>, + <&acio0_dart 3>, + <&acio0_dart 4>, + <&acio0_dart 5>, + <&acio0_dart 6>, + <&acio0_dart 7>, + <&acio0_dart 8>, + <&acio0_dart 9>, + <&acio0_dart 10>, + <&acio0_dart 11>, + <&acio0_dart 16>, + <&acio0_dart 17>, + <&acio0_dart 18>, + <&acio0_dart 19>, + <&acio0_dart 20>, + <&acio0_dart 21>, + <&acio0_dart 22>, + <&acio0_dart 23>, + <&acio0_dart 24>, + <&acio0_dart 25>, + <&acio0_dart 26>, + <&acio0_dart 27>; + }; + }; +}; + +/* + * ATC0's PCIe tunnel: /arm-io/apciec0 and dart-apciec0, the PCIe-C root port behind the router's + * PCIe down adapter, set up as ATC1's. Its config space and windows are J716c's apciec0's, below + * ATC1's; MSIs use the bridge's 32-vector slice (128-159) and PCI domain 1, both unused so far. + */ +/ { + acio0_pcie_tunnel: pcie-tunnel-0 { + #address-cells = <2>; + #size-cells = <2>; + ranges; + nonposted-mmio; + + apciec0_dart: iommu@2a4000000 { + compatible = "apple,t6050-dart", "apple,t8110-dart"; + reg = <0x2 0xa4000000 0x0 0x20000>; + interrupts = ; + power-domains = <&ps_atc0_pcie>; + #iommu-cells = <1>; + apple,bypass-sids = <253 255>; + apple,full-error-reporting; + apple,ctc-flush; + }; + + apciec0: pcie@1c50000000 { + compatible = "apple,t6050-pciec"; + device_type = "pci"; + reg = <0x1c 0x50000000 0x0 0x10000000>, + <0x2 0xa4034000 0x0 0x4000>, + <0x2 0xa4020000 0x0 0x8000>, + <0x2 0xa4038000 0x0 0x4000>, + <0x2 0xa4060000 0x0 0x4000>, + <0x2 0xa402c000 0x0 0x4000>, + <0x2 0xa4028000 0x0 0x4000>; + reg-names = "config", "rc", "port0", "fabric", "debug", "ltssm", "intr2axi"; + /* The port's: link events and INTx */ + interrupts = ; + power-domains = <&ps_atc0_pcie>; + /* No boot loader hands the port over: the kernel cold-initializes it. */ + apple,pciec-kernel-init; + + msi-controller; + msi-parent = <&apciec0>; + msi-ranges = <&aic AIC_IRQ 0 1952 IRQ_TYPE_EDGE_RISING 32>; + apple,msi-vector-base = <128>; + + iommu-map = <0x0 &apciec0_dart 0x0 0x40>; + iommu-map-mask = <0x3f>; + linux,pci-domain = <1>; + bus-range = <0x0 0x7f>; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x43000000 0x8 0x0 0x8 0x0 0x2 0x0>, + <0x02000000 0x0 0x00100000 0xa 0x00100000 0x0 0x3ff00000>, + <0x42000000 0x0 0x40000000 0xa 0x40000000 0x0 0x40000000>; + + apciec0_port: pci@0,0 { + device_type = "pci"; + reg = <0x0 0x0 0x0 0x0 0x0>; + external-facing; + + #address-cells = <3>; + #size-cells = <2>; + ranges; + + interrupt-controller; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &apciec0_port 0 0 0 0>, + <0 0 0 2 &apciec0_port 0 0 0 1>, + <0 0 0 3 &apciec0_port 0 0 0 2>, + <0 0 0 4 &apciec0_port 0 0 0 3>; + }; + }; + }; +}; + +/* + * The PHY's CIO80 RX_TOP tunables (ADT atc-phy0 tunable_LN0/LN1_RX_TOP_CIO_DFLT): 0x200, as on + * the left-front port (the right port's is 0x0). + */ +&atc0_phy { + apple,tunable-lane0-rx-top-cio = <0x35c 0xe00 0x200>; + apple,tunable-lane1-rx-top-cio = <0x35c 0xe00 0x200>; +}; + +&typec2 { + ports { + port@3 { + reg = <3>; + typec2_usb4: endpoint { + remote-endpoint = <&acio0_tbt>; + }; + }; + }; +}; + +/* + * The router's tunables and its DP IN interrupts (atc0-dpin0..3 in the T6050 inventory, as J716c's + * acio0). The router, NHI, DART and tunnel tunables are the same on ATC1 and ATC2 here and on + * J716c's ATC0 and ATC1. + */ +&acio0 { + interrupts = , , + , ; + interrupt-names = "dpin0", "dpin1", "dpin2", "dpin3"; + apple,tunable-rc = <0x0 0xfff0 0x4020>, + <0x2c 0x4 0x0>, + <0x4004 0x1ff01ff 0x1000100>, + <0x4008 0x801f 0x4>, + <0x4010 0x7f 0x40>, + <0x4014 0x801f 0x4>, + <0x401c 0x7f 0x40>, + <0x4024 0x801f 0x4>, + <0x402c 0x7f 0x40>, + <0x4030 0x801f 0x4>, + <0x4038 0xffffffff 0x1010101>, + <0x403c 0xffff 0x101>, + <0x4040 0x1 0x1>, + <0x4044 0xffffffff 0x1010101>, + <0x4048 0x1 0x1>, + <0x404c 0x801f 0x4>, + <0x8004 0x70007 0x40004>, + <0x8008 0x801f 0x4>, + <0x8010 0x70007 0x40004>, + <0x8018 0x801f 0x4>, + <0x8020 0x70007 0x40004>, + <0x8028 0x801f 0x4>, + <0x8030 0x801f 0x4>, + <0x8038 0x801f 0x4>, + <0x8040 0x801f 0x4>, + <0x8048 0x801f 0x4>, + <0x8050 0x801f 0x4>, + <0x8058 0x801f 0x4>, + <0x8060 0x801f 0x4>; + apple,tunable-pcie-adapter = <0x1008 0x6 0x6>; + apple,tunable-router-ap-fw = <0x8 0xff2 0x482>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + acio0_tbt: endpoint { + remote-endpoint = <&typec2_usb4>; + }; + }; + }; +}; + +&acio0_dart { + apple,tunable = <0x20c 0x80000121 0x80000121>, + <0x220 0xf0f 0xf0f>, + <0x224 0xffff 0x909>, + <0x300 0x1f31 0x1>, + <0x308 0x3ffffffc 0x10000000>, + <0x310 0x3ffffffc 0x3ffffffc>, + <0x800 0xf003f 0x10000>, + <0x804 0xf003f 0x10002>, + <0x808 0xf003f 0x10004>, + <0x80c 0xf003f 0x20006>, + <0x810 0xf003f 0x2000a>, + <0x814 0xf003f 0x2000e>, + <0x818 0xf003f 0x20012>, + <0x81c 0xf003f 0x20016>, + <0x820 0xf003f 0x2001a>, + <0x824 0xf003f 0x2001e>, + <0x828 0xf003f 0x20022>, + <0x82c 0xf003f 0x20026>, + <0x830 0xf003f 0x2002a>, + <0x834 0xf003f 0x2002e>, + <0x838 0xf003f 0x20032>, + <0x83c 0xf003f 0x10036>; +}; + +/* + * The host DROM: the J714sAP ADT's /arm-io/acio0 thunderbolt-drom (acio1's with the router's + * port entries for port 0 and UID 0). The boot loader does not replace it on this board (no + * usb4_N_nhi alias). + */ +&acio0_nhi { + apple,tunable-nhi = <0xf8004 0xff 0x80>, + <0xf8008 0x801f 0x4>, + <0xf8010 0x3f 0x20>, + <0xf8014 0x801f 0x4>, + <0xf801c 0x1f 0x10>, + <0xf8020 0x801f 0x4>, + <0xf8028 0xff 0x80>, + <0xf802c 0x801f 0x4>, + <0xf8034 0xff 0x80>, + <0xf8038 0x801f 0x4>, + <0xf8040 0x3f 0x20>, + <0xf8044 0x801f 0x4>, + <0xf804c 0x8007 0x1>, + <0xfc004 0x3 0x2>, + <0xfc008 0x801f 0x4>, + <0xfc010 0x7 0x4>, + <0xfc014 0x801f 0x4>, + <0xfc01c 0x7 0x4>, + <0xfc020 0x801f 0x4>, + <0xfc028 0x7 0x4>, + <0xfc02c 0x801f 0x4>, + <0xfc034 0x7 0x4>, + <0xfc038 0x801f 0x4>, + <0xfc040 0x3 0x2>, + <0xfc044 0x801f 0x4>, + <0xfc04c 0x8007 0x1>, + <0x4000 0x1000000f 0x10000002>, + <0x4004 0x1000000f 0x10000002>, + <0x4008 0x1000000f 0x10000002>, + <0x400c 0x1000000f 0x10000002>, + <0x4010 0x1000000f 0x10000002>, + <0x4014 0x1000000f 0x10000002>, + <0x4018 0x1000000f 0x10000002>, + <0x401c 0x1000000f 0x10000002>, + <0x4020 0x1000000f 0x10000002>, + <0x4024 0x1000000f 0x10000002>, + <0x4028 0x1000000f 0x10000002>, + <0x402c 0x1000000f 0x10000002>, + <0x4040 0x1000000f 0x10000002>, + <0x4044 0x1000000f 0x10000002>, + <0x4048 0x1000000f 0x10000002>, + <0x404c 0x1000000f 0x10000002>, + <0x4050 0x1000000f 0x10000002>, + <0x4054 0x1000000f 0x10000002>, + <0x4058 0x1000000f 0x10000002>, + <0x405c 0x1000000f 0x10000002>, + <0x4060 0x1000000f 0x10000002>, + <0x4064 0x1000000f 0x10000002>, + <0x4068 0x1000000f 0x10000002>, + <0x406c 0x1000000f 0x10000002>, + <0x4080 0x1000000f 0x10000002>, + <0x4084 0x1000000f 0x10000002>, + <0x4088 0x1000000f 0x10000002>, + <0x408c 0x1000000f 0x10000002>, + <0x4090 0x1000000f 0x10000002>, + <0x4094 0x1000000f 0x10000002>, + <0x4098 0x1000000f 0x10000002>, + <0x409c 0x1000000f 0x10000002>, + <0x40a0 0x1000000f 0x10000002>, + <0x40a4 0x1000000f 0x10000002>, + <0x40a8 0x1000000f 0x10000002>, + <0x40ac 0x1000000f 0x10000002>, + <0x40c0 0x1000000f 0x10000002>, + <0x40c4 0x1000000f 0x10000002>, + <0x40c8 0x1000000f 0x10000002>, + <0x40cc 0x1000000f 0x10000002>, + <0x40d0 0x1000000f 0x10000002>, + <0x40d4 0x1000000f 0x10000002>, + <0x40d8 0x1000000f 0x10000002>, + <0x40dc 0x1000000f 0x10000002>, + <0x40e0 0x1000000f 0x10000002>, + <0x40e4 0x1000000f 0x10000002>, + <0x40e8 0x1000000f 0x10000002>, + <0x40ec 0x1000000f 0x10000002>, + <0x4100 0x1000000f 0x10000002>, + <0x4104 0x1000000f 0x10000002>, + <0x4108 0x1000000f 0x10000002>, + <0x410c 0x1000000f 0x10000002>, + <0x4110 0x1000000f 0x10000002>, + <0x4114 0x1000000f 0x10000002>, + <0x4118 0x1000000f 0x10000002>, + <0x411c 0x1000000f 0x10000002>, + <0x4120 0x1000000f 0x10000002>, + <0x4124 0x1000000f 0x10000002>, + <0x4128 0x1000000f 0x10000002>, + <0x412c 0x1000000f 0x10000002>, + <0x4140 0x1000000f 0x10000002>, + <0x4144 0x1000000f 0x10000002>, + <0x4148 0x1000000f 0x10000002>, + <0x414c 0x1000000f 0x10000002>, + <0x4150 0x1000000f 0x10000002>, + <0x4154 0x1000000f 0x10000002>, + <0x4158 0x1000000f 0x10000002>, + <0x415c 0x1000000f 0x10000002>, + <0x4160 0x1000000f 0x10000002>, + <0x4164 0x1000000f 0x10000002>, + <0x4168 0x1000000f 0x10000002>, + <0x416c 0x1000000f 0x10000002>, + <0x43e4 0x7 0x7>; + apple,thunderbolt-drom = [db 00 00 00 00 00 00 00 00 c0 49 a7 a6 00 5c 00 + 00 00 00 00 00 00 08 81 80 02 80 00 00 00 08 82 + 90 01 80 00 00 00 03 83 20 08 84 00 00 00 00 00 + 00 08 85 00 00 00 00 00 00 05 86 09 01 00 08 87 + 00 00 00 00 00 00 05 88 09 01 00 05 89 09 01 00 + 05 8a 09 01 00 0e 01 41 70 70 6c 65 2c 20 49 6e + 63 2e 00 06 02 69 4f 53 00 00 00 00]; +}; + +/* The tunnel's tunables: ATC1's and ATC2's, and J716c's ATC0's */ +&apciec0_dart { + apple,tunable = <0x20c 0x80000121 0x80000121>, + <0x220 0xf0f 0xf0f>, + <0x224 0xffff 0x909>, + <0x300 0x1f31 0x1>, + <0x308 0x3ffffffc 0x10000000>, + <0x310 0x3ffffffc 0x3ffffffc>; +}; + +&apciec0 { + apple,tunable-debug = <0x1000 0x1 0x0>; + apple,tunable-rc = <0x78 0x7000 0x0>, + <0x718 0x7c000 0x0>, + <0x814 0xffffffff 0x2020f060>, + <0x8bc 0x1 0x0>; + apple,tunable-fabric = <0x4 0x3f003f 0x240024>, + <0x8 0x1 0x1>, + <0xc 0x1 0x1>, + <0x10 0x801f 0x4>, + <0x18 0x1ff 0x1e0>, + <0x1c 0x1 0x1>, + <0x20 0x801f 0x4>, + <0x28 0x1f 0x10>, + <0x2c 0x801f 0x4>, + <0x34 0x3f 0x20>, + <0x38 0x801f 0x4>, + <0x40 0x3f 0x20>, + <0x44 0x801f 0x4>, + <0x4c 0x10001 0x10001>, + <0x50 0x1 0x1>, + <0x54 0x1 0x1>, + <0x58 0x801f 0x4>, + <0x60 0x7f007f 0x450045>, + <0x64 0x801f 0x4>, + <0x6c 0x1f001f 0x100010>, + <0x70 0xf1 0x1>, + <0x74 0x801f 0x4>, + <0x7c 0x801f 0x4>, + <0x84 0x1 0x1>, + <0x88 0x1 0x1>, + <0x8c 0x801f 0x4>, + <0x94 0x1 0x1>, + <0x98 0x801f 0x4>, + <0xa0 0x1 0x1>, + <0xa4 0x801f 0x4>, + <0xac 0x1 0x1>, + <0xb0 0x1 0x1>, + <0xb4 0x801f 0x4>, + <0xbc 0x801f 0x4>, + <0xc4 0x801f 0x4>; +}; + +&apciec0_port { + apple,tunable = <0x140 0x1 0x1>, + <0x2a0 0x7e 0xa>; +}; diff --git a/arch/arm64/boot/dts/apple/t6050-j714s-left-usb4.dtsi b/arch/arm64/boot/dts/apple/t6050-j714s-left-usb4.dtsi index 016432b78a47d..081f17d51e47e 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s-left-usb4.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-j714s-left-usb4.dtsi @@ -41,11 +41,6 @@ }; }; -/* The two routers' LSTX pins (79 and 81) are the only AOP GPIOs exposed. */ -&pinctrl_aop { - gpio-reserved-ranges = <0 79>, <80 1>, <82 3>; -}; - &{/soc@200000000} { /* /arm-io/acio-cpu1 reg[0]: the router CPU's mailbox, inside its wrapper */ acio1_mbox: mailbox@2a9108000 { diff --git a/arch/arm64/boot/dts/apple/t6050-j714s.dts b/arch/arm64/boot/dts/apple/t6050-j714s.dts index f94dbf1a70236..a332ba4c813e8 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714s.dts @@ -428,6 +428,11 @@ /* Left-back port (ATC0) */ #include "t6050-j714s-left-back.dtsi" +/* The three routers' LSTX pins (77, 79 and 81) are the only AOP GPIOs exposed. */ +&pinctrl_aop { + gpio-reserved-ranges = <0 77>, <78 1>, <80 1>, <82 3>; +}; + /* * The PMP (ADT pmp0, /chosen, /arm-io/pmgr). iBoot loads its firmware and the driver starts it * with these boot arguments and the firmware properties below. Its report tells it which devices diff --git a/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi b/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi index 488f3c3ee6d6e..9d944c3d182fb 100644 --- a/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-peripherals.dtsi @@ -1545,7 +1545,7 @@ -#ifndef T6050_J716C +#if !defined(T6050_J714S) && !defined(T6050_J716C) apciec0_dart: iommu@2a4000000 { compatible = "apple,t6050-dart", "apple,t8110-dart"; reg = <0x2 0xa4000000 0x0 0x20000>; From 82d92ab6068c1ff532bd313424bed04637da58c3 Mon Sep 17 00:00:00 2001 From: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> Date: Sun, 15 Nov 2026 11:51:06 -0700 Subject: [PATCH 03/10] dt-bindings: display: apple: add apple,connector-group to Type-C routes On T6050 every Type-C port/pipeline pair gets a DRM connector, numbered pipeline by pipeline, with tunnel-only routes after the others. Userspace keys per-monitor settings on the connector names, so a port whose routes are added to a board later must not take names the existing connectors have. Add a route property, apple,connector-group (0 to 3, default 0): the connectors are created group by group, so a port added to a board in the next group gets the next names. It is meant to be the same for all routes to one port. On SoCs with a connector per port/pipeline pair, the tunnel-only routes' come after the others in each group. Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> --- .../bindings/display/apple,dcp-typec-routes.yaml | 13 +++++++++++++ .../devicetree/bindings/display/apple,dcp.yaml | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Documentation/devicetree/bindings/display/apple,dcp-typec-routes.yaml b/Documentation/devicetree/bindings/display/apple,dcp-typec-routes.yaml index 9bd123527b2c8..858a09501e4f6 100644 --- a/Documentation/devicetree/bindings/display/apple,dcp-typec-routes.yaml +++ b/Documentation/devicetree/bindings/display/apple,dcp-typec-routes.yaml @@ -131,6 +131,19 @@ properties: whose connector already has as many mode-switch providers as the Type-C class allows can still offer another tunnel pipeline. + apple,connector-group: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 3 + default: 0 + description: | + The order group of the route's display connector. + Connectors are created group by group, and in a group the + tunnel-only routes' after the others on SoCs that give every + port/pipeline pair a connector of its own (T6050). A port + added to a board gets the next group, so the connectors that + already exist keep their names. All routes to one port + should have the same group. port: $ref: /schemas/graph.yaml#/properties/port required: diff --git a/Documentation/devicetree/bindings/display/apple,dcp.yaml b/Documentation/devicetree/bindings/display/apple,dcp.yaml index 680fc93ef2e5d..62414cd1229d0 100644 --- a/Documentation/devicetree/bindings/display/apple,dcp.yaml +++ b/Documentation/devicetree/bindings/display/apple,dcp.yaml @@ -493,6 +493,18 @@ properties: description: The route carries USB4 DP tunnels only, never a DP Alt Mode display. It is not a Type-C mode-switch. + apple,connector-group: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 3 + default: 0 + description: + The order group of the route's display connector. + Connectors are created group by group, and in a group the + tunnel-only routes' after the others on SoCs that give every + port/pipeline pair a connector of its own (T6050), so a port + added to a board in a new group keeps the existing + connectors' names. port: $ref: /schemas/graph.yaml#/properties/port required: From c88a4c755b8a3eb7ef2587b7aa96b522057b0131 Mon Sep 17 00:00:00 2001 From: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> Date: Sun, 15 Nov 2026 11:51:06 -0700 Subject: [PATCH 04/10] drm/apple: dcp-fabric: order Type-C connectors by apple,connector-group apple_probe_typec_ports() creates T6050's port/pipeline connectors pipeline by pipeline, and the tunnel-only pairs in a second pass. A port added to a board takes a place in every pipeline's run, so every later connector is renumbered: on the J714s, a left-back port would turn dcpext2's right-port connector from DP-3 into DP-4, and so on. Create the connectors group by group (apple,connector-group, default 0). The number of passes is two per group, up to the largest group a route has. On T6050 the tunnel-only pairs come after the others in each group: dcp_typec_port_pass() replaces dcp_typec_port_tunnel_only() and gives a pair's pass. Elsewhere a port's routes share its connectors, which take the first pass of the port's largest group. Without the property nothing changes. A malformed group, or one above 3, fails the route's registration. The topology test builds the J714s's fabric (three ports, dcpext0 to dcpext2 with dcpext1 tunnel-only) and checks the connector order: DP-1..DP-6 as before for the right and left-front ports, and the left-back port's pairs as DP-7..DP-9 in group 1 (or a later group), where in group 0 they would take DP-3. It also checks a port's shared connector pass. Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> --- drivers/gpu/drm/apple/apple_drv.c | 12 +- .../gpu/drm/apple/dcp-fabric-topology-test.c | 149 ++++++++++++++++++ drivers/gpu/drm/apple/dcp-fabric.c | 59 ++++++- drivers/gpu/drm/apple/dcp-fabric.h | 7 +- 4 files changed, 215 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/apple/apple_drv.c b/drivers/gpu/drm/apple/apple_drv.c index bd57a279537cb..f7cf1f0f74ccb 100644 --- a/drivers/gpu/drm/apple/apple_drv.c +++ b/drivers/gpu/drm/apple/apple_drv.c @@ -1245,8 +1245,11 @@ static int apple_probe_typec_ports(struct drm_device *drm, unsigned int n, nr_ports = dcp_typec_nr_ports(); bool fixed = dcp_typec_fixed_crtcs(); unsigned int slots = fixed ? num_dcp : (dcp_typec_dual_stream() ? 2 : 1); - /* T6050 creates its tunnel-only port/pipeline pairs in a second pass. */ - unsigned int passes = fixed ? 2 : 1; + /* + * Connectors are created in passes, by connector group; on T6050, in a + * group, the tunnel-only port/pipeline pairs after the others. + */ + unsigned int passes = dcp_typec_nr_passes(); int i, ret; /* Keep the existing physical-port connector numbers stable. On the @@ -1274,13 +1277,14 @@ static int apple_probe_typec_ports(struct drm_device *drm, if (fixed) { if (!dcp_typec_port_has_candidate(port_idx, pipeline)) continue; - /* T6050: tunnel-only pairs in the second pass */ - if (dcp_typec_port_tunnel_only(port_idx, pipeline) != pass) + if (dcp_typec_port_pass(port_idx, pipeline) != pass) continue; mask = crtc_mask[idx / nr_ports]; if (!mask) continue; } else { + if (dcp_typec_port_pass(port_idx, NULL) != pass) + continue; for (i = 0; i < num_dcp; i++) { if (!dcp_typec_port_has_candidate(port_idx, dcp[i])) continue; diff --git a/drivers/gpu/drm/apple/dcp-fabric-topology-test.c b/drivers/gpu/drm/apple/dcp-fabric-topology-test.c index a9e4c3d95e3a7..823b0b4853444 100644 --- a/drivers/gpu/drm/apple/dcp-fabric-topology-test.c +++ b/drivers/gpu/drm/apple/dcp-fabric-topology-test.c @@ -164,10 +164,159 @@ static void topology_unbind_test(struct kunit *test) } } +/* The J714s's display fabric: three ports, three pipelines, the second tunnel-only */ +enum { TOPO_RIGHT, TOPO_LEFT_FRONT, TOPO_LEFT_BACK, TOPO_PORTS }; +enum { TOPO_DCPEXT0, TOPO_DCPEXT1, TOPO_DCPEXT2, TOPO_PIPES }; +#define TOPO_PAIR(port, pipe) ((port) * TOPO_PIPES + (pipe)) + +struct topology_j714s { + struct apple_dcp_typec_port port[TOPO_PORTS]; + struct apple_dcp_typec_route route[TOPO_PORTS][TOPO_PIPES]; + struct apple_dcp dcp[TOPO_PIPES]; + struct platform_device *pdev[TOPO_PIPES]; + unsigned int first; + /* The passes the ports already registered (a real J714s's) take */ + unsigned int passes; +}; + +static void topology_j714s_unlist(void *data) +{ + struct topology_j714s *t = data; + unsigned int p; + + guard(mutex)(&dcp_typec_fabric_lock); + for (p = 0; p < TOPO_PORTS; p++) + list_del(&t->port[p].link); +} + +static struct topology_j714s *topology_j714s_init(struct kunit *test) +{ + struct topology_j714s *t; + unsigned int p, i; + + t = kunit_kzalloc(test, sizeof(*t), GFP_KERNEL); + KUNIT_ASSERT_NOT_NULL(test, t); + kunit_activate_static_stub(test, dcp_typec_fixed_crtcs, topology_fixed_crtcs); + for (i = 0; i < TOPO_PIPES; i++) { + t->pdev[i] = kunit_platform_device_alloc(test, "dcp-j714s", PLATFORM_DEVID_AUTO); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, t->pdev[i]); + t->dcp[i].dev = &t->pdev[i]->dev; + } + t->first = dcp_typec_nr_ports(); + t->passes = dcp_typec_nr_passes(); + scoped_guard(mutex, &dcp_typec_fabric_lock) { + for (p = 0; p < TOPO_PORTS; p++) { + INIT_LIST_HEAD(&t->port[p].routes); + for (i = 0; i < TOPO_PIPES; i++) { + struct apple_dcp_typec_route *route = &t->route[p][i]; + + route->dcp = &t->dcp[i]; + route->port = &t->port[p]; + route->core.tunnel_only = i == TOPO_DCPEXT1; + list_add_tail(&route->port_link, &t->port[p].routes); + } + list_add_tail(&t->port[p].link, &dcp_typec_ports); + } + } + KUNIT_ASSERT_EQ(test, kunit_add_action_or_reset(test, topology_j714s_unlist, t), 0); + return t; +} + +/* + * Lists the connectors of the first @nr_ports ports in + * apple_probe_typec_ports()'s order, as TOPO_PAIR(port, pipeline), and + * returns how many. It mirrors that loop: passes outermost, then pipelines + * (dcp[idx / nr_ports]), then ports (idx % nr_ports). + */ +static unsigned int topology_connector_order(struct topology_j714s *t, unsigned int nr_ports, + unsigned int *order) +{ + unsigned int pass, i, p, n = 0; + + for (pass = 0; pass < dcp_typec_nr_passes(); pass++) + for (i = 0; i < TOPO_PIPES; i++) + for (p = 0; p < nr_ports; p++) + if (dcp_typec_port_has_candidate(t->first + p, t->pdev[i]) && + dcp_typec_port_pass(t->first + p, t->pdev[i]) == pass) + order[n++] = TOPO_PAIR(p, i); + return n; +} + +/* The passes with @passes needed by the fixture's own routes */ +static unsigned int topology_passes(struct topology_j714s *t, unsigned int passes) +{ + return max(t->passes, passes); +} + +/* + * The J714s's connector names: DP-1..DP-6 for the right and left-front ports + * as before the left-back port was added, whose routes are in connector group + * 1 and get DP-7..DP-9. In group 0 they would take DP-3 and push the rest on. + */ +static void topology_connector_group_test(struct kunit *test) +{ + static const unsigned int two_ports[] = { + TOPO_PAIR(TOPO_RIGHT, TOPO_DCPEXT0), /* DP-1 */ + TOPO_PAIR(TOPO_LEFT_FRONT, TOPO_DCPEXT0), /* DP-2 */ + TOPO_PAIR(TOPO_RIGHT, TOPO_DCPEXT2), /* DP-3 */ + TOPO_PAIR(TOPO_LEFT_FRONT, TOPO_DCPEXT2), /* DP-4 */ + TOPO_PAIR(TOPO_RIGHT, TOPO_DCPEXT1), /* DP-5 */ + TOPO_PAIR(TOPO_LEFT_FRONT, TOPO_DCPEXT1), /* DP-6 */ + }; + static const unsigned int three_ports[] = { + TOPO_PAIR(TOPO_RIGHT, TOPO_DCPEXT0), + TOPO_PAIR(TOPO_LEFT_FRONT, TOPO_DCPEXT0), + TOPO_PAIR(TOPO_RIGHT, TOPO_DCPEXT2), + TOPO_PAIR(TOPO_LEFT_FRONT, TOPO_DCPEXT2), + TOPO_PAIR(TOPO_RIGHT, TOPO_DCPEXT1), + TOPO_PAIR(TOPO_LEFT_FRONT, TOPO_DCPEXT1), + TOPO_PAIR(TOPO_LEFT_BACK, TOPO_DCPEXT0), /* DP-7 */ + TOPO_PAIR(TOPO_LEFT_BACK, TOPO_DCPEXT2), /* DP-8 */ + TOPO_PAIR(TOPO_LEFT_BACK, TOPO_DCPEXT1), /* DP-9 */ + }; + struct topology_j714s *t = topology_j714s_init(test); + unsigned int order[TOPO_PORTS * TOPO_PIPES], i, n; + + /* Everything in group 0: two passes */ + KUNIT_EXPECT_EQ(test, dcp_typec_nr_passes(), topology_passes(t, 2)); + n = topology_connector_order(t, 2, order); + KUNIT_ASSERT_EQ(test, n, ARRAY_SIZE(two_ports)); + KUNIT_EXPECT_MEMEQ(test, order, two_ports, sizeof(two_ports)); + + /* The left-back port in group 0 too: its first pair would be DP-3 */ + n = topology_connector_order(t, 3, order); + KUNIT_ASSERT_EQ(test, n, ARRAY_SIZE(three_ports)); + KUNIT_EXPECT_EQ(test, order[2], TOPO_PAIR(TOPO_LEFT_BACK, TOPO_DCPEXT0)); + + /* In group 1, as the J714s DT has it */ + for (i = 0; i < TOPO_PIPES; i++) + t->route[TOPO_LEFT_BACK][i].connector_group = 1; + KUNIT_EXPECT_EQ(test, dcp_typec_nr_passes(), topology_passes(t, 4)); + KUNIT_EXPECT_EQ(test, dcp_typec_port_pass(t->first + TOPO_LEFT_BACK, + t->pdev[TOPO_DCPEXT0]), 2); + KUNIT_EXPECT_EQ(test, dcp_typec_port_pass(t->first + TOPO_LEFT_BACK, + t->pdev[TOPO_DCPEXT1]), 3); + /* A port's shared connector (no fixed CRTCs) takes its group's first pass */ + KUNIT_EXPECT_EQ(test, dcp_typec_port_pass(t->first + TOPO_LEFT_BACK, NULL), 2); + KUNIT_EXPECT_EQ(test, dcp_typec_port_pass(t->first + TOPO_RIGHT, NULL), 0); + n = topology_connector_order(t, 3, order); + KUNIT_ASSERT_EQ(test, n, ARRAY_SIZE(three_ports)); + KUNIT_EXPECT_MEMEQ(test, order, three_ports, sizeof(three_ports)); + + /* A later group adds passes; the order is the same */ + for (i = 0; i < TOPO_PIPES; i++) + t->route[TOPO_LEFT_BACK][i].connector_group = 3; + KUNIT_EXPECT_EQ(test, dcp_typec_nr_passes(), topology_passes(t, 8)); + n = topology_connector_order(t, 3, order); + KUNIT_ASSERT_EQ(test, n, ARRAY_SIZE(three_ports)); + KUNIT_EXPECT_MEMEQ(test, order, three_ports, sizeof(three_ports)); +} + static struct kunit_case dcp_topology_cases[] = { KUNIT_CASE(topology_pipeline_identity_test), KUNIT_CASE(topology_adopt_release_test), KUNIT_CASE(topology_unbind_test), + KUNIT_CASE(topology_connector_group_test), {} }; diff --git a/drivers/gpu/drm/apple/dcp-fabric.c b/drivers/gpu/drm/apple/dcp-fabric.c index 824df5f341022..6beb6b35f8824 100644 --- a/drivers/gpu/drm/apple/dcp-fabric.c +++ b/drivers/gpu/drm/apple/dcp-fabric.c @@ -4387,23 +4387,59 @@ bool dcp_typec_port_has_candidate(unsigned int idx, struct platform_device *pdev return false; } -/* Is @pdev's route to port @idx for DP tunnels only (apple,tunnel-only)? */ -bool dcp_typec_port_tunnel_only(unsigned int idx, struct platform_device *pdev) +static unsigned int dcp_typec_route_pass(const struct apple_dcp_typec_route *route) +{ + return 2 * route->connector_group + (route->core.tunnel_only ? 1 : 0); +} + +/* + * The number of passes in which the connectors are created: two (the other + * routes', then the tunnel-only ones') per apple,connector-group, up to the + * largest group any route has. + */ +unsigned int dcp_typec_nr_passes(void) { struct apple_dcp_typec_port *port; struct apple_dcp_typec_route *route; + u32 groups = 1; + + guard(mutex)(&dcp_typec_fabric_lock); + + list_for_each_entry(port, &dcp_typec_ports, link) + list_for_each_entry(route, &port->routes, port_link) + groups = max(groups, route->connector_group + 1); + + return 2 * groups; +} + +/* + * The pass in which the connector of @pdev's route to port @idx is created: + * connectors come group by group (apple,connector-group), and in a group a + * tunnel-only route's (apple,tunnel-only) after the others'. A port added to + * a board in the next group gets the next connector names, and the existing + * connectors keep theirs. With @pdev NULL (a port whose routes share its + * connectors), the port's: its largest group's first pass. + */ +unsigned int dcp_typec_port_pass(unsigned int idx, struct platform_device *pdev) +{ + struct apple_dcp_typec_port *port; + struct apple_dcp_typec_route *route; + u32 group = 0; guard(mutex)(&dcp_typec_fabric_lock); port = dcp_typec_port_by_index(idx); if (!port) - return false; + return 0; - list_for_each_entry(route, &port->routes, port_link) - if (route->dcp->dev == &pdev->dev) - return route->core.tunnel_only; + list_for_each_entry(route, &port->routes, port_link) { + if (!pdev) + group = max(group, route->connector_group); + else if (route->dcp->dev == &pdev->dev) + return dcp_typec_route_pass(route); + } - return false; + return 2 * group; } /* @@ -4674,6 +4710,15 @@ static int dcp_register_typec_routes_present(void *data) /* A route for USB4 DP tunnels only is never given a DP-alt stream. */ route->core.tunnel_only = of_property_read_bool(route_np, "apple,tunnel-only"); + ret = of_property_read_u32(route_np, "apple,connector-group", + &route->connector_group); + if (ret == -EINVAL) + route->connector_group = 0; + else if (ret) + return dev_err_probe(dev, ret, "%pOF: invalid connector group\n", route_np); + if (route->connector_group >= DCP_TYPEC_CONNECTOR_GROUPS) + return dev_err_probe(dev, -EINVAL, "%pOF: invalid connector group %u\n", + route_np, route->connector_group); ret = of_property_read_u32_index(dev->of_node, "apple,typec-dptx-phys", route_index, &route->dptx_phy); diff --git a/drivers/gpu/drm/apple/dcp-fabric.h b/drivers/gpu/drm/apple/dcp-fabric.h index c1ee7b6c6e1d6..6674fcce4b79e 100644 --- a/drivers/gpu/drm/apple/dcp-fabric.h +++ b/drivers/gpu/drm/apple/dcp-fabric.h @@ -37,6 +37,8 @@ struct apple_dcp_typec_route { struct mux_control *xbar; struct mux_control *dpin[DCP_FABRIC_DPIN_MAX]; bool dual_stream; + /* apple,connector-group: its connector's order group */ + u32 connector_group; struct typec_mux_dev *typec_mux; u32 dptx_phy; u32 mux_index; @@ -76,7 +78,10 @@ bool dcp_has_typec_routes(struct platform_device *pdev); unsigned int dcp_typec_nr_ports(void); struct device_node *dcp_typec_port_of_node(unsigned int idx); bool dcp_typec_port_has_candidate(unsigned int idx, struct platform_device *pdev); -bool dcp_typec_port_tunnel_only(unsigned int idx, struct platform_device *pdev); +/* Connectors by apple,connector-group; T6050's tunnel-only pairs after the others in each */ +#define DCP_TYPEC_CONNECTOR_GROUPS 4 +unsigned int dcp_typec_nr_passes(void); +unsigned int dcp_typec_port_pass(unsigned int idx, struct platform_device *pdev); bool dcp_typec_port_unusable(unsigned int idx); void dcp_typec_port_set_connector(unsigned int idx, bool secondary, struct apple_connector *connector, From 1be5e3bafe1aaf79bac87ca3c300d88b873723d0 Mon Sep 17 00:00:00 2001 From: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> Date: Sun, 15 Nov 2026 17:59:23 -0700 Subject: [PATCH 05/10] drm/apple: dcp-fabric: skip a Type-C route whose PHY or crossbar is disabled A DCP's Type-C routes are all or nothing, and a disabled PHY or crossbar never registers, so looking it up defers for ever. A failsafe external DCP (T6050's) waits for it in its supplier preflight, dcp_ext_route_suppliers(), until deferred probing gives up (about 10 s after boot), then joins the display subsystem as an unusable pipe with every route disabled. A native T6030 one disables all its routes, and any other fails its probe. One port's disabled PHY so costs every external display on every port. Leave out a route whose PHY or crossbar node is disabled, in the preflight and when the routes register: dcp_typec_route_supplier_disabled() makes that decision for both. Registration also disables the route in the device tree, as is done for all of them on failure, so that its port's controller stops waiting for its mode-switch. Only a disabled node does this. A missing or malformed phys or mux-controls entry, and every lookup error (-EPROBE_DEFER included), defer or fail as before, and a supplier that is merely late is waited for, never dropped. A PHY that is enabled but fails to probe holds every DCP that lists it until deferred probing gives up, as before: a failsafe dcpext then joins as an unusable pipe, with no route. dcp_typec_routes_disable_dev() and the new single-route disable share one helper, which builds and applies one changeset. The topology tests apply an overlay with an available and a disabled PHY and an available and a disabled crossbar. They check the per-route decision, which routes registration skips, and that a skipped route ends up disabled (the test reverts the changeset). They need CONFIG_OF_OVERLAY; tests/topology.kunitconfig has what the topology suite needs: tools/testing/kunit/kunit.py run --arch=arm64 \ --kunitconfig=drivers/gpu/drm/apple/tests/topology.kunitconfig Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> --- drivers/gpu/drm/apple/Makefile | 1 + .../gpu/drm/apple/dcp-fabric-topology-test.c | 100 ++++++++++++++ drivers/gpu/drm/apple/dcp-fabric.c | 129 ++++++++++++++---- drivers/gpu/drm/apple/dcp-fabric.h | 1 + .../drm/apple/dcp-route-supplier-test.dtso | 46 +++++++ drivers/gpu/drm/apple/dcp.c | 9 +- .../gpu/drm/apple/tests/topology.kunitconfig | 10 ++ 7 files changed, 271 insertions(+), 25 deletions(-) create mode 100644 drivers/gpu/drm/apple/dcp-route-supplier-test.dtso create mode 100644 drivers/gpu/drm/apple/tests/topology.kunitconfig diff --git a/drivers/gpu/drm/apple/Makefile b/drivers/gpu/drm/apple/Makefile index 8b2d7288b5639..59592a94690e7 100644 --- a/drivers/gpu/drm/apple/Makefile +++ b/drivers/gpu/drm/apple/Makefile @@ -23,6 +23,7 @@ appledrm-$(CONFIG_DRM_APPLE_KUNIT_TEST) += iomfb_external_hdr_hints_test.o appledrm-$(CONFIG_DRM_APPLE_KUNIT_TEST) += apple_resume_test.o appledrm-$(CONFIG_DRM_APPLE_KUNIT_TEST) += apple_boot_display_test.o appledrm-$(CONFIG_DRM_APPLE_KUNIT_TEST) += dcp-syslog-test.o +appledrm-$(CONFIG_DRM_APPLE_KUNIT_TEST) += dcp-route-supplier-test.dtbo.o appledrm-$(CONFIG_DRM_APPLE_KUNIT_TEST) += parser_mode_test.o appledrm-$(CONFIG_DRM_APPLE_KUNIT_TEST) += dcp_external_resume_test.o appledrm-$(CONFIG_DRM_APPLE_KUNIT_TEST) += dcp_external_ready_test.o diff --git a/drivers/gpu/drm/apple/dcp-fabric-topology-test.c b/drivers/gpu/drm/apple/dcp-fabric-topology-test.c index 823b0b4853444..2240be4d8b2a3 100644 --- a/drivers/gpu/drm/apple/dcp-fabric-topology-test.c +++ b/drivers/gpu/drm/apple/dcp-fabric-topology-test.c @@ -1,8 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-only OR MIT /* Included by dcp-fabric.c to exercise its connector publication paths. */ +#include +#include #include #include +OF_OVERLAY_DECLARE(dcp_route_supplier_test); + struct dcp_topology_test { struct apple_dcp_typec_port port[3]; struct apple_dcp_typec_route route[3][2]; @@ -312,11 +316,107 @@ static void topology_connector_group_test(struct kunit *test) KUNIT_EXPECT_MEMEQ(test, order, three_ports, sizeof(three_ports)); } +static void topology_route_supplier_put(void *data) +{ + struct device *dev = data; + + of_node_put(dev->of_node); + dev->of_node = NULL; +} + +/* + * Only a route whose PHY or crossbar node is disabled is skipped. A missing + * or malformed entry counts as available, so that its lookup fails the probe. + */ +static void topology_route_supplier_test(struct kunit *test) +{ + struct device *dev; + + KUNIT_ASSERT_EQ(test, 0, of_overlay_apply_kunit(test, dcp_route_supplier_test)); + dev = kunit_device_register(test, "dcp-route-supplier"); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev); + dev->of_node = of_find_node_by_path("/dcp-route-supplier-test/dcp"); + KUNIT_ASSERT_NOT_NULL(test, dev->of_node); + KUNIT_ASSERT_EQ(test, + kunit_add_action_or_reset(test, topology_route_supplier_put, dev), 0); + + KUNIT_EXPECT_TRUE(test, dcp_typec_route_supplier_available(dev, "phys", "#phy-cells", + "phy-names", "typec0")); + KUNIT_EXPECT_FALSE(test, dcp_typec_route_supplier_available(dev, "phys", "#phy-cells", + "phy-names", "typec1")); + /* No such name, and no crossbar entry for typec2: the lookups report those */ + KUNIT_EXPECT_TRUE(test, dcp_typec_route_supplier_available(dev, "phys", "#phy-cells", + "phy-names", "typec4")); + KUNIT_EXPECT_TRUE(test, dcp_typec_route_supplier_available(dev, "mux-controls", + "#mux-control-cells", + "mux-control-names", "typec2")); + KUNIT_EXPECT_TRUE(test, dcp_typec_route_supplier_available(dev, "mux-controls", + "#mux-control-cells", + "mux-control-names", "typec1")); + + /* + * The per-route decision a failsafe dcpext's supplier preflight + * (dcp_ext_route_suppliers()) and route registration share + */ + KUNIT_EXPECT_NULL(test, dcp_typec_route_supplier_disabled(dev, "typec0")); + KUNIT_EXPECT_STREQ(test, dcp_typec_route_supplier_disabled(dev, "typec1") ?: "", + "DP PHY"); + KUNIT_EXPECT_NULL(test, dcp_typec_route_supplier_disabled(dev, "typec2")); + KUNIT_EXPECT_STREQ(test, dcp_typec_route_supplier_disabled(dev, "typec3") ?: "", + "display crossbar"); + + /* Available suppliers: the route is not skipped, and nothing is changed */ + KUNIT_EXPECT_NULL(test, dcp_typec_route_skip(dev, dev->of_node, "typec0")); + KUNIT_EXPECT_NULL(test, dcp_typec_route_skip(dev, dev->of_node, "typec2")); + KUNIT_EXPECT_TRUE(test, of_device_is_available(dev->of_node)); +} + +static void topology_route_node_put(void *data) +{ + of_node_put(data); +} + +/* + * A route whose PHY is disabled is skipped and disabled itself, so its port + * stops waiting for it. The changeset is reverted, for the overlay's removal. + */ +static void topology_route_skip_test(struct kunit *test) +{ + struct device_node *route_np; + struct of_changeset *cs; + struct device *dev; + + KUNIT_ASSERT_EQ(test, 0, of_overlay_apply_kunit(test, dcp_route_supplier_test)); + dev = kunit_device_register(test, "dcp-route-skip"); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev); + dev->of_node = of_find_node_by_path("/dcp-route-supplier-test/dcp"); + KUNIT_ASSERT_NOT_NULL(test, dev->of_node); + KUNIT_ASSERT_EQ(test, + kunit_add_action_or_reset(test, topology_route_supplier_put, dev), 0); + route_np = of_find_node_by_path("/dcp-route-supplier-test/dcp/typec-routes/route@1"); + KUNIT_ASSERT_NOT_NULL(test, route_np); + KUNIT_ASSERT_EQ(test, + kunit_add_action_or_reset(test, topology_route_node_put, route_np), 0); + KUNIT_ASSERT_TRUE(test, of_device_is_available(route_np)); + + cs = dcp_typec_route_skip(dev, route_np, "typec1"); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, cs); + KUNIT_EXPECT_FALSE(test, of_device_is_available(route_np)); + + /* A changeset still applied must not be destroyed */ + KUNIT_ASSERT_EQ(test, of_changeset_revert(cs), 0); + of_changeset_destroy(cs); + kfree(cs); + KUNIT_EXPECT_TRUE(test, of_device_is_available(route_np)); +} + static struct kunit_case dcp_topology_cases[] = { KUNIT_CASE(topology_pipeline_identity_test), KUNIT_CASE(topology_adopt_release_test), KUNIT_CASE(topology_unbind_test), KUNIT_CASE(topology_connector_group_test), + KUNIT_CASE(topology_route_supplier_test), + KUNIT_CASE(topology_route_skip_test), {} }; diff --git a/drivers/gpu/drm/apple/dcp-fabric.c b/drivers/gpu/drm/apple/dcp-fabric.c index 6beb6b35f8824..8c9a9039cb9a5 100644 --- a/drivers/gpu/drm/apple/dcp-fabric.c +++ b/drivers/gpu/drm/apple/dcp-fabric.c @@ -4648,6 +4648,104 @@ struct dcp_route_probe_context { struct device_node *routes; }; +/* + * Is the provider that @dev's @names entry @name points to in @list available? + * A disabled one never registers, so looking it up would defer for ever. A + * missing or malformed entry counts as available: the lookup reports it. + */ +static bool dcp_typec_route_supplier_available(struct device *dev, const char *list, + const char *cells, const char *names, + const char *name) +{ + struct of_phandle_args args; + bool available; + int index; + + index = of_property_match_string(dev->of_node, names, name); + if (index < 0 || of_parse_phandle_with_args(dev->of_node, list, cells, index, &args)) + return true; + available = of_device_is_available(args.np); + of_node_put(args.np); + return available; +} + +/* + * Disables @route, or every available route under @routes if @route is NULL, + * in the device tree, in one changeset, for good. A connector passes over + * unavailable routes when it looks for its display routes, so the port no + * longer waits for them. Returns the applied changeset, which stays (the live + * tree refers to it), or an ERR_PTR. + */ +static struct of_changeset *dcp_typec_routes_disable_nodes(struct device *dev, + struct device_node *routes, + struct device_node *route) +{ + struct of_changeset *cs; + struct device_node *np; + int ret = 0; + + cs = kzalloc_obj(*cs); + if (!cs) + return ERR_PTR(-ENOMEM); + of_changeset_init(cs); + if (route) { + ret = of_changeset_update_prop_string(cs, route, "status", "disabled"); + } else { + for_each_available_child_of_node(routes, np) { + ret = of_changeset_update_prop_string(cs, np, "status", "disabled"); + if (ret) { + of_node_put(np); + break; + } + } + } + if (!ret) + ret = of_changeset_apply(cs); + if (ret) { + if (route) + dev_err(dev, "%pOF: could not disable the route: %d\n", route, ret); + else + dev_err(dev, "could not disable the Type-C display routes: %d\n", ret); + of_changeset_destroy(cs); + kfree(cs); + return ERR_PTR(ret); + } + return cs; +} + +/* + * Which of @dev's suppliers for its Type-C route @name ("typecN") has a + * disabled node: "DP PHY", "display crossbar", or NULL if neither. Such a + * route is left out, here and in a failsafe dcpext's supplier preflight. + */ +const char *dcp_typec_route_supplier_disabled(struct device *dev, const char *name) +{ + if (!dcp_typec_route_supplier_available(dev, "phys", "#phy-cells", "phy-names", name)) + return "DP PHY"; + if (!dcp_typec_route_supplier_available(dev, "mux-controls", "#mux-control-cells", + "mux-control-names", name)) + return "display crossbar"; + return NULL; +} + +/* + * A route whose PHY or crossbar node is disabled is skipped and disabled in + * turn, so that one port's disabled PHY costs only that port's displays, not + * every route of the processor. Returns NULL if the route is not skipped, + * else the changeset that disabled it, or an ERR_PTR if that failed. + */ +static struct of_changeset *dcp_typec_route_skip(struct device *dev, + struct device_node *route_np, + const char *name) +{ + const char *what = dcp_typec_route_supplier_disabled(dev, name); + + if (!what) + return NULL; + dev_warn(dev, "%pOF: its %s is disabled, route skipped\n", route_np, what); + return dcp_typec_routes_disable_nodes(dev, NULL, route_np); +} + static int dcp_register_typec_routes_present(void *data) { struct dcp_route_probe_context *ctx = data; @@ -4688,6 +4786,10 @@ static int dcp_register_typec_routes_present(void *data) if (!mux_name) return -ENOMEM; + /* Skipped even if disabling it failed (logged): it cannot register */ + if (dcp_typec_route_skip(dev, route_np, name)) + continue; + route = &dcp->typec_routes[dcp->nr_typec_routes]; route->dcp = dcp; INIT_LIST_HEAD(&route->port_link); @@ -4696,6 +4798,7 @@ static int dcp_register_typec_routes_present(void *data) return dev_err_probe(dev, PTR_ERR(route->phy), "%pOF: failed to get DP PHY\n", route_np); + /* A failure fails the probe, and devres puts the PHY */ route->xbar = devm_mux_control_get(dev, name); if (IS_ERR(route->xbar)) return dev_err_probe(dev, PTR_ERR(route->xbar), @@ -4808,31 +4911,9 @@ void dcp_typec_routes_disable_dev(struct device *dev) { struct device_node *routes __free(device_node) = of_get_child_by_name(dev->of_node, "typec-routes"); - struct device_node *route; - struct of_changeset *cs; - int ret = 0; - if (!routes) - return; - cs = kzalloc(sizeof(*cs), GFP_KERNEL); - if (!cs) - return; - of_changeset_init(cs); - for_each_available_child_of_node(routes, route) { - ret = of_changeset_update_prop_string(cs, route, "status", "disabled"); - if (ret) { - of_node_put(route); - break; - } - } - if (!ret) - ret = of_changeset_apply(cs); - if (ret) { - dev_err(dev, "could not disable the Type-C display routes: %d\n", ret); - of_changeset_destroy(cs); - kfree(cs); - } - /* Applied, it stays: the live tree refers to it. */ + if (routes) + dcp_typec_routes_disable_nodes(dev, routes, NULL); } int dcp_register_typec_routes(struct apple_dcp *dcp) diff --git a/drivers/gpu/drm/apple/dcp-fabric.h b/drivers/gpu/drm/apple/dcp-fabric.h index 6674fcce4b79e..65cc8845a496d 100644 --- a/drivers/gpu/drm/apple/dcp-fabric.h +++ b/drivers/gpu/drm/apple/dcp-fabric.h @@ -132,6 +132,7 @@ int dcp_fabric_sleep_withdraw(struct apple_dcp *dcp, s64 ms[2]); void dcp_fabric_sleep_done(struct apple_dcp *dcp); void dcp_typec_routes_disable(struct apple_dcp *dcp); void dcp_typec_routes_disable_dev(struct device *dev); +const char *dcp_typec_route_supplier_disabled(struct device *dev, const char *name); void dcp_typec_retrain_work(struct work_struct *work); void dcp_fabric_init(struct apple_dcp *dcp); void dcp_fabric_hdmi_resume(struct apple_dcp *dcp); diff --git a/drivers/gpu/drm/apple/dcp-route-supplier-test.dtso b/drivers/gpu/drm/apple/dcp-route-supplier-test.dtso new file mode 100644 index 0000000000000..341c32634afee --- /dev/null +++ b/drivers/gpu/drm/apple/dcp-route-supplier-test.dtso @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT +/dts-v1/; +/plugin/; + +/* + * A DCP's Type-C route suppliers: an available and a disabled DP PHY, and an + * available and a disabled crossbar. Nothing binds to these nodes; the tests + * read them, and disable one route. + */ +&{/} { + dcp-route-supplier-test { + phy_ok: phy-ok { + #phy-cells = <1>; + }; + + phy_off: phy-off { + #phy-cells = <1>; + status = "disabled"; + }; + + xbar_ok: xbar-ok { + #mux-control-cells = <1>; + }; + + xbar_off: xbar-off { + #mux-control-cells = <1>; + status = "disabled"; + }; + + dcp { + phys = <&phy_ok 6>, <&phy_off 6>, <&phy_ok 6>, <&phy_ok 6>; + phy-names = "typec0", "typec1", "typec2", "typec3"; + mux-controls = <&xbar_ok 0>, <&xbar_ok 1>, <&xbar_off 0>; + mux-control-names = "typec0", "typec1", "typec3"; + + typec-routes { + #address-cells = <1>; + #size-cells = <0>; + + route@1 { + reg = <1>; + }; + }; + }; + }; +}; diff --git a/drivers/gpu/drm/apple/dcp.c b/drivers/gpu/drm/apple/dcp.c index d9c1759989781..370c39a722aa7 100644 --- a/drivers/gpu/drm/apple/dcp.c +++ b/drivers/gpu/drm/apple/dcp.c @@ -7108,7 +7108,8 @@ static void dcp_ext_give_up(struct apple_dcp *dcp, int err, const char *when) } /* - * Whether the DP PHY and display crossbar of every Type-C route are there. + * Whether the DP PHY and display crossbar of every Type-C route are there, + * but for a route whose PHY or crossbar node is disabled, which is left out. * Routes register one at a time, and one registered cannot be taken back, * since a port controller may hold it: a later route waiting for its * supplier would leave the dcpext unusable for the boot. Returns @@ -7131,6 +7132,12 @@ static int dcp_ext_route_suppliers(struct device *dev) if (of_property_read_u32(route_np, "reg", &index)) continue; snprintf(name, sizeof(name), "typec%u", index); + /* + * A disabled PHY or crossbar never registers: probe skips its + * route (dcp_register_typec_routes()), so do not wait for it. + */ + if (dcp_typec_route_supplier_disabled(dev, name)) + continue; phy = of_phy_get(dev->of_node, name); if (PTR_ERR_OR_ZERO(phy) == -EPROBE_DEFER) return -EPROBE_DEFER; diff --git a/drivers/gpu/drm/apple/tests/topology.kunitconfig b/drivers/gpu/drm/apple/tests/topology.kunitconfig new file mode 100644 index 0000000000000..8e8ffd66a5d9f --- /dev/null +++ b/drivers/gpu/drm/apple/tests/topology.kunitconfig @@ -0,0 +1,10 @@ +CONFIG_KUNIT=y +CONFIG_ARCH_APPLE=y +CONFIG_MAILBOX=y +CONFIG_APPLE_MAILBOX=y +CONFIG_APPLE_RTKIT=y +CONFIG_DRM=y +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_DRM_APPLE=y +CONFIG_DRM_APPLE_KUNIT_TEST=y +CONFIG_OF_OVERLAY=y From cb85980c924f13008fc148d84c4f35631a7df132 Mon Sep 17 00:00:00 2001 From: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> Date: Sun, 15 Nov 2026 17:59:24 -0700 Subject: [PATCH 06/10] arm64: dts: apple: t6050-j714s: route displays to the left-back port Give the left-back port (ATC0, typec2) the display routes the other two ports have: DP alt mode and USB4 DP tunnels through dcpext0 and dcpext2, and tunnels only through dcpext1. - Each DCP gets route@2 to a new typec2 endpoint, the ATC0 PHY's DP output (DPTX PHY 0) and the left-back crossbar's controls, named typec2 and typec2-dpin0..3, with the crossbar sources it uses on the other ports (dcpext0 0, dcpext1 2, dcpext2 4). - dcpext1's route is apple,tunnel-only: hpm0, like hpm1 and hpm2, has TYPEC_MUX_MAX_DEVS (3) mode-switch providers with the PHY, dcpext0 and dcpext2. - The three routes are in apple,connector-group 1, so their connectors come after the existing six: DP-1..DP-6 keep their ports and pipelines, and the left-back port's are DP-7 (dcpext0), DP-8 (dcpext2) and DP-9 (dcpext1). - The inventory's atc0_dpxbar is enabled with ATC0's always-on and common domains, as atc1_dpxbar, and the PHY gets the four ATC0_COMMON_DP tunnel clock gates, as J716c's atc0_phy. - Every DCP now lists the left-back PHY and crossbar. A route whose PHY or crossbar node is disabled is left out, but a PHY that is enabled and fails to probe holds every dcpext until deferred probing gives up (about 10 s); they then join as unusable pipes with no route, so the panel works and no external display does, on any port. The header comment says so. Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> --- .../boot/dts/apple/t6050-j714s-display.dtsi | 158 +++++++++++++++--- 1 file changed, 131 insertions(+), 27 deletions(-) diff --git a/arch/arm64/boot/dts/apple/t6050-j714s-display.dtsi b/arch/arm64/boot/dts/apple/t6050-j714s-display.dtsi index f4bd8b98ea502..9cd50370858d5 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s-display.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-j714s-display.dtsi @@ -1,9 +1,15 @@ // SPDX-License-Identifier: GPL-2.0+ OR MIT /* - * J714s external displays: DisplayPort alt mode and USB4 DisplayPort tunnels on the left-front - * and right ports. dcpext0 and dcpext2 drive the DP alt mode and tunnel routes, dcpext1 a third - * tunnel on either port; dcpext3 is the pair for modes that need two pipelines. The left-back - * port (ATC0) is the debug port and is not described. + * J714s external displays: DisplayPort alt mode and USB4 DisplayPort tunnels on all three + * ports. dcpext0 and dcpext2 drive the DP alt mode and tunnel routes, dcpext1 a third tunnel on + * any port; dcpext3 is the pair for modes that need two pipelines. Each DCP's routes are the + * right port (typec0, route@0), the left-front port (typec1, route@1) and the left-back port + * (typec2, route@2). The left-back routes were added last: connector group 1 gives their + * connectors the names after the other ports' (DP-7..DP-9), so DP-1..DP-6 keep theirs. + * Every DCP lists all three ports' PHYs and crossbars. A route whose PHY or crossbar node is + * disabled is left out. A PHY that is enabled but fails to probe holds every dcpext until + * deferred probing gives up (about 10 s); they then join the display subsystem as unusable + * pipes with no route: the panel works, and no external display does, on any port. * Addresses and interrupts are from the J714sAP ADT. The boot loader hands each engine over: it * enables the engine, its mailbox and DARTs, publishes its bandwidth scratch and adds its * display DART to the display subsystem. @@ -14,30 +20,32 @@ apple,connector-type = "USB-C"; apple,dptx-die = <0>; /* - * A third pipeline for USB4 DP tunnels on the right and left-front - * ports, so a dock on either can drive three displays as on macOS. + * A third pipeline for USB4 DP tunnels on every port, so a dock on any + * of them can drive three displays as on macOS. * Routing dcpext1 stops it being a merged-mode peer; dcpext0, dcpext1 * and dcpext2 then pair with dcpext3, so only one display wider than * one pipeline runs at a time. - * Crossbar source 2 (dispext1 port 0) on both crossbars follows the + * Crossbar source 2 (dispext1 port 0) on all three crossbars follows the * 2 * dispext pattern of dcpext0 (0) and dcpext2 (4), and the T6040 * dcpext1 (2). - * No mode-switch: hpm1 and hpm2 already have TYPEC_MUX_MAX_DEVS (3) - * mode-switch providers each (the ATC PHY, dcpext0 and dcpext2); + * No mode-switch: hpm0, hpm1 and hpm2 already have TYPEC_MUX_MAX_DEVS + * (3) mode-switch providers each (the ATC PHY, dcpext0 and dcpext2); * tunnels find the port through the endpoint, not the mux. * apple,tunnel-only keeps DP alt mode displays off it: only tunnels * have been driven through it. */ - apple,typec-dptx-phys = <2 1>; - apple,typec-mux-indices = <2 2>; - phys = <&atc2_phy 6>, <&atc1_phy 6>; - phy-names = "typec0", "typec1"; + apple,typec-dptx-phys = <2 1 0>; + apple,typec-mux-indices = <2 2 2>; + phys = <&atc2_phy 6>, <&atc1_phy 6>, <&atc0_phy 6>; + phy-names = "typec0", "typec1", "typec2"; mux-controls = <&atc2_xbar 0>, <&atc2_xbar 1>, <&atc2_xbar 2>, <&atc2_xbar 3>, <&atc2_xbar 4>, <&atc1_dpxbar 0>, <&atc1_dpxbar 1>, <&atc1_dpxbar 2>, - <&atc1_dpxbar 3>, <&atc1_dpxbar 4>; + <&atc1_dpxbar 3>, <&atc1_dpxbar 4>, <&atc0_dpxbar 0>, <&atc0_dpxbar 1>, + <&atc0_dpxbar 2>, <&atc0_dpxbar 3>, <&atc0_dpxbar 4>; mux-control-names = "typec0", "typec0-dpin0", "typec0-dpin1", "typec0-dpin2", "typec0-dpin3", "typec1", "typec1-dpin0", "typec1-dpin1", - "typec1-dpin2", "typec1-dpin3"; + "typec1-dpin2", "typec1-dpin3", "typec2", "typec2-dpin0", + "typec2-dpin1", "typec2-dpin2", "typec2-dpin3"; typec-routes { #address-cells = <1>; @@ -64,6 +72,18 @@ }; }; }; + + route@2 { + reg = <2>; + apple,tunnel-only; + apple,connector-group = <1>; + + port { + dcpext1_left_back: endpoint { + remote-endpoint = <&typec2_dp2>; + }; + }; + }; }; }; @@ -71,16 +91,18 @@ apple,dcp-index = <3>; apple,connector-type = "USB-C"; apple,dptx-die = <0>; - apple,typec-dptx-phys = <2 1>; - apple,typec-mux-indices = <4 4>; - phys = <&atc2_phy 6>, <&atc1_phy 6>; - phy-names = "typec0", "typec1"; + apple,typec-dptx-phys = <2 1 0>; + apple,typec-mux-indices = <4 4 4>; + phys = <&atc2_phy 6>, <&atc1_phy 6>, <&atc0_phy 6>; + phy-names = "typec0", "typec1", "typec2"; mux-controls = <&atc2_xbar 0>, <&atc2_xbar 1>, <&atc2_xbar 2>, <&atc2_xbar 3>, <&atc2_xbar 4>, <&atc1_dpxbar 0>, <&atc1_dpxbar 1>, <&atc1_dpxbar 2>, - <&atc1_dpxbar 3>, <&atc1_dpxbar 4>; + <&atc1_dpxbar 3>, <&atc1_dpxbar 4>, <&atc0_dpxbar 0>, <&atc0_dpxbar 1>, + <&atc0_dpxbar 2>, <&atc0_dpxbar 3>, <&atc0_dpxbar 4>; mux-control-names = "typec0", "typec0-dpin0", "typec0-dpin1", "typec0-dpin2", "typec0-dpin3", "typec1", "typec1-dpin0", "typec1-dpin1", - "typec1-dpin2", "typec1-dpin3"; + "typec1-dpin2", "typec1-dpin3", "typec2", "typec2-dpin0", + "typec2-dpin1", "typec2-dpin2", "typec2-dpin3"; typec-routes { #address-cells = <1>; @@ -107,6 +129,18 @@ }; }; }; + + route@2 { + reg = <2>; + mode-switch; + apple,connector-group = <1>; + + port { + dcpext2_left_back: endpoint { + remote-endpoint = <&typec2_dp1>; + }; + }; + }; }; }; @@ -117,16 +151,18 @@ }; &dcpext0 { - apple,typec-dptx-phys = <2 1>; - apple,typec-mux-indices = <0 0>; - phys = <&atc2_phy 6>, <&atc1_phy 6>; - phy-names = "typec0", "typec1"; + apple,typec-dptx-phys = <2 1 0>; + apple,typec-mux-indices = <0 0 0>; + phys = <&atc2_phy 6>, <&atc1_phy 6>, <&atc0_phy 6>; + phy-names = "typec0", "typec1", "typec2"; mux-controls = <&atc2_xbar 0>, <&atc2_xbar 1>, <&atc2_xbar 2>, <&atc2_xbar 3>, <&atc2_xbar 4>, <&atc1_dpxbar 0>, <&atc1_dpxbar 1>, <&atc1_dpxbar 2>, - <&atc1_dpxbar 3>, <&atc1_dpxbar 4>; + <&atc1_dpxbar 3>, <&atc1_dpxbar 4>, <&atc0_dpxbar 0>, <&atc0_dpxbar 1>, + <&atc0_dpxbar 2>, <&atc0_dpxbar 3>, <&atc0_dpxbar 4>; mux-control-names = "typec0", "typec0-dpin0", "typec0-dpin1", "typec0-dpin2", "typec0-dpin3", "typec1", "typec1-dpin0", "typec1-dpin1", - "typec1-dpin2", "typec1-dpin3"; + "typec1-dpin2", "typec1-dpin3", "typec2", "typec2-dpin0", + "typec2-dpin1", "typec2-dpin2", "typec2-dpin3"; typec-routes { route@0 { @@ -143,6 +179,18 @@ }; }; }; + + route@2 { + reg = <2>; + mode-switch; + apple,connector-group = <1>; + + port { + dcpext0_left_back: endpoint { + remote-endpoint = <&typec2_dp0>; + }; + }; + }; }; }; @@ -199,6 +247,31 @@ }; }; +&typec2 { + ports { + port@2 { + reg = <2>; + #address-cells = <1>; + #size-cells = <0>; + + typec2_dp0: endpoint@0 { + reg = <0>; + remote-endpoint = <&dcpext0_left_back>; + }; + + typec2_dp1: endpoint@1 { + reg = <1>; + remote-endpoint = <&dcpext2_left_back>; + }; + + typec2_dp2: endpoint@2 { + reg = <2>; + remote-endpoint = <&dcpext1_left_back>; + }; + }; + }; +}; + /* Scanout and PIODMA share the first register window, as on dispext0 */ &dispext1_dart { reg = <0x3 0x92300000 0x0 0xc000>; @@ -254,6 +327,29 @@ status = "okay"; }; +/* The left-back crossbar (the inventory's, as atc1_dpxbar) and the PHY's tunnel clock gates */ +&atc0_dpxbar { + power-domains = <&ps_atc0_usb_aon>, <&ps_atc0_common>; + power-domain-names = "usb-aon", "common"; + status = "okay"; +}; + +&ps_atc0_common_dp_0 { + status = "okay"; +}; + +&ps_atc0_common_dp_1 { + status = "okay"; +}; + +&ps_atc0_common_dp_2 { + status = "okay"; +}; + +&ps_atc0_common_dp_3 { + status = "okay"; +}; + &atc2_phy { reg = <0x3 0x83000000 0x0 0x2c000>, <0x3 0x82a90000 0x0 0x4000>, @@ -298,6 +394,14 @@ power-domain-names = "usb-aon", "common", "wrapper", "usb", "dp0", "dp1", "dp2", "dp3"; }; +/* The left-back PHY's tunnel clock gates, as the other ports' */ +&atc0_phy { + power-domains = <&ps_atc0_usb_aon>, <&ps_atc0_common>, <&ps_atc0_phymxwrap>, + <&ps_atc0_usb>, <&ps_atc0_common_dp_0>, <&ps_atc0_common_dp_1>, + <&ps_atc0_common_dp_2>, <&ps_atc0_common_dp_3>; + power-domain-names = "usb-aon", "common", "wrapper", "usb", "dp0", "dp1", "dp2", "dp3"; +}; + /* The right router's DP IN interrupts (ADT atc2-dpin0..3) */ &acio2 { interrupts = , , From 8a6cf8977b299305904028c7fa540e3e649ed82d Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Mon, 16 Nov 2026 15:15:34 -0500 Subject: [PATCH 07/10] dt-bindings: chosen: describe the J714s ATC0 ownership group Describe the disabled device group a boot producer may hand to Linux only after releasing its debug/USB ownership and supplying per-machine PHY tables. Keep shared providers outside the group. Signed-off-by: Diljit Singh --- .../bindings/chosen/apple,atc0-handoff.yaml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/chosen/apple,atc0-handoff.yaml diff --git a/Documentation/devicetree/bindings/chosen/apple,atc0-handoff.yaml b/Documentation/devicetree/bindings/chosen/apple,atc0-handoff.yaml new file mode 100644 index 0000000000000..97f087ec14eba --- /dev/null +++ b/Documentation/devicetree/bindings/chosen/apple,atc0-handoff.yaml @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/chosen/apple,atc0-handoff.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Apple J714s ATC0 boot ownership handoff group + +maintainers: + - Dj + +description: | + The J714s left-back USB-C port is also the boot producer's debug port. + Its devices start disabled. A producer may enable this complete group only + after relinquishing USB/debug ownership, proving no DMA was retained, and + supplying the current machine's PHY tunables. Shared providers are excluded. + An older producer leaves the group disabled. Linux does not activate it. + +select: + properties: + $nodename: + const: chosen + required: + - $nodename + - apple,atc0-handoff + +properties: + $nodename: + const: chosen + + apple,atc0-handoff: + $ref: /schemas/types.yaml#/definitions/phandle-array + minItems: 1 + maxItems: 32 + items: + maxItems: 1 + description: | + ATC0-only power domains, PHY and mailbox, USB DARTs and DRD, port + controller, router and mailbox/NHI/DART, PCIe tunnel parent/DART/root + controller, and display crossbar. Every member must be disabled until + handoff. Do not include the shared AOP GPIO, AUSS or CIO reset providers. + +additionalProperties: true From 028792c8f38600ae3fc85ffe91e6ffb82d7ba57e Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Mon, 16 Nov 2026 15:15:34 -0500 Subject: [PATCH 08/10] arm64: dts: apple: t6050-j714s: require a producer handoff for ATC0 The left-back port can still belong to the debug producer, and its static PHY tables do not match every J714s ADT. Remove those tables and the static ownership assertion. Keep the ATC0 devices, power domains and crossbar disabled until the producer exports its own ADT values and enables the complete handoff group. Keep LSTX reserved until that transaction releases it. Existing ports and their shared AUSS, GPIO and CIO reset providers remain available. Older producers safely leave the new port disabled. Signed-off-by: Diljit Singh --- .../boot/dts/apple/t6050-j714s-display.dtsi | 10 +- .../boot/dts/apple/t6050-j714s-left-back.dtsi | 263 +++++------------- arch/arm64/boot/dts/apple/t6050-j714s.dts | 4 +- 3 files changed, 71 insertions(+), 206 deletions(-) diff --git a/arch/arm64/boot/dts/apple/t6050-j714s-display.dtsi b/arch/arm64/boot/dts/apple/t6050-j714s-display.dtsi index 9cd50370858d5..a7fb666907ef7 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s-display.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-j714s-display.dtsi @@ -331,23 +331,23 @@ &atc0_dpxbar { power-domains = <&ps_atc0_usb_aon>, <&ps_atc0_common>; power-domain-names = "usb-aon", "common"; - status = "okay"; + status = "disabled"; }; &ps_atc0_common_dp_0 { - status = "okay"; + status = "disabled"; }; &ps_atc0_common_dp_1 { - status = "okay"; + status = "disabled"; }; &ps_atc0_common_dp_2 { - status = "okay"; + status = "disabled"; }; &ps_atc0_common_dp_3 { - status = "okay"; + status = "disabled"; }; &atc2_phy { diff --git a/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi b/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi index 969a7f0f9eff1..79aace6c2d6af 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi @@ -15,8 +15,9 @@ * dockchannel UART) and, on request, its USB proxy, whose USB2 route it sets with one DVEn * action in a short DBMa session. Describing the port hands it to Linux: tipd, the PHY and the * DRD's role switch then decide what the USB2 pair carries, and genpd may power the port's - * domains off while unused. The boot loader leaves the PHY without tunables on this port (the - * only one it skips, as its debug link's), so this file carries them. + * domains off while unused. Every ATC0 device starts disabled. Aura may enable the + * handoff group only after excluding debug/proxy ownership, proving USB DMA stopped, + * and exporting this machine's ADT tunables. Older producers leave the port reserved. */ /* @@ -27,24 +28,25 @@ */ &ps_atc0_common { /delete-property/ power-domains; - status = "okay"; + status = "disabled"; }; &ps_atc0_usb_aon { - status = "okay"; + status = "disabled"; }; &ps_atc0_usb { - status = "okay"; + status = "disabled"; }; &ps_atc0_phymxwrap { - status = "okay"; + status = "disabled"; }; &{/soc@200000000} { /* acio-phy-cpu0 reg[0]: the PHY firmware's mailbox (it runs, pre-loaded by iBoot) */ atc0_phy_mbox: mailbox@2a3148000 { + status = "disabled"; compatible = "apple,t6050-asc-mailbox", "apple,asc-mailbox-v4"; reg = <0x2 0xa3148000 0x0 0x4000>; interrupts = , @@ -61,6 +63,7 @@ * does not give the per-port address). */ atc0_phy: phy@2a3000000 { + status = "disabled"; compatible = "apple,t6050-combo-phy"; reg = <0x2 0xa3000000 0x0 0x2c000>, <0x2 0xa2a90000 0x0 0x4000>, @@ -80,8 +83,6 @@ #phy-cells = <1>; #reset-cells = <1>; apple,port-index = <0>; - /* The binding's name for "no other owner"; nothing else drives this port here. */ - apple,guest-port-reserved; mode-switch; orientation-switch; mboxes = <&atc0_phy_mbox>; @@ -100,12 +101,12 @@ /* /arm-io/dart-usb0 reg[0] and reg[1], interrupt 1423; vm-base 0x10000004000 +0xffff0000 */ &usb0_dart { apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "okay"; + status = "disabled"; }; &usb0_dart1 { apple,dma-range = <0x100 0x4000 0x0 0xffff0000>; - status = "okay"; + status = "disabled"; }; /* @@ -130,7 +131,7 @@ apple,tunable-link = <0x10 0xff000000 0xff000000>, <0x20 0x7ff00000 0x4e900000>, <0x24 0x001f8000 0x000b8000>, <0x60 0x0003ffff 0x00000600>; apple,tunable-cio = <0x20 0x00ff0000 0x001e0000>; - status = "okay"; + status = "disabled"; port { usb_drd0_hs: endpoint { @@ -145,6 +146,7 @@ */ &nub_spmi_a0 { hpm0: usb-pd@c { + status = "disabled"; compatible = "apple,sn201202x"; reg = <0xc SPMI_USID>; @@ -176,216 +178,34 @@ }; }; -/* - * The PHY's tunables, which the boot loader exports for ports 1-5 only: the J714sAP ADT's - * tunable_* tables of /arm-io/atc-phy0 and tunable_PIPE_HANDLER_DEFAULT of usb-drd0, under the - * names the boot loader gives them on the other ports. They are ATC1's except in axi2af, - * aus40cmn-shm and cio4pll. - */ -&atc0_phy { - apple,tunable-axi2af = <0x0 0x800000ff 0x80000024>, - <0x4 0x80ff00ff 0x80240002>, - <0x8 0x80ff00ff 0x80240002>, - <0xc 0x80ff00ff 0x80240006>, - <0x10 0x80ff00ff 0x80240002>, - <0x14 0x80ff00ff 0x80220004>, - <0x18 0x80ff00ff 0x80240002>, - <0x1c 0x80ff00ff 0x80240002>, - <0x20 0x80ff00ff 0x80240002>, - <0x24 0x800000ff 0x8000001b>, - <0x28 0x800000ff 0x80000048>, - <0x2c 0x80ff00ff 0x80480004>, - <0x30 0x80ff00ff 0x80480004>, - <0x34 0x80ff00ff 0x80440008>, - <0x38 0x80ff00ff 0x80480004>, - <0x3c 0x80ff00ff 0x80480004>, - <0x40 0x800000ff 0x8000001b>, - <0x44 0x800000ff 0x8000001b>, - <0x48 0x800000ff 0x8000001e>, - <0x100 0xff 0xff>, - <0x104 0x3 0x3>, - <0x300 0x3 0x1>, - <0x304 0x3f3f0000 0x4040000>, - <0x308 0x3ff 0xd>, - <0x30c 0x700003ff 0xc>, - <0x310 0x80001f 0x800001>, - <0x314 0x8080001f 0x80800001>, - <0x318 0x80001f 0x800001>, - <0x31c 0x8080001f 0x80800001>, - <0x320 0x80001f 0x800003>, - <0x324 0x8080001f 0x80800003>, - <0x328 0x80001f 0x800003>, - <0x32c 0x8080001f 0x80800003>, - <0x330 0x80001f 0x800003>, - <0x334 0x8080001f 0x80800003>, - <0x338 0x80001f 0x800003>, - <0x33c 0x80001f 0x800003>, - <0x340 0x80001f 0x800003>, - <0x344 0x80001f 0x800003>, - <0x348 0x80001f 0x800003>, - <0x34c 0x80001f 0x800003>, - <0x350 0x80001f 0x800003>, - <0x404 0xffff0023 0x1e0021>, - <0x408 0x3ff 0xd>, - <0x40c 0x700003ff 0xc>, - <0x410 0x8000001f 0x80000001>, - <0x414 0x8000001f 0x80000001>, - <0x418 0x8000001f 0x80000001>, - <0x41c 0x8000001f 0x80000001>, - <0x420 0x8000001f 0x80000003>, - <0x424 0x8000001f 0x80000003>, - <0x428 0x8000001f 0x80000003>, - <0x42c 0x8000001f 0x80000003>, - <0x430 0x8000001f 0x80000003>, - <0x434 0x8000001f 0x80000003>, - <0x438 0x8000001f 0x80000003>, - <0x43c 0x8000001f 0x80000003>, - <0x440 0x8000001f 0x80000003>, - <0x444 0x8000001f 0x80000003>, - <0x448 0x8000001f 0x80000003>, - <0x44c 0x8000001f 0x80000003>, - <0x450 0x8000001f 0x80000003>, - <0x948 0x7ff07ff 0x280000>, - <0xa48 0x7ff07ff 0x400040>, - <0xb48 0x7ff07ff 0xb8010e>, - <0xc48 0x7ff07ff 0x400020>, - <0xd48 0x7ff07ff 0x8a008a>, - <0x1000 0xffffffff 0x7fffffff>, - <0x1004 0x100 0x100>, - <0x4008 0x1 0x1>, - <0x400c 0x1 0x1>, - <0x4014 0x1 0x1>, - <0x4018 0x1 0x0>, - <0x401c 0x1 0x1>, - <0x108 0xffff0007 0x100001>; - apple,tunable-fabric = <0x4 0x3f003f 0x200020>, - <0xc 0xf1 0xa1>, - <0x10 0x801f 0x4>, - <0x18 0x3f003f 0x200020>, - <0x20 0xf1 0xa1>, - <0x24 0x801f 0x4>, - <0x2c 0xff00ff 0x960096>, - <0x34 0xf1 0x71>, - <0x38 0x801f 0x4>, - <0x40 0x3f 0x20>, - <0x48 0x801f 0x4>, - <0x50 0x7f007f 0x450045>, - <0x58 0x801f 0x4>, - <0x60 0x3f 0x20>, - <0x68 0x801f 0x4>, - <0x70 0x1 0x1>, - <0x74 0x801f 0x4>, - <0x7c 0x7f007f 0x400040>, - <0x80 0xf1 0x11>, - <0x84 0x1 0x1>, - <0x88 0x1 0x1>, - <0x8c 0x801f 0x4>, - <0x94 0x3f003f 0x240024>, - <0x98 0xf1 0x11>, - <0x9c 0x801f 0x4>, - <0xa4 0x1ff 0x1e0>, - <0xa8 0x801f 0x4>, - <0xb0 0x3f 0x20>, - <0xb8 0x801f 0x4>, - <0xc0 0x3f 0x20>, - <0xc8 0x801f 0x4>, - <0xd0 0x1f001f 0x100010>, - <0xd8 0x1 0x1>, - <0xdc 0x1 0x1>, - <0xe0 0x801f 0x4>, - <0xe8 0xf 0x8>, - <0xec 0x801f 0x4>, - <0xf4 0xffffffff 0x1010101>, - <0xf8 0x801f 0x4>, - <0x100 0x1 0x1>, - <0x104 0x1 0x1>, - <0x108 0x801f 0x4>, - <0x110 0x801f 0x4>, - <0x118 0x801f 0x4>, - <0x120 0x1 0x1>, - <0x124 0x1 0x1>, - <0x128 0x801f 0x4>, - <0x130 0xffffffff 0x1010101>, - <0x134 0x801f 0x4>, - <0x13c 0x1 0x1>, - <0x140 0x1 0x1>, - <0x144 0x801f 0x4>, - <0x14c 0x1 0x1>, - <0x150 0x1 0x1>, - <0x154 0x801f 0x4>, - <0x15c 0x801f 0x4>, - <0x164 0xffffffff 0x1010101>, - <0x168 0xffff 0x101>, - <0x16c 0x801f 0x4>, - <0x174 0x1 0x1>, - <0x178 0x1 0x1>, - <0x17c 0x801f 0x4>, - <0x184 0x1 0x1>, - <0x188 0x1 0x1>, - <0x18c 0x801f 0x4>; - apple,tunable-common-cfg = <0x8 0x1 0x1>; - apple,tunable-lioa = <0x28 0xfc2f 0x0>, - <0x2c 0x7 0x0>, - <0x30 0xff 0x0>, - <0x34 0x3ff 0x0>, - <0x58 0x30b 0x0>; - apple,tunable-lane0-rx-clock = <0x94 0x80000 0x80000>, - <0x98 0x80000 0x80000>, - <0xa4 0x800000 0x800000>, - <0xa8 0x200000 0x200000>; - apple,tunable-lane1-rx-clock = <0x94 0x80000 0x80000>, - <0x98 0x80000 0x80000>, - <0xa4 0x800000 0x800000>, - <0xa8 0x200000 0x200000>; - apple,tunable-lane0-rx-eq = <0x698 0x7e00000 0x4400000>, - <0x69c 0x7e00000 0x3800000>, - <0x6a0 0x7e00000 0x3800000>; - apple,tunable-lane1-rx-eq = <0x698 0x7e00000 0x4400000>, - <0x69c 0x7e00000 0x3800000>, - <0x6a0 0x7e00000 0x3800000>; - apple,tunable-auspll = <0x24 0xc00 0x800>, - <0x30 0x1f 0xf>, - <0x40 0x7d8007f 0x4000039>, - <0xb0 0xb800000 0x1800000>, - <0xe8 0x60001 0x40001>, - <0x138 0xf800000 0x7800000>; - apple,tunable-aus40cmn-shm = <0x4 0x7c 0x48>; - apple,tunable-cio4pll = <0x30 0x1f 0xf>, - <0x4c 0xfe7f 0x4e1e>, - <0xb0 0x700000 0x300000>, - <0xe8 0x60000 0x20000>; - apple,tunable-usb2-default = <0x8 0x7003 0x3>, - <0x18 0x703 0x103>; - apple,tunable-usb2-host = <0x8 0x7003 0x7003>; - apple,tunable-pipe-default = <0x44 0x4 0x4>; -}; +/* All per-machine PHY tables are supplied by aura only at a successful handoff. */ /* ==== The USB4/Thunderbolt router and its PCIe tunnel ==== */ &ps_atc0_cio { power-domains = <&ps_atc0_common>; - status = "okay"; + status = "disabled"; }; &ps_atc0_cio_pcie { power-domains = <&ps_atc0_cio>; - status = "okay"; + status = "disabled"; }; &ps_atc0_cio_usb { power-domains = <&ps_atc0_cio>; - status = "okay"; + status = "disabled"; }; &ps_atc0_cio_auss { power-domains = <&ps_atc0_cio>, <&ps_auss>; - status = "okay"; + status = "disabled"; }; /* With the ATC0 USB always-on clock gate, as ATC1_PCIE and ATC2_PCIE */ &ps_atc0_pcie { power-domains = <&ps_atc0_common>, <&ps_atc0_usb_aon>; - status = "okay"; + status = "disabled"; }; /* LSTX: AOP GPIO pin 77 (0x4d), function 1 for the router, as J716c's acio0 */ @@ -398,6 +218,7 @@ &{/soc@200000000} { /* /arm-io/acio-cpu0 reg[0]: the router CPU's mailbox, inside its wrapper */ acio0_mbox: mailbox@2a1108000 { + status = "disabled"; compatible = "apple,t6050-asc-mailbox", "apple,asc-mailbox-v4"; reg = <0x2 0xa1108000 0x0 0x4000>; interrupts = , @@ -410,6 +231,7 @@ }; acio0: acio@2a1ac0000 { + status = "disabled"; compatible = "apple,t6050-usb4-acio"; reg = <0x2 0xa1ac0000 0x0 0xc000>, <0x2 0xa1080000 0x0 0x26000>, @@ -434,6 +256,7 @@ nonposted-mmio; acio0_dart: iommu@a80000 { + status = "disabled"; compatible = "apple,t6050-dart", "apple,t8110-dart"; reg = <0xa80000 0xc000>; interrupts = ; @@ -447,6 +270,7 @@ /* Interrupts 0x62b.. (1579) are the TX rings and 0x637.. (1591) the RX rings */ acio0_nhi: nhi@f00000 { + status = "disabled"; compatible = "apple,t6050-usb4-nhi"; reg = <0xf00000 0x100000>; reg-names = "nhi"; @@ -517,12 +341,14 @@ */ / { acio0_pcie_tunnel: pcie-tunnel-0 { + status = "disabled"; #address-cells = <2>; #size-cells = <2>; ranges; nonposted-mmio; apciec0_dart: iommu@2a4000000 { + status = "disabled"; compatible = "apple,t6050-dart", "apple,t8110-dart"; reg = <0x2 0xa4000000 0x0 0x20000>; interrupts = ; @@ -534,6 +360,7 @@ }; apciec0: pcie@1c50000000 { + status = "disabled"; compatible = "apple,t6050-pciec"; device_type = "pci"; reg = <0x1c 0x50000000 0x0 0x10000000>, @@ -856,3 +683,41 @@ apple,tunable = <0x140 0x1 0x1>, <0x2a0 0x7e 0xa>; }; + +/* + * The producer's all-or-nothing ATC0 activation group. Shared AUSS, AOP GPIO + * and CIO reset providers stay enabled for the existing ports. GPIO 77 stays + * reserved until the same handoff transaction releases only that pin. + */ + +/ { + chosen { + apple,atc0-handoff = <&ps_atc0_common>, + <&ps_atc0_usb_aon>, + <&ps_atc0_usb>, + <&ps_atc0_phymxwrap>, + <&ps_atc0_cio>, + <&ps_atc0_cio_pcie>, + <&ps_atc0_cio_usb>, + <&ps_atc0_cio_auss>, + <&ps_atc0_pcie>, + <&ps_atc0_common_dp_0>, + <&ps_atc0_common_dp_1>, + <&ps_atc0_common_dp_2>, + <&ps_atc0_common_dp_3>, + <&atc0_phy_mbox>, + <&atc0_phy>, + <&usb0_dart>, + <&usb0_dart1>, + <&usb_drd0>, + <&hpm0>, + <&acio0_mbox>, + <&acio0>, + <&acio0_dart>, + <&acio0_nhi>, + <&acio0_pcie_tunnel>, + <&apciec0_dart>, + <&apciec0>, + <&atc0_dpxbar>; + }; +}; diff --git a/arch/arm64/boot/dts/apple/t6050-j714s.dts b/arch/arm64/boot/dts/apple/t6050-j714s.dts index a332ba4c813e8..6e22844b2df7a 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714s.dts @@ -428,9 +428,9 @@ /* Left-back port (ATC0) */ #include "t6050-j714s-left-back.dtsi" -/* The three routers' LSTX pins (77, 79 and 81) are the only AOP GPIOs exposed. */ +/* Reserve ATC0 LSTX until aura hands it over; ATC1/2 retain their pins. */ &pinctrl_aop { - gpio-reserved-ranges = <0 77>, <78 1>, <80 1>, <82 3>; + gpio-reserved-ranges = <0 79>, <80 1>, <82 3>; }; /* From d8a50cc1419e9c0e45b27a4b191e753fc34cf15a Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Mon, 16 Nov 2026 16:21:01 -0500 Subject: [PATCH 09/10] dt-bindings: firmware: give the ATC0 handoff its own interface The core chosen schema is closed, so an extra schema cannot make its vendor property valid. Move the group into an explicitly compatible firmware node with a required device list and a closed binding. Keep the existing ownership and disabled-device rules intact. Signed-off-by: Diljit Singh --- .../apple,j714s-atc0-handoff.yaml} | 33 +++++------ .../boot/dts/apple/t6050-j714s-left-back.dtsi | 59 ++++++++++--------- 2 files changed, 46 insertions(+), 46 deletions(-) rename Documentation/devicetree/bindings/{chosen/apple,atc0-handoff.yaml => firmware/apple,j714s-atc0-handoff.yaml} (53%) diff --git a/Documentation/devicetree/bindings/chosen/apple,atc0-handoff.yaml b/Documentation/devicetree/bindings/firmware/apple,j714s-atc0-handoff.yaml similarity index 53% rename from Documentation/devicetree/bindings/chosen/apple,atc0-handoff.yaml rename to Documentation/devicetree/bindings/firmware/apple,j714s-atc0-handoff.yaml index 97f087ec14eba..97f2baadedcbd 100644 --- a/Documentation/devicetree/bindings/chosen/apple,atc0-handoff.yaml +++ b/Documentation/devicetree/bindings/firmware/apple,j714s-atc0-handoff.yaml @@ -1,34 +1,27 @@ # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause %YAML 1.2 --- -$id: http://devicetree.org/schemas/chosen/apple,atc0-handoff.yaml# +$id: http://devicetree.org/schemas/firmware/apple,j714s-atc0-handoff.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Apple J714s ATC0 boot ownership handoff group +title: Apple J714s ATC0 boot ownership handoff interface maintainers: - Dj description: | The J714s left-back USB-C port is also the boot producer's debug port. - Its devices start disabled. A producer may enable this complete group only - after relinquishing USB/debug ownership, proving no DMA was retained, and - supplying the current machine's PHY tunables. Shared providers are excluded. - An older producer leaves the group disabled. Linux does not activate it. - -select: - properties: - $nodename: - const: chosen - required: - - $nodename - - apple,atc0-handoff + Its devices start disabled. This firmware interface identifies the group + the producer may enable after relinquishing USB/debug ownership, proving + no DMA was retained, and supplying the current machine's PHY tunables. + Shared providers are excluded. Older producers leave the group disabled; + Linux does not activate it. properties: - $nodename: - const: chosen + compatible: + const: apple,j714s-atc0-handoff - apple,atc0-handoff: + apple,devices: $ref: /schemas/types.yaml#/definitions/phandle-array minItems: 1 maxItems: 32 @@ -40,4 +33,8 @@ properties: controller, and display crossbar. Every member must be disabled until handoff. Do not include the shared AOP GPIO, AUSS or CIO reset providers. -additionalProperties: true +required: + - compatible + - apple,devices + +additionalProperties: false diff --git a/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi b/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi index 79aace6c2d6af..b0df6ee89d7da 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi @@ -691,33 +691,36 @@ */ / { - chosen { - apple,atc0-handoff = <&ps_atc0_common>, - <&ps_atc0_usb_aon>, - <&ps_atc0_usb>, - <&ps_atc0_phymxwrap>, - <&ps_atc0_cio>, - <&ps_atc0_cio_pcie>, - <&ps_atc0_cio_usb>, - <&ps_atc0_cio_auss>, - <&ps_atc0_pcie>, - <&ps_atc0_common_dp_0>, - <&ps_atc0_common_dp_1>, - <&ps_atc0_common_dp_2>, - <&ps_atc0_common_dp_3>, - <&atc0_phy_mbox>, - <&atc0_phy>, - <&usb0_dart>, - <&usb0_dart1>, - <&usb_drd0>, - <&hpm0>, - <&acio0_mbox>, - <&acio0>, - <&acio0_dart>, - <&acio0_nhi>, - <&acio0_pcie_tunnel>, - <&apciec0_dart>, - <&apciec0>, - <&atc0_dpxbar>; + firmware { + atc0-handoff { + compatible = "apple,j714s-atc0-handoff"; + apple,devices = <&ps_atc0_common>, + <&ps_atc0_usb_aon>, + <&ps_atc0_usb>, + <&ps_atc0_phymxwrap>, + <&ps_atc0_cio>, + <&ps_atc0_cio_pcie>, + <&ps_atc0_cio_usb>, + <&ps_atc0_cio_auss>, + <&ps_atc0_pcie>, + <&ps_atc0_common_dp_0>, + <&ps_atc0_common_dp_1>, + <&ps_atc0_common_dp_2>, + <&ps_atc0_common_dp_3>, + <&atc0_phy_mbox>, + <&atc0_phy>, + <&usb0_dart>, + <&usb0_dart1>, + <&usb_drd0>, + <&hpm0>, + <&acio0_mbox>, + <&acio0>, + <&acio0_dart>, + <&acio0_nhi>, + <&acio0_pcie_tunnel>, + <&apciec0_dart>, + <&apciec0>, + <&atc0_dpxbar>; + }; }; }; From fc40a0627ed5b114ebfee13f700f8be63c48645c Mon Sep 17 00:00:00 2001 From: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> Date: Thu, 19 Nov 2026 11:52:38 -0700 Subject: [PATCH 10/10] dt-bindings: firmware: apple: make the ATC handoff interface generic Nothing in the J714s ATC0 handoff is specific to that board or port: it is a group of a Type-C port's devices that stays disabled until the boot producer releases the port it may be using. Rename the binding to apple,atc-handoff so other boards whose producer's USB port sits on an ATC can use it, and name the port's PHY with apple,phy, so the producer does not have to find it among the devices. Signed-off-by: Isaac Duarte <31712685+Isaac-Duarte@users.noreply.github.com> --- .../bindings/firmware/apple,atc-handoff.yaml | 48 +++++++++++++++++++ .../firmware/apple,j714s-atc0-handoff.yaml | 40 ---------------- .../boot/dts/apple/t6050-j714s-left-back.dtsi | 3 +- 3 files changed, 50 insertions(+), 41 deletions(-) create mode 100644 Documentation/devicetree/bindings/firmware/apple,atc-handoff.yaml delete mode 100644 Documentation/devicetree/bindings/firmware/apple,j714s-atc0-handoff.yaml diff --git a/Documentation/devicetree/bindings/firmware/apple,atc-handoff.yaml b/Documentation/devicetree/bindings/firmware/apple,atc-handoff.yaml new file mode 100644 index 0000000000000..00b06d90ca689 --- /dev/null +++ b/Documentation/devicetree/bindings/firmware/apple,atc-handoff.yaml @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/firmware/apple,atc-handoff.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Apple Type-C (ATC) port boot ownership handoff interface + +maintainers: + - Dj + +description: | + A Type-C port whose ATC the boot producer may be using, for example as its + USB debug port. The port's devices start disabled. This firmware interface + identifies the port's PHY and the group the producer may enable after + relinquishing USB/debug ownership, proving no DMA was retained, and + supplying the current machine's PHY tunables. Shared providers are + excluded. Older producers leave the group disabled; Linux does not + activate it. + +properties: + compatible: + const: apple,atc-handoff + + apple,phy: + $ref: /schemas/types.yaml#/definitions/phandle + description: | + The port's ATC PHY. It is also a member of apple,devices. + + apple,devices: + $ref: /schemas/types.yaml#/definitions/phandle-array + minItems: 1 + maxItems: 32 + items: + maxItems: 1 + description: | + The port's own devices: its power domains, PHY and mailbox, USB DARTs + and DRD, port controller, USB4 router and its mailbox/NHI/DART, PCIe + tunnel parent/DART/root controller, and display crossbar. Every member + must be disabled until handoff. Do not include providers shared with + other ports, such as the AOP GPIO, AUSS or CIO reset providers. + +required: + - compatible + - apple,phy + - apple,devices + +additionalProperties: false diff --git a/Documentation/devicetree/bindings/firmware/apple,j714s-atc0-handoff.yaml b/Documentation/devicetree/bindings/firmware/apple,j714s-atc0-handoff.yaml deleted file mode 100644 index 97f2baadedcbd..0000000000000 --- a/Documentation/devicetree/bindings/firmware/apple,j714s-atc0-handoff.yaml +++ /dev/null @@ -1,40 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -%YAML 1.2 ---- -$id: http://devicetree.org/schemas/firmware/apple,j714s-atc0-handoff.yaml# -$schema: http://devicetree.org/meta-schemas/core.yaml# - -title: Apple J714s ATC0 boot ownership handoff interface - -maintainers: - - Dj - -description: | - The J714s left-back USB-C port is also the boot producer's debug port. - Its devices start disabled. This firmware interface identifies the group - the producer may enable after relinquishing USB/debug ownership, proving - no DMA was retained, and supplying the current machine's PHY tunables. - Shared providers are excluded. Older producers leave the group disabled; - Linux does not activate it. - -properties: - compatible: - const: apple,j714s-atc0-handoff - - apple,devices: - $ref: /schemas/types.yaml#/definitions/phandle-array - minItems: 1 - maxItems: 32 - items: - maxItems: 1 - description: | - ATC0-only power domains, PHY and mailbox, USB DARTs and DRD, port - controller, router and mailbox/NHI/DART, PCIe tunnel parent/DART/root - controller, and display crossbar. Every member must be disabled until - handoff. Do not include the shared AOP GPIO, AUSS or CIO reset providers. - -required: - - compatible - - apple,devices - -additionalProperties: false diff --git a/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi b/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi index b0df6ee89d7da..e9de93f3d042d 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-j714s-left-back.dtsi @@ -693,7 +693,8 @@ / { firmware { atc0-handoff { - compatible = "apple,j714s-atc0-handoff"; + compatible = "apple,atc-handoff"; + apple,phy = <&atc0_phy>; apple,devices = <&ps_atc0_common>, <&ps_atc0_usb_aon>, <&ps_atc0_usb>,