summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-03-29 15:09:31 -0600
committerCommit Bot <commit-bot@chromium.org>2021-04-07 16:55:32 +0000
commit2abe7b9dd89775e9fe75371a48e66b921d6c0cd3 (patch)
tree833a4f8cfdd87a7106082aa76d62e117cd095e77
parent90d13cec6728a45ff1720325cf50ac21ec890e5c (diff)
downloadchrome-ec-2abe7b9dd89775e9fe75371a48e66b921d6c0cd3.tar.gz
TCPMv2: Detach from debug devices in Unattached entry
Call debug detach routine on the TCPC before setting our terminations in Unattached.SNK/SRC. This will cover more code paths than attempting to ensure we call the debug detach from every possible chipset transition, sysjump, etc. Note we should still debug detach in Attached exits when PR swapping. BRANCH=None BUG=b:183619502 TEST=on Galith, confirm that: - firmware_UserRequestRecovery passes reliably - board is able to boot with no battery and a charger attached in either port Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I6cef8ce57a569b0e15e1e10b77c830b1c7a55d75 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2792690 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 786608d568..9f2dee16db 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -1815,12 +1815,7 @@ static void pd_update_dual_role_config(int port)
* Change to sink if port is currently a source AND (new DRP
* state is force sink OR new DRP state is toggle off and we are
* in the source disconnected state).
- *
- * Force a debug detach in case there was an incomplete debug
- * connection in progress.
*/
- if (get_state_tc(port) != TC_ATTACHED_SRC)
- tcpm_debug_detach(port);
set_state_tc(port, TC_UNATTACHED_SNK);
} else if (tc[port].power_role == PD_ROLE_SINK &&
drp_state[port] == PD_DRP_FORCE_SOURCE) {
@@ -1828,8 +1823,6 @@ static void pd_update_dual_role_config(int port)
* Change to source if port is currently a sink and the
* new DRP state is force source.
*/
- if (get_state_tc(port) != TC_ATTACHED_SNK)
- tcpm_debug_detach(port);
set_state_tc(port, TC_UNATTACHED_SRC);
}
}
@@ -2156,7 +2149,12 @@ static void tc_unattached_snk_entry(const int port)
* ground through Rd.
*
* Restore default current limit Rp in case we swap to source
+ *
+ * Run any debug detaches needed before setting CC, as some TCPCs may
+ * require we set CC Open before changing power roles with a debug
+ * accessory.
*/
+ tcpm_debug_detach(port);
typec_select_pull(port, TYPEC_CC_RD);
typec_select_src_current_limit_rp(port, CONFIG_USB_PD_PULLUP);
typec_update_cc(port);
@@ -2706,7 +2704,12 @@ static void tc_unattached_src_entry(const int port)
* ground through Rp.
*
* Restore default current limit Rp.
+ *
+ * Run any debug detaches needed before setting CC, as some TCPCs may
+ * require we set CC Open before changing power roles with a debug
+ * accessory.
*/
+ tcpm_debug_detach(port);
typec_select_pull(port, TYPEC_CC_RP);
typec_select_src_current_limit_rp(port, CONFIG_USB_PD_PULLUP);
typec_update_cc(port);