summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2021-03-10 21:47:53 -0800
committerCommit Bot <commit-bot@chromium.org>2021-03-16 16:51:46 +0000
commit16aaf46a09b0b0f8b140ea639fe280c222d7b84c (patch)
treea78f3173ba83cb3edf3428aa743715fd60f9c031 /driver
parent1fa94b164460c1e79775f052eafdf03bc450e68f (diff)
downloadchrome-ec-16aaf46a09b0b0f8b140ea639fe280c222d7b84c.tar.gz
ucpd: Add support to turn off type-2 BIST mode
This CL adds changes to the ucpd driver to support turning off BIST mode once it's been started. For ucpd, the peripheral has to be disabled and reset for this purpose. BUG=b:182436876 BRANCH=None TEST=Verfied that honeybuns can pass TDA.2.1.1.1: BMC-PHY-TX-EYE compliance test, which previously was failing because BIST type-2 mode was not being stopped. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Ib6aa898ef5727dd5887e5d1c0b2eee94fdb366b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2751328 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/tcpm/stm32gx.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/driver/tcpm/stm32gx.c b/driver/tcpm/stm32gx.c
index 0606668abe..b71fe3660c 100644
--- a/driver/tcpm/stm32gx.c
+++ b/driver/tcpm/stm32gx.c
@@ -127,6 +127,20 @@ static void stm32gx_tcpm_sw_reset(void)
}
DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, stm32gx_tcpm_sw_reset, HOOK_PRIO_DEFAULT);
+static int stm32gx_tcpm_reset_bist_type_2(int port)
+{
+ /*
+ * The UCPD peripheral must be disabled, then enabled, to recover from
+ * starting BIST type-2 mode. Call the init method to accomplish
+ * this. Then, need to send a hard reset to port partner.
+ */
+ stm32gx_ucpd_init(port);
+ pd_execute_hard_reset(port);
+ task_set_event(PD_PORT_TO_TASK_ID(port), TASK_EVENT_WAKE);
+
+ return EC_SUCCESS;
+}
+
const struct tcpm_drv stm32gx_tcpm_drv = {
.init = &stm32gx_tcpm_init,
.release = &stm32gx_tcpm_release,
@@ -143,4 +157,5 @@ const struct tcpm_drv stm32gx_tcpm_drv = {
.get_message_raw = &stm32gx_tcpm_get_message_raw,
.transmit = &stm32gx_tcpm_transmit,
.get_chip_info = &stm32gx_tcpm_get_chip_info,
+ .reset_bist_type_2 = &stm32gx_tcpm_reset_bist_type_2,
};