Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 1 | /* |
Etienne Carriere | d81dadf | 2020-04-25 11:14:45 +0200 | [diff] [blame] | 2 | * Copyright (c) 2020, STMicroelectronics - All Rights Reserved |
Yann Gautier | 038bff2 | 2019-01-17 19:17:47 +0100 | [diff] [blame] | 3 | * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 4 | * |
| 5 | * SPDX-License-Identifier: BSD-3-Clause |
| 6 | */ |
| 7 | |
Yann Gautier | ee8f542 | 2019-02-14 11:13:25 +0100 | [diff] [blame] | 8 | #ifndef STM32MP_DT_H |
| 9 | #define STM32MP_DT_H |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 10 | |
| 11 | #include <stdbool.h> |
| 12 | |
Yann Gautier | 038bff2 | 2019-01-17 19:17:47 +0100 | [diff] [blame] | 13 | #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 Gautier | 69035a8 | 2018-07-05 16:48:16 +0200 | [diff] [blame] | 18 | struct dt_node_info { |
| 19 | uint32_t base; |
| 20 | int32_t clock; |
| 21 | int32_t reset; |
Yann Gautier | 038bff2 | 2019-01-17 19:17:47 +0100 | [diff] [blame] | 22 | uint32_t status; |
Yann Gautier | 69035a8 | 2018-07-05 16:48:16 +0200 | [diff] [blame] | 23 | }; |
| 24 | |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 25 | /******************************************************************************* |
| 26 | * Function and variable prototypes |
| 27 | ******************************************************************************/ |
| 28 | int dt_open_and_check(void); |
| 29 | int fdt_get_address(void **fdt_addr); |
| 30 | bool fdt_check_node(int node); |
Yann Gautier | ee8f542 | 2019-02-14 11:13:25 +0100 | [diff] [blame] | 31 | uint8_t fdt_get_status(int node); |
Yann Gautier | 69035a8 | 2018-07-05 16:48:16 +0200 | [diff] [blame] | 32 | int dt_set_stdout_pinctrl(void); |
| 33 | void dt_fill_device_info(struct dt_node_info *info, int node); |
| 34 | int dt_get_node(struct dt_node_info *info, int offset, const char *compat); |
| 35 | int dt_get_stdout_uart_info(struct dt_node_info *info); |
Yann Gautier | caf575b | 2018-07-24 17:18:19 +0200 | [diff] [blame] | 36 | uint32_t dt_get_ddr_size(void); |
Yann Gautier | 3d78a2e | 2019-02-14 11:01:20 +0100 | [diff] [blame] | 37 | uintptr_t dt_get_ddrctrl_base(void); |
| 38 | uintptr_t dt_get_ddrphyc_base(void); |
| 39 | uintptr_t dt_get_pwr_base(void); |
Yann Gautier | 3edc7c3 | 2019-05-20 19:17:08 +0200 | [diff] [blame] | 40 | uint32_t dt_get_pwr_vdd_voltage(void); |
| 41 | uintptr_t dt_get_syscfg_base(void); |
Yann Gautier | 69035a8 | 2018-07-05 16:48:16 +0200 | [diff] [blame] | 42 | const char *dt_get_board_model(void); |
Etienne Carriere | d81dadf | 2020-04-25 11:14:45 +0200 | [diff] [blame] | 43 | int fdt_get_gpio_bank_pin_count(unsigned int bank); |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 44 | |
Yann Gautier | ee8f542 | 2019-02-14 11:13:25 +0100 | [diff] [blame] | 45 | #endif /* STM32MP_DT_H */ |