linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms clock driver as module
@ 2020-07-02 15:23 Anson Huang
  2020-07-02 15:23 ` [PATCH V5 1/6] clk: composite: Export clk_hw_register_composite() Anson Huang
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Anson Huang @ 2020-07-02 15:23 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam,
	aisheng.dong, arnd, peng.fan, abel.vesa, j.remmet, sfr,
	georg.waibel, Georg.Waibel, laurent.pinchart, chen.fang,
	fugang.duan, daniel.baluta, yuehaibing, horia.geanta,
	andrew.smirnov, linux-clk, linux-kernel, linux-arm-kernel
  Cc: Linux-imx

Nowdays, there are more and more requirements of building SoC specific
drivers as modules, such as Android GKI (generic kernel image), this
patch set supports building i.MX ARMv6/ARMv7 SoCs clock drivers as modules,

The CLK_IMXxxx is introduced for i.MX ARMv7 platforms in order to support
various build options, and i.MX1/2/3 platforms now still ONLY support built-in
as they are rarely used now.

Changes since V4:
	- add empty function of imx_register_uart_clocks() for MODULE build, then
	  all earlycon related clock handler can be built-out for MODULE;
	- add module build support for ARMv7 platforms, also add COMPILE_TEST for them;
	- add COMPILE_TEST for ARMv8 platforms;
	- keep using builtin_platform_driver() for i.MX8QXP clock driver.

Anson Huang (6):
  clk: composite: Export clk_hw_register_composite()
  clk: imx: Support module build for i.MX5/6/7 and vf610
  clk: imx: Support building i.MX common clock driver as module
  clk: imx: Add clock configuration for ARMv7 platforms
  clk: imx8m: Support module build
  clk: imx8qxp: Support building i.MX8QXP clock driver as module

 drivers/clk/clk-composite.c        |   1 +
 drivers/clk/imx/Kconfig            | 101 ++++++++++++++++++++++++++++++++-----
 drivers/clk/imx/Makefile           |  79 ++++++++++++++---------------
 drivers/clk/imx/clk-composite-8m.c |   2 +
 drivers/clk/imx/clk-cpu.c          |   2 +
 drivers/clk/imx/clk-frac-pll.c     |   2 +
 drivers/clk/imx/clk-gate2.c        |   2 +
 drivers/clk/imx/clk-imx5.c         |   5 ++
 drivers/clk/imx/clk-imx6q.c        |   5 ++
 drivers/clk/imx/clk-imx6sl.c       |   5 ++
 drivers/clk/imx/clk-imx6sll.c      |   5 ++
 drivers/clk/imx/clk-imx6sx.c       |   5 ++
 drivers/clk/imx/clk-imx6ul.c       |   5 ++
 drivers/clk/imx/clk-imx7d.c        |   5 ++
 drivers/clk/imx/clk-imx7ulp.c      |   5 ++
 drivers/clk/imx/clk-imx8mm.c       |   4 ++
 drivers/clk/imx/clk-imx8mn.c       |   4 ++
 drivers/clk/imx/clk-imx8mp.c       |   4 ++
 drivers/clk/imx/clk-imx8mq.c       |   4 ++
 drivers/clk/imx/clk-imx8qxp-lpcg.c |   4 ++
 drivers/clk/imx/clk-imx8qxp.c      |   4 ++
 drivers/clk/imx/clk-pll14xx.c      |   5 ++
 drivers/clk/imx/clk-sscg-pll.c     |   2 +
 drivers/clk/imx/clk-vf610.c        |   5 ++
 drivers/clk/imx/clk.c              |  17 +++++--
 drivers/clk/imx/clk.h              |   6 +++
 26 files changed, 231 insertions(+), 57 deletions(-)

-- 
2.7.4


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

* [PATCH V5 1/6] clk: composite: Export clk_hw_register_composite()
  2020-07-02 15:23 [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms clock driver as module Anson Huang
@ 2020-07-02 15:23 ` Anson Huang
  2020-07-02 15:23 ` [PATCH V5 2/6] clk: imx: Support module build for i.MX5/6/7 and vf610 Anson Huang
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Anson Huang @ 2020-07-02 15:23 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam,
	aisheng.dong, arnd, peng.fan, abel.vesa, j.remmet, sfr,
	georg.waibel, Georg.Waibel, laurent.pinchart, chen.fang,
	fugang.duan, daniel.baluta, yuehaibing, horia.geanta,
	andrew.smirnov, linux-clk, linux-kernel, linux-arm-kernel
  Cc: Linux-imx

Export clk_hw_register_composite() to support user built as module.

ERROR: modpost: "clk_hw_register_composite" [drivers/clk/imx/mxc-clk.ko]
undefined!

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
---
No change.
---
 drivers/clk/clk-composite.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index 7376f57..2ddb54f 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -328,6 +328,7 @@ struct clk_hw *clk_hw_register_composite(struct device *dev, const char *name,
 					   rate_hw, rate_ops, gate_hw,
 					   gate_ops, flags);
 }
+EXPORT_SYMBOL_GPL(clk_hw_register_composite);
 
 struct clk_hw *clk_hw_register_composite_pdata(struct device *dev,
 			const char *name,
-- 
2.7.4


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

* [PATCH V5 2/6] clk: imx: Support module build for i.MX5/6/7 and vf610
  2020-07-02 15:23 [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms clock driver as module Anson Huang
  2020-07-02 15:23 ` [PATCH V5 1/6] clk: composite: Export clk_hw_register_composite() Anson Huang
@ 2020-07-02 15:23 ` Anson Huang
  2020-07-02 15:23 ` [PATCH V5 3/6] clk: imx: Support building i.MX common clock driver as module Anson Huang
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Anson Huang @ 2020-07-02 15:23 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam,
	aisheng.dong, arnd, peng.fan, abel.vesa, j.remmet, sfr,
	georg.waibel, Georg.Waibel, laurent.pinchart, chen.fang,
	fugang.duan, daniel.baluta, yuehaibing, horia.geanta,
	andrew.smirnov, linux-clk, linux-kernel, linux-arm-kernel
  Cc: Linux-imx

Add module author, description and license to support module build
for i.MX5/6/7 and vf610 SoCs.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
New patch.
---
 drivers/clk/imx/clk-imx5.c    | 5 +++++
 drivers/clk/imx/clk-imx6q.c   | 5 +++++
 drivers/clk/imx/clk-imx6sl.c  | 5 +++++
 drivers/clk/imx/clk-imx6sll.c | 5 +++++
 drivers/clk/imx/clk-imx6sx.c  | 5 +++++
 drivers/clk/imx/clk-imx6ul.c  | 5 +++++
 drivers/clk/imx/clk-imx7d.c   | 5 +++++
 drivers/clk/imx/clk-imx7ulp.c | 5 +++++
 drivers/clk/imx/clk-vf610.c   | 5 +++++
 9 files changed, 45 insertions(+)

