From 0fd106fbf4671306114f2d4de51c2d44f46fef55 Mon Sep 17 00:00:00 2001 From: Milton Chiang Date: Fri, 7 Oct 2016 09:52:01 +0800 Subject: [PATCH] elm: disable 3.3V to ANX7688 by default and enable it in board_power_on_pd_mcu. In dead battery mode, we can find ANX7688 will pull the CC to Rp in the beginning; some of the adapters will drop the VBUS since this should be treated as a disconnection, hence the whole system lost the only power source and cannot boot up. According to chrome-os-partner:58283, there's a chance for ANX7688 to be in an abnormal state if the system provides it with 3.3V first but RESET_N and PWR_EN are still in an unstable level. To prevent this situation, we try to enable the 3.3V only after RESET_N and PWR_EN are in their initial state. BRANCH=none BUG=chrome-os-partner:58283 TEST=plug in the adapter, check ANX7688 does not pull CC to Rp in the beginning, and boot up system in dead battery mode Change-Id: Ibb81a33a7dd957d3bdc6c54bb7723cc9ffdcfd26 Signed-off-by: Milton Chiang Reviewed-on: https://chromium-review.googlesource.com/394408 Reviewed-by: Nicolas Boichat --- board/elm/board.c | 2 ++ board/elm/gpio.inc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/board/elm/board.c b/board/elm/board.c index 9548bb71fc..133f6b25af 100644 --- a/board/elm/board.c +++ b/board/elm/board.c @@ -215,6 +215,8 @@ static void board_power_on_pd_mcu(void) /* check if power is already on */ if (!gpio_get_level(GPIO_USB_C0_PWR_EN_L)) return; + + gpio_set_level(GPIO_USB_C0_EXTPWR_EN, 1); hook_call_deferred(&deferred_reset_pd_mcu_data, 1*MSEC); } diff --git a/board/elm/gpio.inc b/board/elm/gpio.inc index d9193938a5..e48290c4ab 100644 --- a/board/elm/gpio.inc +++ b/board/elm/gpio.inc @@ -81,7 +81,7 @@ GPIO(USB_C0_5V_EN, PIN(D, 8), GPIO_OUT_LOW) /* USBC port 0 5V */ GPIO(USB_C0_CHARGE_L, PIN(D, 9), GPIO_OUT_LOW) /* USBC port 0 charge */ GPIO(USB_C0_RST, PIN(D, 10), GPIO_ODR_HIGH) /* ANX7688 reset */ GPIO(USB_C0_PWR_EN_L, PIN(B, 15), GPIO_ODR_HIGH) /* ANX7688 power enable */ -GPIO(USB_C0_EXTPWR_EN, PIN(F, 2), GPIO_OUT_HIGH) /* ANX7688 3.3V ext power enable */ +GPIO(USB_C0_EXTPWR_EN, PIN(F, 2), GPIO_OUT_LOW) /* ANX7688 3.3V ext power enable */ GPIO(USB_DP_HPD, PIN(F, 3), GPIO_INPUT) GPIO(EN_TP_INT_L, PIN(E, 14), GPIO_OUT_LOW) /* touchpad interrupt enable */