linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: imx-scu: Support module build
@ 2020-06-17  4:53 Anson Huang
  2020-06-17  7:57 ` Aisheng Dong
  0 siblings, 1 reply; 8+ messages in thread
From: Anson Huang @ 2020-06-17  4:53 UTC (permalink / raw)
  To: shawnguo, s.hauer, kernel, festevam, peng.fan, arnd,
	leonard.crestez, krzk, daniel.baluta, linux-arm-kernel,
	linux-kernel
  Cc: Linux-imx

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

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
 drivers/soc/imx/Kconfig       | 2 +-
 drivers/soc/imx/soc-imx-scu.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/imx/Kconfig b/drivers/soc/imx/Kconfig
index d515d2c..c255acb 100644
--- a/drivers/soc/imx/Kconfig
+++ b/drivers/soc/imx/Kconfig
@@ -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
diff --git a/drivers/soc/imx/soc-imx-scu.c b/drivers/soc/imx/soc-imx-scu.c
index 20d37ea..bdd43ed 100644
--- a/drivers/soc/imx/soc-imx-scu.c
+++ b/drivers/soc/imx/soc-imx-scu.c
@@ -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 <anson.huang@nxp.com>");
+MODULE_DESCRIPTION("NXP i.MX SCU SoC driver");
+MODULE_LICENSE("GPL v2");
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH] soc: imx-scu: Support module build
  2020-06-17  4:53 [PATCH] soc: imx-scu: Support module build Anson Huang
@ 2020-06-17  7:57 ` Aisheng Dong
  2020-06-17  8:00   ` Anson Huang
  0 siblings, 1 reply; 8+ messages in thread
From: Aisheng Dong @ 2020-06-17  7:57 UTC (permalink / raw)
  To: Anson Huang, shawnguo, s.hauer, kernel, festevam, Peng Fan, arnd,
	Leonard Crestez, krzk, Daniel Baluta, linux-arm-kernel,
	linux-kernel
  Cc: dl-linux-imx

> From: Anson Huang <Anson.Huang@nxp.com>
> Sent: Wednesday, June 17, 2020 12:54 PM
> 
> Change the configuration type to tristate, add module description, author and
> license to support module build.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
>  drivers/soc/imx/Kconfig       | 2 +-
>  drivers/soc/imx/soc-imx-scu.c | 5 +++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/imx/Kconfig b/drivers/soc/imx/Kconfig index
> d515d2c..c255acb 100644
> --- a/drivers/soc/imx/Kconfig
> +++ b/drivers/soc/imx/Kconfig
> @@ -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
> diff --git a/drivers/soc/imx/soc-imx-scu.c b/drivers/soc/imx/soc-imx-scu.c index
> 20d37ea..bdd43ed 100644
> --- a/drivers/soc/imx/soc-imx-scu.c
> +++ b/drivers/soc/imx/soc-imx-scu.c
> @@ -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 <anson.huang@nxp.com>");
> +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

> --
> 2.7.4

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] soc: imx-scu: Support module build
  2020-06-17  7:57 ` Aisheng Dong
@ 2020-06-17  8:00   ` Anson Huang
  2020-06-17  9:41     ` Anson Huang
  0 siblings, 1 reply; 8+ messages in thread
From: Anson Huang @ 2020-06-17  8:00 UTC (permalink / raw)
  To: Aisheng Dong, shawnguo, s.hauer, kernel, festevam, Peng Fan,
	arnd, Leonard Crestez, krzk, Daniel Baluta, linux-arm-kernel,
	linux-kernel
  Cc: dl-linux-imx


> Subject: RE: [PATCH] soc: imx-scu: Support module build
> 
> > From: Anson Huang <Anson.Huang@nxp.com>
> > Sent: Wednesday, June 17, 2020 12:54 PM
> >
> > Change the configuration type to tristate, add module description,
> > author and license to support module build.
> >
> > Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> > ---
> >  drivers/soc/imx/Kconfig       | 2 +-
> >  drivers/soc/imx/soc-imx-scu.c | 5 +++++
> >  2 files changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/soc/imx/Kconfig b/drivers/soc/imx/Kconfig index
> > d515d2c..c255acb 100644
> > --- a/drivers/soc/imx/Kconfig
> > +++ b/drivers/soc/imx/Kconfig
> > @@ -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
> > diff --git a/drivers/soc/imx/soc-imx-scu.c
> > b/drivers/soc/imx/soc-imx-scu.c index 20d37ea..bdd43ed 100644
> > --- a/drivers/soc/imx/soc-imx-scu.c
> > +++ b/drivers/soc/imx/soc-imx-scu.c
> > @@ -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 <anson.huang@nxp.com>");
> > +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?
> 

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] soc: imx-scu: Support module build
  2020-06-17  8:00   ` Anson Huang
@ 2020-06-17  9:41     ` Anson Huang
  2020-06-18  7:20       ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Anson Huang @ 2020-06-17  9:41 UTC (permalink / raw)
  To: Aisheng Dong, shawnguo, s.hauer, kernel, festevam, Peng Fan,
	arnd, Leonard Crestez, krzk, Daniel Baluta, linux-arm-kernel,
	linux-kernel
  Cc: dl-linux-imx


