Skip to contentSkip to conversation

firmware: imx: Add stubs for !CONFIG_IMX_SCU case

PATCH Superseded Anson Huang 3 participants 12 messages Mar 7, 2020 – Mar 16, 2020

Subsystems (6)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/7 firmware: imx: Add stubs for !CONFIG_IMX_SCU case

Add stubs for those i.MX SCU APIs to make those modules depending on IMX_SCU can pass build when COMPILE_TEST is enabled.

---
new patch.

---
 include/linux/firmware/imx/ipc.h | 11 +++++++++++
 include/linux/firmware/imx/sci.h | 19 +++++++++++++++++++
 2 files changed, 30 insertions(+)
include/linux/firmware/imx/ipc.h +11 -0
index 8910574..3fff0e2 100644
@@ -34,6 +34,7 @@ struct imx_sc_rpc_msg {
 	uint8_t func;
 };
 
+#ifdef CONFIG_IMX_SCU
 /*
  * This is an function to send an RPC message over an IPC channel.
  * It is called by client-side SCFW API function shims.
@@ -55,4 +56,14 @@ int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp);
  * @return Returns an error code (0 = success, failed if < 0)
  */
 int imx_scu_get_handle(struct imx_sc_ipc **ipc);
+#else
+static inline int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp)
+{
+	return 0;
+}
+static inline int imx_scu_get_handle(struct imx_sc_ipc **ipc)
+{
+	return 0;
+}
+#endif
 #endif /* _SC_IPC_H */
include/linux/firmware/imx/sci.h +19 -0
index 17ba4e4..4688b60 100644
@@ -16,8 +16,27 @@
 #include <linux/firmware/imx/svc/misc.h>
 #include <linux/firmware/imx/svc/pm.h>
 
+#ifdef CONFIG_IMX_SCU
 int imx_scu_enable_general_irq_channel(struct device *dev);
 int imx_scu_irq_register_notifier(struct notifier_block *nb);
 int imx_scu_irq_unregister_notifier(struct notifier_block *nb);
 int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable);
+#else
+static inline int imx_scu_enable_general_irq_channel(struct device *dev)
+{
+	return 0;
+}
+static inline int imx_scu_irq_register_notifier(struct notifier_block *nb)
+{
+	return 0;
+}
+static inline int imx_scu_irq_unregister_notifier(struct notifier_block *nb)
+{
+	return 0;
+}
+static inline int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable)
+{
+	return 0;
+}
+#endif
 #endif /* _SC_SCI_H */
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 2/7 firmware: imx: add COMPILE_TEST support

Add COMPILE_TEST support to i.MX SCU drivers for better compile testing coverage.

---
no change.

---
 drivers/firmware/imx/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/imx/Kconfig +2 -2
index 1d2e5b8..116707a 100644
@@ -12,7 +12,7 @@ config IMX_DSP
 
 config IMX_SCU
 	bool "IMX SCU Protocol driver"
-	depends on IMX_MBOX
+	depends on IMX_MBOX || COMPILE_TEST
 	help
 	  The System Controller Firmware (SCFW) is a low-level system function
 	  which runs on a dedicated Cortex-M core to provide power, clock, and
@@ -24,6 +24,6 @@ config IMX_SCU
 
 config IMX_SCU_PD
 	bool "IMX SCU Power Domain driver"
-	depends on IMX_SCU
+	depends on IMX_SCU || COMPILE_TEST
 	help
 	  The System Controller Firmware (SCFW) based power domain driver.
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 3/7 rtc: add COMPILE_TEST support for i.MX SC RTC

In reply to Anson Huang

Add COMPILE_TEST support to i.MX SC RTC driver for better compile testing coverage.

---
no change.

---
 drivers/rtc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/Kconfig +1 -1
index acaf6f98..a86768f 100644
@@ -1772,7 +1772,7 @@ config RTC_DRV_SNVS
 	   will be called "rtc-snvs".
 
 config RTC_DRV_IMX_SC
-	depends on IMX_SCU
+	depends on IMX_SCU || COMPILE_TEST
 	depends on HAVE_ARM_SMCCC
 	tristate "NXP i.MX System Controller RTC support"
 	help
