1 /* 2 * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <delay_timer.h> 8 #include <mmio.h> 9 #include <tegra_def.h> 10 #include <tegra_private.h> 11 12 static uint32_t tegra_timerus_get_value(void) 13 { 14 return mmio_read_32(TEGRA_TMRUS_BASE); 15 } 16 17 /* 18 * Initialise the on-chip free rolling us counter as the delay 19 * timer. 20 */ 21 void tegra_delay_timer_init(void) 22 { 23 static const timer_ops_t tegra_timer_ops = { 24 .get_timer_value = tegra_timerus_get_value, 25 .clk_mult = 1, 26 .clk_div = 1, 27 }; 28 29 timer_init(&tegra_timer_ops); 30 } 31