diff options
author | Scott Collyer <scollyer@google.com> | 2021-03-08 18:04:39 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-17 19:13:42 +0000 |
commit | ef96869a8d0c587584d181cd05d331372d507b3a (patch) | |
tree | 4aaa576b4ed0f94a1d6222dbb143f587484e6580 /common | |
parent | 6f12cb4866278a10e08bd6dd5e8f8e77119f3063 (diff) | |
download | chrome-ec-ef96869a8d0c587584d181cd05d331372d507b3a.tar.gz |
TCPMv2: PE/DPM: Don't preemptively set modal flag
Currently we are setting the modal flag as a DFP when the ENTER
command is being sent, without confirmation of the ACK reply from the
UFP. This CL keeps this behavior for TCPMv1, but moves the setting of
the modal flag into the alt mode specific state machine. Currently, we
only support DP and Thunderbolt alt modes.
When the modal flag is set pre-emptively, we will fail the TDA.2.2.3:
BMC-PROT-SEQ-DRSWAP compliance test. This is because we trigger a
hard reset if the modal flag is set and we receive a data role swap
request.
BUG=b:180764800,b:159946351,b:181386294
BRANCH=None
TEST=Verifed that TDA.2.2.3: BMC-PROT-SEQ-DRSWAP passes on quiche
Signed-off-by: Scott Collyer <scollyer@google.com>
Change-Id: I4ae527903859e8ffdb01f355606c5d0f7d177def
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2751329
Commit-Queue: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_pd_alt_mode_dfp.c | 8 | ||||
-rw-r--r-- | common/usbc/dp_alt_mode.c | 2 | ||||
-rw-r--r-- | common/usbc/tbt_alt_mode.c | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c index 1c683145f1..c671616da6 100644 --- a/common/usb_pd_alt_mode_dfp.c +++ b/common/usb_pd_alt_mode_dfp.c @@ -250,10 +250,12 @@ uint32_t pd_dfp_enter_mode(int port, enum tcpm_transmit_type type, /* * Strictly speaking, this should only happen when the request * has been ACKed. - * TODO(b/159854667): Redo setting the enter mode flag to incorporate - * it into the DP state machine. + * For TCPMV1, still set modal flag pre-emptively. For TCPMv2, the modal + * flag is set when the ENTER command is ACK'd for each alt mode that is + * supported. */ - pd_set_dfp_enter_mode_flag(port, true); + if (IS_ENABLED(CONFIG_USB_PD_TCPMV1)) + pd_set_dfp_enter_mode_flag(port, true); /* SVDM to send to UFP for mode entry */ return VDO(modep->fx->svid, 1, CMD_ENTER_MODE | VDO_OPOS(modep->opos)); diff --git a/common/usbc/dp_alt_mode.c b/common/usbc/dp_alt_mode.c index 8e22c23170..321fe1c884 100644 --- a/common/usbc/dp_alt_mode.c +++ b/common/usbc/dp_alt_mode.c @@ -123,6 +123,8 @@ void dp_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count, case DP_START: case DP_ENTER_RETRY: dp_state[port] = DP_ENTER_ACKED; + /* Inform PE layer that alt mode is now active */ + pd_set_dfp_enter_mode_flag(port, true); break; case DP_ENTER_ACKED: /* DP status response & UFP's DP attention have same payload. */ diff --git a/common/usbc/tbt_alt_mode.c b/common/usbc/tbt_alt_mode.c index 3ce66f7e5d..de296aa216 100644 --- a/common/usbc/tbt_alt_mode.c +++ b/common/usbc/tbt_alt_mode.c @@ -290,6 +290,8 @@ void intel_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count, tbt_state[port] = TBT_ACTIVE; tbt_prints("enter mode SOP", port); TBT_SET_FLAG(port, TBT_FLAG_RETRY_DONE); + /* Indicate to PE layer that alt mode is active */ + pd_set_dfp_enter_mode_flag(port, true); break; case TBT_ACTIVE: tbt_prints("exit mode SOP", port); |