blob: b7bf1d012334f770da55556c08ea762949c2ad1f [file] [log] [blame]
Yann Gautier9aea69e2018-07-24 17:13:36 +02001/*
Lionel Debievebc2d88d2019-11-04 14:31:38 +01002 * Copyright (c) 2020-2022, STMicroelectronics - All Rights Reserved
3 * Copyright (c) 2017-2022, ARM Limited and Contributors. All rights reserved.
Yann Gautier9aea69e2018-07-24 17:13:36 +02004 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
Yann Gautieree8f5422019-02-14 11:13:25 +01008#ifndef STM32MP_DT_H
9#define STM32MP_DT_H
Yann Gautier9aea69e2018-07-24 17:13:36 +020010
11#include <stdbool.h>
Yann Gautier05773eb2020-08-24 11:51:50 +020012#include <stdint.h>
Yann Gautier9aea69e2018-07-24 17:13:36 +020013
Yann Gautier038bff22019-01-17 19:17:47 +010014#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
Yann Gautier69035a82018-07-05 16:48:16 +020019struct dt_node_info {
20 uint32_t base;
21 int32_t clock;
22 int32_t reset;
Yann Gautier038bff22019-01-17 19:17:47 +010023 uint32_t status;
Yann Gautier69035a82018-07-05 16:48:16 +020024};
25
Yann Gautier9aea69e2018-07-24 17:13:36 +020026/*******************************************************************************
27 * Function and variable prototypes
28 ******************************************************************************/
Yann Gautier05773eb2020-08-24 11:51:50 +020029int dt_open_and_check(uintptr_t dt_addr);
Yann Gautier9aea69e2018-07-24 17:13:36 +020030int fdt_get_address(void **fdt_addr);
31bool fdt_check_node(int node);
Yann Gautieree8f5422019-02-14 11:13:25 +010032uint8_t fdt_get_status(int node);
Yann Gautier69035a82018-07-05 16:48:16 +020033int dt_set_stdout_pinctrl(void);
34void dt_fill_device_info(struct dt_node_info *info, int node);
35int dt_get_node(struct dt_node_info *info, int offset, const char *compat);
36int dt_get_stdout_uart_info(struct dt_node_info *info);
Yann Gautier4e267842021-09-29 11:31:09 +020037int dt_match_instance_by_compatible(const char *compatible, uintptr_t address);
Yann Gautiercaf575b2018-07-24 17:18:19 +020038uint32_t dt_get_ddr_size(void);
Yann Gautier3edc7c32019-05-20 19:17:08 +020039uint32_t dt_get_pwr_vdd_voltage(void);
Yann Gautier296e1ab2021-09-17 16:08:12 +020040struct rdev *dt_get_vdd_regulator(void);
41struct rdev *dt_get_cpu_regulator(void);
Yann Gautier69035a82018-07-05 16:48:16 +020042const char *dt_get_board_model(void);
Lionel Debievebc2d88d2019-11-04 14:31:38 +010043int dt_find_otp_name(const char *name, uint32_t *otp, uint32_t *otp_len);
Etienne Carriered81dadf2020-04-25 11:14:45 +020044int fdt_get_gpio_bank_pin_count(unsigned int bank);
Yann Gautier9aea69e2018-07-24 17:13:36 +020045
Yann Gautieree8f5422019-02-14 11:13:25 +010046#endif /* STM32MP_DT_H */