Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 1 | /* |
Lionel Debieve | bc2d88d | 2019-11-04 14:31:38 +0100 | [diff] [blame] | 2 | * Copyright (c) 2020-2022, STMicroelectronics - All Rights Reserved |
| 3 | * Copyright (c) 2017-2022, 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> |
Yann Gautier | 05773eb | 2020-08-24 11:51:50 +0200 | [diff] [blame] | 12 | #include <stdint.h> |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 13 | |
Yann Gautier | 038bff2 | 2019-01-17 19:17:47 +0100 | [diff] [blame] | 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 | |
Yann Gautier | 69035a8 | 2018-07-05 16:48:16 +0200 | [diff] [blame] | 19 | struct dt_node_info { |
| 20 | uint32_t base; |
| 21 | int32_t clock; |
| 22 | int32_t reset; |
Yann Gautier | 038bff2 | 2019-01-17 19:17:47 +0100 | [diff] [blame] | 23 | uint32_t status; |
Yann Gautier | 69035a8 | 2018-07-05 16:48:16 +0200 | [diff] [blame] | 24 | }; |
| 25 | |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 26 | /******************************************************************************* |
| 27 | * Function and variable prototypes |
| 28 | ******************************************************************************/ |
Yann Gautier | 05773eb | 2020-08-24 11:51:50 +0200 | [diff] [blame] | 29 | int dt_open_and_check(uintptr_t dt_addr); |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 30 | int fdt_get_address(void **fdt_addr); |
| 31 | bool fdt_check_node(int node); |
Yann Gautier | ee8f542 | 2019-02-14 11:13:25 +0100 | [diff] [blame] | 32 | uint8_t fdt_get_status(int node); |
Yann Gautier | 69035a8 | 2018-07-05 16:48:16 +0200 | [diff] [blame] | 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); |
Yann Gautier | 4e26784 | 2021-09-29 11:31:09 +0200 | [diff] [blame] | 37 | int dt_match_instance_by_compatible(const char *compatible, uintptr_t address); |
Yann Gautier | caf575b | 2018-07-24 17:18:19 +0200 | [diff] [blame] | 38 | uint32_t dt_get_ddr_size(void); |
Yann Gautier | 3edc7c3 | 2019-05-20 19:17:08 +0200 | [diff] [blame] | 39 | uint32_t dt_get_pwr_vdd_voltage(void); |
Yann Gautier | 296e1ab | 2021-09-17 16:08:12 +0200 | [diff] [blame] | 40 | struct rdev *dt_get_vdd_regulator(void); |
| 41 | struct rdev *dt_get_cpu_regulator(void); |
Yann Gautier | 69035a8 | 2018-07-05 16:48:16 +0200 | [diff] [blame] | 42 | const char *dt_get_board_model(void); |
Lionel Debieve | bc2d88d | 2019-11-04 14:31:38 +0100 | [diff] [blame] | 43 | int dt_find_otp_name(const char *name, uint32_t *otp, uint32_t *otp_len); |
Etienne Carriere | d81dadf | 2020-04-25 11:14:45 +0200 | [diff] [blame] | 44 | int fdt_get_gpio_bank_pin_count(unsigned int bank); |
Yann Gautier | 9aea69e | 2018-07-24 17:13:36 +0200 | [diff] [blame] | 45 | |
Yann Gautier | ee8f542 | 2019-02-14 11:13:25 +0100 | [diff] [blame] | 46 | #endif /* STM32MP_DT_H */ |