diff options
author | Abe Levkoy <alevkoy@chromium.org> | 2020-11-17 18:20:29 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-22 00:01:57 +0000 |
commit | 251827028c193eea50630ece1b22b4513e167cd2 (patch) | |
tree | 96b267fd8272fb734fe4671169472b79c7376f6d /include | |
parent | 2034650b0b3aeb6685f26334491e9f5cacbe915e (diff) | |
download | chrome-ec-251827028c193eea50630ece1b22b4513e167cd2.tar.gz |
TCPMv2: Support BIST Test Mode
After the first BIST Test Data packet, enable BIST Test Mode if the TCPC
supports it (currently just TCPCI). While in BIST Test Mode, mask
ALERT.ReceivedSOP*MessageStatus. Unmask it when the test ends, due to
Hard Reset or to detach.
BUG=b:173023378,b:169385081,b:172709198,b:173028832,b:173028791
BUG=b:173141941,b:173142113
TEST=Complete TDA.2.1.2.2 BMC PHY RX INT REJ on volteer without running
out of Rx buffer space or watchdog timeout (still fail though)
BRANCH=firmware-volteer-13521.B-master
Signed-off-by: Abe Levkoy <alevkoy@chromium.org>
Change-Id: I03bbc4cfacceebd0334aa814e11a16e09177a322
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2545667
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/driver/tcpm/tcpci.h | 4 | ||||
-rw-r--r-- | include/driver/tcpm/tcpm.h | 11 | ||||
-rw-r--r-- | include/usb_pd_tcpm.h | 12 |
3 files changed, 27 insertions, 0 deletions
diff --git a/include/driver/tcpm/tcpci.h b/include/driver/tcpm/tcpci.h index 44af755c8b..8e2d288fa0 100644 --- a/include/driver/tcpm/tcpci.h +++ b/include/driver/tcpm/tcpci.h @@ -9,6 +9,7 @@ #define __CROS_EC_USB_PD_TCPM_TCPCI_H #include "config.h" +#include "ec_commands.h" #include "tcpm/tcpm.h" #include "usb_mux.h" #include "usb_pd_tcpm.h" @@ -67,6 +68,7 @@ */ #define TCPC_REG_TCPC_CTRL_EN_LOOK4CONNECTION_ALERT BIT(6) #define TCPC_REG_TCPC_CTRL_DEBUG_ACC_CONTROL BIT(4) +#define TCPC_REG_TCPC_CTRL_BIST_TEST_MODE BIT(1) #define TCPC_REG_ROLE_CTRL 0x1a #define TCPC_REG_ROLE_CTRL_DRP_MASK BIT(6) @@ -265,6 +267,8 @@ int tcpci_tcpc_drp_toggle(int port); #ifdef CONFIG_USB_PD_TCPC_LOW_POWER int tcpci_enter_low_power_mode(int port); #endif +enum ec_error_list tcpci_set_bist_test_mode(const int port, + const bool enable); #ifdef CONFIG_USB_PD_DISCHARGE_TCPC void tcpci_tcpc_discharge_vbus(int port, int enable); #endif diff --git a/include/driver/tcpm/tcpm.h b/include/driver/tcpm/tcpm.h index 9a00a4f402..092b266784 100644 --- a/include/driver/tcpm/tcpm.h +++ b/include/driver/tcpm/tcpm.h @@ -353,6 +353,17 @@ static inline int tcpm_get_chip_info(int port, int live, return EC_ERROR_UNIMPLEMENTED; } +static inline enum ec_error_list tcpc_set_bist_test_mode(int port, bool enable) +{ + const struct tcpm_drv *tcpc; + int rv = EC_SUCCESS; + + tcpc = tcpc_config[port].drv; + if (tcpc->set_bist_test_mode) + rv = tcpc->set_bist_test_mode(port, enable); + return rv; +} + #ifdef CONFIG_USB_PD_FRS_TCPC static inline int tcpm_set_frs_enable(int port, int enable) { diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h index 8cc5543c53..885ca24f71 100644 --- a/include/usb_pd_tcpm.h +++ b/include/usb_pd_tcpm.h @@ -9,6 +9,7 @@ #define __CROS_EC_USB_PD_TCPM_H #include <stdbool.h> +#include "common.h" #include "ec_commands.h" #include "i2c.h" @@ -445,6 +446,17 @@ struct tcpm_drv { */ int (*handle_fault)(int port, int fault); + /** + * Controls BIST Test Mode (or analogous functionality) in the TCPC and + * associated behavior changes. Disables message Rx alerts while the + * port is in Test Mode. + * + * @param port USB-C port number + * @param enable true to enter BIST Test Mode; false to exit + * @return EC_SUCCESS or error code + */ + enum ec_error_list (*set_bist_test_mode)(int port, bool enable); + #ifdef CONFIG_CMD_TCPC_DUMP /** * Dump TCPC registers |