diff --git a/drivers/clk/imx/clk-imx5.c b/drivers/clk/imx/clk-imx5.c
index 01e079b..fcdd398 100644
--- a/drivers/clk/imx/clk-imx5.c
+++ b/drivers/clk/imx/clk-imx5.c
@@ -9,6 +9,7 @@
 #include <linux/clkdev.h>
 #include <linux/clk-provider.h>
 #include <linux/err.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -636,3 +637,7 @@ static void __init mx53_clocks_init(struct device_node *np)
 	imx_register_uart_clocks(uart_clks_mx50_mx53);
 }
 CLK_OF_DECLARE(imx53_ccm, "fsl,imx53-ccm", mx53_clocks_init);
+
+MODULE_AUTHOR("Shawn Guo <shawnguo@kernel.org>");
+MODULE_DESCRIPTION("NXP i.MX5 clock driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c
index ba33c79..46d31be 100644
--- a/drivers/clk/imx/clk-imx6q.c
+++ b/drivers/clk/imx/clk-imx6q.c
@@ -11,6 +11,7 @@
 #include <linux/clk-provider.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -990,3 +991,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
 	imx_register_uart_clocks(uart_clks);
 }
 CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init);
+
+MODULE_AUTHOR("Shawn Guo <shawn.guo@linaro.org>");
+MODULE_DESCRIPTION("NXP i.MX6Q clock driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/clk/imx/clk-imx6sl.c b/drivers/clk/imx/clk-imx6sl.c
index 0f647d1..f19d52f 100644
--- a/drivers/clk/imx/clk-imx6sl.c
+++ b/drivers/clk/imx/clk-imx6sl.c
@@ -6,6 +6,7 @@
 #include <linux/clk.h>
 #include <linux/clkdev.h>
 #include <linux/err.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -455,3 +456,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
 	imx_register_uart_clocks(uart_clks);
 }
 CLK_OF_DECLARE(imx6sl, "fsl,imx6sl-ccm", imx6sl_clocks_init);
+
+MODULE_AUTHOR("Shawn Guo <shawn.guo@linaro.org>");
+MODULE_DESCRIPTION("NXP i.MX6SL clock driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/clk/imx/clk-imx6sll.c b/drivers/clk/imx/clk-imx6sll.c
index 8e8288b..4ec0dea 100644
--- a/drivers/clk/imx/clk-imx6sll.c
+++ b/drivers/clk/imx/clk-imx6sll.c
@@ -11,6 +11,7 @@
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 
@@ -376,3 +377,7 @@ static void __init imx6sll_clocks_init(struct device_node *ccm_node)
 	clk_set_rate(hws[IMX6SLL_CLK_AHB]->clk, 132000000);
 }
 CLK_OF_DECLARE_DRIVER(imx6sll, "fsl,imx6sll-ccm", imx6sll_clocks_init);
+
+MODULE_AUTHOR("Shawn Guo <shawnguo@kernel.org>");
+MODULE_DESCRIPTION("NXP i.MX6SLL clock driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/clk/imx/clk-imx6sx.c b/drivers/clk/imx/clk-imx6sx.c
index 89ba712..156163d 100644
--- a/drivers/clk/imx/clk-imx6sx.c
+++ b/drivers/clk/imx/clk-imx6sx.c
@@ -10,6 +10,7 @@
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -564,3 +565,7 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
 	imx_register_uart_clocks(uart_clks);
 }
 CLK_OF_DECLARE(imx6sx, "fsl,imx6sx-ccm", imx6sx_clocks_init);
+
+MODULE_AUTHOR("Shawn Guo <shawnguo@kernel.org>");
+MODULE_DESCRIPTION("NXP i.MX6SX clock driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/clk/imx/clk-imx6ul.c b/drivers/clk/imx/clk-imx6ul.c
index 5dbb6a9..090b684 100644
--- a/drivers/clk/imx/clk-imx6ul.c
+++ b/drivers/clk/imx/clk-imx6ul.c
@@ -10,6 +10,7 @@
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -513,3 +514,7 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node)
 }
 
 CLK_OF_DECLARE(imx6ul, "fsl,imx6ul-ccm", imx6ul_clocks_init);
+
+MODULE_AUTHOR("Frank Li <frank.li@nxp.com>");
+MODULE_DESCRIPTION("NXP i.MX6UL clock driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c
index b2057bd..1837c42 100644
--- a/drivers/clk/imx/clk-imx7d.c
+++ b/drivers/clk/imx/clk-imx7d.c
@@ -10,6 +10,7 @@
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -906,3 +907,7 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node)
 
 }
 CLK_OF_DECLARE(imx7d, "fsl,imx7d-ccm", imx7d_clocks_init);
+
+MODULE_AUTHOR("Frank Li <frank.li@nxp.com>");
+MODULE_DESCRIPTION("NXP i.MX7D clock driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/clk/imx/clk-imx7ulp.c b/drivers/clk/imx/clk-imx7ulp.c
index 634c0b6..d2eb80e 100644
--- a/drivers/clk/imx/clk-imx7ulp.c
+++ b/drivers/clk/imx/clk-imx7ulp.c
@@ -12,6 +12,7 @@
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
@@ -279,3 +280,7 @@ static void __init imx7ulp_clk_smc1_init(struct device_node *np)
 	of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data);
 }
 CLK_OF_DECLARE(imx7ulp_clk_smc1, "fsl,imx7ulp-smc1", imx7ulp_clk_smc1_init);
+
+MODULE_AUTHOR("A.s. Dong <aisheng.dong@nxp.com>");
+MODULE_DESCRIPTION("NXP i.MX7ULP clock driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/clk/imx/clk-vf610.c b/drivers/clk/imx/clk-vf610.c
index 5129ef8..bf174ac 100644
--- a/drivers/clk/imx/clk-vf610.c
+++ b/drivers/clk/imx/clk-vf610.c
@@ -5,6 +5,7 @@
 
 #include <linux/of_address.h>
 #include <linux/clk.h>
+#include <linux/module.h>
 #include <linux/syscore_ops.h>
 #include <dt-bindings/clock/vf610-clock.h>
 
@@ -468,3 +469,7 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
 	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
 }
 CLK_OF_DECLARE(vf610, "fsl,vf610-ccm", vf610_clocks_init);
+
+MODULE_AUTHOR("Shawn Guo <shawn.guo@linaro.org>");
+MODULE_DESCRIPTION("NXP VF610 clock driver");
+MODULE_LICENSE("GPL v2");
-- 
2.7.4


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

