xref: /rk3399_ARM-atf/include/drivers/st/stm32mp1_clk.h (revision 7839a050909944bd3ee6a70245a2bcc5471b3507)
1 /*
2  * Copyright (c) 2018, STMicroelectronics - All Rights Reserved
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef __STM32MP1_CLK_H__
8 #define __STM32MP1_CLK_H__
9 
10 #include <arch_helpers.h>
11 #include <stdbool.h>
12 
13 int stm32mp1_clk_probe(void);
14 int stm32mp1_clk_init(void);
15 bool stm32mp1_clk_is_enabled(unsigned long id);
16 int stm32mp1_clk_enable(unsigned long id);
17 int stm32mp1_clk_disable(unsigned long id);
18 unsigned long stm32mp1_clk_get_rate(unsigned long id);
19 void stm32mp1_stgen_increment(unsigned long long offset_in_ms);
20 
21 static inline uint32_t get_timer(uint32_t base)
22 {
23 	if (base == 0U) {
24 		return (uint32_t)(~read_cntpct_el0());
25 	}
26 
27 	return base - (uint32_t)(~read_cntpct_el0());
28 }
29 
30 #endif /* __STM32MP1_CLK_H__ */
31