blob: 106dcae01687f291652315a2a7b52f274484dafc [file] [log] [blame]
Yann Gautier9aea69e2018-07-24 17:13:36 +02001/*
2 * Copyright (c) 2017-2018, STMicroelectronics - All Rights Reserved
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00007#ifndef STM32MP1_CLKFUNC_H
8#define STM32MP1_CLKFUNC_H
Yann Gautier9aea69e2018-07-24 17:13:36 +02009
10#include <stdbool.h>
11
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000012#include <libfdt.h>
13
Yann Gautier9aea69e2018-07-24 17:13:36 +020014enum stm32mp_osc_id {
15 _HSI,
16 _HSE,
17 _CSI,
18 _LSI,
19 _LSE,
20 _I2S_CKIN,
21 _USB_PHY_48,
22 NB_OSC,
23 _UNKNOWN_OSC_ID = 0xFF
24};
25
26extern const char *stm32mp_osc_node_label[NB_OSC];
27
28int fdt_osc_read_freq(const char *name, uint32_t *freq);
29bool fdt_osc_read_bool(enum stm32mp_osc_id osc_id, const char *prop_name);
30uint32_t fdt_osc_read_uint32_default(enum stm32mp_osc_id osc_id,
31 const char *prop_name,
32 uint32_t dflt_value);
33
34uint32_t fdt_rcc_read_addr(void);
35int fdt_rcc_read_uint32_array(const char *prop_name,
36 uint32_t *array, uint32_t count);
37int fdt_rcc_subnode_offset(const char *name);
Yann Gautierf9af3bc2018-11-09 15:57:18 +010038const fdt32_t *fdt_rcc_read_prop(const char *prop_name, int *lenp);
Yann Gautier9aea69e2018-07-24 17:13:36 +020039bool fdt_get_rcc_secure_status(void);
40
41uintptr_t fdt_get_stgen_base(void);
42int fdt_get_clock_id(int node);
43
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000044#endif /* STM32MP1_CLKFUNC_H */