summaryrefslogtreecommitdiff
path: root/drivers/timer
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/timer')
-rw-r--r--drivers/timer/omap-timer.c21
-rw-r--r--drivers/timer/ostm_timer.c3
2 files changed, 23 insertions, 1 deletions
diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c
index 721e385fd15..25a6108fef2 100644
--- a/drivers/timer/omap-timer.c
+++ b/drivers/timer/omap-timer.c
@@ -83,6 +83,27 @@ static int omap_timer_of_to_plat(struct udevice *dev)
return 0;
}
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
+ulong timer_get_boot_us(void)
+{
+ u64 ticks = 0;
+ u32 rate = 1;
+ u64 us;
+ int ret;
+
+ ret = dm_timer_init();
+ if (!ret) {
+ /* The timer is available */
+ rate = timer_get_rate(gd->timer);
+ timer_get_count(gd->timer, &ticks);
+ } else {
+ return 0;
+ }
+
+ us = (ticks * 1000) / rate;
+ return us;
+}
+#endif
static const struct timer_ops omap_timer_ops = {
.get_count = omap_timer_get_count,
diff --git a/drivers/timer/ostm_timer.c b/drivers/timer/ostm_timer.c
index 24813de2653..3ec729d2c43 100644
--- a/drivers/timer/ostm_timer.c
+++ b/drivers/timer/ostm_timer.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <clock_legacy.h>
#include <malloc.h>
#include <asm/global_data.h>
#include <asm/io.h>
@@ -51,7 +52,7 @@ static int ostm_probe(struct udevice *dev)
clk_free(&clk);
#else
- uc_priv->clock_rate = CONFIG_SYS_CLK_FREQ / 2;
+ uc_priv->clock_rate = get_board_sys_clk() / 2;
#endif
readb(priv->regs + OSTM_CTL);