summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2020-05-12 08:09:36 -0600
committerCommit Bot <commit-bot@chromium.org>2020-05-12 23:21:26 +0000
commit287478e7db8bd5a21a0c257574b4461e3518163f (patch)
treed8093d6aacec6a59e5c8ccf1073750e793aba313
parent0974bfefec4b41b1af3fe4879ab9355157f739d1 (diff)
downloadchrome-ec-287478e7db8bd5a21a0c257574b4461e3518163f.tar.gz
tcpmv2: hard reset AutoDischarge enable only when needed
The allow unattach path is common code in PE and it gets called even if we are not doing Hard Reset. This can change AutoDischarge to be incorrect during a PR Swap. So guard this code to only being performed if we are actually in a Hard Reset. BUG=none BRANCH=none TEST=check Hard Reset and PR Swap Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ie7e9084d41432d6c449aaaa189b3a55d0dd7f780 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2196642 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 37eeffeb23..b0c321b27a 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -710,10 +710,13 @@ void tc_hard_reset_request(int port)
*/
void tc_hard_reset_allow_unattach(int port)
{
- TC_CLR_FLAG(port, TC_FLAGS_HARD_RESET_NO_UNATTACH);
+ /* Only deal with HardReset if we are currently doing HardReset */
+ if (TC_CHK_FLAG(port, TC_FLAGS_HARD_RESET_NO_UNATTACH)) {
+ TC_CLR_FLAG(port, TC_FLAGS_HARD_RESET_NO_UNATTACH);
- /* Enable AutoDischargeDisconnect */
- tcpm_enable_auto_discharge_disconnect(port, 1);
+ /* Enable AutoDischargeDisconnect */
+ tcpm_enable_auto_discharge_disconnect(port, 1);
+ }
}
void tc_disc_ident_in_progress(int port)