From 251dd6bf0e89a587710fa7bfa320088617f8854e Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Fri, 17 Oct 2025 17:32:30 +0800 Subject: firmware: scmi: Conditionally compile protocol support Add conditional compilation for SCMI protocol support in scmi_get_protocol() and scmi_add_protocol() based on corresponding Kconfig options. This ensures that only the enabled protocols are compiled and accessed, and reducing binary size. Signed-off-by: Peng Fan Reviewed-by: Alice Guo --- include/scmi_agent-uclass.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/scmi_agent-uclass.h b/include/scmi_agent-uclass.h index d6586eb3ff9..ccedd42f367 100644 --- a/include/scmi_agent-uclass.h +++ b/include/scmi_agent-uclass.h @@ -40,11 +40,21 @@ struct scmi_agent_priv { u8 *agent_name; u32 agent_id; struct udevice *base_dev; +#if IS_ENABLED(CONFIG_SCMI_POWER_DOMAIN) struct udevice *pwdom_dev; +#endif +#if IS_ENABLED(CONFIG_CLK_SCMI) struct udevice *clock_dev; +#endif +#if IS_ENABLED(CONFIG_RESET_SCMI) struct udevice *resetdom_dev; +#endif +#if IS_ENABLED(CONFIG_DM_REGULATOR_SCMI) struct udevice *voltagedom_dev; +#endif +#if IS_ENABLED(CONFIG_PINCTRL_IMX_SCMI) struct udevice *pinctrl_dev; +#endif }; static inline u32 scmi_version(struct udevice *dev) -- cgit v1.2.3 From d1f1c98d8468f5f76c2c8c3acb31f83d736d34ce Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Fri, 17 Oct 2025 17:32:31 +0800 Subject: firmware: scmi: Cleanup the SCMI MISC ID SCMI_IMX_PROTOCOL_ID_MISC was never used, so drop it. And move SCMI_PROTOCOL_ID_IMX_MISC out of enum scmi_std_protocol to scmi_nxp_protocols.h, because it is i.MX specific and following Linux Kernel style, use macro definition. Signed-off-by: Peng Fan Reviewed-by: Alice Guo --- include/scmi_nxp_protocols.h | 4 +--- include/scmi_protocols.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'include') diff --git a/include/scmi_nxp_protocols.h b/include/scmi_nxp_protocols.h index fe6ecd6a7cf..7e2143b16ea 100644 --- a/include/scmi_nxp_protocols.h +++ b/include/scmi_nxp_protocols.h @@ -9,9 +9,7 @@ #include #include -enum scmi_imx_protocol { - SCMI_IMX_PROTOCOL_ID_MISC = 0x84, -}; +#define SCMI_PROTOCOL_ID_IMX_MISC 0x84 #define SCMI_PAYLOAD_LEN 100 diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h index 95e0c3cce3b..5c9516d5595 100644 --- a/include/scmi_protocols.h +++ b/include/scmi_protocols.h @@ -25,7 +25,6 @@ enum scmi_std_protocol { SCMI_PROTOCOL_ID_RESET_DOMAIN = 0x16, SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN = 0x17, SCMI_PROTOCOL_ID_PINCTRL = 0x19, - SCMI_PROTOCOL_ID_IMX_MISC = 0x84, }; enum scmi_status_code { -- cgit v1.2.3 From 7830ccc77a13dd2a9880a942734bb5687416c4d8 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Fri, 17 Oct 2025 17:32:32 +0800 Subject: firmware: scmi: Support probe vendor ID 0x80 and 0x82 Preparing to add i.MX LMM and CPU protocol driver, support probe SCMI vendor ID 0x80(i.MX SCMI LMM ID) and 0x82(i.MX SCMI CPU ID). And use Kconfig option to support conditional compilation. Signed-off-by: Peng Fan Reviewed-by: Alice Guo --- include/scmi_agent-uclass.h | 6 ++++++ include/scmi_protocols.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'include') diff --git a/include/scmi_agent-uclass.h b/include/scmi_agent-uclass.h index ccedd42f367..9b36d3ae67b 100644 --- a/include/scmi_agent-uclass.h +++ b/include/scmi_agent-uclass.h @@ -55,6 +55,12 @@ struct scmi_agent_priv { #if IS_ENABLED(CONFIG_PINCTRL_IMX_SCMI) struct udevice *pinctrl_dev; #endif +#if IS_ENABLED(CONFIG_SCMI_ID_VENDOR_80) + struct udevice *vendor_dev_80; +#endif +#if IS_ENABLED(CONFIG_SCMI_ID_VENDOR_82) + struct udevice *vendor_dev_82; +#endif }; static inline u32 scmi_version(struct udevice *dev) diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h index 5c9516d5595..bb74a57f79a 100644 --- a/include/scmi_protocols.h +++ b/include/scmi_protocols.h @@ -25,6 +25,8 @@ enum scmi_std_protocol { SCMI_PROTOCOL_ID_RESET_DOMAIN = 0x16, SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN = 0x17, SCMI_PROTOCOL_ID_PINCTRL = 0x19, + SCMI_PROTOCOL_ID_VENDOR_80 = 0x80, + SCMI_PROTOCOL_ID_VENDOR_82 = 0x82, }; enum scmi_status_code { -- cgit v1.2.3 From 3f20ea3675c466ab16761c9b280e6c382bae02c3 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Fri, 17 Oct 2025 17:32:33 +0800 Subject: firmware: scmi: Add i.MX95 SCMI LMM protocol driver Add Logical Machine Management(LMM) protocol which is intended for boot, shutdown, and reset of other logical machines (LM). It is usually used to allow one LM to manager another used as an offload or accelerator engine. Following Linux Kernel, created a separate folder for holding vendor protocol drivers. Signed-off-by: Peng Fan Reviewed-by: Alice Guo --- include/scmi_nxp_protocols.h | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'include') diff --git a/include/scmi_nxp_protocols.h b/include/scmi_nxp_protocols.h index 7e2143b16ea..1c79bc2282b 100644 --- a/include/scmi_nxp_protocols.h +++ b/include/scmi_nxp_protocols.h @@ -9,6 +9,7 @@ #include #include +#define SCMI_PROTOCOL_ID_IMX_LMM 0x80 #define SCMI_PROTOCOL_ID_IMX_MISC 0x84 #define SCMI_PAYLOAD_LEN 100 @@ -50,4 +51,48 @@ struct scmi_imx_misc_reset_reason_out { u32 extInfo[MISC_MAX_EXTINFO]; }; +#define LMM_ID_DISCOVER 0xFFFFFFFFU +#define LMM_MAX_NAME 16 + +enum scmi_imx_lmm_state { + LMM_STATE_LM_OFF, + LMM_STATE_LM_ON, + LMM_STATE_LM_SUSPEND, + LMM_STATE_LM_POWERED, +}; + +struct scmi_imx_lmm_info { + u32 lmid; + enum scmi_imx_lmm_state state; + u32 errstatus; + u8 name[LMM_MAX_NAME]; +}; + +#if IS_ENABLED(CONFIG_IMX_SM_LMM) +int scmi_imx_lmm_info(struct udevice *dev, u32 lmid, struct scmi_imx_lmm_info *info); +int scmi_imx_lmm_power_boot(struct udevice *dev, u32 lmid, bool boot); +int scmi_imx_lmm_reset_vector_set(struct udevice *dev, u32 lmid, u32 cpuid, u32 flags, u64 vector); +int scmi_imx_lmm_shutdown(struct udevice *dev, u32 lmid, bool flags); +#else +static inline int scmi_imx_lmm_info(struct udevice *dev, u32 lmid, struct scmi_imx_lmm_info *info) +{ + return -EOPNOTSUPP; +} + +static inline int scmi_imx_lmm_power_boot(struct udevice *dev, u32 lmid, bool boot) +{ + return -EOPNOTSUPP; +} + +static inline int +scmi_imx_lmm_reset_vector_set(struct udevice *dev, u32 lmid, u32 cpuid, u32 flags, u64 vector) +{ + return -EOPNOTSUPP; +} + +static inline int scmi_imx_lmm_shutdown(struct udevice *dev, u32 lmid, bool flags) +{ + return -EOPNOTSUPP; +} +#endif #endif -- cgit v1.2.3 From ac9b02dd1028d14b6326970c93dfc3c50daa16f1 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Fri, 17 Oct 2025 17:32:34 +0800 Subject: firmware: scmi: Add i.MX95 SCMI CPU Protocol This protocol allows an agent to start, stop a CPU or set reset vector. It is used to manage auxiliary CPUs in an LM (e.g. additional cores in an AP cluster). Signed-off-by: Peng Fan Reviewed-by: Alice Guo --- include/scmi_nxp_protocols.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'include') diff --git a/include/scmi_nxp_protocols.h b/include/scmi_nxp_protocols.h index 1c79bc2282b..c17f3663eba 100644 --- a/include/scmi_nxp_protocols.h +++ b/include/scmi_nxp_protocols.h @@ -10,6 +10,7 @@ #include #define SCMI_PROTOCOL_ID_IMX_LMM 0x80 +#define SCMI_PROTOCOL_ID_IMX_CPU 0x82 #define SCMI_PROTOCOL_ID_IMX_MISC 0x84 #define SCMI_PAYLOAD_LEN 100 @@ -95,4 +96,27 @@ static inline int scmi_imx_lmm_shutdown(struct udevice *dev, u32 lmid, bool flag return -EOPNOTSUPP; } #endif + +#if IS_ENABLED(CONFIG_IMX_SM_CPU) +int scmi_imx_cpu_started(struct udevice *dev, u32 cpuid, bool *started); +int scmi_imx_cpu_reset_vector_set(struct udevice *dev, u32 cpuid, u32 flags, u64 vector, + bool start, bool boot, bool resume); +int scmi_imx_cpu_start(struct udevice *dev, u32 cpuid, bool start); +#else +static inline int scmi_imx_cpu_started(struct udevice *dev, u32 cpuid, bool *started) +{ + return -EOPNOTSUPP; +} + +static inline int scmi_imx_cpu_reset_vector_set(struct udevice *dev, u32 cpuid, u32 flags, + u64 vector, bool start, bool boot, bool resume) +{ + return -EOPNOTSUPP; +} + +static inline int scmi_imx_cpu_start(struct udevice *dev, u32 cpuid, bool start) +{ + return -EOPNOTSUPP; +} +#endif #endif -- cgit v1.2.3