summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoro Chen <koro.chen@mediatek.com>2016-06-15 13:53:26 +0800
committerchrome-bot <chrome-bot@chromium.org>2016-06-17 07:36:27 -0700
commitd831100df926df2e1d987fc64e6ac6733989ad91 (patch)
tree098aa5a7e753e3dfefdfcaf4ee34667398e256fc
parent0cf04948a8b546c815a9e4906b5fc6b954ad5889 (diff)
downloadchrome-ec-d831100df926df2e1d987fc64e6ac6733989ad91.tar.gz
pd: Set PD_FLAGS_VBUS_NEVER_LOW after tcpm_init
When we jump from RO to RW, tcpc_vbus declared in tcpci.c is initialized to 0. So even if we had VBUS present before, PD_FLAGS_VBUS_NEVER_LOW is not set and soft reset cannot be used later when source cap is timeout. This causes power loss and reboot when we boot up system without battery. Set PD_FLAGS_VBUS_NEVER_LOW after tcpm_init() so we can refresh tcpc_vbus from TCPC first. BUG=chrome-os-partner:53496 BRANCH=none TEST=test on elm. Remove battery and boot up successfully only with AC. Use "sysjump rw" command and ec won't reboot by pd hard reset. Change-Id: Id4737f076a9572cb540310f9fdce062198257967 Signed-off-by: Koro Chen <koro.chen@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/352833 Reviewed-by: Rong Chang <rongchang@chromium.org>
-rw-r--r--common/usb_pd_protocol.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index a13b295503..2b6d39fd82 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -1411,6 +1411,10 @@ void pd_task(void)
/* Ensure the power supply is in the default state */
pd_power_supply_reset(port);
+ /* Initialize TCPM driver and wait for TCPC to be ready */
+ res = tcpm_init(port);
+ CPRINTS("TCPC p%d init %s", port, res ? "failed" : "ready");
+
#ifdef CONFIG_USB_PD_DUAL_ROLE
/*
* If VBUS is high, then initialize flag for VBUS has always been
@@ -1420,10 +1424,6 @@ void pd_task(void)
pd[port].flags = pd_is_vbus_present(port) ? PD_FLAGS_VBUS_NEVER_LOW : 0;
#endif
- /* Initialize TCPM driver and wait for TCPC to be ready */
- res = tcpm_init(port);
- CPRINTS("TCPC p%d init %s", port, res ? "failed" : "ready");
-
/* Disable TCPC RX until connection is established */
tcpm_set_rx_enable(port, 0);