diff options
author | Caveh Jalali <caveh@chromium.org> | 2021-06-10 14:17:33 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-11 21:20:39 +0000 |
commit | c1da363a46b718f12089189f0dab30172d33105a (patch) | |
tree | 43e2f452023eb994fa201302f12544ace246bf9f /common | |
parent | 4a46ad60f03301f0184df4a0f977b02cfeb3a1f7 (diff) | |
download | chrome-ec-c1da363a46b718f12089189f0dab30172d33105a.tar.gz |
common/usbc: Allow boards to determine DTS (CCD) port
This adds support for a board specific function to determine if a
particular port supports DTS (Debug and Test System) - more commonly
known as the CCD port. Typically, only one port supports CCD and we
should not enter debug accessory mode on non-CCD ports.
The default implementation simply returns true which is equivalent to
the original behavior. Boards can override board_is_dts_port() to limit
entering debug accessory mode to specific ports.
BRANCH=none
BUG=b:188851792
TEST=buildall passes
Change-Id: I10ad3cbed68478b23379b5f7ec6eff6ebae11084
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2954196
Reviewed-by: Diana Z <dzigterman@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_common.c | 5 | ||||
-rw-r--r-- | common/usbc/usb_tc_drp_acc_trysrc_sm.c | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/common/usb_common.c b/common/usb_common.c index dc8fb21e0a..9e17c0d98c 100644 --- a/common/usb_common.c +++ b/common/usb_common.c @@ -356,6 +356,11 @@ __overridable bool board_is_usb_pd_port_present(int port) return (port >= 0) && (port < board_get_usb_pd_port_count()); } +__overridable bool board_is_dts_port(int port) +{ + return true; +} + int pd_get_retry_count(int port, enum tcpm_transmit_type type) { /* PD 3.0 6.7.7: nRetryCount = 2; PD 2.0 6.6.9: nRetryCount = 3 */ diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c index 554cf5129b..d84b2c5216 100644 --- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c +++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c @@ -2321,7 +2321,7 @@ static void tc_attach_wait_snk_run(const int port) /* Check for connection */ tcpm_get_cc(port, &cc1, &cc2); - if (cc_is_rp(cc1) && cc_is_rp(cc2)) + if (cc_is_rp(cc1) && cc_is_rp(cc2) && board_is_dts_port(port)) new_cc_state = PD_CC_DFP_DEBUG_ACC; else if (cc_is_rp(cc1) || cc_is_rp(cc2)) new_cc_state = PD_CC_DFP_ATTACHED; @@ -2855,9 +2855,12 @@ static void tc_attach_wait_src_run(const int port) /* Check for connection */ tcpm_get_cc(port, &cc1, &cc2); - /* Debug accessory */ - if (cc_is_snk_dbg_acc(cc1, cc2)) { - /* Debug accessory */ + if (cc_is_snk_dbg_acc(cc1, cc2) && board_is_dts_port(port)) { + /* + * Debug accessory. + * A debug accessory in a non-DTS port will be + * recognized by at_least_one_rd as UFP attached. + */ new_cc_state = PD_CC_UFP_DEBUG_ACC; } else if (cc_is_at_least_one_rd(cc1, cc2)) { /* UFP attached */ |