From 5cbb8b80b52abe1df380e65c1c0ad1008d7449f3 Mon Sep 17 00:00:00 2001 From: Abe Levkoy Date: Tue, 3 May 2022 15:47:30 -0600 Subject: TCPMv2: Wait for VCONN discharge during Data Reset During PE_DDR_Perform_Data_Reset, do not start tVconnReapplied until VCONN has discharged, according to the VCONN transition time configured for the board. BUG=b:209625351,b:209624473 TEST=Observe DFP-initiated Data Reset with scope on VCONN BRANCH=none Signed-off-by: Abe Levkoy Change-Id: I8d0e59b4b873d26f179e9d4b1b3ca0f93d944b8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3625573 Reviewed-by: Diana Z --- common/usbc/usb_pe_drp_sm.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index bafbbbdbad..6906c4c6f8 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -7607,8 +7607,14 @@ static void pe_ddr_perform_data_reset_run(int port) if (IS_ENABLED(CONFIG_USBC_VCONN) && !tc_is_vconn_src(port) && PE_CHK_FLAG(port, PE_FLAGS_VCONN_SWAP_COMPLETE)) { PE_CLR_FLAG(port, PE_FLAGS_VCONN_SWAP_COMPLETE); + /* Wait until VCONN has discharged to start tVconnReapplied. */ + pd_timer_enable(port, PE_TIMER_TIMEOUT, + CONFIG_USBC_VCONN_SWAP_DELAY_US); + } else if (IS_ENABLED(CONFIG_USBC_VCONN) && + pd_timer_is_expired(port, PE_TIMER_TIMEOUT)) { + pd_timer_disable(port, PE_TIMER_TIMEOUT); pd_timer_enable(port, PE_TIMER_VCONN_REAPPLIED, - PD_T_VCONN_REAPPLIED); + PD_T_VCONN_REAPPLIED); } else if (IS_ENABLED(CONFIG_USBC_VCONN) && pd_timer_is_expired(port, PE_TIMER_VCONN_REAPPLIED)) { pd_request_vconn_swap_on(port); @@ -7616,9 +7622,9 @@ static void pe_ddr_perform_data_reset_run(int port) /* * 4) After tDataReset the DFP shall: - * a) Reconnect the [USB 2.0] D+/D- signals - * b) If the Port was operating in [USB 3.2] or [USB4] - * reapply the port’s Rx Terminations + * a) Reconnect the USB 2.0 D+/D- signals. + * b) If the Port was operating in USB 3.2 or USB4 reapply + * the port’s Rx Terminations. * TODO: Section 6.3.14 implies that tDataReset is a minimum * time for the DFP to leave the lines disconnected during Data * Reset, possibly starting after the cable reset. Section -- cgit v1.2.1