Yann Gautier | 4d42947 | 2019-02-14 11:15:20 +0100 | [diff] [blame] | 1 | /* |
Gabriel Fernandez | 5177ea2 | 2020-05-15 08:00:03 +0200 | [diff] [blame] | 2 | * Copyright (c) 2017-2022, STMicroelectronics - All Rights Reserved |
Yann Gautier | 4d42947 | 2019-02-14 11:15:20 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef STM32MP_CLKFUNC_H |
| 8 | #define STM32MP_CLKFUNC_H |
| 9 | |
| 10 | #include <stdbool.h> |
| 11 | |
| 12 | #include <libfdt.h> |
| 13 | |
Yann Gautier | 5f2e874 | 2019-05-17 15:57:56 +0200 | [diff] [blame] | 14 | #include <platform_def.h> |
| 15 | |
| 16 | int fdt_osc_read_freq(const char *name, uint32_t *freq); |
Gabriel Fernandez | 5177ea2 | 2020-05-15 08:00:03 +0200 | [diff] [blame] | 17 | bool fdt_clk_read_bool(const char *node_label, const char *prop_name); |
| 18 | uint32_t fdt_clk_read_uint32_default(const char *node_label, |
Yann Gautier | 5f2e874 | 2019-05-17 15:57:56 +0200 | [diff] [blame] | 19 | const char *prop_name, |
| 20 | uint32_t dflt_value); |
| 21 | |
Andre Przywara | cc99f3f | 2020-03-26 12:51:21 +0000 | [diff] [blame] | 22 | int fdt_rcc_read_uint32_array(const char *prop_name, uint32_t count, |
| 23 | uint32_t *array); |
Yann Gautier | 4d42947 | 2019-02-14 11:15:20 +0100 | [diff] [blame] | 24 | int fdt_rcc_subnode_offset(const char *name); |
| 25 | const fdt32_t *fdt_rcc_read_prop(const char *prop_name, int *lenp); |
| 26 | bool fdt_get_rcc_secure_status(void); |
| 27 | |
Yann Gautier | 4d42947 | 2019-02-14 11:15:20 +0100 | [diff] [blame] | 28 | int fdt_get_clock_id(int node); |
Nicolas Le Bayon | dc08ebe | 2019-09-11 11:46:40 +0200 | [diff] [blame] | 29 | unsigned long fdt_get_uart_clock_freq(uintptr_t instance); |
Yann Gautier | 4d42947 | 2019-02-14 11:15:20 +0100 | [diff] [blame] | 30 | |
Lionel Debieve | deef969 | 2019-12-04 21:50:19 +0100 | [diff] [blame] | 31 | void stm32mp_stgen_config(unsigned long rate); |
| 32 | void stm32mp_stgen_restore_counter(unsigned long long value, |
| 33 | unsigned long long offset_in_ms); |
| 34 | unsigned long long stm32mp_stgen_get_counter(void); |
| 35 | |
Yann Gautier | 4d42947 | 2019-02-14 11:15:20 +0100 | [diff] [blame] | 36 | #endif /* STM32MP_CLKFUNC_H */ |