Skip to content
Snippets Groups Projects
Commit 68d919d4 authored by Benoît Thébaudeau's avatar Benoît Thébaudeau Committed by Albert ARIBAUD
Browse files

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.

Signed-off-by: default avatarBenoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: default avatarStefano Babic <sbabic@denx.de>
parent f2d3ae07
No related branches found
No related tags found
No related merge requests found
...@@ -61,7 +61,7 @@ static inline unsigned long long tick_to_time(unsigned long long tick) ...@@ -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) static inline unsigned long long us_to_tick(unsigned long long usec)
{ {
usec *= CLK_32KHZ; usec = usec * CLK_32KHZ + 999999;
do_div(usec, 1000000); do_div(usec, 1000000);
return usec; return usec;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment