From 6887c5bed9d7dc26f8dbd196a5878c9c4a128d94 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 14 Nov 2019 12:57:26 -0700 Subject: [PATCH] common: Move some time functions out of common.h These functions belong in time.h so move them over and add comments. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- arch/arm/cpu/armv7/ls102xa/timer.c | 1 + arch/arm/cpu/armv8/generic_timer.c | 1 + arch/arm/mach-imx/syscounter.c | 1 + arch/arm/mach-imx/timer.c | 1 + arch/m68k/lib/time.c | 1 + arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c | 1 + arch/powerpc/cpu/mpc8xxx/srio.c | 1 + arch/powerpc/lib/time.c | 1 + drivers/crypto/fsl/jr.c | 1 + drivers/i2c/fsl_i2c.c | 1 + include/common.h | 4 ---- include/time.h | 16 ++++++++++++++++ 12 files changed, 26 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/armv7/ls102xa/timer.c b/arch/arm/cpu/armv7/ls102xa/timer.c index e79360ada8..a5f4e31ac7 100644 --- a/arch/arm/cpu/armv7/ls102xa/timer.c +++ b/arch/arm/cpu/armv7/ls102xa/timer.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c index c1706dcec1..46e63294fe 100644 --- a/arch/arm/cpu/armv8/generic_timer.c +++ b/arch/arm/cpu/armv8/generic_timer.c @@ -6,6 +6,7 @@ #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/arm/mach-imx/syscounter.c b/arch/arm/mach-imx/syscounter.c index c888a93938..5a292c3964 100644 --- a/arch/arm/mach-imx/syscounter.c +++ b/arch/arm/mach-imx/syscounter.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include diff --git a/arch/arm/mach-imx/timer.c b/arch/arm/mach-imx/timer.c index ed5eb1c8a7..5fe5c51f6a 100644 --- a/arch/arm/mach-imx/timer.c +++ b/arch/arm/mach-imx/timer.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include diff --git a/arch/m68k/lib/time.c b/arch/m68k/lib/time.c index a6345a0bc9..c76c5fedc9 100644 --- a/arch/m68k/lib/time.c +++ b/arch/m68k/lib/time.c @@ -7,6 +7,7 @@ */ #include +#include #include #include diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c index fcfa730233..ebdcd29c13 100644 --- a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c +++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c @@ -5,6 +5,7 @@ #include #include +#include #ifdef CONFIG_SYS_P4080_ERRATUM_SERDES8 #include #endif diff --git a/arch/powerpc/cpu/mpc8xxx/srio.c b/arch/powerpc/cpu/mpc8xxx/srio.c index ea7dac6e66..a1f9403559 100644 --- a/arch/powerpc/cpu/mpc8xxx/srio.c +++ b/arch/powerpc/cpu/mpc8xxx/srio.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include diff --git a/arch/powerpc/lib/time.c b/arch/powerpc/lib/time.c index a22a73abfa..e1494fa129 100644 --- a/arch/powerpc/lib/time.c +++ b/arch/powerpc/lib/time.c @@ -5,6 +5,7 @@ */ #include +#include #include /* ------------------------------------------------------------------------- */ diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c index 3121762364..1ea9db6850 100644 --- a/drivers/crypto/fsl/jr.c +++ b/drivers/crypto/fsl/jr.c @@ -11,6 +11,7 @@ #include "jr.h" #include "jobdesc.h" #include "desc_constr.h" +#include #ifdef CONFIG_FSL_CORENET #include #endif diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c index bf8d52d5ad..bbbd6ef5bf 100644 --- a/drivers/i2c/fsl_i2c.c +++ b/drivers/i2c/fsl_i2c.c @@ -9,6 +9,7 @@ #include #include #include /* Functional interface */ +#include #include #include /* HW definitions */ #include diff --git a/include/common.h b/include/common.h index 1e77ed393e..20d143deb8 100644 --- a/include/common.h +++ b/include/common.h @@ -288,10 +288,6 @@ int cleanup_before_linux_select(int flags); uint64_t get_ticks(void); void wait_ticks (unsigned long); -/* arch/$(ARCH)/lib/time.c */ -ulong usec2ticks (unsigned long usec); -ulong ticks2usec (unsigned long ticks); - /* lib/uuid.c */ #include diff --git a/include/time.h b/include/time.h index a1149522ed..a1bdefc164 100644 --- a/include/time.h +++ b/include/time.h @@ -70,4 +70,20 @@ uint64_t usec_to_tick(unsigned long usec); (time_after_eq(a,b) && \ time_before(a,c)) +/** + * usec2ticks() - Convert microseconds to internal ticks + * + * @usec: Value of microseconds to convert + * @return Corresponding internal ticks value, calculated using get_tbclk() + */ +ulong usec2ticks(unsigned long usec); + +/** + * ticks2usec() - Convert internal ticks to microseconds + * + * @ticks: Value of ticks to convert + * @return Corresponding microseconds value, calculated using get_tbclk() + */ +ulong ticks2usec(unsigned long ticks); + #endif /* _TIME_H */ -- 2.39.5