From 2ecca6507d27482d6f8bee99af71d64897423b30 Mon Sep 17 00:00:00 2001 From: Mary Ruthven Date: Thu, 30 Mar 2017 13:55:20 -0700 Subject: [PATCH] cr50: print '.' every time cr50 resumes from sleep Right now there is no way to verify cr50 is asleep just by looking at the UART output. You can check by running taskinfo and seeing that the GC_IRQNUM_PMU_INTR_WAKEUP_INT irq count has increased or by measuring cr50 power. In the past we have had Cr50 issues that we think are related to sleep. Devices like poppy will have the Cr50 uart connected to servo, so we can capture the Cr50 console output. It would be helpful if there was an easy way to tell that cr50 is asleep from the UART output to more easily confirm issues might be related to sleep. This change will print '.' every time Cr50 resumes from sleep. Cr50 wakes up every half second for HOOK_TICK, so with this change '.' prints every half second while cr50 is asleep. BUG=none BRANCH=none TEST=boot a device, wait a while, and verify cr50 starts printing '.' every half second. Turn off the device and verify the '.'s stop. Change-Id: I94a82db00076062dbba2c3bc273cbe0731430520 Signed-off-by: Mary Ruthven Reviewed-on: https://chromium-review.googlesource.com/463990 Reviewed-by: Scott Collyer --- board/cr50/board.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/board/cr50/board.c b/board/cr50/board.c index 81b9c2c22e..408cd55c9e 100644 --- a/board/cr50/board.c +++ b/board/cr50/board.c @@ -345,6 +345,7 @@ static void init_pmu(void) void pmu_wakeup_interrupt(void) { int exiten, wakeup_src; + static int count; delay_sleep_by(1 * MSEC); @@ -356,6 +357,16 @@ void pmu_wakeup_interrupt(void) /* Clear pmu reset */ GWRITE(PMU, CLRRST, 1); + /* + * This will print '.' every time cr50 resumes from regular sleep. + * During sleep Cr50 wakes up every half second for HOOK_TICK, so that + * is around the rate cr50 will print '.' while it is idle. + */ + ccprintf("."); + if (!(count % 50)) + ccprintf("\n"); + count++; + if (wakeup_src & GC_PMU_EXITPD_SRC_PIN_PD_EXIT_MASK) { /* * If any wake pins are edge triggered, the pad logic latches