blob: 44ad820dc5c990c13fe1b6b410782576faf00635 [file] [log] [blame]
Yann Gautier9aea69e2018-07-24 17:13:36 +02001/*
Etienne Carriered81dadf2020-04-25 11:14:45 +02002 * Copyright (c) 2020, STMicroelectronics - All Rights Reserved
Yann Gautier038bff22019-01-17 19:17:47 +01003 * Copyright (c) 2017-2019, 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>
12
Yann Gautier038bff22019-01-17 19:17:47 +010013#define DT_DISABLED U(0)
14#define DT_NON_SECURE U(1)
15#define DT_SECURE U(2)
16#define DT_SHARED (DT_NON_SECURE | DT_SECURE)
17
Yann Gautier69035a82018-07-05 16:48:16 +020018struct dt_node_info {
19 uint32_t base;
20 int32_t clock;
21 int32_t reset;
Yann Gautier038bff22019-01-17 19:17:47 +010022 uint32_t status;
Yann Gautier69035a82018-07-05 16:48:16 +020023};
24
Yann Gautier9aea69e2018-07-24 17:13:36 +020025/*******************************************************************************
26 * Function and variable prototypes
27 ******************************************************************************/
28int dt_open_and_check(void);
29int fdt_get_address(void **fdt_addr);
30bool fdt_check_node(int node);
Yann Gautieree8f5422019-02-14 11:13:25 +010031uint8_t fdt_get_status(int node);
Yann Gautier69035a82018-07-05 16:48:16 +020032int dt_set_stdout_pinctrl(void);
33void dt_fill_device_info(struct dt_node_info *info, int node);
34int dt_get_node(struct dt_node_info *info, int offset, const char *compat);
35int dt_get_stdout_uart_info(struct dt_node_info *info);
Yann Gautiercaf575b2018-07-24 17:18:19 +020036uint32_t dt_get_ddr_size(void);
Yann Gautier3d78a2e2019-02-14 11:01:20 +010037uintptr_t dt_get_ddrctrl_base(void);
38uintptr_t dt_get_ddrphyc_base(void);
39uintptr_t dt_get_pwr_base(void);
Yann Gautier3edc7c32019-05-20 19:17:08 +020040uint32_t dt_get_pwr_vdd_voltage(void);
41uintptr_t dt_get_syscfg_base(void);
Yann Gautier69035a82018-07-05 16:48:16 +020042const char *dt_get_board_model(void);
Etienne Carriered81dadf2020-04-25 11:14:45 +020043int fdt_get_gpio_bank_pin_count(unsigned int bank);
Yann Gautier9aea69e2018-07-24 17:13:36 +020044
Yann Gautieree8f5422019-02-14 11:13:25 +010045#endif /* STM32MP_DT_H */