timer: Use a shorter error in TPL
authorSimon Glass <sjg@chromium.org>
Wed, 23 Dec 2020 15:11:16 +0000 (08:11 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 5 Jan 2021 19:24:40 +0000 (12:24 -0700)
This error should not happen in normal use. Reduce the length of it to
save space in the image.

Add an empty spl.h file to sh since it appears to lack this.

Signed-off-by: Simon Glass <sjg@chromium.org>
lib/time.c

index 88bc504..cc6944e 100644 (file)
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <init.h>
+#include <spl.h>
 #include <time.h>
 #include <timer.h>
 #include <watchdog.h>
@@ -96,8 +97,13 @@ uint64_t notrace get_ticks(void)
        }
 
        ret = timer_get_count(gd->timer, &count);
-       if (ret)
-               panic("Could not read count from timer (err %d)\n", ret);
+       if (ret) {
+               if (spl_phase() > PHASE_TPL)
+                       panic("Could not read count from timer (err %d)\n",
+                             ret);
+               else
+                       panic("no timer (err %d)\n", ret);
+       }
 
        return count;
 }