summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2015-11-24 13:31:17 -0700
committerSimon Glass <sjg@chromium.org>2015-12-01 06:23:51 -0700
commit9ca07ebbac3c94974db75e25004203289d9013bc (patch)
tree71505c28b02624db37f3edacd631af87ea08feef /lib
parentf838f124522ea4fb5202c1b584b4706aa48ee144 (diff)
downloadblackbird-obmc-uboot-9ca07ebbac3c94974db75e25004203289d9013bc.tar.gz
blackbird-obmc-uboot-9ca07ebbac3c94974db75e25004203289d9013bc.zip
dm: timer: Support 64-bit counter
There are timers with a 64-bit counter value but current timer uclass driver assumes a 32-bit one. Modify timer_get_count() to ask timer driver to always return a 64-bit counter value, and provide an inline helper function timer_conv_64() to handle the 32-bit/64-bit conversion automatically. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/time.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/time.c b/lib/time.c
index b001745203..f37a6628d6 100644
--- a/lib/time.c
+++ b/lib/time.c
@@ -69,9 +69,9 @@ ulong notrace get_tbclk(void)
return timer_get_rate(gd->timer);
}
-unsigned long notrace timer_read_counter(void)
+uint64_t notrace get_ticks(void)
{
- unsigned long count;
+ u64 count;
int ret;
ret = dm_timer_init();
@@ -84,7 +84,8 @@ unsigned long notrace timer_read_counter(void)
return count;
}
-#endif /* CONFIG_TIMER */
+
+#else /* !CONFIG_TIMER */
uint64_t __weak notrace get_ticks(void)
{
@@ -97,6 +98,8 @@ uint64_t __weak notrace get_ticks(void)
return ((uint64_t)gd->timebase_h << 32) | gd->timebase_l;
}
+#endif /* CONFIG_TIMER */
+
/* Returns time in milliseconds */
static uint64_t notrace tick_to_time(uint64_t tick)
{
OpenPOWER on IntegriCloud