]> git.sur5r.net Git - u-boot/blobdiff - lib/time.c
stm32x7: add support for stm32x7 serial driver
[u-boot] / lib / time.c
index b001745203e85c2c6f944e5d470291660eae0af6..e9f6861b9843773f780ec3bd278340dcb55a2a2e 100644 (file)
@@ -41,23 +41,6 @@ extern unsigned long __weak timer_read_counter(void);
 #endif
 
 #ifdef CONFIG_TIMER
-static int notrace dm_timer_init(void)
-{
-       struct udevice *dev;
-       int ret;
-
-       if (!gd->timer) {
-               ret = uclass_first_device(UCLASS_TIMER, &dev);
-               if (ret)
-                       return ret;
-               if (!dev)
-                       return -ENODEV;
-               gd->timer = dev;
-       }
-
-       return 0;
-}
-
 ulong notrace get_tbclk(void)
 {
        int ret;
@@ -69,9 +52,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 +67,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 +81,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)
 {