2015-07-16 11:17:03 +01:00
|
|
|
/*
|
2017-04-27 15:00:54 +01:00
|
|
|
* Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
|
2015-07-16 11:17:03 +01:00
|
|
|
*
|
2017-05-03 09:38:09 +01:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2015-07-16 11:17:03 +01:00
|
|
|
*/
|
|
|
|
|
2018-12-14 00:18:21 +00:00
|
|
|
#include <drivers/delay_timer.h>
|
|
|
|
#include <lib/mmio.h>
|
|
|
|
|
2015-07-16 11:17:03 +01:00
|
|
|
#include <tegra_def.h>
|
2017-04-27 15:00:54 +01:00
|
|
|
#include <tegra_private.h>
|
2015-07-16 11:17:03 +01:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2017-04-27 15:00:54 +01:00
|
|
|
static const timer_ops_t tegra_timer_ops = {
|
|
|
|
.get_timer_value = tegra_timerus_get_value,
|
|
|
|
.clk_mult = 1,
|
|
|
|
.clk_div = 1,
|
|
|
|
};
|
|
|
|
|
2015-07-16 11:17:03 +01:00
|
|
|
timer_init(&tegra_timer_ops);
|
|
|
|
}
|