blob: 63dcf410c2eb14b1b437e8665b1181b50d7012e5 [file] [log] [blame]
Varun Wadekarbc74fec2015-07-16 15:47:03 +05301/*
Anthony Zhouee4be0f2017-04-27 22:00:54 +08002 * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
Varun Wadekarbc74fec2015-07-16 15:47:03 +05303 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Varun Wadekarbc74fec2015-07-16 15:47:03 +05305 */
6
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00007#include <drivers/delay_timer.h>
8#include <lib/mmio.h>
9
Varun Wadekarbc74fec2015-07-16 15:47:03 +053010#include <tegra_def.h>
Anthony Zhouee4be0f2017-04-27 22:00:54 +080011#include <tegra_private.h>
Varun Wadekarbc74fec2015-07-16 15:47:03 +053012
13static uint32_t tegra_timerus_get_value(void)
14{
15 return mmio_read_32(TEGRA_TMRUS_BASE);
16}
17
Varun Wadekarbc74fec2015-07-16 15:47:03 +053018/*
19 * Initialise the on-chip free rolling us counter as the delay
20 * timer.
21 */
22void tegra_delay_timer_init(void)
23{
Anthony Zhouee4be0f2017-04-27 22:00:54 +080024 static const timer_ops_t tegra_timer_ops = {
25 .get_timer_value = tegra_timerus_get_value,
26 .clk_mult = 1,
27 .clk_div = 1,
28 };
29
Varun Wadekarbc74fec2015-07-16 15:47:03 +053030 timer_init(&tegra_timer_ops);
31}