[coreboot-gerrit] New patch to review for coreboot: e40de81 tegra132: fill out udelay() implementation

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Fri Mar 20 16:30:58 CET 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8830

-gerrit

commit e40de8107484486f8b623c7c8eb3aeedfa63da3e
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Mon Aug 4 16:21:50 2014 -0500

    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 at chromium.org>
    Original-Commit-Id: c8832e73de238358ea801ccd7c2330de35a7b40e
    Original-Change-Id: I201f2fdc4e4f5c88d48e4002839b03e808a5a1bc
    Original-Signed-off-by: Aaron Durbin <adurbin at chromium.org>
    Original-Reviewed-on: https://chromium-review.googlesource.com/210827
    Original-Reviewed-by: Furquan Shaikh <furquan at chromium.org>
---
 src/soc/nvidia/tegra132/timer.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/soc/nvidia/tegra132/timer.c b/src/soc/nvidia/tegra132/timer.c
index e2b0b82..4a43208 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));
 }



More information about the coreboot-gerrit mailing list