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
10 changes: 9 additions & 1 deletion drivers/gpu/drm/apple/dcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7197,8 +7197,16 @@ static int dcp_platform_probe_pipe(struct platform_device *pdev)
}

fw_compat = dcp_check_firmware_version(dev);
if (fw_compat == DCP_FIRMWARE_UNKNOWN)
if (fw_compat == DCP_FIRMWARE_UNKNOWN) {
/*
* The firmware does not change until the next boot, so this
* processor never registers its Type-C display routes: disable
* them, so that the port controllers that name them as their
* mode switch do not wait for them, and USB on the ports goes on.
*/
dcp_typec_routes_disable_dev(dev);
return -ENODEV;
}
if (fw_compat == DCP_FIRMWARE_V_26_6_DESKTOP ||
(fw_compat == DCP_FIRMWARE_V_27_0 &&
of_device_is_compatible(dev->of_node, "apple,t6041-dcp"))) {
Expand Down
16 changes: 9 additions & 7 deletions drivers/phy/apple/atc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4638,14 +4638,16 @@ static int atcphy_usb3_power_off(struct phy *phy)
return ret;
atcphy->t8103_usb3_retry = false;
/*
* T8132 keeps DWC3 on the dummy PIPE while USB4/Thunderbolt owns the
* lanes. Stopping that USB host must not take the dock's PCIe and DP
* tunnels down before their drivers suspend. The Type-C mux owns the
* CIO mode and releases it when the connection ends. A CIO mode whose
* last transition failed is still taken down, as before.
* In USB4/Thunderbolt the router owns the lanes: dwc3 only had its PIPE
* on the router's USB3 adapter (or on the dummy backend), and that is
* parked above. Stopping the USB host, for a cable change or only for a
* data role swap, must not take the router's link down with it: that
* drops a host-to-host link, and a dock's PCIe and DP tunnels, before
* their drivers know. The Type-C mux owns the CIO mode and releases it
* when the connection ends. A CIO mode whose last transition failed is
* still taken down, as before.
*/
if (atcphy->hw->gen == ATCPHY_GENERATION_T8132 && atcphy_mode_is_cio(atcphy->mode) &&
!atcphy->mode_dirty)
if (atcphy_mode_is_cio(atcphy->mode) && !atcphy->mode_dirty)
return 0;
/*
* dwc3 can tear its host down while a DisplayPort alt mode link is up,
Expand Down
29 changes: 17 additions & 12 deletions tools/asahi/atc-usb3-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
T600x/T8112/T602x still match the T8103 PHY fallback but keep their previous
single-poll/BIST/role behavior. OF compatible lookup is a modeled boundary.
The DT-to-driver match contract is checked from the actual sources.
T8132 cases cover CIO ownership during USB host shutdown; its lane setup
CIO ownership during USB host shutdown is covered on T8103 and T8132; T8132 lane setup
and electrical behavior are not modeled. Hardware qualification remains necessary.
Run --mutations for sensitivity checks.
"""
Expand Down Expand Up @@ -398,14 +398,17 @@ def block(source, marker):
assert(atcphy_usb3_power_off(&phy)==-ETIMEDOUT);assert(!configure_calls);
unlock_ret=0;assert(!atcphy_usb3_power_off(&phy));assert(p.mode==APPLE_ATCPHY_MODE_USB3_DP&&!configure_calls&&!p.t8103_usb3_retry&&!p.t8103_dummy_pending);
}
static void t8132_usb_stop_keeps_cio_until_mux_disconnect(void) {
static void usb_stop_keeps_cio_until_mux_disconnect(void) {
const enum atcphy_mode modes[] = { APPLE_ATCPHY_MODE_TBT, APPLE_ATCPHY_MODE_USB4 };
for (unsigned i=0;i<2;i++) {
reset(ATCPHY_GENERATION_T8132,false);p.mode=modes[i];p.typec_mode=modes[i];p.host_active=true;
/* Every generation: T8112 and T600x run the T8103 PHY sequence. */
const enum atcphy_generation gens[] = { ATCPHY_GENERATION_T8103, ATCPHY_GENERATION_T8132 };
for (unsigned g=0;g<2;g++) for (unsigned i=0;i<2;i++) {
reset(gens[g],false);p.mode=modes[i];p.typec_mode=modes[i];p.host_active=true;
assert(!atcphy_usb3_power_off(&phy));
assert(!p.host_active&&p.mode==modes[i]&&!configure_calls&&atcphy_rpm_busy(&p));
assert(!atcphy_dwc3_reset_assert(&p.rcdev,0));
assert(p.mode==modes[i]&&!configure_calls&&atcphy_rpm_busy(&p)&&usb2_power_off_calls==1);
if (gens[g]!=ATCPHY_GENERATION_T8132) continue; /* the OFF lane setup is modeled for T8132 only */
model_t8132_off=true;
assert(!atcphy_mux_switch(&p,APPLE_ATCPHY_MODE_OFF));
assert(p.mode==APPLE_ATCPHY_MODE_OFF&&configure_calls==1&&!atcphy_rpm_busy(&p));
Expand Down Expand Up @@ -614,7 +617,7 @@ def block(source, marker):
TEST(usb4_and_dead_parking_single_poll);TEST(early_host_and_device);TEST(early_admission_and_failure);TEST(later_off_and_bist_unchanged);TEST(success_only_all_generations);
TEST(live_lock_failure_restores_masks);TEST(live_park_then_pending_completion);TEST(legacy_live_dispatch_and_generation);TEST(pending_blocks_lane_and_backend);
TEST(canceled_lane_change_reconnects);TEST(role_finishes_pending);TEST(target_failure_preserves_reconnect);TEST(nonusb_commit_clears_retry);TEST(dp_assignment_d_retains_usb3);TEST(modern_safe_refusal_retained);
TEST(fixed_hub_host_dispatch);TEST(reset_release_retries_before_writes);TEST(reset_assert_failure_and_stop);TEST(power_off_preserves_dp_and_finishes_pending);TEST(t8132_usb_stop_keeps_cio_until_mux_disconnect);TEST(setup_known_reset_clears_obligations);TEST(target_mode_table_and_dirty);
TEST(fixed_hub_host_dispatch);TEST(reset_release_retries_before_writes);TEST(reset_assert_failure_and_stop);TEST(power_off_preserves_dp_and_finishes_pending);TEST(usb_stop_keeps_cio_until_mux_disconnect);TEST(setup_known_reset_clears_obligations);TEST(target_mode_table_and_dirty);
TEST(lock_timeout_left_to_caller);
printf("%u ATCPHY USB3 host cases passed\n",tests);
}
Expand Down Expand Up @@ -731,13 +734,15 @@ def harness(source):
return PRELUDE + defines + "\n" + "\n".join(usb_defines) + "\n" + types + "\n" + table + stubs + functions + scope_c + TESTS


MUTATIONS = {'t8132-usb-stop-keeps-dirty-cio': ('atcphy_usb3_power_off',
'&&\n\t !atcphy->mode_dirty)', ')'),
't8132-usb-stop-drops-cio': ('atcphy_usb3_power_off',
'atcphy->hw->gen == ATCPHY_GENERATION_T8132 && atcphy_mode_is_cio(atcphy->mode)', 'false'),
't8132-usb-stop-keeps-usb-too': ('atcphy_usb3_power_off',
'atcphy->hw->gen == ATCPHY_GENERATION_T8132 && atcphy_mode_is_cio(atcphy->mode)',
'atcphy->hw->gen == ATCPHY_GENERATION_T8132'),
MUTATIONS = {'usb-stop-keeps-dirty-cio': ('atcphy_usb3_power_off',
'atcphy_mode_is_cio(atcphy->mode) && !atcphy->mode_dirty)', 'atcphy_mode_is_cio(atcphy->mode))'),
'usb-stop-drops-cio': ('atcphy_usb3_power_off',
'atcphy_mode_is_cio(atcphy->mode) && !atcphy->mode_dirty', 'false'),
'usb-stop-keeps-usb-too': ('atcphy_usb3_power_off',
'atcphy_mode_is_cio(atcphy->mode) && !atcphy->mode_dirty', '!atcphy->mode_dirty'),
'usb-stop-keeps-cio-t8132-only': ('atcphy_usb3_power_off',
'atcphy_mode_is_cio(atcphy->mode) && !atcphy->mode_dirty',
'atcphy->hw->gen == ATCPHY_GENERATION_T8132 && atcphy_mode_is_cio(atcphy->mode) && !atcphy->mode_dirty'),
'no-live-retry': ('atcphy_pipehandler_lock_live', '? 10 : 1;', '? 1 : 1;'),
'retry-later-generations': ('atcphy_pipehandler_lock_live', '? 10 : 1;', '? 10 : 10;'),
'sleep-after-last': ('atcphy_pipehandler_lock_live', 'if (attempt + 1 < attempts)', 'if (true)'),
Expand Down
Loading