tegra132: convert to stopwatch API

Simplify the timed operations by using the stopwatch API.

BUG=None
BRANCH=None
TEST=Built and booted to kernel. Analyzed logs. Output as expected.

Change-Id: Ia49bccccc412f23bb620ed386b9174468a434116
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: a877020c6d8ba12422c9c2c487122b7eb4a1967b
Original-Change-Id: Iffc32fcb9b8bfdcfbef67f563ac3014912f82e7f
Original-Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/219494
Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: http://review.coreboot.org/8831
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/src/soc/nvidia/tegra132/timer.c b/src/soc/nvidia/tegra132/timer.c
index 4a43208..ed10340 100644
--- a/src/soc/nvidia/tegra132/timer.c
+++ b/src/soc/nvidia/tegra132/timer.c
@@ -28,18 +28,18 @@
 
 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))
+		;
 }