blob: 2467af9bb26a6790b599603b7a40be76277154e3 [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
Yann Gautierf9af3bc2018-11-09 15:57:18 +010010#include <libfdt.h>
Yann Gautier9aea69e2018-07-24 17:13:36 +020011#include <stdbool.h>
12
13enum 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
25extern const char *stm32mp_osc_node_label[NB_OSC];
26
27int fdt_osc_read_freq(const char *name, uint32_t *freq);
28bool fdt_osc_read_bool(enum stm32mp_osc_id osc_id, const char *prop_name);
29uint32_t fdt_osc_read_uint32_default(enum stm32mp_osc_id osc_id,
30 const char *prop_name,
31 uint32_t dflt_value);
32
33uint32_t fdt_rcc_read_addr(void);
34int fdt_rcc_read_uint32_array(const char *prop_name,
35 uint32_t *array, uint32_t count);
36int fdt_rcc_subnode_offset(const char *name);
Yann Gautierf9af3bc2018-11-09 15:57:18 +010037const fdt32_t *fdt_rcc_read_prop(const char *prop_name, int *lenp);
Yann Gautier9aea69e2018-07-24 17:13:36 +020038bool fdt_get_rcc_secure_status(void);
39
40uintptr_t fdt_get_stgen_base(void);
41int fdt_get_clock_id(int node);
42
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000043#endif /* STM32MP1_CLKFUNC_H */