summaryrefslogtreecommitdiff
path: root/payloads/libpayload
diff options
context:
space:
mode:
authorIonela Voinescu <ionela.voinescu@imgtec.com>2015-01-22 14:53:28 +0000
committerPatrick Georgi <pgeorgi@google.com>2015-03-21 11:08:33 +0100
commitb29a67d8c87d1e66042bab3029bbb5b82bd4e972 (patch)
tree2f3038c6556f13f29da21de313b957e745e6084f /payloads/libpayload
parent66fc77d3afbefa7b755bf0f025556b23ae4cff2c (diff)
libpayload: pistachio: fix timer implementation
timer_raw_value must return the number of CPU ticks, and not the time obtained by dividing the ticks by the CPU frequency. The CPU counter is increased at every 2 CPU clocks and therfore the number of ticks will be the counter value multiplied by 2. BUG=chrome-os-partner:31438 TEST=tested on Pistachio FPGA; it works properly. BRANCH=none Change-Id: Iae62cb328e882f84822250bdf72146321ca9bbe0 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 7ab25ce7dcaffb453ee774d870963a56444d46af Original-Change-Id: I74408950900463a2c054d5aebd3edb005a325adb Original-Signed-off-by: Ionela Voinescu <ionela.voinescu@imgtec.com> Original-Reviewed-on: https://chromium-review.googlesource.com/242393 Original-Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: http://review.coreboot.org/8744 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads/libpayload')
-rw-r--r--payloads/libpayload/drivers/timer/img_pistachio.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/payloads/libpayload/drivers/timer/img_pistachio.c b/payloads/libpayload/drivers/timer/img_pistachio.c
index dcfe555a73..ae53a9d0b1 100644
--- a/payloads/libpayload/drivers/timer/img_pistachio.c
+++ b/payloads/libpayload/drivers/timer/img_pistachio.c
@@ -20,11 +20,6 @@
#include <libpayload.h>
#include <arch/cpu.h>
-static int get_timer_speed_khz(void)
-{
- return get_cpu_speed()/2;
-}
-
uint64_t timer_hz(void)
{
return lib_sysinfo.cpu_khz * 1000;
@@ -32,5 +27,5 @@ uint64_t timer_hz(void)
uint64_t timer_raw_value(void)
{
- return read_c0_count()/(get_timer_speed_khz()/1000);
+ return read_c0_count() * 2;
}