blob: 61286b2244d32b28e8b3b23eefb41584ab9e708b [file] [log] [blame]
Yann Gautier4d429472019-02-14 11:15:20 +01001/*
Gabriel Fernandez5177ea22020-05-15 08:00:03 +02002 * Copyright (c) 2017-2022, STMicroelectronics - All Rights Reserved
Yann Gautier4d429472019-02-14 11:15:20 +01003 *
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 Gautier5f2e8742019-05-17 15:57:56 +020014#include <platform_def.h>
15
16int fdt_osc_read_freq(const char *name, uint32_t *freq);
Gabriel Fernandez5177ea22020-05-15 08:00:03 +020017bool fdt_clk_read_bool(const char *node_label, const char *prop_name);
18uint32_t fdt_clk_read_uint32_default(const char *node_label,
Yann Gautier5f2e8742019-05-17 15:57:56 +020019 const char *prop_name,
20 uint32_t dflt_value);
21
Andre Przywaracc99f3f2020-03-26 12:51:21 +000022int fdt_rcc_read_uint32_array(const char *prop_name, uint32_t count,
23 uint32_t *array);
Yann Gautier4d429472019-02-14 11:15:20 +010024int fdt_rcc_subnode_offset(const char *name);
25const fdt32_t *fdt_rcc_read_prop(const char *prop_name, int *lenp);
Lionel Debieve3c0fbfe2020-12-15 10:35:59 +010026bool fdt_get_rcc_secure_state(void);
Yann Gautier4d429472019-02-14 11:15:20 +010027
Yann Gautier4d429472019-02-14 11:15:20 +010028int fdt_get_clock_id(int node);
Nicolas Le Bayondc08ebe2019-09-11 11:46:40 +020029unsigned long fdt_get_uart_clock_freq(uintptr_t instance);
Yann Gautier4d429472019-02-14 11:15:20 +010030
Lionel Debievedeef9692019-12-04 21:50:19 +010031void stm32mp_stgen_config(unsigned long rate);
32void stm32mp_stgen_restore_counter(unsigned long long value,
33 unsigned long long offset_in_ms);
34unsigned long long stm32mp_stgen_get_counter(void);
35
Yann Gautier4d429472019-02-14 11:15:20 +010036#endif /* STM32MP_CLKFUNC_H */