summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2014-12-05 10:15:00 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-06 01:11:22 +0000
commit9b1b0cb2fc24ebb443adb348049cf2e1fc3a1788 (patch)
tree2be82888a4f1fad71aee0c6e5c3caeebc09a976b
parent7014afec765349222ca6b3375b46b24998cb16b2 (diff)
downloadchrome-ec-9b1b0cb2fc24ebb443adb348049cf2e1fc3a1788.tar.gz
g: fix hwtimer event deadline
We were losing timer events because usecs_to_ticks(deadline) was clipping the value when deadline was larger than 0x08888888 (deadline is a timestamp rather than a delay). The computation of the timer deadline has been modified to avoid the clipping issue. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:34347 TEST=run on Cr50 with the watchdog activated and no longer see watchdog warnings. Run the "timer_calib" test and see that the 1s sleep is 1000038 us : make BOARD=cr50 tests fhl ../build/cr50/timer_calib/timer_calib.RO.hex Change-Id: Id2200a89eb1b72099e536291af321609b24b4777 Reviewed-on: https://chromium-review.googlesource.com/233531 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--chip/g/hwtimer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/chip/g/hwtimer.c b/chip/g/hwtimer.c
index 974a3ff754..3c1ef73759 100644
--- a/chip/g/hwtimer.c
+++ b/chip/g/hwtimer.c
@@ -87,7 +87,8 @@ void __hw_clock_event_set(uint32_t deadline)
/* How long from the current time to the deadline? */
time_now_in_ticks = (0xffffffff - GR_TIMEHS_VALUE(0, 1));
- GR_TIMEHS_LOAD(0, 2) = usecs_to_ticks(deadline) - time_now_in_ticks;
+ GR_TIMEHS_LOAD(0, 2) = (deadline - time_now_in_ticks / clock_mul_factor)
+ * clock_mul_factor;
/* timer & interrupts enabled */
GR_TIMEHS_CONTROL(0, 2) = 0xa3;