Skip to contentSkip to conversation

soc: imx-scu: Support module build

PATCH In review Anson Huang 3 participants 8 messages Jun 17, 2020 – Jun 19, 2020 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: imx-scu: Support module build

Change the configuration type to tristate, add module description, author and license to support module build.

---
 drivers/soc/imx/Kconfig       | 2 +-
 drivers/soc/imx/soc-imx-scu.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/soc/imx/Kconfig +1 -1
index d515d2c..c255acb 100644
@@ -9,7 +9,7 @@ config IMX_GPCV2_PM_DOMAINS
 	default y if SOC_IMX7D
 
 config IMX_SCU_SOC
-	bool "i.MX System Controller Unit SoC info support"
+	tristate "i.MX System Controller Unit SoC info support"
 	depends on IMX_SCU
 	select SOC_BUS
 	help
drivers/soc/imx/soc-imx-scu.c +5 -0
index 20d37ea..bdd43ed 100644
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/firmware/imx/rsrc.h>
 #include <linux/firmware/imx/sci.h>
+#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/sys_soc.h>
 #include <linux/platform_device.h>
@@ -185,3 +186,7 @@ static int __init imx_scu_soc_init(void)
 	return PTR_ERR_OR_ZERO(pdev);
 }
 device_initcall(imx_scu_soc_init);
+
+MODULE_AUTHOR("Anson Huang <[email protected]>");
+MODULE_DESCRIPTION("NXP i.MX SCU SoC driver");
+MODULE_LICENSE("GPL v2");
Signature · 1 line
2.7.4
#1 lore raw
Quoted 38 lines

From: Anson Huang <[email protected]>
Sent: Wednesday, June 17, 2020 12:54 PM

Change the configuration type to tristate, add module description, author and license to support module build.

---
 drivers/soc/imx/Kconfig       | 2 +-
 drivers/soc/imx/soc-imx-scu.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/soc/imx/Kconfig index renamed from drivers/soc/imx/Kconfig +0 -0

d515d2c..c255acb 100644

drivers/soc/imx/Kconfig +1 -1
@@ -9,7 +9,7 @@ config IMX_GPCV2_PM_DOMAINS
 	default y if SOC_IMX7D
 
 config IMX_SCU_SOC
-	bool "i.MX System Controller Unit SoC info support"
+	tristate "i.MX System Controller Unit SoC info support"
 	depends on IMX_SCU
 	select SOC_BUS
 	help
drivers/soc/imx/soc-imx-scu.c index renamed from drivers/soc/imx/soc-imx-scu.c +0 -0

20d37ea..bdd43ed 100644

drivers/soc/imx/soc-imx-scu.c +0 -0
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/firmware/imx/rsrc.h>  #include

<linux/firmware/imx/sci.h>

drivers/soc/imx/soc-imx-scu.c +1 -0
+#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/sys_soc.h>
 #include <linux/platform_device.h>

drivers/soc/imx/soc-imx-scu.c static int __init imx_scu_soc_init(void) · line 192

Quoted 7 lines
drivers/soc/imx/soc-imx-scu.c +4 -0
@@ -185,3 +186,7 @@ static int __init imx_scu_soc_init(void)
 	return PTR_ERR_OR_ZERO(pdev);
 }
 device_initcall(imx_scu_soc_init);
+
+MODULE_AUTHOR("Anson Huang <[email protected]>");
+MODULE_DESCRIPTION("NXP i.MX SCU SoC driver"); MODULE_LICENSE("GPL
+v2");

I'm ok with the change. But I'm curious how can this module be autoloaded without MODULE_DEVICE_TABLE.
Have you tested if it can work?

Regards
Aisheng

Quoted 2 lines

--
2.7.4

#2 lore raw
Quoted 48 lines

Subject: RE: [PATCH] soc: imx-scu: Support module build

Quoted 38 lines

From: Anson Huang <[email protected]>
Sent: Wednesday, June 17, 2020 12:54 PM

Change the configuration type to tristate, add module description, author and license to support module build.

---
 drivers/soc/imx/Kconfig       | 2 +-
 drivers/soc/imx/soc-imx-scu.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/soc/imx/Kconfig index renamed from drivers/soc/imx/Kconfig +0 -0

d515d2c..c255acb 100644

drivers/soc/imx/Kconfig +1 -1
@@ -9,7 +9,7 @@ config IMX_GPCV2_PM_DOMAINS
 	default y if SOC_IMX7D
 
 config IMX_SCU_SOC
-	bool "i.MX System Controller Unit SoC info support"
+	tristate "i.MX System Controller Unit SoC info support"
 	depends on IMX_SCU
 	select SOC_BUS
 	help
(quoted diff) +0 -0

b/drivers/soc/imx/soc-imx-scu.c index 20d37ea..bdd43ed 100644

drivers/soc/imx/soc-imx-scu.c +0 -0
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/firmware/imx/rsrc.h>  #include

<linux/firmware/imx/sci.h>

drivers/soc/imx/soc-imx-scu.c +1 -0
+#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/sys_soc.h>
 #include <linux/platform_device.h>

drivers/soc/imx/soc-imx-scu.c static int __init imx_scu_soc_init(void) · line 191

Quoted 6 lines
drivers/soc/imx/soc-imx-scu.c +3 -0
@@ -185,3 +186,7 @@ static int __init imx_scu_soc_init(void)
 	return PTR_ERR_OR_ZERO(pdev);
 }
 device_initcall(imx_scu_soc_init);
