mx5/6 timer: Round up tick_to_time() value
Subsystems (2)
PATCH 1/1 mx5/6 timer: Round up tick_to_time() value
Round up tick_to_time() value instead of truncating it. This avoids stopping waits instantly for low usec values, and this generally guarantees that the code always waits for at least the requested duration.
--- .../arch/arm/cpu/armv7/imx-common/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv7/imx-common/timer.c +1 -1
@@ -61,7 +61,7 @@ static inline unsigned long long tick_to_time(unsigned long long tick)static inline unsigned long long us_to_tick (unsigned long long usec) { - usec *=CLK_32KHZ ; + usec = usec *CLK_32KHZ +999999 ;do_div (usec,1000000 );return usec;
PATCH 1/1 mx5/6 timer: Round up tick_to_time() value
Quoted 16 lines · Beno?t Th?baudeau
Round up
tick_to_time()value instead of truncating it. This avoids stopping waits instantly for low usec values, and this generally guarantees that the code always waits for at least the requested duration.Signed-off-by Beno?t Th?baudeau <[email protected]>Cc Stefano Babic <[email protected]>--- .../arch/arm/cpu/armv7/imx-common/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/cpu/armv7/imx-common/timer.c +0
-0
arch/arm/cpu/armv7/imx-common/timer.c static inline unsigned long long tick_to_time(unsigned long long tick) · line 67
Quoted 8 lines
arch/arm/cpu/armv7/imx-common/timer.c +1
-1@@ -61,7 +61,7 @@ static inline unsigned long long tick_to_time(unsigned long long tick)static inline unsigned long long us_to_tick (unsigned long long usec) { - usec *=CLK_32KHZ ; + usec = usec *CLK_32KHZ +999999 ;do_div (usec,1000000 );return usec;
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 1/1 mx5/6 timer: Round up tick_to_time() value
In reply to Benoît ThébaudeauQuoted 16 lines · Beno?t Th?baudeau
Round up
tick_to_time()value instead of truncating it. This avoids stopping waits instantly for low usec values, and this generally guarantees that the code always waits for at least the requested duration.Signed-off-by Beno?t Th?baudeau <[email protected]>Cc Stefano Babic <[email protected]>--- .../arch/arm/cpu/armv7/imx-common/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/cpu/armv7/imx-common/timer.c +0
-0
arch/arm/cpu/armv7/imx-common/timer.c static inline unsigned long long tick_to_time(unsigned long long tick) · line 67
Quoted 8 lines
arch/arm/cpu/armv7/imx-common/timer.c +1
-1@@ -61,7 +61,7 @@ static inline unsigned long long tick_to_time(unsigned long long tick)static inline unsigned long long us_to_tick (unsigned long long usec) { - usec *=CLK_32KHZ ; + usec = usec *CLK_32KHZ +999999 ;do_div (usec,1000000 );return usec;
Applied to u-boot-imx, thanks.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================