mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-11 02:15:14 +00:00
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>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user