Varun Wadekar | bc74fec | 2015-07-16 15:47:03 +0530 | [diff] [blame] | 1 | /* |
Anthony Zhou | ee4be0f | 2017-04-27 22:00:54 +0800 | [diff] [blame] | 2 | * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved. |
Varun Wadekar | bc74fec | 2015-07-16 15:47:03 +0530 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Varun Wadekar | bc74fec | 2015-07-16 15:47:03 +0530 | [diff] [blame] | 5 | */ |
| 6 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 7 | #include <drivers/delay_timer.h> |
| 8 | #include <lib/mmio.h> |
| 9 | |
Varun Wadekar | bc74fec | 2015-07-16 15:47:03 +0530 | [diff] [blame] | 10 | #include <tegra_def.h> |
Anthony Zhou | ee4be0f | 2017-04-27 22:00:54 +0800 | [diff] [blame] | 11 | #include <tegra_private.h> |
Varun Wadekar | bc74fec | 2015-07-16 15:47:03 +0530 | [diff] [blame] | 12 | |
| 13 | static uint32_t tegra_timerus_get_value(void) |
| 14 | { |
| 15 | return mmio_read_32(TEGRA_TMRUS_BASE); |
| 16 | } |
| 17 | |
Varun Wadekar | bc74fec | 2015-07-16 15:47:03 +0530 | [diff] [blame] | 18 | /* |
| 19 | * Initialise the on-chip free rolling us counter as the delay |
| 20 | * timer. |
| 21 | */ |
| 22 | void tegra_delay_timer_init(void) |
| 23 | { |
Anthony Zhou | ee4be0f | 2017-04-27 22:00:54 +0800 | [diff] [blame] | 24 | 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 Wadekar | bc74fec | 2015-07-16 15:47:03 +0530 | [diff] [blame] | 30 | timer_init(&tegra_timer_ops); |
| 31 | } |