aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Leach <mike.leach@linaro.org>2024-01-23 14:01:23 +0000
committerMike Leach <mike.leach@linaro.org>2024-02-02 17:41:50 +0000
commit503133b778968847c8e0e69cf6f93b14b44680b2 (patch)
tree0f39d69f5393311b42edacc8148f9c1ff8adcbbb
parent53b7419a0afb65fe6bb476bf39fe4774c4e45b9e (diff)
module: scmi_power_domain: Add DT configuration support
Update scmi_power_domain SCP module to support device tree configuration. Signed-off-by: Mike Leach <mike.leach@linaro.org>
-rw-r--r--module/scmi_power_domain/CMakeLists.txt10
-rw-r--r--module/scmi_power_domain/src/config_dt_scmi_power_domain.c46
2 files changed, 56 insertions, 0 deletions
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 <mod_scmi_power_domain.h>
+
+#include <fwk_element.h>
+#include <fwk_macros.h>
+#include <fwk_module.h>
+#include <fwk_module_idx.h>
+
+#include <fwk_dt_config_dyn.h>
+#include <fwk_dt_config_common.h>
+
+#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
+