aboutsummaryrefslogtreecommitdiff
path: root/plat/nvidia/tegra/common/tegra_delay_timer.c
blob: 3bd2b0e2454d6de3a3410cbfc0bc4275b2d8ff55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <delay_timer.h>
#include <mmio.h>
#include <tegra_def.h>
#include <tegra_private.h>

static uint32_t tegra_timerus_get_value(void)
{
	return mmio_read_32(TEGRA_TMRUS_BASE);
}

/*
 * Initialise the on-chip free rolling us counter as the delay
 * timer.
 */
void tegra_delay_timer_init(void)
{
	static const timer_ops_t tegra_timer_ops = {
		.get_timer_value	= tegra_timerus_get_value,
		.clk_mult		= 1,
		.clk_div		= 1,
	};

	timer_init(&tegra_timer_ops);
}