Signature · 1 line
2.7.4
#3 lore raw

PATCH v2 4/7 input: keyboard: add COMPILE_TEST support for KEYBOARD_IMX_SC_KEY

In reply to Anson Huang

Add COMPILE_TEST support to i.MX SC keyboard driver for better compile testing coverage.

---
no change.

---
 drivers/input/keyboard/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/Kconfig +1 -1
index 4706ff0..81e26f6 100644
@@ -467,7 +467,7 @@ config KEYBOARD_IMX
 
 config KEYBOARD_IMX_SC_KEY
 	tristate "IMX SCU Key Driver"
-	depends on IMX_SCU
+	depends on IMX_SCU || COMPILE_TEST
 	help
 	  This is the system controller key driver for NXP i.MX SoCs with
 	  system controller inside.
Signature · 1 line
2.7.4
#4 lore raw

PATCH v2 5/7 input: keyboard: imx_sc_key: Fix build warning for !CONFIG_IMX_SCU case

In reply to Anson Huang

Fix below build warning when COMPILE_TEST is enabled while IMX_SCU is not:

drivers/input/keyboard/imx_sc_key.c: In function ‘imx_sc_check_for_events’:
drivers/input/keyboard/imx_sc_key.c:87:27: warning: ‘msg.state’ is used uninitialized in this function [-Wuninitialized]

state = (bool)(msg.state & 0xff);
                             ^

AR drivers/input/keyboard/built-in.a

---
new patch.

---
 drivers/input/keyboard/imx_sc_key.c | 1 +
 1 file changed, 1 insertion(+)
drivers/input/keyboard/imx_sc_key.c +1 -0
index 9f809ae..26a12fb 100644
@@ -72,6 +72,7 @@ static void imx_sc_check_for_events(struct work_struct *work)
 	hdr->func = IMX_SC_MISC_FUNC_GET_BUTTON_STATUS;
 	hdr->size = 1;
 
+	msg.state = 0;
 	error = imx_scu_call_rpc(priv->key_ipc_handle, &msg, true);
 	if (error) {
 		dev_err(&input->dev, "read imx sc key failed, error %d\n", error);
Signature · 1 line
2.7.4
#6 lore raw

PATCH v2 7/7 thermal: add COMPILE_TEST support for IMX_SC_THERMAL

In reply to Anson Huang

Add COMPILE_TEST support to i.MX SC thermal driver for better compile testing coverage.

---
no change.

---
 drivers/thermal/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/Kconfig +1 -1
index 91af271..55c7641 100644
@@ -254,7 +254,7 @@ config IMX_THERMAL
 
 config IMX_SC_THERMAL
 	tristate "Temperature sensor driver for NXP i.MX SoCs with System Controller"
-	depends on IMX_SCU
+	depends on IMX_SCU || COMPILE_TEST
 	depends on OF
 	help
 	  Support for Temperature Monitor (TEMPMON) found on NXP i.MX SoCs with
Signature · 1 line
2.7.4
#5 lore raw

PATCH v2 6/7 watchdog: add COMPILE_TEST support for IMX_SC_WDT

In reply to Anson Huang

Add COMPILE_TEST support to i.MX SC watchdog driver for better compile testing coverage.

---
no change.

---
 drivers/watchdog/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/Kconfig +1 -1
index 9ea2b43..6388154 100644
@@ -712,7 +712,7 @@ config IMX2_WDT
 config IMX_SC_WDT
 	tristate "IMX SC Watchdog"
 	depends on HAVE_ARM_SMCCC
-	depends on IMX_SCU
+	depends on IMX_SCU || COMPILE_TEST
 	select WATCHDOG_CORE
 	help
 	  This is the driver for the system controller watchdog
Signature · 1 line
2.7.4
maintainer
#7 lore raw
In reply to Anson Huang
Quoted 58 lines · Anson Huang

Add stubs for those i.MX SCU APIs to make those modules depending on IMX_SCU can pass build when COMPILE_TEST is enabled.

---
new patch.

---
 include/linux/firmware/imx/ipc.h | 11 +++++++++++
 include/linux/firmware/imx/sci.h | 19 +++++++++++++++++++
 2 files changed, 30 insertions(+)
include/linux/firmware/imx/ipc.h +11 -0
index 8910574..3fff0e2 100644
@@ -34,6 +34,7 @@ struct imx_sc_rpc_msg {
 	uint8_t func;
 };
 
+#ifdef CONFIG_IMX_SCU
 /*
  * This is an function to send an RPC message over an IPC channel.
  * It is called by client-side SCFW API function shims.
@@ -55,4 +56,14 @@ int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp);
  * @return Returns an error code (0 = success, failed if < 0)
  */
 int imx_scu_get_handle(struct imx_sc_ipc **ipc);
+#else
+static inline int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp)
+{
+	return 0;
+}
+static inline int imx_scu_get_handle(struct imx_sc_ipc **ipc)
+{
+	return 0;
+}
+#endif
 #endif /* _SC_IPC_H */
