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: I201f2fdc4e4f5c88d48e4002839b03e808a5a1bc
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/210827
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
This commit is contained in:
Aaron Durbin 2014-08-04 16:21:50 -05:00 committed by chrome-internal-fetch
commit c8832e73de

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