Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
220 changes: 220 additions & 0 deletions arch/arm64/boot/dts/apple/t6041-j575c-usbc-dcpext3.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
* A third USB-C DisplayPort processor on the J575c: dcpext3, with a route to
* each of the four back Type-C ports (typec0-3), next to dcpext1 and dcpext2.
*
* The node is the J614c/J616c's (t6041-j616c-usbc-dcpext3.dtsi) with the
* fourth route added: the J575c ADT has dcpext3 at the same address
* (/arm-io/dcpext3 0x106e00000 + 0x2_0000_0000, interrupts +0x48,
* external-index 4, bwr-agent DISP_EXT3 slot 6, dp-switch-ufp-endpoint 3)
* and iBoot preloads and starts it here too (iop-dcpext3-nub pre-loaded 1,
* running 1). As dcpext1 and dcpext2, no PMP and no DISPEXT3 power domain is
* described: the chain runs as iBoot left it powered.
*
* 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>, <&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
* (3) + port (0)
*/
apple,typec-dptx-phys = <0 1 2 3>;
apple,typec-mux-indices = <6 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>;
};
};
};

route@3 {
reg = <3>;
mode-switch;
status = "disabled";

port {
dcpext3_typec3: endpoint {
remote-endpoint = <&typec3_dcpext3>;
};
};
};
};
};

dcpext3_mbox: mailbox@306e08000 {
compatible = "apple,t6041-asc-mailbox", "apple,asc-mailbox-v4";
reg = <0x3 0x06e08000 0x0 0x4000>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 1434 IRQ_TYPE_LEVEL_HIGH>,
<AIC_IRQ 1435 IRQ_TYPE_LEVEL_HIGH>,
<AIC_IRQ 1436 IRQ_TYPE_LEVEL_HIGH>,
<AIC_IRQ 1437 IRQ_TYPE_LEVEL_HIGH>;
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 = <AIC_IRQ 1381 IRQ_TYPE_LEVEL_HIGH>;
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 = <AIC_IRQ 1381 IRQ_TYPE_LEVEL_HIGH>;
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>;
};
};
};
};

&typec3 {
ports {
port@3 {
typec3_dcpext3: endpoint@2 {
reg = <2>;
remote-endpoint = <&dcpext3_typec3>;
};
};
};
};
1 change: 1 addition & 0 deletions arch/arm64/boot/dts/apple/t6041-j575c.dts
Original file line number Diff line number Diff line change
Expand Up @@ -2085,6 +2085,7 @@
#include "t6041-j575c-usb3.dtsi"
#include "t6041-j575c-usbc.dtsi"
#include "t6041-j575c-usbc-dcpext2.dtsi"
#include "t6041-j575c-usbc-dcpext3.dtsi"
#include "t6041-j575c-hdmi.dtsi"

/* Not described: the SEP (no Touch ID sensor). */
Expand Down
78 changes: 77 additions & 1 deletion drivers/soc/apple/display-gate-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1440,10 +1440,22 @@ static void __init gt_max_fill(struct kunit *test, unsigned int i)
static void __init gt_max_expect_chain(struct kunit *test, unsigned int i, bool enabled)
{
const struct gate_staged *st = &t6041_max_stages[i];
unsigned int n;
struct device_node *routes, *route;
unsigned int n, nr_routes = 0;

for (n = 0; n < st->nr; n++)
KUNIT_EXPECT_EQ_MSG(test, gt_okay(test, st->nodes[n]), enabled, "%s", st->nodes[n]);
if (!st->dt_routes)
return;
/* A chain that takes its routes from the tree has every one of them. */
routes = staged_routes(st);
KUNIT_ASSERT_NOT_NULL(test, routes);
for_each_child_of_node(routes, route) {
KUNIT_EXPECT_EQ_MSG(test, of_device_is_available(route), enabled, "%pOF", route);
nr_routes++;
}
of_node_put(routes);
KUNIT_EXPECT_GT(test, nr_routes, 0);
}

