summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-08-04 16:21:50 -0500
committerPatrick Georgi <pgeorgi@google.com>2015-03-21 17:00:56 +0100
commit515bd135d2f175d7eaad91e9d39834eda44fd1c7 (patch)
treea08856a1f815e108135b298c3b9ea0cbd500f56d /src
parent53a83fba1ed5ec967bee4ae88e63828fbc1fa2ff (diff)
tegra132: fill out udelay() implementation
There was an empty udelay() implementation result in 0 waits. Provide an actual implementation. BUG=None BRANCH=None TEST=Built and ran through to depthcharge on rush. Change-Id: Ia7060566a71c36bb7e4543c2fe4ee49d168518c7 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: c8832e73de238358ea801ccd7c2330de35a7b40e Original-Change-Id: I201f2fdc4e4f5c88d48e4002839b03e808a5a1bc Original-Signed-off-by: Aaron Durbin <adurbin@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/210827 Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: http://review.coreboot.org/8830 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/soc/nvidia/tegra132/timer.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/soc/nvidia/tegra132/timer.c b/src/soc/nvidia/tegra132/timer.c
index e2b0b82f1e..4a43208f61 100644
--- a/src/soc/nvidia/tegra132/timer.c
+++ b/src/soc/nvidia/tegra132/timer.c
@@ -28,4 +28,18 @@ void init_timer(void)
void udelay(unsigned usec)
{
+ struct mono_time current, end;
+
+ if (!thread_yield_microseconds(usec))
+ return;
+
+ /*
+ * 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));
}