blob: 11ff7bf24788d9bbc4a3caee7d0365223ef75d13 [file] [log] [blame]
Yann Gautier9aea69e2018-07-24 17:13:36 +02001/*
Yann Gautiera2e2a302019-02-14 11:13:39 +01002 * Copyright (c) 2018-2019, STMicroelectronics - All Rights Reserved
Yann Gautier9aea69e2018-07-24 17:13:36 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00007#ifndef STM32MP1_CLK_H
8#define STM32MP1_CLK_H
Yann Gautier9aea69e2018-07-24 17:13:36 +02009
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000010#include <arch_helpers.h>
11
Yann Gautier9aea69e2018-07-24 17:13:36 +020012int stm32mp1_clk_probe(void);
13int stm32mp1_clk_init(void);
Yann Gautier9aea69e2018-07-24 17:13:36 +020014void stm32mp1_stgen_increment(unsigned long long offset_in_ms);
15
16static inline uint32_t get_timer(uint32_t base)
17{
18 if (base == 0U) {
19 return (uint32_t)(~read_cntpct_el0());
20 }
21
22 return base - (uint32_t)(~read_cntpct_el0());
23}
24
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000025#endif /* STM32MP1_CLK_H */