efi_loader: avoid EFI_CALL() for clearing screen
[platform/kernel/u-boot.git] / lib / time.c
index 38a9758..f3aaf47 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <clock_legacy.h>
 #include <bootstage.h>
 #include <dm.h>
 #include <errno.h>
@@ -46,12 +47,15 @@ ulong timer_get_boot_us(void)
 {
        ulong count = timer_read_counter();
 
-#if CONFIG_SYS_TIMER_RATE == 1000000
-       return count;
-#elif CONFIG_SYS_TIMER_RATE > 1000000
-       return lldiv(count, CONFIG_SYS_TIMER_RATE / 1000000);
-#elif defined(CONFIG_SYS_TIMER_RATE)
-       return (unsigned long long)count * 1000000 / CONFIG_SYS_TIMER_RATE;
+#ifdef CONFIG_SYS_TIMER_RATE
+       const ulong timer_rate = CONFIG_SYS_TIMER_RATE;
+
+       if (timer_rate == 1000000)
+               return count;
+       else if (timer_rate > 1000000)
+               return lldiv(count, timer_rate / 1000000);
+       else
+               return (unsigned long long)count * 1000000 / timer_rate;
 #else
        /* Assume the counter is in microseconds */
        return count;
@@ -194,7 +198,7 @@ void udelay(unsigned long usec)
        ulong kv;
 
        do {
-               WATCHDOG_RESET();
+               schedule();
                kv = usec > CONFIG_WD_PERIOD ? CONFIG_WD_PERIOD : usec;
                __udelay(kv);
                usec -= kv;