From 503133b778968847c8e0e69cf6f93b14b44680b2 Mon Sep 17 00:00:00 2001 From: Mike Leach Date: Tue, 23 Jan 2024 14:01:23 +0000 Subject: module: scmi_power_domain: Add DT configuration support Update scmi_power_domain SCP module to support device tree configuration. Signed-off-by: Mike Leach --- module/scmi_power_domain/CMakeLists.txt | 10 +++++ .../src/config_dt_scmi_power_domain.c | 46 ++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 module/scmi_power_domain/src/config_dt_scmi_power_domain.c diff --git a/module/scmi_power_domain/CMakeLists.txt b/module/scmi_power_domain/CMakeLists.txt index c3cc127d6ea1..a98ba273b128 100644 --- a/module/scmi_power_domain/CMakeLists.txt +++ b/module/scmi_power_domain/CMakeLists.txt @@ -14,6 +14,16 @@ target_sources( ${SCP_MODULE_TARGET} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/mod_scmi_power_domain.c") +# Device tree module configuration +if(SCP_MODULE IN_LIST SCP_DT_CONFIG_MODULES_ALL) + target_sources(${SCP_MODULE_TARGET} + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/config_dt_scmi_power_domain.c") + + # no header files needed for dt include + +endif() + + target_link_libraries(${SCP_MODULE_TARGET} PRIVATE module-power-domain module-scmi) diff --git a/module/scmi_power_domain/src/config_dt_scmi_power_domain.c b/module/scmi_power_domain/src/config_dt_scmi_power_domain.c new file mode 100644 index 000000000000..440e78089c72 --- /dev/null +++ b/module/scmi_power_domain/src/config_dt_scmi_power_domain.c @@ -0,0 +1,46 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +#include + +#include +#include +#include +#include + +#include +#include + +#ifdef BUILD_HAS_MOD_DEBUG + +#define SCMI_PD_COMPAT scp_scmi_pwr_domain + +struct fwk_module_config config_dt_scmi_power_domain = { + .data = &((struct mod_scmi_pd_config) { + /* ids ordered indexes 0 - 1 */ + .debug_pd_id = FWK_DT_PH_IDX_SCP_ID_BY_TYPE(SCMI_PD_COMPAT, 0, 0), + .debug_id = FWK_DT_PH_IDX_SCP_ID_BY_TYPE(SCMI_PD_COMPAT, 0, 1), + }), +}; + +/* cannot support table mods at runtime via the get elements generator function + * or more than one instance + */ + +#ifdef FWK_MODULE_GEN_DYNAMIC_SCMI_POWER_DOMAIN + #error ("SCMI power domain module does not support DT dynamic configuration") +#endif + +static_assert(DT_N_INST_scp_scmi_pwr_domain_NUM_OKAY == 1, + "Error - multiple scmi-pwr-domain defined in device tree - must only be one"); + +#else +/* No elements, no module configuration data */ +struct fwk_module_config config_dt_scmi_power_domain = { 0 }; +#endif + -- cgit v1.2.3