* [PATCH V5 3/6] clk: imx: Support building i.MX common clock driver as module
  2020-07-02 15:23 [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms clock driver as module Anson Huang
  2020-07-02 15:23 ` [PATCH V5 1/6] clk: composite: Export clk_hw_register_composite() Anson Huang
  2020-07-02 15:23 ` [PATCH V5 2/6] clk: imx: Support module build for i.MX5/6/7 and vf610 Anson Huang
@ 2020-07-02 15:23 ` Anson Huang
  2020-07-02 15:23 ` [PATCH V5 4/6] clk: imx: Add clock configuration for ARMv7 platforms Anson Huang
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Anson Huang @ 2020-07-02 15:23 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam,
	aisheng.dong, arnd, peng.fan, abel.vesa, j.remmet, sfr,
	georg.waibel, Georg.Waibel, laurent.pinchart, chen.fang,
	fugang.duan, daniel.baluta, yuehaibing, horia.geanta,
	andrew.smirnov, linux-clk, linux-kernel, linux-arm-kernel
  Cc: Linux-imx

There are more and more requirements of building SoC specific drivers
as modules, add support for building i.MX common clock driver as module
to meet the requirement.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
Changes since V4:
	- add empty function of imx_register_uart_clocks() for MODULE build, and
	  exclude all uart clock related handler when building MODULE.
---
 drivers/clk/imx/Kconfig            |  8 ++++++--
 drivers/clk/imx/Makefile           | 40 +++++++++++++++++++-------------------
 drivers/clk/imx/clk-composite-8m.c |  2 ++
 drivers/clk/imx/clk-cpu.c          |  2 ++
 drivers/clk/imx/clk-frac-pll.c     |  2 ++
 drivers/clk/imx/clk-gate2.c        |  2 ++
 drivers/clk/imx/clk-pll14xx.c      |  5 +++++
 drivers/clk/imx/clk-sscg-pll.c     |  2 ++
 drivers/clk/imx/clk.c              | 17 ++++++++++++----
 drivers/clk/imx/clk.h              |  6 ++++++
 10 files changed, 60 insertions(+), 26 deletions(-)

diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
index db0253f..ee854ac 100644
--- a/drivers/clk/imx/Kconfig
+++ b/drivers/clk/imx/Kconfig
@@ -1,8 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 # common clock support for NXP i.MX SoC family.
 config MXC_CLK
-	bool
-	def_bool ARCH_MXC
+	tristate "IMX clock"
+	depends on ARCH_MXC
 
 config MXC_CLK_SCU
 	bool
@@ -11,24 +11,28 @@ config MXC_CLK_SCU
 config CLK_IMX8MM
 	bool "IMX8MM CCM Clock Driver"
 	depends on ARCH_MXC
+	select MXC_CLK
 	help
 	    Build the driver for i.MX8MM CCM Clock Driver
 
 config CLK_IMX8MN
 	bool "IMX8MN CCM Clock Driver"
 	depends on ARCH_MXC
+	select MXC_CLK
 	help
 	    Build the driver for i.MX8MN CCM Clock Driver
 
 config CLK_IMX8MP
 	bool "IMX8MP CCM Clock Driver"
 	depends on ARCH_MXC
+	select MXC_CLK
 	help
 	    Build the driver for i.MX8MP CCM Clock Driver
 
 config CLK_IMX8MQ
 	bool "IMX8MQ CCM Clock Driver"
 	depends on ARCH_MXC
+	select MXC_CLK
 	help
 	    Build the driver for i.MX8MQ CCM Clock Driver
 
diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile
index 928f874..687207d 100644
--- a/drivers/clk/imx/Makefile
+++ b/drivers/clk/imx/Makefile
@@ -1,25 +1,25 @@
 # SPDX-License-Identifier: GPL-2.0
 
-obj-$(CONFIG_MXC_CLK) += \
-	clk.o \
-	clk-busy.o \
-	clk-composite-8m.o \
-	clk-cpu.o \
-	clk-composite-7ulp.o \
-	clk-divider-gate.o \
-	clk-fixup-div.o \
-	clk-fixup-mux.o \
-	clk-frac-pll.o \
-	clk-gate-exclusive.o \
-	clk-gate2.o \
-	clk-pfd.o \
-	clk-pfdv2.o \
-	clk-pllv1.o \
-	clk-pllv2.o \
-	clk-pllv3.o \
-	clk-pllv4.o \
-	clk-sscg-pll.o \
-	clk-pll14xx.o
+mxc-clk-objs += clk.o
+mxc-clk-objs += clk-busy.o
+mxc-clk-objs += clk-composite-7ulp.o
+mxc-clk-objs += clk-composite-8m.o
+mxc-clk-objs += clk-cpu.o
+mxc-clk-objs += clk-divider-gate.o
+mxc-clk-objs += clk-fixup-div.o
+mxc-clk-objs += clk-fixup-mux.o
+mxc-clk-objs += clk-frac-pll.o
+mxc-clk-objs += clk-gate2.o
+mxc-clk-objs += clk-gate-exclusive.o
+mxc-clk-objs += clk-pfd.o
+mxc-clk-objs += clk-pfdv2.o
+mxc-clk-objs += clk-pllv1.o
+mxc-clk-objs += clk-pllv2.o
+mxc-clk-objs += clk-pllv3.o
+mxc-clk-objs += clk-pllv4.o
+mxc-clk-objs += clk-pll14xx.o
+mxc-clk-objs += clk-sscg-pll.o
+obj-$(CONFIG_MXC_CLK) += mxc-clk.o
 
 obj-$(CONFIG_MXC_CLK_SCU) += \
 	clk-scu.o \
diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-composite-8m.c
index d2b5af8..78fb7e5 100644
--- a/drivers/clk/imx/clk-composite-8m.c
+++ b/drivers/clk/imx/clk-composite-8m.c
@@ -5,6 +5,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/errno.h>
+#include <linux/export.h>
 #include <linux/io.h>
 #include <linux/slab.h>
 
@@ -243,3 +244,4 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,
 	kfree(mux);
 	return ERR_CAST(hw);
 }
+EXPORT_SYMBOL_GPL(imx8m_clk_hw_composite_flags);
diff --git a/drivers/clk/imx/clk-cpu.c b/drivers/clk/imx/clk-cpu.c
index cb182be..cb6ca4c 100644
--- a/drivers/clk/imx/clk-cpu.c
+++ b/drivers/clk/imx/clk-cpu.c
@@ -5,6 +5,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/export.h>
 #include <linux/slab.h>
 #include "clk.h"
 
