From 515bd135d2f175d7eaad91e9d39834eda44fd1c7 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Mon, 4 Aug 2014 16:21:50 -0500 Subject: 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 Original-Commit-Id: c8832e73de238358ea801ccd7c2330de35a7b40e Original-Change-Id: I201f2fdc4e4f5c88d48e4002839b03e808a5a1bc Original-Signed-off-by: Aaron Durbin Original-Reviewed-on: https://chromium-review.googlesource.com/210827 Original-Reviewed-by: Furquan Shaikh Reviewed-on: http://review.coreboot.org/8830 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/soc/nvidia/tegra132/timer.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/soc/nvidia/tegra132') 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(¤t); + } while (mono_time_before(¤t, &end)); } -- cgit v1.2.3