diff options
author | Mary Ruthven <mruthven@chromium.org> | 2022-12-09 12:48:59 -0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-04-28 16:49:13 +0000 |
commit | b44d8d1ee21e923e37a748ba767d8ae6bf95d873 (patch) | |
tree | dc0b795ed63790f9e071f14d96001bd773505ae8 /include/timer.h | |
parent | f11b31e9125a24b47d551f81f8d5ec92f5f17173 (diff) | |
download | chrome-ec-b44d8d1ee21e923e37a748ba767d8ae6bf95d873.tar.gz |
hwtimer: add support for tracking time since cold boot
Pinweaver needs a timer that counts through deep sleep. This change
keeps track of the time since cold boot in PWRDN_SCRATCH23. Before the
low speed timer is cleared during init add the value to PWRDN_SCRATCH23.
BUG=b:262036852,b:279759625
TEST=manual
After hard reset the cold reset time and system time should be
the same.
> sysinfo
Reset flags: 0x00000800 (hard)
Reset count: 0
> get
Time: 0x0000000006628dd7 = 107.122135 s
since cold_reset: 107 s
Verify the cold reset timer keeps counting during deep sleep.
dut-control cold_reset:on
[138.415843 AP off]
[Reset cause: hibernate wake-pin]
[Image: RW, ...
[0.003864 Inits done]
[0.009647 init_jittery_clock_locking_o...
[0.039134 init took 22838]
> get
Time: 0x0000000000bf3e3a = 12.533306 s
since cold_reset: 150 s
> sysi
Reset flags: 0x00000140 (hibernate wake-pin)
Verify cold reset and system time are the same after H1_RST_L
is pulsed
dut-control gsc_reset:on gsc_reset:off
> get
Time: 0x00000000001cdea9 = 1.892009 s
since cold_reset: 1 s
> sysi
Reset flags: 0x00000008 (power-on)
Reset count: 1
Change-Id: Ie57324880c8b8068ddff62760848e161b2df903d
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4093120
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Diffstat (limited to 'include/timer.h')
-rw-r--r-- | include/timer.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/timer.h b/include/timer.h index 7c107d2185..bbdf3c3435 100644 --- a/include/timer.h +++ b/include/timer.h @@ -117,6 +117,11 @@ static inline void sleep(unsigned sec) timestamp_t get_time(void); /** + * Get the time in seconds since cold boot. + */ +uint32_t get_seconds_since_cold_boot(void); + +/** * Force the current value of the system timer. * * This function is for the power management implementation which wants to fix |