@@ -104,3 +105,4 @@ struct clk_hw *imx_clk_hw_cpu(const char *name, const char *parent_name,
 
 	return hw;
 }
+EXPORT_SYMBOL_GPL(imx_clk_hw_cpu);
diff --git a/drivers/clk/imx/clk-frac-pll.c b/drivers/clk/imx/clk-frac-pll.c
index 101e0a3..c703056 100644
--- a/drivers/clk/imx/clk-frac-pll.c
+++ b/drivers/clk/imx/clk-frac-pll.c
@@ -10,6 +10,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/err.h>
+#include <linux/export.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/slab.h>
@@ -233,3 +234,4 @@ struct clk_hw *imx_clk_hw_frac_pll(const char *name,
 
 	return hw;
 }
+EXPORT_SYMBOL_GPL(imx_clk_hw_frac_pll);
diff --git a/drivers/clk/imx/clk-gate2.c b/drivers/clk/imx/clk-gate2.c
index b87ab3c..512f675 100644
--- a/drivers/clk/imx/clk-gate2.c
+++ b/drivers/clk/imx/clk-gate2.c
@@ -7,6 +7,7 @@
  */
 
 #include <linux/clk-provider.h>
+#include <linux/export.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/io.h>
@@ -177,3 +178,4 @@ struct clk_hw *clk_hw_register_gate2(struct device *dev, const char *name,
 
 	return hw;
 }
+EXPORT_SYMBOL_GPL(clk_hw_register_gate2);
diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c
index f9eb189..f5c3e7e 100644
--- a/drivers/clk/imx/clk-pll14xx.c
+++ b/drivers/clk/imx/clk-pll14xx.c
@@ -6,6 +6,7 @@
 #include <linux/bitops.h>
 #include <linux/clk-provider.h>
 #include <linux/err.h>
+#include <linux/export.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/slab.h>
@@ -68,6 +69,7 @@ struct imx_pll14xx_clk imx_1443x_pll = {
 	.rate_table = imx_pll1443x_tbl,
 	.rate_count = ARRAY_SIZE(imx_pll1443x_tbl),
 };
