summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/default/src/tcpci_test_common.c
diff options
context:
space:
mode:
authorDevin Lu <Devin.Lu@quantatw.com>2022-08-18 16:23:27 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-24 20:35:07 +0000
commita9cbf4e19e1a534be8f4b0cbe0d09d94cbe570d3 (patch)
tree97e016d7abbea3d20b24afca5876a5bae4553813 /zephyr/test/drivers/default/src/tcpci_test_common.c
parent4c8ba5d95b22713dbd9f3367162c4d99eeb43ca3 (diff)
downloadchrome-ec-a9cbf4e19e1a534be8f4b0cbe0d09d94cbe570d3.tar.gz
zephyr: test: Add tcpci_hard_reset_reinit test
Add coverage for tcpci_hard_reset_reinit. BUG=b:239183823 BRANCH=none TEST=twister -T zephyr/test/drivers Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Ibc61086f7531654a2d400fa9554141538f5166ec Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3837606 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Tested-by: Devin Lu <devin.lu@quantatw.com> Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'zephyr/test/drivers/default/src/tcpci_test_common.c')
-rw-r--r--zephyr/test/drivers/default/src/tcpci_test_common.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/zephyr/test/drivers/default/src/tcpci_test_common.c b/zephyr/test/drivers/default/src/tcpci_test_common.c
index 1369b44a08..3fb1cd40e9 100644
--- a/zephyr/test/drivers/default/src/tcpci_test_common.c
+++ b/zephyr/test/drivers/default/src/tcpci_test_common.c
@@ -1011,3 +1011,20 @@ void test_tcpci_set_bist_mode(const struct emul *emul,
check_tcpci_reg(emul, TCPC_REG_TCPC_CTRL, exp_ctrl);
check_tcpci_reg(emul, TCPC_REG_ALERT_MASK, exp_mask);
}
+
+void test_tcpci_hard_reset_reinit(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port)
+{
+ const struct tcpm_drv *drv = tcpc_config[port].drv;
+ uint16_t power_status_mask;
+ uint16_t alert_mask;
+
+ zassume_equal(EC_SUCCESS, drv->init(port), NULL);
+ tcpci_emul_get_reg(emul, TCPC_REG_POWER_STATUS_MASK,
+ &power_status_mask);
+ tcpci_emul_get_reg(emul, TCPC_REG_ALERT_MASK, &alert_mask);
+ zassert_ok(tcpci_hard_reset_reinit(USBC_PORT_C0), NULL);
+ check_tcpci_reg(emul, TCPC_REG_POWER_STATUS_MASK, power_status_mask);
+ check_tcpci_reg(emul, TCPC_REG_ALERT_MASK, alert_mask);
+}