diff options
author | Alec Berg <alecaberg@chromium.org> | 2015-06-29 15:51:33 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-06-30 19:02:57 +0000 |
commit | a11ffa6c93e28f536cf97eb29e613399d25baf63 (patch) | |
tree | ae334ab1abad2577eafffb6f7216dfd3878ab78d /driver/tcpm | |
parent | dd9e4fa427d106a716534cf85da4c27a0e932957 (diff) | |
download | chrome-ec-a11ffa6c93e28f536cf97eb29e613399d25baf63.tar.gz |
tcpc: use initialization complete alert bit to signal readiness
Use the new TCPC initialization complete bit in alert register to
signal TCPC readiness instead of checking for USB VID to be set.
BUG=none
BRANCH=none
TEST=load on glados, make sure we can boot without battery.
Change-Id: I4b25c973ece0de6dd3f419c5901cff1d8d05ed95
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/282593
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'driver/tcpm')
-rw-r--r-- | driver/tcpm/tcpci.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c index ecb68bbf53..cd5c783db8 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -39,17 +39,21 @@ static int init_alert_mask(int port) int tcpm_init(int port) { - int rv, vid = 0; + int rv, alert = 0; while (1) { rv = i2c_read16(I2C_PORT_TCPC, I2C_ADDR_TCPC(port), - TCPC_REG_VENDOR_ID, &vid); + TCPC_REG_ALERT, &alert); /* * If i2c succeeds and VID is non-zero, then initialization * is complete */ - if (rv == EC_SUCCESS && vid) + if (rv == EC_SUCCESS && (alert & TCPC_REG_ALERT_TCPC_INITED)) { + /* clear all alert bits */ + i2c_write16(I2C_PORT_TCPC, I2C_ADDR_TCPC(port), + TCPC_REG_ALERT, 0xff); return init_alert_mask(port); + } msleep(10); } } |