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>
This commit is contained in:
Aaron Durbin 2014-08-04 16:21:50 -05:00 committed by Patrick Georgi
parent 53a83fba1e
commit 515bd135d2
1 changed files with 14 additions and 0 deletions

View File

@ -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));
}