From 754b649d8e78eebf736c55aacedb896d3cddc9c5 Mon Sep 17 00:00:00 2001 From: Jos Dehaes Date: Thu, 12 Nov 2026 13:53:24 +0100 Subject: [PATCH] arm64: dts: apple: t6041-j614c-j616c: dcpext3 for a third USB-C display With dcpext1 and dcpext2, two of the three USB-C ports can drive a display at the same time. Describe dcpext3 as dcpext2, so that each port can: iBoot preloads and starts it too (iop-dcpext3-nub pre-loaded 1, running 1). Its block is dcpext2's moved from 0x6xxxxxxxx to 0x3xxxxxxxx, interrupts +0x48, external-index 4, crossbar state 6 (2 * dp-switch-ufp-endpoint 3 + port 0). The ADT pmgr bwr-agent table gives DISP_EXT3 slot 6, so its bandwidth scratch is 0x38000, by the rule dcpext1 (slot 4, 0x30000) and dcpext2 (slot 5, 0x34000) follow. The display gate enables dcpext3's chain as dcpext2's, and the KUnit tree and cases cover it. Signed-off-by: Jos Dehaes --- .../boot/dts/apple/t6041-j614c-j616c.dtsi | 1 + .../dts/apple/t6041-j616c-usbc-dcpext3.dtsi | 194 ++++++++++++++++++ drivers/soc/apple/display-gate-test.c | 16 ++ drivers/soc/apple/display-gate.c | 12 ++ drivers/soc/apple/t6041-gate-test.dtso | 56 ++++- 5 files changed, 278 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/boot/dts/apple/t6041-j616c-usbc-dcpext3.dtsi diff --git a/arch/arm64/boot/dts/apple/t6041-j614c-j616c.dtsi b/arch/arm64/boot/dts/apple/t6041-j614c-j616c.dtsi index 8e2b49a4567ea..938a0ecd8a80d 100644 --- a/arch/arm64/boot/dts/apple/t6041-j614c-j616c.dtsi +++ b/arch/arm64/boot/dts/apple/t6041-j614c-j616c.dtsi @@ -2547,6 +2547,7 @@ #include "t6041-j616c-hdmi.dtsi" #include "t6041-j616c-usbc.dtsi" #include "t6041-j616c-usbc-dcpext2.dtsi" +#include "t6041-j616c-usbc-dcpext3.dtsi" /* * Keyboard backlight, as on the M4 Pro boards: the ADT /arm-io/pwm0 has one diff --git a/arch/arm64/boot/dts/apple/t6041-j616c-usbc-dcpext3.dtsi b/arch/arm64/boot/dts/apple/t6041-j616c-usbc-dcpext3.dtsi new file mode 100644 index 0000000000000..6257843799f9d --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6041-j616c-usbc-dcpext3.dtsi @@ -0,0 +1,194 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * A third USB-C DisplayPort processor on the J614c and J616c: dcpext3, with + * a route to each of the three USB-C ports (typec0-2), next to dcpext1 and + * dcpext2. Each USB-C port can then drive a display of its own. + * + * dcpext3 is dcpext2's block moved from 0x6xxxxxxxx to 0x3xxxxxxxx (ADT + * /arm-io/dcpext3 at 0x106e00000 + 0x2_0000_0000, interrupts +0x48, + * external-index 4). iBoot preloads and starts it on the M4 Max + * (iop-dcpext3-nub pre-loaded 1, running 1). As dcpext1 and dcpext2 on this + * SoC, no PMP and no DISPEXT3 power domain is described. + * + * Everything here is disabled. The boot loader fills dcpext3's firmware + * memory from this boot's ADT (aura t6041_exts) and the display gate enables + * the chain once it has. + */ + +/ { + aliases { + dcpext3 = &dcpext3; + }; + + reserved-memory { + dcpext3_text: dcpext3-text { + compatible = "apple,asc-mem"; + reg = <0x0 0x0 0x0 0x4000>; + no-map; + status = "disabled"; + }; + + dcpext3_data: dcpext3-data { + compatible = "apple,asc-mem"; + reg = <0x0 0x0 0x0 0x4000>; + no-map; + status = "disabled"; + }; + + dcpext3_heap: dcpext3-heap { + compatible = "apple,asc-mem"; + reg = <0x0 0x0 0x0 0x4000>; + no-map; + status = "disabled"; + }; + }; + + dcpext3: dcp@306e00000 { + compatible = "apple,t6041-dcpext", "apple,dcpext"; + reg = <0x3 0x06e00000 0x0 0x4000>, + <0x3 0x04000000 0x0 0x4000000>, + <0x3 0x06240000 0x0 0x10000>, + <0x3 0x063a8000 0x0 0x4000>, + <0x3 0x06800000 0x0 0x800000>; + reg-names = "coproc", "disp-0", "disp-1", "disp-2", "disp-3"; + mboxes = <&dcpext3_mbox>; + mbox-names = "mbox"; + iommus = <&dcpext3_dart 23>; + /* + * PMGR bandwidth agent scratch: the bwr-agent the ADT dispext3 + * function-bw_req_interrupt0 (0x4f) names: ADT + * pmgr bwr-agent DISP_EXT3, slot 6, so 0x20000 + 6 * 0x4000. + */ + apple,bw-scratch = <&pmgr_dcp 0 4 0x38000>; + /* ADT iop-dcpext3-nub external-index */ + apple,dcp-endpoint = <4>; + /* 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>; + phy-names = "typec0", "typec1", "typec2"; + mux-controls = <&atcphy0_xbar 0>, <&atcphy1_xbar 0>, <&atcphy2_xbar 0>; + mux-control-names = "typec0", "typec1", "typec2"; + /* + * indexed by route; crossbar state = 2 * dp-switch-ufp-endpoint + * (3) + port (0) + */ + apple,typec-dptx-phys = <0 1 2>; + apple,typec-mux-indices = <6 6 6>; + memory-region = <&dcpext3_text>, <&dcpext3_data>, <&dcpext3_heap>; + memory-region-names = "text", "data", "heap"; + status = "disabled"; + + dispext3_piodma: piodma { + iommus = <&dispext3_dart 16>; + }; + + typec-routes { + #address-cells = <1>; + #size-cells = <0>; + + route@0 { + reg = <0>; + mode-switch; + status = "disabled"; + + port { + dcpext3_typec0: endpoint { + remote-endpoint = <&typec0_dcpext3>; + }; + }; + }; + + route@1 { + reg = <1>; + mode-switch; + status = "disabled"; + + port { + dcpext3_typec1: endpoint { + remote-endpoint = <&typec1_dcpext3>; + }; + }; + }; + + route@2 { + reg = <2>; + mode-switch; + status = "disabled"; + + port { + dcpext3_typec2: endpoint { + remote-endpoint = <&typec2_dcpext3>; + }; + }; + }; + }; + }; + + dcpext3_mbox: mailbox@306e08000 { + compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4"; + reg = <0x3 0x06e08000 0x0 0x4000>; + interrupt-parent = <&aic>; + interrupts = , + , + , + ; + interrupt-names = "send-empty", "send-not-empty", + "recv-empty", "recv-not-empty"; + #mbox-cells = <0>; + status = "disabled"; + }; + + dispext3_dart: iommu@306300000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x06300000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x10 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; + + dcpext3_dart: iommu@306340000 { + compatible = "apple,t6041-dart", "apple,t8110-dart"; + reg = <0x3 0x06340000 0x0 0xc000>; + #iommu-cells = <1>; + apple,dma-range = <0x100 0x0 0x10 0x0>; + interrupt-parent = <&aic>; + interrupts = ; + status = "disabled"; + }; +}; + +&typec0 { + ports { + port@3 { + typec0_dcpext3: endpoint@2 { + reg = <2>; + remote-endpoint = <&dcpext3_typec0>; + }; + }; + }; +}; + +&typec1 { + ports { + port@3 { + typec1_dcpext3: endpoint@2 { + reg = <2>; + remote-endpoint = <&dcpext3_typec1>; + }; + }; + }; +}; + +&typec2 { + ports { + port@3 { + typec2_dcpext3: endpoint@2 { + reg = <2>; + remote-endpoint = <&dcpext3_typec2>; + }; + }; + }; +}; diff --git a/drivers/soc/apple/display-gate-test.c b/drivers/soc/apple/display-gate-test.c index 3b0b162ed6799..d83933c87fb32 100644 --- a/drivers/soc/apple/display-gate-test.c +++ b/drivers/soc/apple/display-gate-test.c @@ -1154,6 +1154,7 @@ static void __init gate_t6041_max_no_memory(struct kunit *test) gt_max_expect_chain(test, 0, false); gt_max_expect_chain(test, 1, false); gt_max_expect_chain(test, 2, false); + gt_max_expect_chain(test, 3, false); gt_max_expect_display(test, 0); } @@ -1167,9 +1168,23 @@ static void __init gate_t6041_max_second_usbc(struct kunit *test) gt_max_expect_chain(test, 0, true); gt_max_expect_chain(test, 1, true); gt_max_expect_chain(test, 2, true); + gt_max_expect_chain(test, 3, false); gt_max_expect_display(test, BIT(0) | BIT(1) | BIT(2)); } +/* With all four filled, every external chain comes up, dcpext3's last. */ +static void __init gate_t6041_max_all_externals(struct kunit *test) +{ + unsigned int i; + + for (i = 0; i < 4; i++) + gt_max_fill(test, i); + gt_max_run(test); + for (i = 0; i < 4; i++) + gt_max_expect_chain(test, i, true); + gt_max_expect_display(test, BIT(0) | BIT(1) | BIT(2) | BIT(3)); +} + /* The other processor's chain does not wait for one that was refused. */ static void __init gate_t6041_max_one_processor(struct kunit *test) { @@ -1237,6 +1252,7 @@ static struct kunit_case gate_t6041_max_cases[] __refdata = { KUNIT_CASE(gate_t6041_max_enabled), KUNIT_CASE(gate_t6041_max_no_memory), KUNIT_CASE(gate_t6041_max_second_usbc), + KUNIT_CASE(gate_t6041_max_all_externals), KUNIT_CASE(gate_t6041_max_one_processor), KUNIT_CASE(gate_t6041_max_partial_memory), KUNIT_CASE(gate_t6041_max_enabled_by_loader), diff --git a/drivers/soc/apple/display-gate.c b/drivers/soc/apple/display-gate.c index cde6d7c835d31..825e0d02480f4 100644 --- a/drivers/soc/apple/display-gate.c +++ b/drivers/soc/apple/display-gate.c @@ -3129,10 +3129,22 @@ static const char *const t6041_max_usbc2_nodes[] = { "/dcp@606e00000", }; +/* The third USB-C processor of the J614c/J616c, dcpext3, as dcpext2's chain. */ +static const char *const t6041_max_usbc3_nodes[] = { + "/iommu@306340000", + "/iommu@306300000", + "/mailbox@306e08000", + "/dcp@306e00000/typec-routes/route@0", + "/dcp@306e00000/typec-routes/route@1", + "/dcp@306e00000/typec-routes/route@2", + "/dcp@306e00000", +}; + static const struct gate_staged t6041_max_stages[] = { { "/iommu@3a2300000", t6041_max_hdmi_nodes, ARRAY_SIZE(t6041_max_hdmi_nodes) }, { "/iommu@602300000", t6041_max_usbc_nodes, ARRAY_SIZE(t6041_max_usbc_nodes) }, { "/iommu@606300000", t6041_max_usbc2_nodes, ARRAY_SIZE(t6041_max_usbc2_nodes) }, + { "/iommu@306300000", t6041_max_usbc3_nodes, ARRAY_SIZE(t6041_max_usbc3_nodes) }, }; /* diff --git a/drivers/soc/apple/t6041-gate-test.dtso b/drivers/soc/apple/t6041-gate-test.dtso index e77e3415199a3..9519dad0eea4a 100644 --- a/drivers/soc/apple/t6041-gate-test.dtso +++ b/drivers/soc/apple/t6041-gate-test.dtso @@ -2,7 +2,8 @@ /* * Test device tree for the display gate KUnit test: the J616c's external * display chains at their real paths (t604x-extdisp.dtsi, - * t6041-j616c-hdmi.dtsi, t6041-j616c-usbc.dtsi, t6041-j616c-usbc-dcpext2.dtsi), + * t6041-j616c-hdmi.dtsi, t6041-j616c-usbc.dtsi, t6041-j616c-usbc-dcpext2.dtsi, + * t6041-j616c-usbc-dcpext3.dtsi), * disabled, and the display * subsystem with the internal display's DART. There is no PMP. The data and * heap regions of both processors are the boot loader's disabled @@ -63,6 +64,20 @@ compatible = "apple,asc-mem"; status = "disabled"; }; + + dcpext3_text: dcpext3-text { + compatible = "apple,asc-mem"; + }; + + dcpext3_data: dcpext3-data { + compatible = "apple,asc-mem"; + status = "disabled"; + }; + + dcpext3_heap: dcpext3-heap { + compatible = "apple,asc-mem"; + status = "disabled"; + }; }; power-management@502800000 { @@ -224,6 +239,45 @@ }; }; + dcpext3_dart: iommu@306340000 { + #iommu-cells = <1>; + status = "disabled"; + }; + + dispext3_dart: iommu@306300000 { + #iommu-cells = <1>; + status = "disabled"; + }; + + mailbox@306e08000 { + status = "disabled"; + }; + + dcp@306e00000 { + compatible = "apple,t6041-dcpext"; + iommus = <&dcpext3_dart 23>; + memory-region = <&dcpext3_data>, <&dcpext3_heap>, <&dcpext3_text>; + status = "disabled"; + + typec-routes { + route@0 { + status = "disabled"; + }; + + route@1 { + status = "disabled"; + }; + + route@2 { + status = "disabled"; + }; + }; + + piodma { + iommus = <&dispext3_dart 16>; + }; + }; + disp_dart: iommu@a00000000 { #iommu-cells = <1>; };