summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorDevin Lu <Devin.Lu@quantatw.com>2022-06-06 19:06:49 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-14 22:16:18 +0000
commit26e3fe318448df383d5decf09f76a6c04786afc4 (patch)
tree0ff0e949c64fcf3e8d2b5ccfe73d9b3e97ed9ecf /driver
parent440ae3333ac2431686b01316a6cc3650cbb5580d (diff)
downloadchrome-ec-26e3fe318448df383d5decf09f76a6c04786afc4.tar.gz
TCPCI: nct38xx: Only restore mask registers during hard reset
Currently the mask registers will be reseted after hard reset received. TCPM did full initialization and restore the mask registers as well. However, full initialization will cause tPSHardReset time to worse. To improve tPSHardReset time during hard reset, so only restore the mask registers during hard reset. BUG=b:232326002 BRANCH=none TEST=On Vell. Check tPSHardReset time. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I2ae250af7cb06fe5102c8ba4dce98e5d467a2d93 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3702883 Tested-by: Devin Lu <devin.lu@quantatw.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/tcpm/nct38xx.c1
-rw-r--r--driver/tcpm/tcpci.c18
2 files changed, 19 insertions, 0 deletions
diff --git a/driver/tcpm/nct38xx.c b/driver/tcpm/nct38xx.c
index 16e0866ca6..810f92c6f8 100644
--- a/driver/tcpm/nct38xx.c
+++ b/driver/tcpm/nct38xx.c
@@ -393,4 +393,5 @@ const struct tcpm_drv nct38xx_tcpm_drv = {
.set_frs_enable = &nct38xx_set_frs_enable,
#endif
.handle_fault = &nct3807_handle_fault,
+ .hard_reset_reinit = &tcpci_hard_reset_reinit,
};
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index 51451041ee..4775da6db3 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -1080,6 +1080,21 @@ static int tcpci_handle_fault(int port, int fault)
return rv;
}
+int tcpci_hard_reset_reinit(int port)
+{
+ int rv;
+
+ /* Initialize power_status_mask */
+ rv = init_power_status_mask(port);
+ /* Initialize alert_mask */
+ rv |= init_alert_mask(port);
+
+ CPRINTS("C%d: Hard Reset re-initialize %s", port,
+ rv ? "failed" : "success");
+
+ return rv;
+}
+
enum ec_error_list tcpci_set_bist_test_mode(const int port, const bool enable)
{
int rv;
@@ -1270,6 +1285,9 @@ void tcpci_tcpc_alert(int port)
if (alert & TCPC_REG_ALERT_RX_HARD_RST) {
/* hard reset received */
CPRINTS("C%d Hard Reset received", port);
+
+ tcpm_hard_reset_reinit(port);
+
pd_event |= PD_EVENT_RX_HARD_RESET;
}