Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, STMicroelectronics - All Rights Reserved |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 7 | #ifndef STM32MP1_CLK_H |
| 8 | #define STM32MP1_CLK_H |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 9 | |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 10 | #include <stdbool.h> |
| 11 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 12 | #include <arch_helpers.h> |
| 13 | |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 14 | int stm32mp1_clk_probe(void); |
| 15 | int stm32mp1_clk_init(void); |
| 16 | bool stm32mp1_clk_is_enabled(unsigned long id); |
| 17 | int stm32mp1_clk_enable(unsigned long id); |
| 18 | int stm32mp1_clk_disable(unsigned long id); |
| 19 | unsigned long stm32mp1_clk_get_rate(unsigned long id); |
| 20 | void stm32mp1_stgen_increment(unsigned long long offset_in_ms); |
| 21 | |
| 22 | static inline uint32_t get_timer(uint32_t base) |
| 23 | { |
| 24 | if (base == 0U) { |
| 25 | return (uint32_t)(~read_cntpct_el0()); |
| 26 | } |
| 27 | |
| 28 | return base - (uint32_t)(~read_cntpct_el0()); |
| 29 | } |
| 30 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 31 | #endif /* STM32MP1_CLK_H */ |