1 /* 2 * Copyright (c) 2024-2025, Altera Corporation. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef SOCFPGA_DT_H 8 #define SOCFPGA_DT_H 9 10 11 #include <stdlib.h> 12 #include <drivers/arm/gicv3.h> 13 #include <drivers/delay_timer.h> 14 /* 15 * This macro takes three arguments: 16 * config: Configuration identifier 17 * name: property namespace 18 * callback: populate() function 19 */ 20 #define SOCFPGA_REGISTER_POPULATOR(config, name, callback) \ 21 __section(".socfpga_populator") __used \ 22 static const struct socfpga_populator (name##__populator) = { \ 23 .config_type = (#config), \ 24 .info = (#name), \ 25 .populate = (callback) \ 26 } 27 28 /* 29 * Populator callback 30 * 31 * This structure are used by the fconf_populate function and should only be 32 * defined by the SOCFPGA_REGISTER_POPULATOR macro. 33 */ 34 struct socfpga_populator { 35 /* Description of the data loaded by the callback */ 36 const char *config_type; 37 const char *info; 38 39 /* Callback used by fconf_populate function with a provided config dtb. 40 * Return 0 on success, err_code < 0 otherwise. 41 */ 42 int (*populate)(uintptr_t config); 43 }; 44 45 /* Hardware Config related getter */ 46 #define hw_config__gicv3_config_getter(prop) plat_gicv3_gic_data.prop 47 48 /* Function Definitions */ 49 int socfpga_dt_open_and_check(uintptr_t dt_addr, char *compatible_str); 50 int socfpga_dt_populate_gicv3_config(uintptr_t dt_addr, gicv3_driver_data_t *plat_driver_data); 51 int socfpga_dt_populate_dram_layout(uintptr_t dt_addr); 52 53 #endif 54