summaryrefslogtreecommitdiff
path: root/src/soc/nvidia/tegra132/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/nvidia/tegra132/timer.c')
-rw-r--r--src/soc/nvidia/tegra132/timer.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/soc/nvidia/tegra132/timer.c b/src/soc/nvidia/tegra132/timer.c
index 4a43208f61..ed10340040 100644
--- a/src/soc/nvidia/tegra132/timer.c
+++ b/src/soc/nvidia/tegra132/timer.c
@@ -28,18 +28,18 @@ void init_timer(void)
void udelay(unsigned usec)
{
- struct mono_time current, end;
-
- if (!thread_yield_microseconds(usec))
- return;
+ struct stopwatch sw;
/*
* As the hardware clock granularity is in microseconds pad the
* requested delay by one to get at least >= requested usec delay.
*/
- timer_monotonic_get(&end);
- mono_time_add_usecs(&end, usec + 1);
- do {
- timer_monotonic_get(&current);
- } while (mono_time_before(&current, &end));
+ usec += 1;
+
+ if (!thread_yield_microseconds(usec))
+ return;
+
+ stopwatch_init_usecs_expire(&sw, usec);
+ while (!stopwatch_expired(&sw))
+ ;
}