include/linux/firmware/imx/sci.h +8 -0
index 17ba4e4..4688b60 100644
@@ -16,8 +16,27 @@
 #include <linux/firmware/imx/svc/misc.h>
 #include <linux/firmware/imx/svc/pm.h>
 
+#ifdef CONFIG_IMX_SCU
 int imx_scu_enable_general_irq_channel(struct device *dev);
 int imx_scu_irq_register_notifier(struct notifier_block *nb);
 int imx_scu_irq_unregister_notifier(struct notifier_block *nb);
 int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable);
+#else
+static inline int imx_scu_enable_general_irq_channel(struct device *dev)
+{
+	return 0;
+}
+static inline int imx_scu_irq_register_notifier(struct notifier_block *nb)
+{

include/linux/firmware/imx/sci.h line 40

Quoted 10 lines
include/linux/firmware/imx/sci.h +10 -0
+	return 0;
+}
+static inline int imx_scu_irq_unregister_notifier(struct notifier_block *nb)
+{
+	return 0;
+}
+static inline int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable)
+{
+	return 0;
+}

It would probably be more appropriate to return errors from the stub functions.

Guenter

Quoted 3 lines
include/linux/firmware/imx/sci.h +1 -0
+#endif
 #endif /* _SC_SCI_H */
#8 lore raw

Hi, Guenter

Quoted 69 lines

Subject: Re: [PATCH V2 1/7] firmware: imx: Add stubs for !CONFIG_IMX_SCU case

include/linux/firmware/imx/ipc.h int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void

Quoted 25 lines · Anson Huang

Add stubs for those i.MX SCU APIs to make those modules depending on IMX_SCU can pass build when COMPILE_TEST is enabled.

---
new patch.

---
 include/linux/firmware/imx/ipc.h | 11 +++++++++++
include/linux/firmware/imx/sci.h | 19 +++++++++++++++++++
 2 files changed, 30 insertions(+)
include/linux/firmware/imx/ipc.h +1 -0
index 8910574..3fff0e2 100644
@@ -34,6 +34,7 @@ struct imx_sc_rpc_msg {
 	uint8_t func;
 };
 
+#ifdef CONFIG_IMX_SCU
 /*
  * This is an function to send an RPC message over an IPC channel.
  * It is called by client-side SCFW API function shims.
@@ -55,4 +56,14 @@ int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void

*msg, bool have_resp);

Quoted 39 lines
include/linux/firmware/imx/ipc.h +9 -0
  * @return Returns an error code (0 = success, failed if < 0)
  */
 int imx_scu_get_handle(struct imx_sc_ipc **ipc);
+#else
+static inline int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg,
+bool have_resp) {
+	return 0;
+}
+static inline int imx_scu_get_handle(struct imx_sc_ipc **ipc) {
+	return 0;
+}
+#endif
 #endif /* _SC_IPC_H */
include/linux/firmware/imx/sci.h +0 -0
index 17ba4e4..4688b60 100644
@@ -16,8 +16,27 @@
 #include <linux/firmware/imx/svc/misc.h>  #include

<linux/firmware/imx/svc/pm.h>

+#ifdef CONFIG_IMX_SCU
int imx_scu_enable_general_irq_channel(struct device *dev); int
imx_scu_irq_register_notifier(struct notifier_block *nb); int imx_scu_irq_unregister_notifier(struct notifier_block *nb); int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable);

