From 46a56188b0fc517aa24a6316ae53958f21058159 Mon Sep 17 00:00:00 2001 From: Sean Dolbec Date: Wed, 11 Nov 2026 17:31:59 -0500 Subject: [PATCH 1/2] usb: typec: tipd: Set a USB role for TBT3 on T8132 ports without a router cd321x_update_work() derives the USB role only from the USB2 and USB3 connection bits of DATA_STATUS. In Thunderbolt 3 alt mode the controller sets neither: on the Mac mini (J773g) a Thunderbolt 3 dock gives DATA_STATUS 0x86010001, which has the data connection and TBT connection bits and a TBT cable speed, but no USB2, USB3, DisplayPort or USB4 connection bit. The role stays USB_ROLE_NONE and the port's dwc3 never starts an xHCI. That is right for a port with a USB4/Thunderbolt router, which tunnels the partner's USB. The J773g's ports have no router, and their T8132 PHY has no CIO calibration, so the PHY serves the partner's USB2 instead of the Thunderbolt link. Without a USB role nothing uses it. On a T8132 SN201202x port without a router, give a TBT or USB4 connection that reports no USB2 or USB3 connection the USB role of the port's Type-C data role, taken from STATUS, since DATA_STATUS reports no USB connection to take the USB data role from. Ports with a router, and other SoCs, are unchanged. Assisted-by: LLM checkpatch Signed-off-by: Sean Dolbec --- drivers/usb/typec/tipd/core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index a43e56d31133a..68b5a99857ec9 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -1151,6 +1151,21 @@ static void cd321x_update_work(struct work_struct *work) new_role = USB_ROLE_DEVICE; else new_role = USB_ROLE_HOST; + } else if (new_connected && !cd321x->tbt_switch && + device_is_compatible(tps->dev, "apple,t8132-sn201202x") && + (st.data_status & (TPS_DATA_STATUS_TBT_CONNECTION | + CD321X_DATA_STATUS_USB4_CONNECTION))) { + /* + * In Thunderbolt 3 alt mode the controller reports neither a + * USB2 nor a USB3 connection. With a USB4/Thunderbolt router, + * the partner's USB is tunnelled through it. A T8132 port + * without a router has nothing to tunnel through, and a T8132 + * PHY without the CIO calibration serves the partner's USB 2.0 + * on D+/D- instead of the link. Give the port the USB role of + * its Type-C data role, or its USB controller never starts. + */ + new_role = TPS_STATUS_TO_TYPEC_DATAROLE(st.status) == TYPEC_HOST ? + USB_ROLE_HOST : USB_ROLE_DEVICE; } if (new_connected) { From 9b0ca0025809c0d0d22fe9e0200c334898fc1f2e Mon Sep 17 00:00:00 2001 From: Sean Dolbec Date: Thu, 12 Nov 2026 10:07:53 -0500 Subject: [PATCH 2/2] selftests: apple-dcp: declare the Type-C data role in the lifecycle shim The lifecycle harness builds cd321x_update_work() from tipd/core.c on the host. It now compares the STATUS data role against TYPEC_HOST for a T8132 TBT3 port without a router, and the shim had no enum typec_data_role, so physical-disconnect, fast-replug-bounce and dropped-swap-teardown failed to compile. Declare the enum as include/linux/usb/typec.h does. Assisted-by: LLM Signed-off-by: Sean Dolbec --- tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py b/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py index 86a95e0f4178e..eda67bec94e7f 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py @@ -194,6 +194,7 @@ def function(file, name): enum usb_role { USB_ROLE_NONE, USB_ROLE_HOST, USB_ROLE_DEVICE }; enum typec_pwr_opmode { TYPEC_PWR_MODE_USB, TYPEC_PWR_MODE_PD }; enum typec_orientation { TYPEC_ORIENTATION_NONE, TYPEC_ORIENTATION_NORMAL, TYPEC_ORIENTATION_REVERSE }; +enum typec_data_role { TYPEC_DEVICE, TYPEC_HOST }; struct usb_pd_identity { int id; }; static void * __attribute__((unused)) memchr_inv(const void *p, int c, size_t n) { const unsigned char *b = p; for (size_t i = 0; i < n; i++) if (b[i] != (unsigned char)c) return (void *)(b + i); return NULL; }