> Subject: RE: [PATCH] soc: imx-scu: Support module build
> 
> 
> > Subject: RE: [PATCH] soc: imx-scu: Support module build
> >
> > > From: Anson Huang <Anson.Huang@nxp.com>
> > > Sent: Wednesday, June 17, 2020 12:54 PM
> > >
> > > Change the configuration type to tristate, add module description,
> > > author and license to support module build.
> > >
> > > Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> > > ---
> > >  drivers/soc/imx/Kconfig       | 2 +-
> > >  drivers/soc/imx/soc-imx-scu.c | 5 +++++
> > >  2 files changed, 6 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/soc/imx/Kconfig b/drivers/soc/imx/Kconfig index
> > > d515d2c..c255acb 100644
> > > --- a/drivers/soc/imx/Kconfig
> > > +++ b/drivers/soc/imx/Kconfig
> > > @@ -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
> > > diff --git a/drivers/soc/imx/soc-imx-scu.c
> > > b/drivers/soc/imx/soc-imx-scu.c index 20d37ea..bdd43ed 100644
> > > --- a/drivers/soc/imx/soc-imx-scu.c
> > > +++ b/drivers/soc/imx/soc-imx-scu.c
> > > @@ -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 <anson.huang@nxp.com>");
> > > +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?
> >
> 
> 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 
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] soc: imx-scu: Support module build
  2020-06-17  9:41     ` Anson Huang
@ 2020-06-18  7:20       ` Arnd Bergmann
  2020-06-19  6:20         ` Aisheng Dong
  0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2020-06-18  7:20 UTC (permalink / raw)
  To: Anson Huang
  Cc: Aisheng Dong, Peng Fan, Daniel Baluta, shawnguo, s.hauer,
	linux-kernel, krzk, dl-linux-imx, kernel, Leonard Crestez,
	festevam, linux-arm-kernel

On Wed, Jun 17, 2020 at 11:41 AM Anson Huang <anson.huang@nxp.com> wrote:

> > >
> > > 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?

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] soc: imx-scu: Support module build
  2020-06-18  7:20       ` Arnd Bergmann
@ 2020-06-19  6:20         ` Aisheng Dong
  2020-06-19  7:39           ` Anson Huang
  0 siblings, 1 reply; 8+ messages in thread
From: Aisheng Dong @ 2020-06-19  6:20 UTC (permalink / raw)
  To: Arnd Bergmann, Anson Huang
  Cc: Daniel Baluta, Peng Fan, shawnguo, s.hauer, linux-kernel, krzk,
	dl-linux-imx, kernel, Leonard Crestez, festevam,
	linux-arm-kernel

> From: Arnd Bergmann <arnd@arndb.de>
> Sent: Thursday, June 18, 2020 3:21 PM
> 
> On Wed, Jun 17, 2020 at 11:41 AM Anson Huang <anson.huang@nxp.com>
> wrote:
> 
> > > >
> > > > 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?
> 
> 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

>        Arnd
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] soc: imx-scu: Support module build
  2020-06-19  6:20         ` Aisheng Dong
@ 2020-06-19  7:39           ` Anson Huang
  2020-06-19 12:09             ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Anson Huang @ 2020-06-19  7:39 UTC (permalink / raw)
  To: Aisheng Dong, Arnd Bergmann
  Cc: Daniel Baluta, Peng Fan, shawnguo, s.hauer, linux-kernel, krzk,
	dl-linux-imx, kernel, Leonard Crestez, festevam,
	linux-arm-kernel



> Subject: RE: [PATCH] soc: imx-scu: Support module build
> 
> > From: Arnd Bergmann <arnd@arndb.de>
> > Sent: Thursday, June 18, 2020 3:21 PM
> >
> > On Wed, Jun 17, 2020 at 11:41 AM Anson Huang <anson.huang@nxp.com>
> > wrote:
> >
> > > > >
> > > > > 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?
> >
> > 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.

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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] soc: imx-scu: Support module build
  2020-06-19  7:39           ` Anson Huang
@ 2020-06-19 12:09             ` Arnd Bergmann
  0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2020-06-19 12:09 UTC (permalink / raw)
  To: Anson Huang
  Cc: Aisheng Dong, Peng Fan, Daniel Baluta, shawnguo, s.hauer,
	linux-kernel, krzk, dl-linux-imx, kernel, Leonard Crestez,
	festevam, linux-arm-kernel

On Fri, Jun 19, 2020 at 9:40 AM Anson Huang <anson.huang@nxp.com> wrote:
> > Subject: RE: [PATCH] soc: imx-scu: Support module build
> >
> > > From: Arnd Bergmann <arnd@arndb.de> 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.
> > >
> > > 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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-06-19 12:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17  4:53 [PATCH] soc: imx-scu: Support module build Anson Huang
2020-06-17  7:57 ` Aisheng Dong
2020-06-17  8:00   ` Anson Huang
2020-06-17  9:41     ` Anson Huang
2020-06-18  7:20       ` Arnd Bergmann
2020-06-19  6:20         ` Aisheng Dong
2020-06-19  7:39           ` Anson Huang
2020-06-19 12:09             ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).