xref: /rk3399_ARM-atf/plat/nvidia/tegra/common/tegra_delay_timer.c (revision f132b4a05b23916c1101add4bd6d973a99983719)
1 /*
2  * Copyright (c) 2015, 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 
11 static uint32_t tegra_timerus_get_value(void)
12 {
13 	return mmio_read_32(TEGRA_TMRUS_BASE);
14 }
15 
16 static const timer_ops_t tegra_timer_ops = {
17 	.get_timer_value	= tegra_timerus_get_value,
18 	.clk_mult		= 1,
19 	.clk_div		= 1,
20 };
21 
22 /*
23  * Initialise the on-chip free rolling us counter as the delay
24  * timer.
25  */
26 void tegra_delay_timer_init(void)
27 {
28 	timer_init(&tegra_timer_ops);
29 }
30