/*
Expand Down Expand Up @@ -1525,6 +1537,67 @@ static void __init gate_t6041_max_all_externals(struct kunit *test)
gt_max_expect_display(test, BIT(0) | BIT(1) | BIT(2) | BIT(3));
}

/*
* dcpext3 takes its routes from the tree: with a route to a fourth Type-C port,
* as the J575c has, that route comes up with the chain too.
*/
static void __init gate_t6041_max_dt_routes(struct kunit *test)
{
struct gate_test *t = test->priv;
struct device_node *route;

route = of_changeset_create_node(&t->cs, gt_node(test, "/dcp@306e00000/typec-routes"),
"route@3");
KUNIT_ASSERT_NOT_NULL(test, route);
KUNIT_ASSERT_EQ(test, of_changeset_add_prop_u32(&t->cs, route, "reg", 3), 0);
KUNIT_ASSERT_EQ(test, of_changeset_add_prop_string(&t->cs, route, "status", "disabled"), 0);
gt_max_fill(test, 3);
gt_max_run(test);
gt_max_expect_chain(test, 3, true);
KUNIT_EXPECT_TRUE(test, gt_okay(test, "/dcp@306e00000/typec-routes/route@3"));
gt_max_expect_display(test, BIT(3));
}

static void __init gt_max_expect_dt_routes_refused(struct kunit *test)
{
const struct gate_staged *st = &t6041_max_stages[3];
struct device_node *display = gt_node(test, "/display-subsystem");
unsigned int n;

gt_max_fill(test, 3);
gt_max_run(test);
for (n = 0; n < st->nr; n++)
KUNIT_EXPECT_FALSE_MSG(test, gt_okay(test, st->nodes[n]), "%s", st->nodes[n]);
gt_max_expect_display(test, 0);

/* Direct application refuses it too and leaves the changeset untouched. */
if (gt_okay(test, st->nodes[st->nr - 1]))
return;
KUNIT_EXPECT_EQ(test, t6041_max_apply(3, display), -ENODEV);
for (n = 0; n < st->nr; n++)
KUNIT_EXPECT_FALSE_MSG(test, gt_okay(test, st->nodes[n]), "%s", st->nodes[n]);
gt_max_expect_display(test, 0);
}

/* A dt_routes stage whose typec-routes container is missing stays off whole. */
static void __init gate_t6041_max_dt_routes_missing(struct kunit *test)
{
gt_detach(test, "/dcp@306e00000/typec-routes/route@0");
gt_detach(test, "/dcp@306e00000/typec-routes/route@1");
gt_detach(test, "/dcp@306e00000/typec-routes/route@2");
gt_detach(test, "/dcp@306e00000/typec-routes");
gt_max_expect_dt_routes_refused(test);
}

/* A dt_routes stage whose typec-routes container has no routes stays off whole. */
static void __init gate_t6041_max_dt_routes_empty(struct kunit *test)
{
gt_detach(test, "/dcp@306e00000/typec-routes/route@0");
gt_detach(test, "/dcp@306e00000/typec-routes/route@1");
gt_detach(test, "/dcp@306e00000/typec-routes/route@2");
gt_max_expect_dt_routes_refused(test);
}

/* The other processor's chain does not wait for one that was refused. */
static void __init gate_t6041_max_one_processor(struct kunit *test)
{
Expand Down Expand Up @@ -1646,6 +1719,9 @@ static struct kunit_case gate_t6041_max_cases[] __refdata = {
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_dt_routes),
KUNIT_CASE(gate_t6041_max_dt_routes_missing),
KUNIT_CASE(gate_t6041_max_dt_routes_empty),
KUNIT_CASE(gate_t6041_max_one_processor),
KUNIT_CASE(gate_t6041_max_partial_memory),
KUNIT_CASE(gate_t6041_max_enabled_by_loader),
Expand Down
Loading
Loading