summaryrefslogtreecommitdiff
path: root/chip/lm4/hwtimer.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-05-11 12:26:49 -0700
committerRandall Spangler <rspangler@chromium.org>2012-05-11 13:36:34 -0700
commit27e8bdb7c099ff4642c5c1d567029467da35da4f (patch)
treea22aa72b80161b73341bb633cee1157597e0b453 /chip/lm4/hwtimer.c
parent2f2a5d90224a1a408c6eca408e4d6e87f0fa0503 (diff)
downloadchrome-ec-27e8bdb7c099ff4642c5c1d567029467da35da4f.tar.gz
Maintain timer value across sysjumps and clean up init debug output
This helps us keep track of how long vboot is taking on the EC. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:9651 TEST=reboot system and look at debug log. time shouldn't start over after it jumps to image A. Change-Id: Iad86e90d42dabf1c67b2c2be80dda1151cf9a288
Diffstat (limited to 'chip/lm4/hwtimer.c')
-rw-r--r--chip/lm4/hwtimer.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/chip/lm4/hwtimer.c b/chip/lm4/hwtimer.c
index 41e737b10d..b3c8498294 100644
--- a/chip/lm4/hwtimer.c
+++ b/chip/lm4/hwtimer.c
@@ -69,7 +69,7 @@ static int update_prescaler(void)
DECLARE_HOOK(HOOK_FREQ_CHANGE, update_prescaler, HOOK_PRIO_DEFAULT);
-int __hw_clock_source_init(void)
+int __hw_clock_source_init(uint32_t start_t)
{
volatile uint32_t scratch __attribute__((unused));
@@ -93,10 +93,13 @@ int __hw_clock_source_init(void)
/* Periodic mode, counting down */
LM4_TIMER_TAMR(6) = 0x22;
- /* use the full 32-bits of the timer */
+ /* Use the full 32-bits of the timer */
LM4_TIMER_TAILR(6) = 0xffffffff;
/* Starts counting in timer A */
LM4_TIMER_CTL(6) |= 0x1;
+ /* Override the count with the start value now that counting has
+ * started. */
+ LM4_TIMER_TAV(6) = 0xffffffff - start_t;
/* Enable interrupt */
task_enable_irq(LM4_IRQ_TIMERW0A);