blob: 3415b051d5b08c6d7e1b5d9b8770771099bc6cac [file] [log] [blame]
Yann Gautier9aea69e2018-07-24 17:13:36 +02001/*
Yann Gautier038bff22019-01-17 19:17:47 +01002 * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
Yann Gautier9aea69e2018-07-24 17:13:36 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Yann Gautieree8f5422019-02-14 11:13:25 +01007#ifndef STM32MP_DT_H
8#define STM32MP_DT_H
Yann Gautier9aea69e2018-07-24 17:13:36 +02009
10#include <stdbool.h>
11
Yann Gautier038bff22019-01-17 19:17:47 +010012#define DT_DISABLED U(0)
13#define DT_NON_SECURE U(1)
14#define DT_SECURE U(2)
15#define DT_SHARED (DT_NON_SECURE | DT_SECURE)
16
Yann Gautier69035a82018-07-05 16:48:16 +020017struct dt_node_info {
18 uint32_t base;
19 int32_t clock;
20 int32_t reset;
Yann Gautier038bff22019-01-17 19:17:47 +010021 uint32_t status;
Yann Gautier69035a82018-07-05 16:48:16 +020022};
23
Yann Gautier9aea69e2018-07-24 17:13:36 +020024/*******************************************************************************
25 * Function and variable prototypes
26 ******************************************************************************/
27int dt_open_and_check(void);
28int fdt_get_address(void **fdt_addr);
29bool fdt_check_node(int node);
Yann Gautieree8f5422019-02-14 11:13:25 +010030uint8_t fdt_get_status(int node);
Yann Gautier9aea69e2018-07-24 17:13:36 +020031uint32_t fdt_read_uint32_default(int node, const char *prop_name,
32 uint32_t dflt_value);
33int fdt_read_uint32_array(int node, const char *prop_name,
34 uint32_t *array, uint32_t count);
Yann Gautier69035a82018-07-05 16:48:16 +020035int dt_set_stdout_pinctrl(void);
36void dt_fill_device_info(struct dt_node_info *info, int node);
37int dt_get_node(struct dt_node_info *info, int offset, const char *compat);
38int dt_get_stdout_uart_info(struct dt_node_info *info);
39int dt_get_stdout_node_offset(void);
Yann Gautiercaf575b2018-07-24 17:18:19 +020040uint32_t dt_get_ddr_size(void);
Yann Gautier3d78a2e2019-02-14 11:01:20 +010041uintptr_t dt_get_ddrctrl_base(void);
42uintptr_t dt_get_ddrphyc_base(void);
43uintptr_t dt_get_pwr_base(void);
Yann Gautier69035a82018-07-05 16:48:16 +020044const char *dt_get_board_model(void);
Yann Gautier9aea69e2018-07-24 17:13:36 +020045
Yann Gautieree8f5422019-02-14 11:13:25 +010046#endif /* STM32MP_DT_H */