1 /*
2  * Copyright (c) 2020-2023, STMicroelectronics - All Rights Reserved
3  * Copyright (c) 2017-2023, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef STM32MP_DT_H
9 #define STM32MP_DT_H
10 
11 #include <stdbool.h>
12 #include <stdint.h>
13 
14 #define DT_DISABLED		U(0)
15 #define DT_NON_SECURE		U(1)
16 #define DT_SECURE		U(2)
17 #define DT_SHARED		(DT_NON_SECURE | DT_SECURE)
18 
19 struct dt_node_info {
20 	uint32_t base;
21 	int32_t clock;
22 	int32_t reset;
23 	uint32_t status;
24 };
25 
26 /*******************************************************************************
27  * Function and variable prototypes
28  ******************************************************************************/
29 int dt_open_and_check(uintptr_t dt_addr);
30 int fdt_get_address(void **fdt_addr);
31 bool fdt_check_node(int node);
32 uint8_t fdt_get_status(int node);
33 int dt_set_stdout_pinctrl(void);
34 void dt_fill_device_info(struct dt_node_info *info, int node);
35 int dt_get_node(struct dt_node_info *info, int offset, const char *compat);
36 int dt_get_stdout_uart_info(struct dt_node_info *info);
37 int dt_match_instance_by_compatible(const char *compatible, uintptr_t address);
38 size_t dt_get_ddr_size(void);
39 uint32_t dt_get_pwr_vdd_voltage(void);
40 struct rdev *dt_get_vdd_regulator(void);
41 struct rdev *dt_get_cpu_regulator(void);
42 const char *dt_get_board_model(void);
43 int dt_find_otp_name(const char *name, uint32_t *otp, uint32_t *otp_len);
44 int fdt_get_gpio_bank_pin_count(unsigned int bank);
45 
46 #endif /* STM32MP_DT_H */
47