From 9a4f6e8e2ef99e0ab654d9d08ca3487c8603d7d0 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Tue, 23 May 2017 22:08:35 -0700 Subject: poppy: Fix tcpc power mode handling for ANX ANX has specific sequencing requirements for PWR_EN and RESETN when entering active and standby modes. The order in which the two GPIOs were set did not match the spec. Update board_set_tcpc_power_mode to ensure correct ordering for both the modes. BUG=b:62043928 BRANCH=None TEST=make -j buildall Change-Id: Ifc2991da87c7b7facd3384f752792371efb9fe1e Signed-off-by: Furquan Shaikh Reviewed-on: https://chromium-review.googlesource.com/513477 Reviewed-by: Nicolas Boichat --- board/poppy/board.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/board/poppy/board.c b/board/poppy/board.c index c2cb27390d..bb548dafd5 100644 --- a/board/poppy/board.c +++ b/board/poppy/board.c @@ -345,10 +345,17 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) == /* called from anx74xx_set_power_mode() */ void board_set_tcpc_power_mode(int port, int mode) { - if (port == 0) { - gpio_set_level(GPIO_USB_C0_PD_RST_L, mode); - msleep(mode ? 10 : 1); - gpio_set_level(GPIO_USB_C0_TCPC_PWR, mode); + if (port != 0) + return; + + if (mode) { + gpio_set_level(GPIO_USB_C0_TCPC_PWR, 1); + msleep(10); + gpio_set_level(GPIO_USB_C0_PD_RST_L, 1); + } else { + gpio_set_level(GPIO_USB_C0_PD_RST_L, 0); + msleep(1); + gpio_set_level(GPIO_USB_C0_TCPC_PWR, 0); } } -- cgit v1.2.1