summaryrefslogtreecommitdiff
path: root/board/puff/board.c
diff options
context:
space:
mode:
authorAndrew McRae <amcrae@google.com>2020-08-27 11:34:12 +1000
committerCommit Bot <commit-bot@chromium.org>2020-08-27 07:33:22 +0000
commitb2767e370cef083683eaaa60b306f8d024268237 (patch)
treed68bc7733908258a62920aa54e128c38f81598b3 /board/puff/board.c
parentbf411187b05aab57a9eb23c9a5b54f32b45aa2da (diff)
downloadchrome-ec-b2767e370cef083683eaaa60b306f8d024268237.tar.gz
Puff: Restore VBUS (if sourcing) upon CPU start
The PPC (sn5s330) internally disables PP1 if the source drops, so upon CPU restart when the rail is up, check whether we are sourcing VBUS and re-enable it if necessary. BUG=b:161963268 TEST=Run firmware_FwScreenPressPower test and monitor VBUS via twinkie. BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Ibe1c2151526ac1c20690e1891272efbb811f3d8c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2377063 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Andrew McRae <amcrae@chromium.org> Tested-by: Andrew McRae <amcrae@chromium.org>
Diffstat (limited to 'board/puff/board.c')
-rw-r--r--board/puff/board.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/board/puff/board.c b/board/puff/board.c
index 02b5b0d6bd..7073ebaa76 100644
--- a/board/puff/board.c
+++ b/board/puff/board.c
@@ -472,6 +472,22 @@ static void board_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+static void board_chipset_startup(void)
+{
+ /*
+ * Workaround to restore VBUS on PPC.
+ * PP1 is sourced from PP5000_A, and when the CPU shuts down and
+ * this rail drops, the PPC will internally turn off PP1_EN.
+ * When the CPU starts again, and the rail is restored, the PPC
+ * does not turn PP1_EN on again, causing VBUS to stay turned off.
+ * The workaround is to check whether the PPC is sourcing VBUS, and
+ * if so, make sure it is enabled.
+ */
+ if (ppc_is_sourcing_vbus(0))
+ ppc_vbus_source_enable(0, 1);
+}
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup,
+ HOOK_PRIO_DEFAULT);
/******************************************************************************/
/* USB-C PPC Configuration */
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {