summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorreno.wang <reno.wang@lcfc.corp-partner.google.com>2021-10-27 21:04:17 +0800
committerCommit Bot <commit-bot@chromium.org>2021-11-30 03:24:57 +0000
commit5d4a500896e4443bb49c640575c1651874ecf5a5 (patch)
tree0c9bd7b48aa3365bd39062b94c07f3fdbeee2270
parent048ed1dca23971a4f17c13e131e2b188d839e912 (diff)
downloadchrome-ec-5d4a500896e4443bb49c640575c1651874ecf5a5.tar.gz
taeko: Nx20p3483 cannot sink power after reset ec
To avoid nx20p3483 cannot sink power after reset ec w/ AC only in TCPC1 port, EC shouldn't assert GPIO_USB_C1_RT_RST_R_ODL if no battery. This is caused by ps8815 is in reset, so en_snk is asserted to low. In this moment, nx20p3483 won't supply power to system. That means VBUS_IN is 0V. PP3300_USB_DB_Z1 may discharge to 0V, then nx20p3483 is reset to default, dead battery mode. However, adapter's pd keep in High-V because there is no De-attach process or HARD Reset event to send adapter pd. As nx20p3483's datasheet, its default VBUS OVLO is 6.8V, but VBUS from adapter is High-V, nx20p3483 is latched and won't sink power. So, after reset ec, it should check if battery is present or not before assert GPIO_USB_C1_RT_RST_R_ODL. BUG=b:202489681 BRANCH=None TEST=make -j BOARD=taeko, verify ps8815 fw update in AC+DC, verify power on/off with AC only Signed-off-by: reno.wang <reno.wang@lcfc.corp-partner.google.com> Change-Id: Ib403d2f3f8bbfb719c3fc932bc6a147bea8a2fcf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3247730 Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
-rw-r--r--board/taeko/gpio.inc2
-rw-r--r--board/taeko/usbc_config.c16
2 files changed, 16 insertions, 2 deletions
diff --git a/board/taeko/gpio.inc b/board/taeko/gpio.inc
index d07d51f16e..583efc308c 100644
--- a/board/taeko/gpio.inc
+++ b/board/taeko/gpio.inc
@@ -73,7 +73,7 @@ GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH)
GPIO(USB_C0_TCPC_RST_ODL, PIN(A, 7), GPIO_ODR_LOW)
GPIO(USB_C1_FRS_EN, PIN(9, 4), GPIO_OUT_LOW)
GPIO(USB_C1_RT_INT_ODL, PIN(A, 0), GPIO_INPUT)
-GPIO(USB_C1_RT_RST_R_ODL, PIN(0, 2), GPIO_ODR_LOW)
+GPIO(USB_C1_RT_RST_R_ODL, PIN(0, 2), GPIO_ODR_HIGH)
GPIO(VCCST_PWRGD_OD, PIN(A, 4), GPIO_ODR_LOW)
/* UART alternate functions */
diff --git a/board/taeko/usbc_config.c b/board/taeko/usbc_config.c
index c8e02581be..aaf3fcbf5c 100644
--- a/board/taeko/usbc_config.c
+++ b/board/taeko/usbc_config.c
@@ -6,6 +6,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include "battery.h"
#include "common.h"
#include "compile_time_macros.h"
#include "console.h"
@@ -168,6 +169,11 @@ static void ps8815_reset(void)
if (i2c_read8(I2C_PORT_USB_C1_TCPC,
PS8751_I2C_ADDR1_FLAGS, 0x0f, &val) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
+ else {
+ CPRINTS("delay 10ms to make sure PS8815 is waken from idle");
+ msleep(10);
+ }
+
if (i2c_write8(I2C_PORT_USB_C1_TCPC,
PS8751_I2C_ADDR1_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
@@ -235,7 +241,15 @@ void board_reset_pd_mcu(void)
*/
gpio_set_level(GPIO_USB_C0_TCPC_RST_ODL, 0);
- gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0);
+
+ /*
+ * (b/202489681): Nx20p3483 cannot sink power after reset ec
+ * To avoid nx20p3483 cannot sink power after reset ec w/ AC
+ * only in TCPC1 port, EC shouldn't assert GPIO_USB_C1_RT_RST_R_ODL
+ * if no battery.
+ */
+ if (battery_hw_present())
+ gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0);
/*
* delay for power-on to reset-off and min. assertion time