tegra124: Implement the monotonic timer by reading the 1us timer register.
It turns out there's a register in tegra which automatically counts at 1us
increments. It's primarily intended for hardware to use (I think to drive
other timers) but we can read it ourselves since a 1us timer is exactly what
we need to support the monotonic timer API.
TEST=Built and booted into the bootblock on nyan with test code in the
bootblock. Used that code to print two serial messages, 1 minute apart. The
messages happened 1 minute and 2 seconds apart. That's pretty close, although
it might be worthwhile to figure out where those extra two seconds are coming
from (measurement error?).
Signed-off-by: Gabe Black <firstname.lastname@example.org>
Reviewed-by: Ronald Minnich <email@example.com>
Reviewed-by: David Hendricks <firstname.lastname@example.org>
Commit-Queue: Gabe Black <email@example.com>
Tested-by: Gabe Black <firstname.lastname@example.org>
diff --git a/src/soc/nvidia/tegra124/monotonic_timer.c b/src/soc/nvidia/tegra124/monotonic_timer.c
index 3423dde..7967b83 100644
@@ -17,8 +17,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
void timer_monotonic_get(struct mono_time *mt)
+ mono_time_set_usecs(mt, read32((void *)TEGRA_TMRUS_BASE));