summaryrefslogtreecommitdiff
path: root/drivers/timer/omap-timer.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-01-17 11:24:43 -0500
committerTom Rini <trini@konsulko.com>2022-01-17 11:24:43 -0500
commit4e81f3be340072ad2c0aac093677333702f14f22 (patch)
tree447e16a695d5e55d52cf4687495a35fda48dacd6 /drivers/timer/omap-timer.c
parent6d2ebcd7be3e7f9cc81011ddb97540c81a301701 (diff)
parent609983e981a0a7f053ee6f9f6cd2772226a33000 (diff)
Merge branch '2022-01-15-TI-platform-updates'
- Let am335x_evm use the CPSW or PRUSS ethernet. - Implement timer_get_boot_us in the omap timer driver - gpmc bitflip, QSPI clock calculation on am437x, da8xx_gpio bugfixes - Assorted K3 updates
Diffstat (limited to 'drivers/timer/omap-timer.c')
-rw-r--r--drivers/timer/omap-timer.c21
1 files changed, 21 insertions, 0 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,