+EXPORT_SYMBOL_GPL(imx_1443x_pll);
 
 struct imx_pll14xx_clk imx_1443x_dram_pll = {
 	.type = PLL_1443X,
@@ -75,12 +77,14 @@ struct imx_pll14xx_clk imx_1443x_dram_pll = {
 	.rate_count = ARRAY_SIZE(imx_pll1443x_tbl),
 	.flags = CLK_GET_RATE_NOCACHE,
 };
+EXPORT_SYMBOL_GPL(imx_1443x_dram_pll);
 
 struct imx_pll14xx_clk imx_1416x_pll = {
 	.type = PLL_1416X,
 	.rate_table = imx_pll1416x_tbl,
 	.rate_count = ARRAY_SIZE(imx_pll1416x_tbl),
 };
+EXPORT_SYMBOL_GPL(imx_1416x_pll);
 
 static const struct imx_pll14xx_rate_table *imx_get_pll_settings(
 		struct clk_pll14xx *pll, unsigned long rate)
@@ -436,3 +440,4 @@ struct clk_hw *imx_dev_clk_hw_pll14xx(struct device *dev, const char *name,
 
 	return hw;
 }
+EXPORT_SYMBOL_GPL(imx_dev_clk_hw_pll14xx);
diff --git a/drivers/clk/imx/clk-sscg-pll.c b/drivers/clk/imx/clk-sscg-pll.c
index 773d8a5..9d6cdff 100644
--- a/drivers/clk/imx/clk-sscg-pll.c
+++ b/drivers/clk/imx/clk-sscg-pll.c
@@ -10,6 +10,7 @@
 
 #include <linux/clk-provider.h>
 #include <linux/err.h>
+#include <linux/export.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/slab.h>
@@ -537,3 +538,4 @@ struct clk_hw *imx_clk_hw_sscg_pll(const char *name,
 
 	return hw;
 }
+EXPORT_SYMBOL_GPL(imx_clk_hw_sscg_pll);
diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
index 87ab8db..547cade 100644
--- a/drivers/clk/imx/clk.c
+++ b/drivers/clk/imx/clk.c
@@ -3,6 +3,7 @@
 #include <linux/clk-provider.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -13,6 +14,7 @@
 #define CCDR_MMDC_CH1_MASK		BIT(16)
 
 DEFINE_SPINLOCK(imx_ccm_lock);
+EXPORT_SYMBOL_GPL(imx_ccm_lock);
 
 void imx_unregister_clocks(struct clk *clks[], unsigned int count)
 {
@@ -29,8 +31,9 @@ void imx_unregister_hw_clocks(struct clk_hw *hws[], unsigned int count)
 	for (i = 0; i < count; i++)
 		clk_hw_unregister(hws[i]);
 }
+EXPORT_SYMBOL_GPL(imx_unregister_hw_clocks);
 
-void __init imx_mmdc_mask_handshake(void __iomem *ccm_base,
+void imx_mmdc_mask_handshake(void __iomem *ccm_base,
 				    unsigned int chn)
 {
 	unsigned int reg;
@@ -59,8 +62,9 @@ void imx_check_clk_hws(struct clk_hw *clks[], unsigned int count)
 			pr_err("i.MX clk %u: register failed with %ld\n",
 			       i, PTR_ERR(clks[i]));
 }
+EXPORT_SYMBOL_GPL(imx_check_clk_hws);
 
-static struct clk * __init imx_obtain_fixed_clock_from_dt(const char *name)
+static struct clk *imx_obtain_fixed_clock_from_dt(const char *name)
 {
 	struct of_phandle_args phandle;
 	struct clk *clk = ERR_PTR(-ENODEV);
@@ -80,7 +84,7 @@ static struct clk * __init imx_obtain_fixed_clock_from_dt(const char *name)
 	return clk;
 }
 
-struct clk * __init imx_obtain_fixed_clock(
+struct clk *imx_obtain_fixed_clock(
 			const char *name, unsigned long rate)
 {
 	struct clk *clk;
@@ -91,7 +95,7 @@ struct clk * __init imx_obtain_fixed_clock(
 	return clk;
 }
 
-struct clk_hw * __init imx_obtain_fixed_clock_hw(
+struct clk_hw *imx_obtain_fixed_clock_hw(
 			const char *name, unsigned long rate)
 {
 	struct clk *clk;
@@ -113,6 +117,7 @@ struct clk_hw * imx_obtain_fixed_clk_hw(struct device_node *np,
 
 	return __clk_get_hw(clk);
 }
+EXPORT_SYMBOL_GPL(imx_obtain_fixed_clk_hw);
 
 /*
  * This fixups the register CCM_CSCMR1 write value.
@@ -140,6 +145,7 @@ void imx_cscmr1_fixup(u32 *val)
 	return;
 }
 
+#ifndef MODULE
 static int imx_keep_uart_clocks;
 static struct clk ** const *imx_uart_clocks;
 
@@ -177,3 +183,6 @@ static int __init imx_clk_disable_uart(void)
 	return 0;
 }
 late_initcall_sync(imx_clk_disable_uart);
+#endif
+
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h
index 16adbc3..dd47c19 100644
--- a/drivers/clk/imx/clk.h
+++ b/drivers/clk/imx/clk.h
@@ -11,7 +11,13 @@ extern spinlock_t imx_ccm_lock;
 
 void imx_check_clocks(struct clk *clks[], unsigned int count);
 void imx_check_clk_hws(struct clk_hw *clks[], unsigned int count);
+#ifndef MODULE
 void imx_register_uart_clocks(struct clk ** const clks[]);
+#else
+static inline void imx_register_uart_clocks(struct clk ** const clks[])
+{
+}
+#endif
 void imx_mmdc_mask_handshake(void __iomem *ccm_base, unsigned int chn);
 void imx_unregister_clocks(struct clk *clks[], unsigned int count);
 void imx_unregister_hw_clocks(struct clk_hw *hws[], unsigned int count);
-- 
2.7.4


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

* [PATCH V5 4/6] clk: imx: Add clock configuration for ARMv7 platforms
  2020-07-02 15:23 [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms clock driver as module Anson Huang
                   ` (2 preceding siblings ...)
  2020-07-02 15:23 ` [PATCH V5 3/6] clk: imx: Support building i.MX common clock driver as module Anson Huang
@ 2020-07-02 15:23 ` Anson Huang
  2020-07-02 15:24 ` [PATCH V5 5/6] clk: imx8m: Support module build Anson Huang
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Anson Huang @ 2020-07-02 15:23 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam,
	aisheng.dong, arnd, peng.fan, abel.vesa, j.remmet, sfr,
	georg.waibel, Georg.Waibel, laurent.pinchart, chen.fang,
	fugang.duan, daniel.baluta, yuehaibing, horia.geanta,
	andrew.smirnov, linux-clk, linux-kernel, linux-arm-kernel
  Cc: Linux-imx

Add CONFIG_CLK_xxx for i.MX ARMv7 platforms, and use it as build option
instead of CONFIG_SOC_xxx, the CONFIG_CLK_xxx will be selected by default
according to CONFIG_SOC_xxx, COMPILE_TEST will be also supported.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
---
Changes since V4:
	- remove COMPILE_TEST support for i.MX1/2/3;
	- add COMPILE_TEST support for i.MX ARMv7 platform ONLY when the corresponding SOC
	  config is NOT set.
---
 drivers/clk/imx/Kconfig  | 71 +++++++++++++++++++++++++++++++++++++++++++++++-
 drivers/clk/imx/Makefile | 30 ++++++++++----------
 2 files changed, 85 insertions(+), 16 deletions(-)

diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
index ee854ac..595c435 100644
--- a/drivers/clk/imx/Kconfig
+++ b/drivers/clk/imx/Kconfig
@@ -2,12 +2,81 @@
 # common clock support for NXP i.MX SoC family.
 config MXC_CLK
 	tristate "IMX clock"
-	depends on ARCH_MXC
+	depends on ARCH_MXC || COMPILE_TEST
 
 config MXC_CLK_SCU
 	bool
 	depends on IMX_SCU
 
+config CLK_IMX1
+	def_bool SOC_IMX1
+	select CLK_MXC
+
+config CLK_IMX21
+	def_bool SOC_IMX21
+	select CLK_MXC
+
+config CLK_IMX25
+	def_bool SOC_IMX25
+	select CLK_MXC
+
+config CLK_IMX27
+	def_bool SOC_IMX27
+	select CLK_MXC
+
+config CLK_IMX31
+	def_bool SOC_IMX31
+	select CLK_MXC
+
+config CLK_IMX35
+	def_bool SOC_IMX35
+	select CLK_MXC
+
+config CLK_IMX5
+	tristate "IMX5 CCM Clock Driver" if COMPILE_TEST && !SOC_IMX5
+	default SOC_IMX5
+	select MXC_CLK
+
+config CLK_IMX6Q
+	tristate "IMX6Q CCM Clock Driver" if COMPILE_TEST && !SOC_IMX6Q
+	default SOC_IMX6Q
+	select MXC_CLK
+
+config CLK_IMX6SL
+	tristate "IMX6SL CCM Clock Driver" if COMPILE_TEST && !SOC_IMX6SL
+	default SOC_IMX6SL
+	select MXC_CLK
+
+config CLK_IMX6SLL
+	tristate "IMX6SLL CCM Clock Driver" if COMPILE_TEST && !SOC_IMX6SLL
+	default SOC_IMX6SLL
+	select MXC_CLK
+
+config CLK_IMX6SX
+	tristate "IMX6SX CCM Clock Driver" if COMPILE_TEST && !SOC_IMX6SX
+	default SOC_IMX6SX
+	select MXC_CLK
+
+config CLK_IMX6UL
+	tristate "IMX6UL CCM Clock Driver" if COMPILE_TEST && !SOC_IMX6UL
+	default SOC_IMX6UL
+	select MXC_CLK
+
+config CLK_IMX7D
+	tristate "IMX7D CCM Clock Driver" if COMPILE_TEST && !SOC_IMX7D
+	default SOC_IMX7D
+	select MXC_CLK
+
+config CLK_IMX7ULP
+	tristate "IMX7ULP Clock Driver" if COMPILE_TEST && !SOC_IMX7ULP
+	default SOC_IMX7ULP
+	select MXC_CLK
+
+config CLK_VF610
+	tristate "VF610 Clock Driver" if COMPILE_TEST && !SOC_VF610
+	default SOC_VF610
+	select MXC_CLK
+
 config CLK_IMX8MM
 	bool "IMX8MM CCM Clock Driver"
 	depends on ARCH_MXC
diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile
index 687207d..17f5d12 100644
--- a/drivers/clk/imx/Makefile
+++ b/drivers/clk/imx/Makefile
@@ -31,18 +31,18 @@ obj-$(CONFIG_CLK_IMX8MP) += clk-imx8mp.o
 obj-$(CONFIG_CLK_IMX8MQ) += clk-imx8mq.o
 obj-$(CONFIG_CLK_IMX8QXP) += clk-imx8qxp.o clk-imx8qxp-lpcg.o
 
-obj-$(CONFIG_SOC_IMX1)   += clk-imx1.o
-obj-$(CONFIG_SOC_IMX21)  += clk-imx21.o
-obj-$(CONFIG_SOC_IMX25)  += clk-imx25.o
-obj-$(CONFIG_SOC_IMX27)  += clk-imx27.o
-obj-$(CONFIG_SOC_IMX31)  += clk-imx31.o
-obj-$(CONFIG_SOC_IMX35)  += clk-imx35.o
-obj-$(CONFIG_SOC_IMX5)   += clk-imx5.o
-obj-$(CONFIG_SOC_IMX6Q)  += clk-imx6q.o
-obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o
-obj-$(CONFIG_SOC_IMX6SLL) += clk-imx6sll.o
-obj-$(CONFIG_SOC_IMX6SX) += clk-imx6sx.o
-obj-$(CONFIG_SOC_IMX6UL) += clk-imx6ul.o
-obj-$(CONFIG_SOC_IMX7D)  += clk-imx7d.o
-obj-$(CONFIG_SOC_IMX7ULP) += clk-imx7ulp.o
-obj-$(CONFIG_SOC_VF610)  += clk-vf610.o
+obj-$(CONFIG_CLK_IMX1)   += clk-imx1.o
+obj-$(CONFIG_CLK_IMX21)  += clk-imx21.o
+obj-$(CONFIG_CLK_IMX25)  += clk-imx25.o
+obj-$(CONFIG_CLK_IMX27)  += clk-imx27.o
+obj-$(CONFIG_CLK_IMX31)  += clk-imx31.o
+obj-$(CONFIG_CLK_IMX35)  += clk-imx35.o
+obj-$(CONFIG_CLK_IMX5)   += clk-imx5.o
+obj-$(CONFIG_CLK_IMX6Q)  += clk-imx6q.o
+obj-$(CONFIG_CLK_IMX6SL) += clk-imx6sl.o
+obj-$(CONFIG_CLK_IMX6SLL) += clk-imx6sll.o
+obj-$(CONFIG_CLK_IMX6SX) += clk-imx6sx.o
+obj-$(CONFIG_CLK_IMX6UL) += clk-imx6ul.o
+obj-$(CONFIG_CLK_IMX7D)  += clk-imx7d.o
+obj-$(CONFIG_CLK_IMX7ULP) += clk-imx7ulp.o
+obj-$(CONFIG_CLK_VF610)  += clk-vf610.o
-- 
2.7.4


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

* [PATCH V5 5/6] clk: imx8m: Support module build
  2020-07-02 15:23 [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms clock driver as module Anson Huang
                   ` (3 preceding siblings ...)
  2020-07-02 15:23 ` [PATCH V5 4/6] clk: imx: Add clock configuration for ARMv7 platforms Anson Huang
@ 2020-07-02 15:24 ` Anson Huang
  2020-07-02 15:24 ` [PATCH V5 6/6] clk: imx8qxp: Support building i.MX8QXP clock driver as module Anson Huang
  2020-07-02 18:29 ` [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms " Laurent Pinchart
  6 siblings, 0 replies; 9+ messages in thread
From: Anson Huang @ 2020-07-02 15:24 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam,
	aisheng.dong, arnd, peng.fan, abel.vesa, j.remmet, sfr,
	georg.waibel, Georg.Waibel, laurent.pinchart, chen.fang,
	fugang.duan, daniel.baluta, yuehaibing, horia.geanta,
	andrew.smirnov, linux-clk, linux-kernel, linux-arm-kernel
  Cc: Linux-imx

Change configuration to "tristate", add module author, description
and license to support building i.MX8M SoCs clock driver as module.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 drivers/clk/imx/Kconfig      | 16 ++++++++--------
 drivers/clk/imx/clk-imx8mm.c |  4 ++++
 drivers/clk/imx/clk-imx8mn.c |  4 ++++
 drivers/clk/imx/clk-imx8mp.c |  4 ++++
 drivers/clk/imx/clk-imx8mq.c |  4 ++++
 5 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
index 595c435..4f4f86e 100644
--- a/drivers/clk/imx/Kconfig
+++ b/drivers/clk/imx/Kconfig
@@ -78,29 +78,29 @@ config CLK_VF610
 	select MXC_CLK
 
 config CLK_IMX8MM
-	bool "IMX8MM CCM Clock Driver"
-	depends on ARCH_MXC
+	tristate "IMX8MM CCM Clock Driver"
+	depends on ARCH_MXC || COMPILE_TEST
 	select MXC_CLK
 	help
 	    Build the driver for i.MX8MM CCM Clock Driver
 
 config CLK_IMX8MN
-	bool "IMX8MN CCM Clock Driver"
-	depends on ARCH_MXC
+	tristate "IMX8MN CCM Clock Driver"
+	depends on ARCH_MXC || COMPILE_TEST
 	select MXC_CLK
 	help
 	    Build the driver for i.MX8MN CCM Clock Driver
 
 config CLK_IMX8MP
-	bool "IMX8MP CCM Clock Driver"
-	depends on ARCH_MXC
+	tristate "IMX8MP CCM Clock Driver"
+	depends on ARCH_MXC || COMPILE_TEST
 	select MXC_CLK
 	help
 	    Build the driver for i.MX8MP CCM Clock Driver
 
 config CLK_IMX8MQ
-	bool "IMX8MQ CCM Clock Driver"
-	depends on ARCH_MXC
+	tristate "IMX8MQ CCM Clock Driver"
+	depends on ARCH_MXC || COMPILE_TEST
 	select MXC_CLK
 	help
 	    Build the driver for i.MX8MQ CCM Clock Driver
diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c
index b793264..0de0be0 100644
--- a/drivers/clk/imx/clk-imx8mm.c
+++ b/drivers/clk/imx/clk-imx8mm.c
@@ -657,3 +657,7 @@ static struct platform_driver imx8mm_clk_driver = {
 	},
 };
 module_platform_driver(imx8mm_clk_driver);
+
+MODULE_AUTHOR("Bai Ping <ping.bai@nxp.com>");
+MODULE_DESCRIPTION("NXP i.MX8MM clock driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c
index 213cc37..e984de5 100644
--- a/drivers/clk/imx/clk-imx8mn.c
+++ b/drivers/clk/imx/clk-imx8mn.c
@@ -608,3 +608,7 @@ static struct platform_driver imx8mn_clk_driver = {
 	},
 };
 module_platform_driver(imx8mn_clk_driver);
+
+MODULE_AUTHOR("Anson Huang <Anson.Huang@nxp.com>");
+MODULE_DESCRIPTION("NXP i.MX8MN clock driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c
index ca74771..f3cedf2 100644
--- a/drivers/clk/imx/clk-imx8mp.c
+++ b/drivers/clk/imx/clk-imx8mp.c
@@ -773,3 +773,7 @@ static struct platform_driver imx8mp_clk_driver = {
 	},
 };
 module_platform_driver(imx8mp_clk_driver);
+
+MODULE_AUTHOR("Anson Huang <Anson.Huang@nxp.com>");
+MODULE_DESCRIPTION("NXP i.MX8MP clock driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/clk/imx/clk-imx8mq.c b/drivers/clk/imx/clk-imx8mq.c
index a64aace..a06cc21 100644
--- a/drivers/clk/imx/clk-imx8mq.c
+++ b/drivers/clk/imx/clk-imx8mq.c
@@ -643,3 +643,7 @@ static struct platform_driver imx8mq_clk_driver = {
 	},
 };
 module_platform_driver(imx8mq_clk_driver);
+
+MODULE_AUTHOR("Abel Vesa <abel.vesa@nxp.com>");
+MODULE_DESCRIPTION("NXP i.MX8MQ clock driver");
+MODULE_LICENSE("GPL v2");
-- 
2.7.4


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

* [PATCH V5 6/6] clk: imx8qxp: Support building i.MX8QXP clock driver as module
  2020-07-02 15:23 [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms clock driver as module Anson Huang
                   ` (4 preceding siblings ...)
  2020-07-02 15:24 ` [PATCH V5 5/6] clk: imx8m: Support module build Anson Huang
@ 2020-07-02 15:24 ` Anson Huang
  2020-07-02 18:29 ` [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms " Laurent Pinchart
  6 siblings, 0 replies; 9+ messages in thread
From: Anson Huang @ 2020-07-02 15:24 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam,
	aisheng.dong, arnd, peng.fan, abel.vesa, j.remmet, sfr,
	georg.waibel, Georg.Waibel, laurent.pinchart, chen.fang,
	fugang.duan, daniel.baluta, yuehaibing, horia.geanta,
	andrew.smirnov, linux-clk, linux-kernel, linux-arm-kernel
  Cc: Linux-imx

Change configuration to "tristate", add module author, description and
license to support building i.MX8QXP clock drivers as module.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
Changes since V4:
	- keep using builtin_platform_driver();
	- add COMPILE_TEST support.
---
 drivers/clk/imx/Kconfig            | 8 +++++---
 drivers/clk/imx/Makefile           | 9 ++++-----
 drivers/clk/imx/clk-imx8qxp-lpcg.c | 4 ++++
 drivers/clk/imx/clk-imx8qxp.c      | 4 ++++
 4 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
index 4f4f86e..51be5e8 100644
--- a/drivers/clk/imx/Kconfig
+++ b/drivers/clk/imx/Kconfig
@@ -5,7 +5,8 @@ config MXC_CLK
 	depends on ARCH_MXC || COMPILE_TEST
 
 config MXC_CLK_SCU
-	bool
+	tristate "IMX SCU clock"
+	depends on ARCH_MXC || COMPILE_TEST
 	depends on IMX_SCU
 
 config CLK_IMX1
@@ -106,8 +107,9 @@ config CLK_IMX8MQ
 	    Build the driver for i.MX8MQ CCM Clock Driver
 
 config CLK_IMX8QXP
-	bool "IMX8QXP SCU Clock"
-	depends on ARCH_MXC && IMX_SCU && ARM64
+	tristate "IMX8QXP SCU Clock"
+	depends on (ARCH_MXC && ARM64) || COMPILE_TEST
+	depends on IMX_SCU
 	select MXC_CLK_SCU
 	help
 	  Build the driver for IMX8QXP SCU based clocks.
diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile
index 17f5d12..79e53f2 100644
--- a/drivers/clk/imx/Makefile
+++ b/drivers/clk/imx/Makefile
@@ -21,15 +21,14 @@ mxc-clk-objs += clk-pll14xx.o
 mxc-clk-objs += clk-sscg-pll.o
 obj-$(CONFIG_MXC_CLK) += mxc-clk.o
 
-obj-$(CONFIG_MXC_CLK_SCU) += \
-	clk-scu.o \
-	clk-lpcg-scu.o
-
 obj-$(CONFIG_CLK_IMX8MM) += clk-imx8mm.o
 obj-$(CONFIG_CLK_IMX8MN) += clk-imx8mn.o
 obj-$(CONFIG_CLK_IMX8MP) += clk-imx8mp.o
 obj-$(CONFIG_CLK_IMX8MQ) += clk-imx8mq.o
-obj-$(CONFIG_CLK_IMX8QXP) += clk-imx8qxp.o clk-imx8qxp-lpcg.o
+
+obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o
+clk-imx-scu-$(CONFIG_CLK_IMX8QXP) += clk-scu.o clk-imx8qxp.o
+clk-imx-lpcg-scu-$(CONFIG_CLK_IMX8QXP) += clk-lpcg-scu.o clk-imx8qxp-lpcg.o
 
 obj-$(CONFIG_CLK_IMX1)   += clk-imx1.o
 obj-$(CONFIG_CLK_IMX21)  += clk-imx21.o
diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c
index 04c8ee3..e947a70 100644
--- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
+++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
@@ -232,3 +232,7 @@ static struct platform_driver imx8qxp_lpcg_clk_driver = {
 };
 
 builtin_platform_driver(imx8qxp_lpcg_clk_driver);
+
+MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>");
+MODULE_DESCRIPTION("NXP i.MX8QXP LPCG clock driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c
index 5e2903e..d650ca3 100644
--- a/drivers/clk/imx/clk-imx8qxp.c
+++ b/drivers/clk/imx/clk-imx8qxp.c
@@ -152,3 +152,7 @@ static struct platform_driver imx8qxp_clk_driver = {
 	.probe = imx8qxp_clk_probe,
 };
 builtin_platform_driver(imx8qxp_clk_driver);
+
+MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>");
+MODULE_DESCRIPTION("NXP i.MX8QXP clock driver");
+MODULE_LICENSE("GPL v2");
-- 
2.7.4


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

* Re: [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms clock driver as module
  2020-07-02 15:23 [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms clock driver as module Anson Huang
                   ` (5 preceding siblings ...)
  2020-07-02 15:24 ` [PATCH V5 6/6] clk: imx8qxp: Support building i.MX8QXP clock driver as module Anson Huang
@ 2020-07-02 18:29 ` Laurent Pinchart
  2020-07-07  2:26   ` Anson Huang
  6 siblings, 1 reply; 9+ messages in thread
From: Laurent Pinchart @ 2020-07-02 18:29 UTC (permalink / raw)
  To: Anson Huang
  Cc: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam,
	aisheng.dong, arnd, peng.fan, abel.vesa, j.remmet, sfr,
	georg.waibel, Georg.Waibel, chen.fang, fugang.duan,
	daniel.baluta, yuehaibing, horia.geanta, andrew.smirnov,
	linux-clk, linux-kernel, linux-arm-kernel, Linux-imx

Hi Anson,

On Thu, Jul 02, 2020 at 11:23:55PM +0800, Anson Huang wrote:
> Nowdays, there are more and more requirements of building SoC specific
> drivers as modules, such as Android GKI (generic kernel image), this
> patch set supports building i.MX ARMv6/ARMv7 SoCs clock drivers as modules,

I'm curious, how does the system boot to userspace to be able to load
modules without clock support in the kernel ? What if the driver for the
device storing the rootfs cope with clocks not being available ? Does
this require an initramfs with the clock module ? Even then, how does
the serial port driver cope with not having clocks ?

> The CLK_IMXxxx is introduced for i.MX ARMv7 platforms in order to support
> various build options, and i.MX1/2/3 platforms now still ONLY support built-in
> as they are rarely used now.
> 
> Changes since V4:
> 	- add empty function of imx_register_uart_clocks() for MODULE build, then
> 	  all earlycon related clock handler can be built-out for MODULE;
> 	- add module build support for ARMv7 platforms, also add COMPILE_TEST for them;
> 	- add COMPILE_TEST for ARMv8 platforms;
> 	- keep using builtin_platform_driver() for i.MX8QXP clock driver.
> 
> Anson Huang (6):
>   clk: composite: Export clk_hw_register_composite()
>   clk: imx: Support module build for i.MX5/6/7 and vf610
>   clk: imx: Support building i.MX common clock driver as module
>   clk: imx: Add clock configuration for ARMv7 platforms
>   clk: imx8m: Support module build
>   clk: imx8qxp: Support building i.MX8QXP clock driver as module
> 
>  drivers/clk/clk-composite.c        |   1 +
>  drivers/clk/imx/Kconfig            | 101 ++++++++++++++++++++++++++++++++-----
>  drivers/clk/imx/Makefile           |  79 ++++++++++++++---------------
>  drivers/clk/imx/clk-composite-8m.c |   2 +
>  drivers/clk/imx/clk-cpu.c          |   2 +
>  drivers/clk/imx/clk-frac-pll.c     |   2 +
>  drivers/clk/imx/clk-gate2.c        |   2 +
>  drivers/clk/imx/clk-imx5.c         |   5 ++
>  drivers/clk/imx/clk-imx6q.c        |   5 ++
>  drivers/clk/imx/clk-imx6sl.c       |   5 ++
>  drivers/clk/imx/clk-imx6sll.c      |   5 ++
>  drivers/clk/imx/clk-imx6sx.c       |   5 ++
>  drivers/clk/imx/clk-imx6ul.c       |   5 ++
>  drivers/clk/imx/clk-imx7d.c        |   5 ++
>  drivers/clk/imx/clk-imx7ulp.c      |   5 ++
>  drivers/clk/imx/clk-imx8mm.c       |   4 ++
>  drivers/clk/imx/clk-imx8mn.c       |   4 ++
>  drivers/clk/imx/clk-imx8mp.c       |   4 ++
>  drivers/clk/imx/clk-imx8mq.c       |   4 ++
>  drivers/clk/imx/clk-imx8qxp-lpcg.c |   4 ++
>  drivers/clk/imx/clk-imx8qxp.c      |   4 ++
>  drivers/clk/imx/clk-pll14xx.c      |   5 ++
>  drivers/clk/imx/clk-sscg-pll.c     |   2 +
>  drivers/clk/imx/clk-vf610.c        |   5 ++
>  drivers/clk/imx/clk.c              |  17 +++++--
>  drivers/clk/imx/clk.h              |   6 +++
>  26 files changed, 231 insertions(+), 57 deletions(-)

-- 
Regards,

Laurent Pinchart

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

* RE: [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms clock driver as module
  2020-07-02 18:29 ` [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms " Laurent Pinchart
@ 2020-07-07  2:26   ` Anson Huang
  0 siblings, 0 replies; 9+ messages in thread
From: Anson Huang @ 2020-07-07  2:26 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam,
	Aisheng Dong, arnd, Peng Fan, Abel Vesa, j.remmet, sfr,
	georg.waibel, Georg.Waibel, Fancy Fang, Andy Duan, Daniel Baluta,
	yuehaibing, Horia Geanta, andrew.smirnov, linux-clk,
	linux-kernel, linux-arm-kernel, dl-linux-imx

Hi, Laurent

> Subject: Re: [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms
> clock driver as module
> 
> Hi Anson,
> 
> On Thu, Jul 02, 2020 at 11:23:55PM +0800, Anson Huang wrote:
> > Nowdays, there are more and more requirements of building SoC specific
> > drivers as modules, such as Android GKI (generic kernel image), this
> > patch set supports building i.MX ARMv6/ARMv7 SoCs clock drivers as
> > modules,
> 
> I'm curious, how does the system boot to userspace to be able to load
> modules without clock support in the kernel ? What if the driver for the device
> storing the rootfs cope with clocks not being available ? Does this require an
> initramfs with the clock module ? Even then, how does the serial port driver
> cope with not having clocks ?

Yes, this requires an initramfs, and in the initramfs, it will insmod those .ko with
correct sequence, as per my test and Android GKI test from our Andoird team,
the clock and pinctrl need to be insmod first, then the debug console, then other
module devices....And this patch series ONLY provides the capability of loadable
clock module for this scenario, Linux will still use built-in by default. 

Thanks,
Anson

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

end of thread, other threads:[~2020-07-07  2:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02 15:23 [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms clock driver as module Anson Huang
2020-07-02 15:23 ` [PATCH V5 1/6] clk: composite: Export clk_hw_register_composite() Anson Huang
2020-07-02 15:23 ` [PATCH V5 2/6] clk: imx: Support module build for i.MX5/6/7 and vf610 Anson Huang
2020-07-02 15:23 ` [PATCH V5 3/6] clk: imx: Support building i.MX common clock driver as module Anson Huang
2020-07-02 15:23 ` [PATCH V5 4/6] clk: imx: Add clock configuration for ARMv7 platforms Anson Huang
2020-07-02 15:24 ` [PATCH V5 5/6] clk: imx8m: Support module build Anson Huang
2020-07-02 15:24 ` [PATCH V5 6/6] clk: imx8qxp: Support building i.MX8QXP clock driver as module Anson Huang
2020-07-02 18:29 ` [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms " Laurent Pinchart
2020-07-07  2:26   ` Anson Huang

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).