From 3c07eacef1b0e5ef40fd23684cb1400c18f1d70f Mon Sep 17 00:00:00 2001 From: Roberto Dantas <7robertodantas@gmail.com> Date: Fri, 13 Nov 2026 21:03:28 -0300 Subject: [PATCH] arm64: dts: apple: t6041-j575c: USB-C displays on all four back ports The J575c drove a USB-C display on typec1 only: dcpext1 had a single route, and the tree deleted the display crossbars of ATC0, ATC2 and ATC3. macOS drives a display on each of its four back Type-C ports, and the J575c ADT has the four crossbars (atc0-3-dpxbar) and the external display processors dcpext0-3 at the J614c/J616c's addresses. iBoot starts dcpext2 here too (iop-dcpext2-nub), and aura's t6041_exts fills its firmware memory. Describe the ports as the J614c/J616c does, with the fourth one added: - dcpext1 gets a route to each of typec0-3 (t6041-j575c-usbc.dtsi), and atcphy0-3 are mode switches. The ATC0, ATC2 and ATC3 crossbars are no longer deleted. - dcpext2 is described with a route to each of typec0-3 (t6041-j575c-usbc-dcpext2.dtsi), as t6041-j616c-usbc-dcpext2.dtsi with the fourth route. With HDMI on dcpext0, two USB-C displays can then run at the same time, each on any back port. - The display gate's J575c USB-C chain enables the four crossbars and the four routes, and a new J575c chain enables dcpext2 with its four routes. The DT and the gate change together: dcpext1's crossbars must be enabled by the gate, and the old gate list names nodes the old tree deletes. Tested on a J575c with aura main (3351432), one USB-C to HDMI adapter (pin assignment D) at 2560x1440, and HDMI connected throughout: - dcpext1 drives typec0, typec1 and typec3, boot-attached and after replugs, on the first link training attempt. - dcpext2 (with dcpext1's routes removed in a test-only tree) drives typec0, typec1 and typec3 the same way. - typec2 is unreliable on both processors and in both plug orientations: link training fails with "DPTXPort: firmware reports link fault 22", and the driver retries. It came up after one or two retries twice, and kept failing for over a minute once, also when attached at boot. macOS 27.2.1 on the same machine does not drive a display on typec2 with this adapter either (both orientations, "no HDMI cable" on the monitor), while typec0, typec1 and typec3 work, so this is the port or the adapter, not this change. Its PHY tunables match the ADT. Not tested: two USB-C displays at once (one adapter). Assisted-by: LLM Signed-off-by: Roberto Dantas <7robertodantas@gmail.com> Co-Authored-By: Claude Opus 5.5 --- .../dts/apple/t6041-j575c-usbc-dcpext2.dtsi | 219 ++++++++++++++++++ .../boot/dts/apple/t6041-j575c-usbc.dtsi | 137 +++++++++-- arch/arm64/boot/dts/apple/t6041-j575c.dts | 10 +- drivers/soc/apple/display-gate.c | 35 ++- 4 files changed, 374 insertions(+), 27 deletions(-) create mode 100644 arch/arm64/boot/dts/apple/t6041-j575c-usbc-dcpext2.dtsi diff --git a/arch/arm64/boot/dts/apple/t6041-j575c-usbc-dcpext2.dtsi b/arch/arm64/boot/dts/apple/t6041-j575c-usbc-dcpext2.dtsi new file mode 100644 index 0000000000000..b697335008fad --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6041-j575c-usbc-dcpext2.dtsi @@ -0,0 +1,219 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * A second USB-C DisplayPort processor on the J575c: dcpext2, with a route to + * each of the four back Type-C ports (typec0-3), next to dcpext1. Two USB-C + * displays then run at the same time, one on each processor, beside HDMI on + * dcpext0. + * + * The node is the J614c/J616c's (t6041-j616c-usbc-dcpext2.dtsi) with the + * fourth route added: the J575c ADT has dcpext2 at the same address + * (/arm-io/dcpext2 0x406e00000 + 0x2_0000_0000) and iBoot preloads and starts + * it here too (iop-dcpext2-nub). As dcpext1, no PMP and no DISPEXT2 power + * domain is described: the chain runs as iBoot left it powered. + * + * Everything here is disabled. The boot loader fills dcpext2's firmware + * memory from this boot's ADT (aura t6041_exts) and the display gate enables + * the chain once it has. + */ + +/ { + aliases { + dcpext2 = &dcpext2; + }; + + reserved-memory { + dcpext2_text: dcpext2-text { + compatible = "apple,asc-mem"; + reg = <0x0 0x0 0x0 0x4000>; + no-map; + status = "disabled"; + }; + + dcpext2_data: dcpext2-data { + compatible = "apple,asc-mem"; + reg = <0x0 0x0 0x0 0x4000>; + no-map; + status = "disabled"; + }; + + dcpext2_heap: dcpext2-heap { + compatible = "apple,asc-mem"; + reg = <0x0 0x0 0x0 0x4000>; + no-map; + status = "disabled"; + }; + }; + + dcpext2: dcp@606e00000 { + compatible = "apple,t6041-dcpext", "apple,dcpext"; + reg = <0x6 0x06e00000 0x0 0x4000>, + <0x6 0x04000000 0x0 0x4000000>, + <0x6 0x06240000 0x0 0x10000>, + <0x6 0x063a8000 0x0 0x4000>, + <0x6 0x06800000 0x0 0x800000>; + reg-names = "coproc", "disp-0", "disp-1", "disp-2", "disp-3"; + mboxes = <&dcpext2_mbox>; + mbox-names = "mbox"; + iommus = <&dcpext2_dart 23>; + /* + * PMGR bandwidth agent scratch: the bwr-agent the ADT dispext2 + * function-bw_req_interrupt0 (0x90) names, 0x20000 + 5 * 0x4000. + */ + apple,bw-scratch = <&pmgr_dcp 0 4 0x34000>; + /* ADT iop-dcpext2-nub external-index */ + apple,dcp-endpoint = <3>; + /* as dcpext0/1: without it apple-dcp's probe fails with -EINVAL */ + apple,iomfb-surfaces = <1 1 0 0>; + apple,connector-type = "USB-C"; + phys = <&atcphy0 PHY_TYPE_DP>, <&atcphy1 PHY_TYPE_DP>, + <&atcphy2 PHY_TYPE_DP>, <&atcphy3 PHY_TYPE_DP>; + phy-names = "typec0", "typec1", "typec2", "typec3"; + mux-controls = <&atcphy0_xbar 0>, <&atcphy1_xbar 0>, + <&atcphy2_xbar 0>, <&atcphy3_xbar 0>; + mux-control-names = "typec0", "typec1", "typec2", "typec3"; + /* + * indexed by route; crossbar state = 2 * dp-switch-ufp-endpoint + * (2) + port (0), as the J614s's dcpext2 (#1654) + */ + apple,typec-dptx-phys = <0 1 2 3>; + apple,typec-mux-indices = <4 4 4 4>; + memory-region = <&dcpext2_text>, <&dcpext2_data>, <&dcpext2_heap>; + memory-region-names = "text", "data", "heap"; + status = "disabled"; + + dispext2_piodma: piodma { + iommus = <&dispext2_dart 16>; + }; + + typec-routes { + #address-cells = <1>; + #size-cells = <0>; + + route@0 { + reg = <0>; + mode-switch; + status = "disabled"; + + port { + dcpext2_typec0: endpoint { + remote-endpoint = <&typec0_dcpext2>; + }; + }; + }; + + route@1 { + reg = <1>; + mode-switch; + status = "disabled"; + + port { + dcpext2_typec1: endpoint { + remote-endpoint = <&typec1_dcpext2>; + }; + }; + }; + + route@2 { + reg = <2>; + mode-switch; + status = "disabled"; + + port { + dcpext2_typec2: endpoint { + remote-endpoint = <&typec2_dcpext2>; + }; + }; + }; + + route@3 { + reg = <3>; + mode-switch; + status = "disabled"; + + port { + dcpext2_typec3: endpoint { + remote-endpoint = <&typec3_dcpext2>; + }; + }; + }; + }; + }; + + dcpext2_mbox: mailbox@606e08000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x6 0x06e08000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + status = "disabled"; + }; + + dispext2_dart: iommu@606300000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x6 0x06300000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x10 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + dcpext2_dart: iommu@606340000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x6 0x06340000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x10 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; +}; + +&typec0 { + ports { + port@3 { + typec0_dcpext2: endpoint@1 { + reg = <1>; + remote-endpoint = <&dcpext2_typec0>; + }; + }; + }; +}; + +&typec1 { + ports { + port@3 { + typec1_dcpext2: endpoint@1 { + reg = <1>; + remote-endpoint = <&dcpext2_typec1>; + }; + }; + }; +}; + +&typec2 { + ports { + port@3 { + typec2_dcpext2: endpoint@1 { + reg = <1>; + remote-endpoint = <&dcpext2_typec2>; + }; + }; + }; +}; + +&typec3 { + ports { + port@3 { + typec3_dcpext2: endpoint@1 { + reg = <1>; + remote-endpoint = <&dcpext2_typec3>; + }; + }; + }; +}; diff --git a/arch/arm64/boot/dts/apple/t6041-j575c-usbc.dtsi b/arch/arm64/boot/dts/apple/t6041-j575c-usbc.dtsi index 15afb8d2574ad..af456fff96fbd 100644 --- a/arch/arm64/boot/dts/apple/t6041-j575c-usbc.dtsi +++ b/arch/arm64/boot/dts/apple/t6041-j575c-usbc.dtsi @@ -1,15 +1,16 @@ // SPDX-License-Identifier: GPL-2.0+ OR MIT /* - * USB-C DisplayPort on the J575c's back-right-middle port (typec1): dcpext1, - * the ATC1 display crossbar and atcphy1 in DP alt mode, driven by hpm1. The - * same chain as the J616c's typec1 (t6041-j616c-usbc.dtsi). The adapters it - * was tested with negotiate pin assignment D, whose two DP lanes run on the - * USB3 PHY, so this needs t6041-j575c-usb3.dtsi. + * USB-C DisplayPort on the J575c's four back Type-C ports (typec0-3): + * dcpext1, the ATC0-3 display crossbars and atcphy0-3 in DP alt mode, driven + * by hpm0-3, as dcpext1 on the J614c/J616c (t6041-j616c-usbc.dtsi) with the + * fourth port added. The J575c ADT has atc0-3-dpxbar at the J616c's + * addresses. The adapters it was tested with negotiate pin assignment D, + * whose two DP lanes run on the USB3 PHY, so this needs t6041-j575c-usb3.dtsi. * - * dcpext1, its DARTs, mailbox, crossbar and Type-C route are disabled: the + * dcpext1, its DARTs, mailbox, crossbars and Type-C routes are disabled: the * display gate enables them once the boot loader has filled dcpext1's - * firmware memory. A disabled route is no mode switch, so typec1 then keeps - * USB2 and PD as before. + * firmware memory. A disabled route is no mode switch, so the ports then keep + * USB and PD as before. */ / { @@ -50,13 +51,15 @@ &dcpext1 { apple,iomfb-surfaces = <1 1 0 0>; apple,connector-type = "USB-C"; - phys = <&atcphy1 PHY_TYPE_DP>; - phy-names = "typec1"; - mux-controls = <&atcphy1_xbar 0>; - mux-control-names = "typec1"; - /* indexed by route */ - apple,typec-dptx-phys = <0 1 2>; - apple,typec-mux-indices = <2 2 2>; + phys = <&atcphy0 PHY_TYPE_DP>, <&atcphy1 PHY_TYPE_DP>, + <&atcphy2 PHY_TYPE_DP>, <&atcphy3 PHY_TYPE_DP>; + phy-names = "typec0", "typec1", "typec2", "typec3"; + mux-controls = <&atcphy0_xbar 0>, <&atcphy1_xbar 0>, + <&atcphy2_xbar 0>, <&atcphy3_xbar 0>; + mux-control-names = "typec0", "typec1", "typec2", "typec3"; + /* indexed by route; dcpext1 ufp 1 port 0 = crossbar state 2, as on the M4 Pro */ + apple,typec-dptx-phys = <0 1 2 3>; + apple,typec-mux-indices = <2 2 2 2>; memory-region = <&dcpext1_text>, <&dcpext1_data>, <&dcpext1_heap>; memory-region-names = "text", "data", "heap"; @@ -64,6 +67,18 @@ #address-cells = <1>; #size-cells = <0>; + route@0 { + reg = <0>; + mode-switch; + status = "disabled"; + + port { + dcpext1_typec0: endpoint { + remote-endpoint = <&typec0_dcpext1>; + }; + }; + }; + route@1 { reg = <1>; mode-switch; @@ -75,22 +90,110 @@ }; }; }; + + route@2 { + reg = <2>; + mode-switch; + status = "disabled"; + + port { + dcpext1_typec2: endpoint { + remote-endpoint = <&typec2_dcpext1>; + }; + }; + }; + + route@3 { + reg = <3>; + mode-switch; + status = "disabled"; + + port { + dcpext1_typec3: endpoint { + remote-endpoint = <&typec3_dcpext1>; + }; + }; + }; + }; +}; + +&typec0 { + ports { + port@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + + typec0_dcpext1: endpoint@0 { + reg = <0>; + remote-endpoint = <&dcpext1_typec0>; + }; + }; }; }; &typec1 { ports { port@3 { + #address-cells = <1>; + #size-cells = <0>; reg = <3>; - typec1_dcpext1: endpoint { + + typec1_dcpext1: endpoint@0 { + reg = <0>; remote-endpoint = <&dcpext1_typec1>; }; }; }; }; -/* The DP mux of typec1 (the tunables and USB3 are in t6041-j575c-usb3.dtsi) */ +&typec2 { + ports { + port@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + + typec2_dcpext1: endpoint@0 { + reg = <0>; + remote-endpoint = <&dcpext1_typec2>; + }; + }; + }; +}; + +&typec3 { + ports { + port@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + + typec3_dcpext1: endpoint@0 { + reg = <0>; + remote-endpoint = <&dcpext1_typec3>; + }; + }; + }; +}; + +/* The DP muxes (the tunables and USB3 are in t6041-j575c-usb3.dtsi) */ +&atcphy0 { + mode-switch; + orientation-switch; +}; + &atcphy1 { mode-switch; orientation-switch; }; + +&atcphy2 { + mode-switch; + orientation-switch; +}; + +&atcphy3 { + mode-switch; + orientation-switch; +}; diff --git a/arch/arm64/boot/dts/apple/t6041-j575c.dts b/arch/arm64/boot/dts/apple/t6041-j575c.dts index edbdefbfc352d..75be806091fcf 100644 --- a/arch/arm64/boot/dts/apple/t6041-j575c.dts +++ b/arch/arm64/boot/dts/apple/t6041-j575c.dts @@ -2012,19 +2012,17 @@ #include "t604x-extdisp.dtsi" /* - * Only typec1 carries an external display chain here. ATC3 is the fourth - * back Type-C port, not the J616c's HDMI PHY: drop that description, and - * t6041-j575c-atc3.dtsi describes the port instead. + * ATC3 is the fourth back Type-C port, not the J616c's HDMI PHY: drop that + * description, and t6041-j575c-atc3.dtsi describes the port instead. Its + * display crossbar (atcphy3_xbar) is the port's and stays. */ -/delete-node/ &atcphy0_xbar; -/delete-node/ &atcphy2_xbar; -/delete-node/ &atcphy3_xbar; /delete-node/ &atcphy3; /delete-node/ &atcphy3_mbox; #include "t6041-j575c-atc3.dtsi" #include "t6041-j575c-usb3.dtsi" #include "t6041-j575c-usbc.dtsi" +#include "t6041-j575c-usbc-dcpext2.dtsi" #include "t6041-j575c-hdmi.dtsi" /* Not described: the SEP (no Touch ID sensor). */ diff --git a/drivers/soc/apple/display-gate.c b/drivers/soc/apple/display-gate.c index de08af5e7716e..03db5ed73e343 100644 --- a/drivers/soc/apple/display-gate.c +++ b/drivers/soc/apple/display-gate.c @@ -3136,17 +3136,23 @@ static const struct gate_staged t6041_max_stages[] = { }; /* - * The J575c's typec1 chain: ATC1 crossbar, DARTs, mailbox, route, dcpext1. - * That port is also a USB3 port, so its device tree enables the ATC1 PHY's - * coprocessor mailbox, as the M4 Pro boards do: the mailbox is not part of - * the chain here. + * The J575c's USB-C chain: the crossbars of its four back Type-C ports + * (ATC0-3), DARTs, mailbox, a route per port, dcpext1. The ports are also + * USB3 ports, so the device tree enables the ATC PHYs' coprocessor + * mailboxes, as the M4 Pro boards do: they are not part of the chain here. */ static const char *const t6041_j575c_usbc_nodes[] = { + "/mux@38324c000", "/mux@38b24c000", + "/mux@39324c000", + "/mux@39b24c000", "/iommu@602340000", "/iommu@602300000", "/mailbox@602e08000", + "/dcp@602e00000/typec-routes/route@0", "/dcp@602e00000/typec-routes/route@1", + "/dcp@602e00000/typec-routes/route@2", + "/dcp@602e00000/typec-routes/route@3", "/dcp@602e00000", }; @@ -3154,6 +3160,25 @@ static const struct gate_staged t6041_j575c_usbc = { "/iommu@602300000", t6041_j575c_usbc_nodes, ARRAY_SIZE(t6041_j575c_usbc_nodes), }; +/* + * The J575c's second USB-C processor, as the J614c/J616c's, with a route to + * the fourth port too. It shares the crossbars with dcpext1's chain. + */ +static const char *const t6041_j575c_usbc2_nodes[] = { + "/iommu@606340000", + "/iommu@606300000", + "/mailbox@606e08000", + "/dcp@606e00000/typec-routes/route@0", + "/dcp@606e00000/typec-routes/route@1", + "/dcp@606e00000/typec-routes/route@2", + "/dcp@606e00000/typec-routes/route@3", + "/dcp@606e00000", +}; + +static const struct gate_staged t6041_j575c_usbc2 = { + "/iommu@606300000", t6041_j575c_usbc2_nodes, ARRAY_SIZE(t6041_j575c_usbc2_nodes), +}; + /* * The J575c's HDMI chain. Its ATC3 is a USB-C port, and its HDMI port runs * through the LPDPTX PHY instead (t6041-j575c-hdmi.dtsi): that PHY's power, @@ -3179,6 +3204,8 @@ static const struct gate_staged *t6041_max_stage(unsigned int i) return &t6041_j575c_hdmi; if (i == 1 && of_machine_is_compatible("apple,j575c")) return &t6041_j575c_usbc; + if (i == 2 && of_machine_is_compatible("apple,j575c")) + return &t6041_j575c_usbc2; return &t6041_max_stages[i]; }