+
+MODULE_AUTHOR("Anson Huang <[email protected]>");
+MODULE_DESCRIPTION("NXP i.MX SCU SoC driver");

MODULE_LICENSE("GPL

Quoted 6 lines

drivers/soc/imx/soc-imx-scu.c static int __init imx_scu_soc_init(void) · line 192

Quoted 1 line
drivers/soc/imx/soc-imx-scu.c +1 -0
+v2");

I'm ok with the change. But I'm curious how can this module be autoloaded without MODULE_DEVICE_TABLE.
Have you tested if it can work?

I ONLY tested the manual insmod, if want to support auto load, may need some more change, will try it later and send out a V2 if needed.

Anson

#3 lore raw
Quoted 53 lines

Subject: RE: [PATCH] soc: imx-scu: Support module build

Quoted 49 lines

Subject: RE: [PATCH] soc: imx-scu: Support module build

Quoted 38 lines

From: Anson Huang <[email protected]>
Sent: Wednesday, June 17, 2020 12:54 PM

Change the configuration type to tristate, add module description, author and license to support module build.

---
 drivers/soc/imx/Kconfig       | 2 +-
 drivers/soc/imx/soc-imx-scu.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/soc/imx/Kconfig index renamed from drivers/soc/imx/Kconfig +0 -0

d515d2c..c255acb 100644

drivers/soc/imx/Kconfig +1 -1
@@ -9,7 +9,7 @@ config IMX_GPCV2_PM_DOMAINS
 	default y if SOC_IMX7D
 
 config IMX_SCU_SOC
-	bool "i.MX System Controller Unit SoC info support"
+	tristate "i.MX System Controller Unit SoC info support"
 	depends on IMX_SCU
 	select SOC_BUS
 	help
(quoted diff) +0 -0

b/drivers/soc/imx/soc-imx-scu.c index 20d37ea..bdd43ed 100644

drivers/soc/imx/soc-imx-scu.c +0 -0
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/firmware/imx/rsrc.h>  #include

<linux/firmware/imx/sci.h>

drivers/soc/imx/soc-imx-scu.c +1 -0
+#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/sys_soc.h>
 #include <linux/platform_device.h>

drivers/soc/imx/soc-imx-scu.c static int __init imx_scu_soc_init(void) · line 191

Quoted 6 lines
drivers/soc/imx/soc-imx-scu.c +3 -0
@@ -185,3 +186,7 @@ static int __init imx_scu_soc_init(void)
 	return PTR_ERR_OR_ZERO(pdev);
 }
 device_initcall(imx_scu_soc_init);
+
+MODULE_AUTHOR("Anson Huang <[email protected]>");
+MODULE_DESCRIPTION("NXP i.MX SCU SoC driver");

