TCPMv2: Fix Soft Reset logic
TEST=Observe Soft Reset after not receiving GoodCRC 3 times
BRANCH=firmware-volteer-13521.B-master
@@ -1233,14 +1233,23 @@ void pe_report_error(int port, enum pe_error e, enum tcpm_transmit_type type)
* See section 8.3.3.4.1.1 PE_SRC_Send_Soft_Reset State:
*
* The PE_Send_Soft_Reset state shall be entered from
- * any state when a Protocol Error is detected by
- * Protocol Layer during a Non-Interruptible AMS or when
- * Message has not been sent after retries. When an explicit
- * contract is not in effect. Otherwise go to PE_Snk/Src_Ready
- */
- if (!PE_CHK_FLAG(port, PE_FLAGS_EXPLICIT_CONTRACT) &&
- (!PE_CHK_FLAG(port, PE_FLAGS_INTERRUPTIBLE_AMS)
- || (e == ERR_TCH_XMIT))) {
+ * any state when
+ * * A Protocol Error is detected by Protocol Layer during a
+ * Non-Interruptible AMS or
+ * * A message has not been sent after retries or
+ * * When not in an explicit contract and
+ * * Protocol Errors occurred on SOP during an Interruptible AMS or
+ * * Protocol Errors occurred on SOP during any AMS where the first
+ * Message in the sequence has not yet been sent i.e. an unexpected
+ * Message is received instead of the expected GoodCRC Message
+ * response.
+ */
+ /* All error types besides transmit errors are Protocol Errors. */
+ if ((e != ERR_TCH_XMIT &&
+ !PE_CHK_FLAG(port, PE_FLAGS_INTERRUPTIBLE_AMS))
+ || e == ERR_TCH_XMIT
+ || (!PE_CHK_FLAG(port, PE_FLAGS_EXPLICIT_CONTRACT) &&
+ type == TCPC_TX_SOP)) {
pe_send_soft_reset(port, type);
}
/*
