Merge tag 'ti-v2020.07-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
[oweals/u-boot.git] / arch / arm / mach-imx / syscounter.c
index 1d4ebfe3439ff1fb078ca820674fcdd957b058f8..5a292c396433308ffc98155429afd2ffa50eb633 100644 (file)
@@ -1,12 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2015 Freescale Semiconductor, Inc.
  *
- * SPDX-License-Identifier:    GPL-2.0+
- *
  * The file use ls102xa/timer.c as a reference.
  */
 
 #include <common.h>
+#include <time.h>
 #include <asm/io.h>
 #include <div64.h>
 #include <asm/arch/imx-regs.h>
@@ -56,6 +56,7 @@ static inline unsigned long long us_to_tick(unsigned long long usec)
        return usec;
 }
 
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
 int timer_init(void)
 {
        struct sctr_regs *sctr = (struct sctr_regs *)SCTR_BASE_ADDR;
@@ -77,6 +78,7 @@ int timer_init(void)
 
        return 0;
 }
+#endif
 
 unsigned long long get_ticks(void)
 {
@@ -90,14 +92,9 @@ unsigned long long get_ticks(void)
        return now;
 }
 
-ulong get_timer_masked(void)
-{
-       return tick_to_time(get_ticks());
-}
-
 ulong get_timer(ulong base)
 {
-       return get_timer_masked() - base;
+       return tick_to_time(get_ticks()) - base;
 }
 
 void __udelay(unsigned long usec)