MODULE_LICENSE("GPL

Quoted 1 line
drivers/soc/imx/soc-imx-scu.c +1 -0
+v2");
Quoted 7 lines
Quoted 4 lines

I'm ok with the change. But I'm curious how can this module be autoloaded without MODULE_DEVICE_TABLE.
Have you tested if it can work?

I ONLY tested the manual insmod, if want to support auto load, may need some more change, will try it later and send out a V2 if needed.

The further check shows that, if want to support auto load, the platform device register needs to be done in somewhere else which is built-in (in my test, I move it to clk-imx8qxp.c's probe), and also need to add below module alias in this driver, because it has no device node in DT and no device table in driver.

+MODULE_ALIAS("platform:imx-scu-soc");

Since this driver has no device node in DT, and the target is to build all SoC specific drivers as module, so the best way is to add a virtual device node in DT in order to support auto load?

Anson

#4 lore raw
Quoted 14 lines · Anson Huang
Quoted 8 lines
Quoted 5 lines

I'm ok with the change. But I'm curious how can this module be autoloaded without MODULE_DEVICE_TABLE.
Have you tested if it can work?

I ONLY tested the manual insmod, if want to support auto load, may need some more change, will try it later and send out a V2 if needed.

The further check shows that, if want to support auto load, the platform device register needs to be done in somewhere else which is built-in (in my test, I move it to clk-imx8qxp.c's probe), and also need to add below module alias in this driver, because it has no device node in DT and no device table in driver.

Quoted 5 lines

+MODULE_ALIAS("platform:imx-scu-soc");

Since this driver has no device node in DT, and the target is to build all SoC specific drivers as module, so the best way is to add a virtual device node in DT in order to support auto load?

I see that there is indeed a driver for the device node in drivers/firmware/imx/imx-scu.c,
the only reason for this module using device_initcall() with a manual platform_device_register_simple() seems to be that we cannot have two platform drivers bind to the same device node.

I think a cleaner way to handle this would be to just move the entire soc driver into the firmware driver and then remove the duplication.

Arnd

#5 lore raw
Quoted 27 lines

From: Arnd Bergmann <[email protected]>
Sent: Thursday, June 18, 2020 3:21 PM

Quoted 6 lines · Anson Huang
Quoted 6 lines
Quoted 5 lines

I'm ok with the change. But I'm curious how can this module be autoloaded without MODULE_DEVICE_TABLE.
Have you tested if it can work?

Quoted 7 lines
Quoted 2 lines

I ONLY tested the manual insmod, if want to support auto load, may need some more change, will try it later and send out a V2 if needed.

The further check shows that, if want to support auto load, the platform device register needs to be done in somewhere else which is built-in (in my test, I move it to clk-imx8qxp.c's probe), and also need to add below module alias in this driver, because it has no device node in

DT and no device table in driver.

Quoted 6 lines

+MODULE_ALIAS("platform:imx-scu-soc");

Since this driver has no device node in DT, and the target is to build all SoC specific drivers as module, so the best way is to add a virtual device node in DT in order to support auto load?

Quoted 9 lines

I see that there is indeed a driver for the device node in drivers/firmware/imx/imx-scu.c, the only reason for this module using device_initcall() with a manual platform_device_register_simple() seems to be that we cannot have two platform drivers bind to the same device node.

I think a cleaner way to handle this would be to just move the entire soc driver into the firmware driver and then remove the duplication.

Yes, sounds like a good idea to me.

Regards
Aisheng

Quoted 1 line

Arnd

#6 lore raw
Quoted 38 lines

Subject: RE: [PATCH] soc: imx-scu: Support module build

Quoted 34 lines

From: Arnd Bergmann <[email protected]>
Sent: Thursday, June 18, 2020 3:21 PM

Quoted 6 lines · Anson Huang
Quoted 6 lines
Quoted 5 lines

I'm ok with the change. But I'm curious how can this module be autoloaded without MODULE_DEVICE_TABLE.
Have you tested if it can work?

Quoted 8 lines
Quoted 2 lines

I ONLY tested the manual insmod, if want to support auto load, may need some more change, will try it later and send out a V2 if needed.

The further check shows that, if want to support auto load, the platform device register needs to be done in somewhere else which is built-in (in my test, I move it to clk-imx8qxp.c's probe), and also need to add below module alias in this driver, because it has no device node in

DT and no device table in driver.

Quoted 6 lines

+MODULE_ALIAS("platform:imx-scu-soc");

Since this driver has no device node in DT, and the target is to build all SoC specific drivers as module, so the best way is to add a virtual device node in DT in order to support auto load?

I see that there is indeed a driver for the device node in drivers/firmware/imx/imx-scu.c, the only reason for this module using device_initcall() with a manual platform_device_register_simple() seems to be that we cannot have two platform drivers bind to the same device node.

Quoted 5 lines
Quoted 3 lines

I think a cleaner way to handle this would be to just move the entire soc driver into the firmware driver and then remove the duplication.

Yes, sounds like a good idea to me.

So the idea is to remove this driver and implement the soc id/revision/serial_number etc. in drivers/firmware/imx/imx-scu.c, right?

Anson

#7 lore raw
Quoted 9 lines · Anson Huang
Quoted 9 lines

Subject: RE: [PATCH] soc: imx-scu: Support module build

Quoted 7 lines

From: Arnd Bergmann <[email protected]> Sent: Thursday, June 18, 2020 3:21 PM I see that there is indeed a driver for the device node in drivers/firmware/imx/imx-scu.c, the only reason for this module using device_initcall() with a manual platform_device_register_simple() seems to be that we cannot have two platform drivers bind to the same device node.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I think a cleaner way to handle this would be to just move the entire soc driver into the firmware driver and then remove the duplication.

Yes, sounds like a good idea to me.

So the idea is to remove this driver and implement the soc id/revision/serial_number etc. in drivers/firmware/imx/imx-scu.c, right?

Yes, I think you can basically merge imx_scu_soc_probe() into imx_scu_probe() or call it from there, with only a few changes.

Arnd