include/linux/firmware/imx/sci.h +12 -0
+#else
+static inline int imx_scu_enable_general_irq_channel(struct device
+*dev) {
+	return 0;
+}
+static inline int imx_scu_irq_register_notifier(struct notifier_block
+*nb) {
+	return 0;
+}
+static inline int imx_scu_irq_unregister_notifier(struct
+notifier_block *nb) {
+	return 0;
Quoted 8 lines

include/linux/firmware/imx/sci.h

Quoted 5 lines
include/linux/firmware/imx/sci.h +5 -0
+}
+static inline int imx_scu_irq_group_enable(u8 group, u32 mask, u8
+enable) {
+	return 0;
+}

It would probably be more appropriate to return errors from the stub functions.

Agreed, improve them in V3 patch series.

Thanks,
Anson

#9 lore raw
In reply to Anson Huang
Quoted 4 lines · Anson Huang

Add stubs for those i.MX SCU APIs to make those modules depending on IMX_SCU can pass build when COMPILE_TEST is enabled.

Already had such a patch from Peng Fan.

Shawn

Quoted 69 lines

---
new patch.

---
 include/linux/firmware/imx/ipc.h | 11 +++++++++++
 include/linux/firmware/imx/sci.h | 19 +++++++++++++++++++
 2 files changed, 30 insertions(+)
include/linux/firmware/imx/ipc.h +11 -0
index 8910574..3fff0e2 100644
@@ -34,6 +34,7 @@ struct imx_sc_rpc_msg {
 	uint8_t func;
 };
 
+#ifdef CONFIG_IMX_SCU
 /*
  * This is an function to send an RPC message over an IPC channel.
  * It is called by client-side SCFW API function shims.
@@ -55,4 +56,14 @@ int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp);
  * @return Returns an error code (0 = success, failed if < 0)
  */
 int imx_scu_get_handle(struct imx_sc_ipc **ipc);
+#else
+static inline int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp)
+{
+	return 0;
+}
+static inline int imx_scu_get_handle(struct imx_sc_ipc **ipc)
+{
+	return 0;
+}
+#endif
 #endif /* _SC_IPC_H */
include/linux/firmware/imx/sci.h +19 -0
index 17ba4e4..4688b60 100644
@@ -16,8 +16,27 @@
 #include <linux/firmware/imx/svc/misc.h>
 #include <linux/firmware/imx/svc/pm.h>
 
+#ifdef CONFIG_IMX_SCU
 int imx_scu_enable_general_irq_channel(struct device *dev);
 int imx_scu_irq_register_notifier(struct notifier_block *nb);
 int imx_scu_irq_unregister_notifier(struct notifier_block *nb);
 int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable);
+#else
+static inline int imx_scu_enable_general_irq_channel(struct device *dev)
+{
+	return 0;
+}
+static inline int imx_scu_irq_register_notifier(struct notifier_block *nb)
+{
+	return 0;
+}
+static inline int imx_scu_irq_unregister_notifier(struct notifier_block *nb)
+{
+	return 0;
+}
+static inline int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable)
+{
+	return 0;
+}
+#endif
 #endif /* _SC_SCI_H */
Signature · 1 line
2.7.4
maintainer
#10 lore raw
Quoted 8 lines · Shawn Guo
Quoted 4 lines · Anson Huang

Add stubs for those i.MX SCU APIs to make those modules depending on IMX_SCU can pass build when COMPILE_TEST is enabled.

Already had such a patch from Peng Fan.

Did you follow the discussion and the conclusion that the only patch really needed is patch 2/7 ?

Guenter

#11 lore raw
Quoted 5 lines · Guenter Roeck
Quoted 4 lines · Shawn Guo
Quoted 3 lines · Anson Huang

Add stubs for those i.MX SCU APIs to make those modules depending on IMX_SCU can pass build when COMPILE_TEST is enabled.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Already had such a patch from Peng Fan.

Did you follow the discussion and the conclusion that the only patch really needed is patch 2/7 ?

Thanks for the reminding. Just did.

Shawn