Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017-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_CLKFUNC_H |
| 8 | #define STM32MP1_CLKFUNC_H |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 9 | |
Yann Gautier | f9af3bc | 2018-11-09 15:57:18 +0100 | [diff] [blame] | 10 | #include <libfdt.h> |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 11 | #include <stdbool.h> |
| 12 | |
| 13 | enum stm32mp_osc_id { |
| 14 | _HSI, |
| 15 | _HSE, |
| 16 | _CSI, |
| 17 | _LSI, |
| 18 | _LSE, |
| 19 | _I2S_CKIN, |
| 20 | _USB_PHY_48, |
| 21 | NB_OSC, |
| 22 | _UNKNOWN_OSC_ID = 0xFF |
| 23 | }; |
| 24 | |
| 25 | extern const char *stm32mp_osc_node_label[NB_OSC]; |
| 26 | |
| 27 | int fdt_osc_read_freq(const char *name, uint32_t *freq); |
| 28 | bool fdt_osc_read_bool(enum stm32mp_osc_id osc_id, const char *prop_name); |
| 29 | uint32_t fdt_osc_read_uint32_default(enum stm32mp_osc_id osc_id, |
| 30 | const char *prop_name, |
| 31 | uint32_t dflt_value); |
| 32 | |
| 33 | uint32_t fdt_rcc_read_addr(void); |
| 34 | int fdt_rcc_read_uint32_array(const char *prop_name, |
| 35 | uint32_t *array, uint32_t count); |
| 36 | int fdt_rcc_subnode_offset(const char *name); |
Yann Gautier | f9af3bc | 2018-11-09 15:57:18 +0100 | [diff] [blame] | 37 | const fdt32_t *fdt_rcc_read_prop(const char *prop_name, int *lenp); |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 38 | bool fdt_get_rcc_secure_status(void); |
| 39 | |
| 40 | uintptr_t fdt_get_stgen_base(void); |
| 41 | int fdt_get_clock_id(int node); |
| 42 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 43 | #endif /* STM32MP1_CLKFUNC_H */ |