All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V4 0/5] Support building i.MX8 SoCs clock driver as module
@ 2020-07-02  2:14 ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  2:14 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam, peng.fan,
	arnd, abel.vesa, aisheng.dong, fugang.duan, daniel.baluta,
	yuehaibing, sfr, 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.MX8 SoCs clock drivers as modules, including
i.MX8MQ/MM/MN/MP/QXP, the common clock modules are: mxc-clk.ko for
i.MX8MQ/MM/MN/MP, i.MX8QXP has linked the common scu/lpcg clock driver into
its clock drivers.

Since i.MX common clk driver will support module build and no longer selected
by default, so for i.MX ARMv7 platforms, add clock configuration for each SoC
and they are selected by default if the corresponding SoC config is selected.

Changes since V3:
	- merge all i.MX8M SoCs patches together;
	- add module author/description;
	- drop __setup_param() change, it is ONLY needed for built-in version,
	  so just add #if check for module build;
	- link common scu and lpcg clock into i.MX8QXP clock driver, then export
	  is no needed for common scu/lpcg clock driver.

Anson Huang (5):
  clk: composite: Export clk_hw_register_composite()
  clk: imx: Add clock configuration for ARMv7 platforms
  clk: imx: Support building i.MX common clock driver as module
  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            | 112 ++++++++++++++++++++++++++++++++++---
 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-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 |  10 +++-
 drivers/clk/imx/clk-imx8qxp.c      |  11 +++-
 drivers/clk/imx/clk-pll14xx.c      |   5 ++
 drivers/clk/imx/clk-sscg-pll.c     |   2 +
 drivers/clk/imx/clk.c              |  22 ++++++--
 16 files changed, 209 insertions(+), 57 deletions(-)

-- 
2.7.4


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

* [PATCH V4 0/5] Support building i.MX8 SoCs clock driver as module
@ 2020-07-02  2:14 ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  2:14 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam, peng.fan,
	arnd, abel.vesa, aisheng.dong, fugang.duan, daniel.baluta,
	yuehaibing, sfr, 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.MX8 SoCs clock drivers as modules, including
i.MX8MQ/MM/MN/MP/QXP, the common clock modules are: mxc-clk.ko for
i.MX8MQ/MM/MN/MP, i.MX8QXP has linked the common scu/lpcg clock driver into
its clock drivers.

Since i.MX common clk driver will support module build and no longer selected
by default, so for i.MX ARMv7 platforms, add clock configuration for each SoC
and they are selected by default if the corresponding SoC config is selected.

Changes since V3:
	- merge all i.MX8M SoCs patches together;
	- add module author/description;
	- drop __setup_param() change, it is ONLY needed for built-in version,
	  so just add #if check for module build;
	- link common scu and lpcg clock into i.MX8QXP clock driver, then export
	  is no needed for common scu/lpcg clock driver.

Anson Huang (5):
  clk: composite: Export clk_hw_register_composite()
  clk: imx: Add clock configuration for ARMv7 platforms
  clk: imx: Support building i.MX common clock driver as module
  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            | 112 ++++++++++++++++++++++++++++++++++---
 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-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 |  10 +++-
 drivers/clk/imx/clk-imx8qxp.c      |  11 +++-
 drivers/clk/imx/clk-pll14xx.c      |   5 ++
 drivers/clk/imx/clk-sscg-pll.c     |   2 +
 drivers/clk/imx/clk.c              |  22 ++++++--
 16 files changed, 209 insertions(+), 57 deletions(-)

-- 
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] 52+ messages in thread

* [PATCH V4 1/5] clk: composite: Export clk_hw_register_composite()
  2020-07-02  2:14 ` Anson Huang
@ 2020-07-02  2:14   ` Anson Huang
  -1 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  2:14 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam, peng.fan,
	arnd, abel.vesa, aisheng.dong, fugang.duan, daniel.baluta,
	yuehaibing, sfr, 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] 52+ messages in thread

* [PATCH V4 1/5] clk: composite: Export clk_hw_register_composite()
@ 2020-07-02  2:14   ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  2:14 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam, peng.fan,
	arnd, abel.vesa, aisheng.dong, fugang.duan, daniel.baluta,
	yuehaibing, sfr, 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


_______________________________________________
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] 52+ messages in thread

* [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
  2020-07-02  2:14 ` Anson Huang
@ 2020-07-02  2:14   ` Anson Huang
  -1 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  2:14 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam, peng.fan,
	arnd, abel.vesa, aisheng.dong, fugang.duan, daniel.baluta,
	yuehaibing, sfr, 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.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
Changes since V3:
	- Add clock configuration for each ARMv7.
---
 drivers/clk/imx/Kconfig  | 90 ++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/imx/Makefile | 30 ++++++++--------
 2 files changed, 105 insertions(+), 15 deletions(-)

diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
index db0253f..09fc8ad 100644
--- a/drivers/clk/imx/Kconfig
+++ b/drivers/clk/imx/Kconfig
@@ -8,6 +8,96 @@ config MXC_CLK_SCU
 	bool
 	depends on IMX_SCU
 
+config CLK_IMX1
+         bool "IMX1 CCM Clock Driver"
+         depends on SOC_IMX1 || COMPILE_TEST
+         default SOC_IMX1
+         select MXC_CLK
+
+config CLK_IMX21
+         bool "IMX21 CCM Clock Driver"
+         depends on SOC_IMX21 || COMPILE_TEST
+         default SOC_IMX21
+         select MXC_CLK
+
+config CLK_IMX25
+         bool "IMX25 CCM Clock Driver"
+         depends on SOC_IMX25 || COMPILE_TEST
+         default SOC_IMX25
+         select MXC_CLK
+
+config CLK_IMX27
+         bool "IMX27 CCM Clock Driver"
+         depends on SOC_IMX27 || COMPILE_TEST
+         default SOC_IMX27
+         select MXC_CLK
+
+config CLK_IMX31
+         bool "IMX31 CCM Clock Driver"
+         depends on SOC_IMX31 || COMPILE_TEST
+         default SOC_IMX31
+         select MXC_CLK
+
+config CLK_IMX35
+         bool "IMX35 CCM Clock Driver"
+         depends on SOC_IMX35 || COMPILE_TEST
+         default SOC_IMX35
+         select MXC_CLK
+
+config CLK_IMX5
+         bool "IMX5 CCM Clock Driver"
+         depends on SOC_IMX5 || COMPILE_TEST
+         default SOC_IMX5
+         select MXC_CLK
+
+config CLK_IMX6Q
+         bool "IMX6Q CCM Clock Driver"
+         depends on SOC_IMX6Q || COMPILE_TEST
+         default SOC_IMX6Q
+         select MXC_CLK
+
+config CLK_IMX6SL
+         bool "IMX6SL CCM Clock Driver"
+         depends on SOC_IMX6SL || COMPILE_TEST
+         default SOC_IMX6SL
+         select MXC_CLK
+
+config CLK_IMX6SLL
+         bool "IMX6SLL CCM Clock Driver"
+         depends on SOC_IMX6SLL || COMPILE_TEST
+         default SOC_IMX6SLL
+         select MXC_CLK
+
+config CLK_IMX6SX
+         bool "IMX6SX CCM Clock Driver"
+         depends on SOC_IMX6SX || COMPILE_TEST
+         default SOC_IMX6SX
+         select MXC_CLK
+
+config CLK_IMX6UL
+         bool "IMX6UL CCM Clock Driver"
+         depends on SOC_IMX6UL || COMPILE_TEST
+         default SOC_IMX6UL
+         select MXC_CLK
+
+config CLK_IMX7D
+         bool "IMX7D CCM Clock Driver"
+         depends on SOC_IMX7D || COMPILE_TEST
+         default SOC_IMX7D
+         select MXC_CLK
+
+config CLK_IMX7ULP
+         bool "IMX7ULP Clock Driver"
+         depends on SOC_IMX7ULP || COMPILE_TEST
+         default SOC_IMX7ULP
+         select MXC_CLK
+
+config CLK_VF610
+         bool "VF610 Clock Driver"
+         depends on SOC_VF610 || COMPILE_TEST
+         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 928f874..394ade7 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] 52+ messages in thread

* [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
@ 2020-07-02  2:14   ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  2:14 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam, peng.fan,
	arnd, abel.vesa, aisheng.dong, fugang.duan, daniel.baluta,
	yuehaibing, sfr, 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.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
Changes since V3:
	- Add clock configuration for each ARMv7.
---
 drivers/clk/imx/Kconfig  | 90 ++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/imx/Makefile | 30 ++++++++--------
 2 files changed, 105 insertions(+), 15 deletions(-)

diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
index db0253f..09fc8ad 100644
--- a/drivers/clk/imx/Kconfig
+++ b/drivers/clk/imx/Kconfig
@@ -8,6 +8,96 @@ config MXC_CLK_SCU
 	bool
 	depends on IMX_SCU
 
+config CLK_IMX1
+         bool "IMX1 CCM Clock Driver"
+         depends on SOC_IMX1 || COMPILE_TEST
+         default SOC_IMX1
+         select MXC_CLK
+
+config CLK_IMX21
+         bool "IMX21 CCM Clock Driver"
+         depends on SOC_IMX21 || COMPILE_TEST
+         default SOC_IMX21
+         select MXC_CLK
+
+config CLK_IMX25
+         bool "IMX25 CCM Clock Driver"
+         depends on SOC_IMX25 || COMPILE_TEST
+         default SOC_IMX25
+         select MXC_CLK
+
+config CLK_IMX27
+         bool "IMX27 CCM Clock Driver"
+         depends on SOC_IMX27 || COMPILE_TEST
+         default SOC_IMX27
+         select MXC_CLK
+
+config CLK_IMX31
+         bool "IMX31 CCM Clock Driver"
+         depends on SOC_IMX31 || COMPILE_TEST
+         default SOC_IMX31
+         select MXC_CLK
+
+config CLK_IMX35
+         bool "IMX35 CCM Clock Driver"
+         depends on SOC_IMX35 || COMPILE_TEST
+         default SOC_IMX35
+         select MXC_CLK
+
+config CLK_IMX5
+         bool "IMX5 CCM Clock Driver"
+         depends on SOC_IMX5 || COMPILE_TEST
+         default SOC_IMX5
+         select MXC_CLK
+
+config CLK_IMX6Q
+         bool "IMX6Q CCM Clock Driver"
+         depends on SOC_IMX6Q || COMPILE_TEST
+         default SOC_IMX6Q
+         select MXC_CLK
+
+config CLK_IMX6SL
+         bool "IMX6SL CCM Clock Driver"
+         depends on SOC_IMX6SL || COMPILE_TEST
+         default SOC_IMX6SL
+         select MXC_CLK
+
+config CLK_IMX6SLL
+         bool "IMX6SLL CCM Clock Driver"
+         depends on SOC_IMX6SLL || COMPILE_TEST
+         default SOC_IMX6SLL
+         select MXC_CLK
+
+config CLK_IMX6SX
+         bool "IMX6SX CCM Clock Driver"
+         depends on SOC_IMX6SX || COMPILE_TEST
+         default SOC_IMX6SX
+         select MXC_CLK
+
+config CLK_IMX6UL
+         bool "IMX6UL CCM Clock Driver"
+         depends on SOC_IMX6UL || COMPILE_TEST
+         default SOC_IMX6UL
+         select MXC_CLK
+
+config CLK_IMX7D
+         bool "IMX7D CCM Clock Driver"
+         depends on SOC_IMX7D || COMPILE_TEST
+         default SOC_IMX7D
+         select MXC_CLK
+
+config CLK_IMX7ULP
+         bool "IMX7ULP Clock Driver"
+         depends on SOC_IMX7ULP || COMPILE_TEST
+         default SOC_IMX7ULP
+         select MXC_CLK
+
+config CLK_VF610
+         bool "VF610 Clock Driver"
+         depends on SOC_VF610 || COMPILE_TEST
+         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 928f874..394ade7 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


_______________________________________________
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] 52+ messages in thread

* [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
  2020-07-02  2:14 ` Anson Huang
@ 2020-07-02  2:14   ` Anson Huang
  -1 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  2:14 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam, peng.fan,
	arnd, abel.vesa, aisheng.dong, fugang.duan, daniel.baluta,
	yuehaibing, sfr, 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 V3:
	- ONLY include __setup_param() build for built-in, module build no need
	  to have it.
---
 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              | 22 +++++++++++++++------
 9 files changed, 57 insertions(+), 28 deletions(-)

diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
index 09fc8ad..f6ddf76 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
@@ -101,24 +101,28 @@ config CLK_VF610
 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 394ade7..17f5d12 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..6f2a94d 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.
@@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)
 static int imx_keep_uart_clocks;
 static struct clk ** const *imx_uart_clocks;
 
-static int __init imx_keep_uart_clocks_param(char *str)
+static int __maybe_unused imx_keep_uart_clocks_param(char *str)
 {
 	imx_keep_uart_clocks = 1;
 
 	return 0;
 }
+#ifndef MODULE
 __setup_param("earlycon", imx_keep_uart_earlycon,
 	      imx_keep_uart_clocks_param, 0);
 __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
 	      imx_keep_uart_clocks_param, 0);
+#endif
 
 void imx_register_uart_clocks(struct clk ** const clks[])
 {
@@ -164,8 +171,9 @@ void imx_register_uart_clocks(struct clk ** const clks[])
 			clk_prepare_enable(*imx_uart_clocks[i]);
 	}
 }
+EXPORT_SYMBOL_GPL(imx_register_uart_clocks);
 
-static int __init imx_clk_disable_uart(void)
+static int imx_clk_disable_uart(void)
 {
 	if (imx_keep_uart_clocks && imx_uart_clocks) {
 		int i;
@@ -177,3 +185,5 @@ static int __init imx_clk_disable_uart(void)
 	return 0;
 }
 late_initcall_sync(imx_clk_disable_uart);
+
+MODULE_LICENSE("GPL v2");
-- 
2.7.4


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

* [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
@ 2020-07-02  2:14   ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  2:14 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam, peng.fan,
	arnd, abel.vesa, aisheng.dong, fugang.duan, daniel.baluta,
	yuehaibing, sfr, 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 V3:
	- ONLY include __setup_param() build for built-in, module build no need
	  to have it.
---
 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              | 22 +++++++++++++++------
 9 files changed, 57 insertions(+), 28 deletions(-)

diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
index 09fc8ad..f6ddf76 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
@@ -101,24 +101,28 @@ config CLK_VF610
 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 394ade7..17f5d12 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..6f2a94d 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.
@@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)
 static int imx_keep_uart_clocks;
 static struct clk ** const *imx_uart_clocks;
 
-static int __init imx_keep_uart_clocks_param(char *str)
+static int __maybe_unused imx_keep_uart_clocks_param(char *str)
 {
 	imx_keep_uart_clocks = 1;
 
 	return 0;
 }
+#ifndef MODULE
 __setup_param("earlycon", imx_keep_uart_earlycon,
 	      imx_keep_uart_clocks_param, 0);
 __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
 	      imx_keep_uart_clocks_param, 0);
+#endif
 
 void imx_register_uart_clocks(struct clk ** const clks[])
 {
@@ -164,8 +171,9 @@ void imx_register_uart_clocks(struct clk ** const clks[])
 			clk_prepare_enable(*imx_uart_clocks[i]);
 	}
 }
+EXPORT_SYMBOL_GPL(imx_register_uart_clocks);
 
-static int __init imx_clk_disable_uart(void)
+static int imx_clk_disable_uart(void)
 {
 	if (imx_keep_uart_clocks && imx_uart_clocks) {
 		int i;
@@ -177,3 +185,5 @@ static int __init imx_clk_disable_uart(void)
 	return 0;
 }
 late_initcall_sync(imx_clk_disable_uart);
+
+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] 52+ messages in thread

* [PATCH V4 4/5] clk: imx8m: Support module build
  2020-07-02  2:14 ` Anson Huang
@ 2020-07-02  2:14   ` Anson Huang
  -1 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  2:14 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam, peng.fan,
	arnd, abel.vesa, aisheng.dong, fugang.duan, daniel.baluta,
	yuehaibing, sfr, 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>
---
Changes since V3:
	- add module author/description, and merge all i.MX8M SoCs patch into
	  one patch.
---
 drivers/clk/imx/Kconfig      | 8 ++++----
 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, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
index f6ddf76..1867111 100644
--- a/drivers/clk/imx/Kconfig
+++ b/drivers/clk/imx/Kconfig
@@ -99,28 +99,28 @@ config CLK_VF610
          select MXC_CLK
 
 config CLK_IMX8MM
-	bool "IMX8MM CCM Clock Driver"
+	tristate "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"
+	tristate "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"
+	tristate "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"
+	tristate "IMX8MQ CCM Clock Driver"
 	depends on ARCH_MXC
 	select MXC_CLK
 	help
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] 52+ messages in thread

* [PATCH V4 4/5] clk: imx8m: Support module build
@ 2020-07-02  2:14   ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  2:14 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam, peng.fan,
	arnd, abel.vesa, aisheng.dong, fugang.duan, daniel.baluta,
	yuehaibing, sfr, 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>
---
Changes since V3:
	- add module author/description, and merge all i.MX8M SoCs patch into
	  one patch.
---
 drivers/clk/imx/Kconfig      | 8 ++++----
 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, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
index f6ddf76..1867111 100644
--- a/drivers/clk/imx/Kconfig
+++ b/drivers/clk/imx/Kconfig
@@ -99,28 +99,28 @@ config CLK_VF610
          select MXC_CLK
 
 config CLK_IMX8MM
-	bool "IMX8MM CCM Clock Driver"
+	tristate "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"
+	tristate "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"
+	tristate "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"
+	tristate "IMX8MQ CCM Clock Driver"
 	depends on ARCH_MXC
 	select MXC_CLK
 	help
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


_______________________________________________
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] 52+ messages in thread

* [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock driver as module
  2020-07-02  2:14 ` Anson Huang
@ 2020-07-02  2:14   ` Anson Huang
  -1 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  2:14 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam, peng.fan,
	arnd, abel.vesa, aisheng.dong, fugang.duan, daniel.baluta,
	yuehaibing, sfr, linux-clk, linux-kernel, linux-arm-kernel
  Cc: Linux-imx

Change configuration to "tristate", use device_initcall() instead
of builtin_platform_driver(), 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 V3:
	- use device_initcall() instead of builtin_platform_driver();
	- add module author/description;
	- link common scu/lpcg clock driver to i.MX8QXP clock driver, then
	  no need to have exports.
---
 drivers/clk/imx/Kconfig            |  6 +++---
 drivers/clk/imx/Makefile           |  9 ++++-----
 drivers/clk/imx/clk-imx8qxp-lpcg.c | 10 +++++++++-
 drivers/clk/imx/clk-imx8qxp.c      | 11 ++++++++++-
 4 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
index 1867111..8340dfe 100644
--- a/drivers/clk/imx/Kconfig
+++ b/drivers/clk/imx/Kconfig
@@ -5,8 +5,8 @@ config MXC_CLK
 	depends on ARCH_MXC
 
 config MXC_CLK_SCU
-	bool
-	depends on IMX_SCU
+	tristate "IMX SCU clock"
+	depends on ARCH_MXC && IMX_SCU
 
 config CLK_IMX1
          bool "IMX1 CCM Clock Driver"
@@ -127,7 +127,7 @@ config CLK_IMX8MQ
 	    Build the driver for i.MX8MQ CCM Clock Driver
 
 config CLK_IMX8QXP
-	bool "IMX8QXP SCU Clock"
+	tristate "IMX8QXP SCU Clock"
 	depends on ARCH_MXC && IMX_SCU && ARM64
 	select MXC_CLK_SCU
 	help
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..5b6648e 100644
--- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
+++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
@@ -231,4 +231,12 @@ static struct platform_driver imx8qxp_lpcg_clk_driver = {
 	.probe = imx8qxp_lpcg_clk_probe,
 };
 
-builtin_platform_driver(imx8qxp_lpcg_clk_driver);
+static int __init imx8qxp_lpcg_clk_init(void)
+{
+	return platform_driver_register(&imx8qxp_lpcg_clk_driver);
+}
+device_initcall(imx8qxp_lpcg_clk_init);
+
+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..9bcf0d1 100644
--- a/drivers/clk/imx/clk-imx8qxp.c
+++ b/drivers/clk/imx/clk-imx8qxp.c
@@ -151,4 +151,13 @@ static struct platform_driver imx8qxp_clk_driver = {
 	},
 	.probe = imx8qxp_clk_probe,
 };
-builtin_platform_driver(imx8qxp_clk_driver);
+
+static int __init imx8qxp_clk_init(void)
+{
+	return platform_driver_register(&imx8qxp_clk_driver);
+}
+device_initcall(imx8qxp_clk_init);
+
+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] 52+ messages in thread

* [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock driver as module
@ 2020-07-02  2:14   ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  2:14 UTC (permalink / raw)
  To: mturquette, sboyd, shawnguo, s.hauer, kernel, festevam, peng.fan,
	arnd, abel.vesa, aisheng.dong, fugang.duan, daniel.baluta,
	yuehaibing, sfr, linux-clk, linux-kernel, linux-arm-kernel
  Cc: Linux-imx

Change configuration to "tristate", use device_initcall() instead
of builtin_platform_driver(), 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 V3:
	- use device_initcall() instead of builtin_platform_driver();
	- add module author/description;
	- link common scu/lpcg clock driver to i.MX8QXP clock driver, then
	  no need to have exports.
---
 drivers/clk/imx/Kconfig            |  6 +++---
 drivers/clk/imx/Makefile           |  9 ++++-----
 drivers/clk/imx/clk-imx8qxp-lpcg.c | 10 +++++++++-
 drivers/clk/imx/clk-imx8qxp.c      | 11 ++++++++++-
 4 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
index 1867111..8340dfe 100644
--- a/drivers/clk/imx/Kconfig
+++ b/drivers/clk/imx/Kconfig
@@ -5,8 +5,8 @@ config MXC_CLK
 	depends on ARCH_MXC
 
 config MXC_CLK_SCU
-	bool
-	depends on IMX_SCU
+	tristate "IMX SCU clock"
+	depends on ARCH_MXC && IMX_SCU
 
 config CLK_IMX1
          bool "IMX1 CCM Clock Driver"
@@ -127,7 +127,7 @@ config CLK_IMX8MQ
 	    Build the driver for i.MX8MQ CCM Clock Driver
 
 config CLK_IMX8QXP
-	bool "IMX8QXP SCU Clock"
+	tristate "IMX8QXP SCU Clock"
 	depends on ARCH_MXC && IMX_SCU && ARM64
 	select MXC_CLK_SCU
 	help
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..5b6648e 100644
--- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
+++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
@@ -231,4 +231,12 @@ static struct platform_driver imx8qxp_lpcg_clk_driver = {
 	.probe = imx8qxp_lpcg_clk_probe,
 };
 
-builtin_platform_driver(imx8qxp_lpcg_clk_driver);
+static int __init imx8qxp_lpcg_clk_init(void)
+{
+	return platform_driver_register(&imx8qxp_lpcg_clk_driver);
+}
+device_initcall(imx8qxp_lpcg_clk_init);
+
+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..9bcf0d1 100644
--- a/drivers/clk/imx/clk-imx8qxp.c
+++ b/drivers/clk/imx/clk-imx8qxp.c
@@ -151,4 +151,13 @@ static struct platform_driver imx8qxp_clk_driver = {
 	},
 	.probe = imx8qxp_clk_probe,
 };
-builtin_platform_driver(imx8qxp_clk_driver);
+
+static int __init imx8qxp_clk_init(void)
+{
+	return platform_driver_register(&imx8qxp_clk_driver);
+}
+device_initcall(imx8qxp_clk_init);
+
+MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>");
+MODULE_DESCRIPTION("NXP i.MX8QXP clock 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] 52+ messages in thread

* RE: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
  2020-07-02  2:14   ` Anson Huang
@ 2020-07-02  2:38     ` Aisheng Dong
  -1 siblings, 0 replies; 52+ messages in thread
From: Aisheng Dong @ 2020-07-02  2:38 UTC (permalink / raw)
  To: Anson Huang, mturquette, sboyd, shawnguo, s.hauer, kernel,
	festevam, Peng Fan, arnd, Abel Vesa, Andy Duan, Daniel Baluta,
	yuehaibing, sfr, linux-clk, linux-kernel, linux-arm-kernel
  Cc: dl-linux-imx

> From: Anson Huang <Anson.Huang@nxp.com>
> Sent: Thursday, July 2, 2020 10:15 AM
> 
> 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.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>

Regards
Aisheng

> ---
> Changes since V3:
> 	- Add clock configuration for each ARMv7.
> ---
>  drivers/clk/imx/Kconfig  | 90
> ++++++++++++++++++++++++++++++++++++++++++++++++
>  drivers/clk/imx/Makefile | 30 ++++++++--------
>  2 files changed, 105 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig index
> db0253f..09fc8ad 100644
> --- a/drivers/clk/imx/Kconfig
> +++ b/drivers/clk/imx/Kconfig
> @@ -8,6 +8,96 @@ config MXC_CLK_SCU
>  	bool
>  	depends on IMX_SCU
> 
> +config CLK_IMX1
> +         bool "IMX1 CCM Clock Driver"
> +         depends on SOC_IMX1 || COMPILE_TEST
> +         default SOC_IMX1
> +         select MXC_CLK
> +
> +config CLK_IMX21
> +         bool "IMX21 CCM Clock Driver"
> +         depends on SOC_IMX21 || COMPILE_TEST
> +         default SOC_IMX21
> +         select MXC_CLK
> +
> +config CLK_IMX25
> +         bool "IMX25 CCM Clock Driver"
> +         depends on SOC_IMX25 || COMPILE_TEST
> +         default SOC_IMX25
> +         select MXC_CLK
> +
> +config CLK_IMX27
> +         bool "IMX27 CCM Clock Driver"
> +         depends on SOC_IMX27 || COMPILE_TEST
> +         default SOC_IMX27
> +         select MXC_CLK
> +
> +config CLK_IMX31
> +         bool "IMX31 CCM Clock Driver"
> +         depends on SOC_IMX31 || COMPILE_TEST
> +         default SOC_IMX31
> +         select MXC_CLK
> +
> +config CLK_IMX35
> +         bool "IMX35 CCM Clock Driver"
> +         depends on SOC_IMX35 || COMPILE_TEST
> +         default SOC_IMX35
> +         select MXC_CLK
> +
> +config CLK_IMX5
> +         bool "IMX5 CCM Clock Driver"
> +         depends on SOC_IMX5 || COMPILE_TEST
> +         default SOC_IMX5
> +         select MXC_CLK
> +
> +config CLK_IMX6Q
> +         bool "IMX6Q CCM Clock Driver"
> +         depends on SOC_IMX6Q || COMPILE_TEST
> +         default SOC_IMX6Q
> +         select MXC_CLK
> +
> +config CLK_IMX6SL
> +         bool "IMX6SL CCM Clock Driver"
> +         depends on SOC_IMX6SL || COMPILE_TEST
> +         default SOC_IMX6SL
> +         select MXC_CLK
> +
> +config CLK_IMX6SLL
> +         bool "IMX6SLL CCM Clock Driver"
> +         depends on SOC_IMX6SLL || COMPILE_TEST
> +         default SOC_IMX6SLL
> +         select MXC_CLK
> +
> +config CLK_IMX6SX
> +         bool "IMX6SX CCM Clock Driver"
> +         depends on SOC_IMX6SX || COMPILE_TEST
> +         default SOC_IMX6SX
> +         select MXC_CLK
> +
> +config CLK_IMX6UL
> +         bool "IMX6UL CCM Clock Driver"
> +         depends on SOC_IMX6UL || COMPILE_TEST
> +         default SOC_IMX6UL
> +         select MXC_CLK
> +
> +config CLK_IMX7D
> +         bool "IMX7D CCM Clock Driver"
> +         depends on SOC_IMX7D || COMPILE_TEST
> +         default SOC_IMX7D
> +         select MXC_CLK
> +
> +config CLK_IMX7ULP
> +         bool "IMX7ULP Clock Driver"
> +         depends on SOC_IMX7ULP || COMPILE_TEST
> +         default SOC_IMX7ULP
> +         select MXC_CLK
> +
> +config CLK_VF610
> +         bool "VF610 Clock Driver"
> +         depends on SOC_VF610 || COMPILE_TEST
> +         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
> 928f874..394ade7 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	[flat|nested] 52+ messages in thread

* RE: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
@ 2020-07-02  2:38     ` Aisheng Dong
  0 siblings, 0 replies; 52+ messages in thread
From: Aisheng Dong @ 2020-07-02  2:38 UTC (permalink / raw)
  To: Anson Huang, mturquette, sboyd, shawnguo, s.hauer, kernel,
	festevam, Peng Fan, arnd, Abel Vesa, Andy Duan, Daniel Baluta,
	yuehaibing, sfr, linux-clk, linux-kernel, linux-arm-kernel
  Cc: dl-linux-imx

> From: Anson Huang <Anson.Huang@nxp.com>
> Sent: Thursday, July 2, 2020 10:15 AM
> 
> 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.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>

Regards
Aisheng

> ---
> Changes since V3:
> 	- Add clock configuration for each ARMv7.
> ---
>  drivers/clk/imx/Kconfig  | 90
> ++++++++++++++++++++++++++++++++++++++++++++++++
>  drivers/clk/imx/Makefile | 30 ++++++++--------
>  2 files changed, 105 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig index
> db0253f..09fc8ad 100644
> --- a/drivers/clk/imx/Kconfig
> +++ b/drivers/clk/imx/Kconfig
> @@ -8,6 +8,96 @@ config MXC_CLK_SCU
>  	bool
>  	depends on IMX_SCU
> 
> +config CLK_IMX1
> +         bool "IMX1 CCM Clock Driver"
> +         depends on SOC_IMX1 || COMPILE_TEST
> +         default SOC_IMX1
> +         select MXC_CLK
> +
> +config CLK_IMX21
> +         bool "IMX21 CCM Clock Driver"
> +         depends on SOC_IMX21 || COMPILE_TEST
> +         default SOC_IMX21
> +         select MXC_CLK
> +
> +config CLK_IMX25
> +         bool "IMX25 CCM Clock Driver"
> +         depends on SOC_IMX25 || COMPILE_TEST
> +         default SOC_IMX25
> +         select MXC_CLK
> +
> +config CLK_IMX27
> +         bool "IMX27 CCM Clock Driver"
> +         depends on SOC_IMX27 || COMPILE_TEST
> +         default SOC_IMX27
> +         select MXC_CLK
> +
> +config CLK_IMX31
> +         bool "IMX31 CCM Clock Driver"
> +         depends on SOC_IMX31 || COMPILE_TEST
> +         default SOC_IMX31
> +         select MXC_CLK
> +
> +config CLK_IMX35
> +         bool "IMX35 CCM Clock Driver"
> +         depends on SOC_IMX35 || COMPILE_TEST
> +         default SOC_IMX35
> +         select MXC_CLK
> +
> +config CLK_IMX5
> +         bool "IMX5 CCM Clock Driver"
> +         depends on SOC_IMX5 || COMPILE_TEST
> +         default SOC_IMX5
> +         select MXC_CLK
> +
> +config CLK_IMX6Q
> +         bool "IMX6Q CCM Clock Driver"
> +         depends on SOC_IMX6Q || COMPILE_TEST
> +         default SOC_IMX6Q
> +         select MXC_CLK
> +
> +config CLK_IMX6SL
> +         bool "IMX6SL CCM Clock Driver"
> +         depends on SOC_IMX6SL || COMPILE_TEST
> +         default SOC_IMX6SL
> +         select MXC_CLK
> +
> +config CLK_IMX6SLL
> +         bool "IMX6SLL CCM Clock Driver"
> +         depends on SOC_IMX6SLL || COMPILE_TEST
> +         default SOC_IMX6SLL
> +         select MXC_CLK
> +
> +config CLK_IMX6SX
> +         bool "IMX6SX CCM Clock Driver"
> +         depends on SOC_IMX6SX || COMPILE_TEST
> +         default SOC_IMX6SX
> +         select MXC_CLK
> +
> +config CLK_IMX6UL
> +         bool "IMX6UL CCM Clock Driver"
> +         depends on SOC_IMX6UL || COMPILE_TEST
> +         default SOC_IMX6UL
> +         select MXC_CLK
> +
> +config CLK_IMX7D
> +         bool "IMX7D CCM Clock Driver"
> +         depends on SOC_IMX7D || COMPILE_TEST
> +         default SOC_IMX7D
> +         select MXC_CLK
> +
> +config CLK_IMX7ULP
> +         bool "IMX7ULP Clock Driver"
> +         depends on SOC_IMX7ULP || COMPILE_TEST
> +         default SOC_IMX7ULP
> +         select MXC_CLK
> +
> +config CLK_VF610
> +         bool "VF610 Clock Driver"
> +         depends on SOC_VF610 || COMPILE_TEST
> +         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
> 928f874..394ade7 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

_______________________________________________
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] 52+ messages in thread

* Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
  2020-07-02  2:14   ` Anson Huang
@ 2020-07-02  2:50     ` Dong Aisheng
  -1 siblings, 0 replies; 52+ messages in thread
From: Dong Aisheng @ 2020-07-02  2:50 UTC (permalink / raw)
  To: Anson Huang
  Cc: Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
	Sascha Hauer, Fabio Estevam, Peng Fan, Arnd Bergmann, Abel Vesa,
	Dong Aisheng, Fugang Duan, Daniel Baluta, YueHaibing,
	Stephen Rothwell, linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx

On Thu, Jul 2, 2020 at 10:19 AM Anson Huang <Anson.Huang@nxp.com> wrote:
>
> 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 V3:
>         - ONLY include __setup_param() build for built-in, module build no need
>           to have it.
> ---
>  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              | 22 +++++++++++++++------
>  9 files changed, 57 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
> index 09fc8ad..f6ddf76 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
> @@ -101,24 +101,28 @@ config CLK_VF610
>  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 394ade7..17f5d12 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..6f2a94d 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.
> @@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)
>  static int imx_keep_uart_clocks;
>  static struct clk ** const *imx_uart_clocks;
>
> -static int __init imx_keep_uart_clocks_param(char *str)
> +static int __maybe_unused imx_keep_uart_clocks_param(char *str)
>  {
>         imx_keep_uart_clocks = 1;
>
>         return 0;
>  }
> +#ifndef MODULE
>  __setup_param("earlycon", imx_keep_uart_earlycon,
>               imx_keep_uart_clocks_param, 0);
>  __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
>               imx_keep_uart_clocks_param, 0);

I feel not only the __setup_param, the whole logic of keep_uart_clocks
are not needed for Module case. Is it true?

Regards
Aisheng

> +#endif
>
>  void imx_register_uart_clocks(struct clk ** const clks[])
>  {
> @@ -164,8 +171,9 @@ void imx_register_uart_clocks(struct clk ** const clks[])
>                         clk_prepare_enable(*imx_uart_clocks[i]);
>         }
>  }
> +EXPORT_SYMBOL_GPL(imx_register_uart_clocks);
>
> -static int __init imx_clk_disable_uart(void)
> +static int imx_clk_disable_uart(void)
>  {
>         if (imx_keep_uart_clocks && imx_uart_clocks) {
>                 int i;
> @@ -177,3 +185,5 @@ static int __init imx_clk_disable_uart(void)
>         return 0;
>  }
>  late_initcall_sync(imx_clk_disable_uart);
> +
> +MODULE_LICENSE("GPL v2");
> --
> 2.7.4
>

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

* Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
@ 2020-07-02  2:50     ` Dong Aisheng
  0 siblings, 0 replies; 52+ messages in thread
From: Dong Aisheng @ 2020-07-02  2:50 UTC (permalink / raw)
  To: Anson Huang
  Cc: Dong Aisheng, Stephen Rothwell, Peng Fan, Fugang Duan, Abel Vesa,
	Arnd Bergmann, Stephen Boyd, Shawn Guo, Michael Turquette,
	YueHaibing, open list, Daniel Baluta, linux-clk, dl-linux-imx,
	Sascha Hauer, Fabio Estevam, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

On Thu, Jul 2, 2020 at 10:19 AM Anson Huang <Anson.Huang@nxp.com> wrote:
>
> 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 V3:
>         - ONLY include __setup_param() build for built-in, module build no need
>           to have it.
> ---
>  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              | 22 +++++++++++++++------
>  9 files changed, 57 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
> index 09fc8ad..f6ddf76 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
> @@ -101,24 +101,28 @@ config CLK_VF610
>  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 394ade7..17f5d12 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..6f2a94d 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.
> @@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)
>  static int imx_keep_uart_clocks;
>  static struct clk ** const *imx_uart_clocks;
>
> -static int __init imx_keep_uart_clocks_param(char *str)
> +static int __maybe_unused imx_keep_uart_clocks_param(char *str)
>  {
>         imx_keep_uart_clocks = 1;
>
>         return 0;
>  }
> +#ifndef MODULE
>  __setup_param("earlycon", imx_keep_uart_earlycon,
>               imx_keep_uart_clocks_param, 0);
>  __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
>               imx_keep_uart_clocks_param, 0);

I feel not only the __setup_param, the whole logic of keep_uart_clocks
are not needed for Module case. Is it true?

Regards
Aisheng

> +#endif
>
>  void imx_register_uart_clocks(struct clk ** const clks[])
>  {
> @@ -164,8 +171,9 @@ void imx_register_uart_clocks(struct clk ** const clks[])
>                         clk_prepare_enable(*imx_uart_clocks[i]);
>         }
>  }
> +EXPORT_SYMBOL_GPL(imx_register_uart_clocks);
>
> -static int __init imx_clk_disable_uart(void)
> +static int imx_clk_disable_uart(void)
>  {
>         if (imx_keep_uart_clocks && imx_uart_clocks) {
>                 int i;
> @@ -177,3 +185,5 @@ static int __init imx_clk_disable_uart(void)
>         return 0;
>  }
>  late_initcall_sync(imx_clk_disable_uart);
> +
> +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	[flat|nested] 52+ messages in thread

* Re: [PATCH V4 4/5] clk: imx8m: Support module build
  2020-07-02  2:14   ` Anson Huang
@ 2020-07-02  2:51     ` Dong Aisheng
  -1 siblings, 0 replies; 52+ messages in thread
From: Dong Aisheng @ 2020-07-02  2:51 UTC (permalink / raw)
  To: Anson Huang
  Cc: Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
	Sascha Hauer, Fabio Estevam, Peng Fan, Arnd Bergmann, Abel Vesa,
	Dong Aisheng, Fugang Duan, Daniel Baluta, YueHaibing,
	Stephen Rothwell, linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx

On Thu, Jul 2, 2020 at 10:18 AM Anson Huang <Anson.Huang@nxp.com> wrote:
>
> 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>

Regards
Aisheng

> ---
> Changes since V3:
>         - add module author/description, and merge all i.MX8M SoCs patch into
>           one patch.
> ---
>  drivers/clk/imx/Kconfig      | 8 ++++----
>  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, 20 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
> index f6ddf76..1867111 100644
> --- a/drivers/clk/imx/Kconfig
> +++ b/drivers/clk/imx/Kconfig
> @@ -99,28 +99,28 @@ config CLK_VF610
>           select MXC_CLK
>
>  config CLK_IMX8MM
> -       bool "IMX8MM CCM Clock Driver"
> +       tristate "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"
> +       tristate "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"
> +       tristate "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"
> +       tristate "IMX8MQ CCM Clock Driver"
>         depends on ARCH_MXC
>         select MXC_CLK
>         help
> 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	[flat|nested] 52+ messages in thread

* Re: [PATCH V4 4/5] clk: imx8m: Support module build
@ 2020-07-02  2:51     ` Dong Aisheng
  0 siblings, 0 replies; 52+ messages in thread
From: Dong Aisheng @ 2020-07-02  2:51 UTC (permalink / raw)
  To: Anson Huang
  Cc: Dong Aisheng, Stephen Rothwell, Peng Fan, Fugang Duan, Abel Vesa,
	Arnd Bergmann, Stephen Boyd, Shawn Guo, Michael Turquette,
	YueHaibing, open list, Daniel Baluta, linux-clk, dl-linux-imx,
	Sascha Hauer, Fabio Estevam, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

On Thu, Jul 2, 2020 at 10:18 AM Anson Huang <Anson.Huang@nxp.com> wrote:
>
> 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>

Regards
Aisheng

> ---
> Changes since V3:
>         - add module author/description, and merge all i.MX8M SoCs patch into
>           one patch.
> ---
>  drivers/clk/imx/Kconfig      | 8 ++++----
>  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, 20 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
> index f6ddf76..1867111 100644
> --- a/drivers/clk/imx/Kconfig
> +++ b/drivers/clk/imx/Kconfig
> @@ -99,28 +99,28 @@ config CLK_VF610
>           select MXC_CLK
>
>  config CLK_IMX8MM
> -       bool "IMX8MM CCM Clock Driver"
> +       tristate "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"
> +       tristate "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"
> +       tristate "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"
> +       tristate "IMX8MQ CCM Clock Driver"
>         depends on ARCH_MXC
>         select MXC_CLK
>         help
> 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
>

_______________________________________________
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] 52+ messages in thread

* Re: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock driver as module
  2020-07-02  2:14   ` Anson Huang
@ 2020-07-02  3:17     ` Dong Aisheng
  -1 siblings, 0 replies; 52+ messages in thread
From: Dong Aisheng @ 2020-07-02  3:17 UTC (permalink / raw)
  To: Anson Huang
  Cc: Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
	Sascha Hauer, Fabio Estevam, Peng Fan, Arnd Bergmann, Abel Vesa,
	Dong Aisheng, Fugang Duan, Daniel Baluta, YueHaibing,
	Stephen Rothwell, linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx

On Thu, Jul 2, 2020 at 10:20 AM Anson Huang <Anson.Huang@nxp.com> wrote:
>
> Change configuration to "tristate", use device_initcall() instead
> of builtin_platform_driver(), 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 V3:
>         - use device_initcall() instead of builtin_platform_driver();
>         - add module author/description;
>         - link common scu/lpcg clock driver to i.MX8QXP clock driver, then
>           no need to have exports.
> ---
>  drivers/clk/imx/Kconfig            |  6 +++---
>  drivers/clk/imx/Makefile           |  9 ++++-----
>  drivers/clk/imx/clk-imx8qxp-lpcg.c | 10 +++++++++-
>  drivers/clk/imx/clk-imx8qxp.c      | 11 ++++++++++-
>  4 files changed, 26 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
> index 1867111..8340dfe 100644
> --- a/drivers/clk/imx/Kconfig
> +++ b/drivers/clk/imx/Kconfig
> @@ -5,8 +5,8 @@ config MXC_CLK
>         depends on ARCH_MXC
>
>  config MXC_CLK_SCU
> -       bool
> -       depends on IMX_SCU
> +       tristate "IMX SCU clock"
> +       depends on ARCH_MXC && IMX_SCU
>
>  config CLK_IMX1
>           bool "IMX1 CCM Clock Driver"
> @@ -127,7 +127,7 @@ config CLK_IMX8MQ
>             Build the driver for i.MX8MQ CCM Clock Driver
>
>  config CLK_IMX8QXP
> -       bool "IMX8QXP SCU Clock"
> +       tristate "IMX8QXP SCU Clock"
>         depends on ARCH_MXC && IMX_SCU && ARM64
>         select MXC_CLK_SCU
>         help
> 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..5b6648e 100644
> --- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
> +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
> @@ -231,4 +231,12 @@ static struct platform_driver imx8qxp_lpcg_clk_driver = {
>         .probe = imx8qxp_lpcg_clk_probe,
>  };
>
> -builtin_platform_driver(imx8qxp_lpcg_clk_driver);
> +static int __init imx8qxp_lpcg_clk_init(void)

Does __init work for module?

> +{
> +       return platform_driver_register(&imx8qxp_lpcg_clk_driver);
> +}
> +device_initcall(imx8qxp_lpcg_clk_init);

Any reason to change to device_initcall which looks a bit strange?
Is it because the following line?
+obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o
But it looks to me they're still two modules. Aren't they?

Regards
Aisheng

> +
> +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..9bcf0d1 100644
> --- a/drivers/clk/imx/clk-imx8qxp.c
> +++ b/drivers/clk/imx/clk-imx8qxp.c
> @@ -151,4 +151,13 @@ static struct platform_driver imx8qxp_clk_driver = {
>         },
>         .probe = imx8qxp_clk_probe,
>  };
> -builtin_platform_driver(imx8qxp_clk_driver);
> +
> +static int __init imx8qxp_clk_init(void)
> +{
> +       return platform_driver_register(&imx8qxp_clk_driver);
> +}
> +device_initcall(imx8qxp_clk_init);
> +
> +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	[flat|nested] 52+ messages in thread

* Re: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock driver as module
@ 2020-07-02  3:17     ` Dong Aisheng
  0 siblings, 0 replies; 52+ messages in thread
From: Dong Aisheng @ 2020-07-02  3:17 UTC (permalink / raw)
  To: Anson Huang
  Cc: Dong Aisheng, Stephen Rothwell, Peng Fan, Fugang Duan, Abel Vesa,
	Arnd Bergmann, Stephen Boyd, Shawn Guo, Michael Turquette,
	YueHaibing, open list, Daniel Baluta, linux-clk, dl-linux-imx,
	Sascha Hauer, Fabio Estevam, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

On Thu, Jul 2, 2020 at 10:20 AM Anson Huang <Anson.Huang@nxp.com> wrote:
>
> Change configuration to "tristate", use device_initcall() instead
> of builtin_platform_driver(), 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 V3:
>         - use device_initcall() instead of builtin_platform_driver();
>         - add module author/description;
>         - link common scu/lpcg clock driver to i.MX8QXP clock driver, then
>           no need to have exports.
> ---
>  drivers/clk/imx/Kconfig            |  6 +++---
>  drivers/clk/imx/Makefile           |  9 ++++-----
>  drivers/clk/imx/clk-imx8qxp-lpcg.c | 10 +++++++++-
>  drivers/clk/imx/clk-imx8qxp.c      | 11 ++++++++++-
>  4 files changed, 26 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
> index 1867111..8340dfe 100644
> --- a/drivers/clk/imx/Kconfig
> +++ b/drivers/clk/imx/Kconfig
> @@ -5,8 +5,8 @@ config MXC_CLK
>         depends on ARCH_MXC
>
>  config MXC_CLK_SCU
> -       bool
> -       depends on IMX_SCU
> +       tristate "IMX SCU clock"
> +       depends on ARCH_MXC && IMX_SCU
>
>  config CLK_IMX1
>           bool "IMX1 CCM Clock Driver"
> @@ -127,7 +127,7 @@ config CLK_IMX8MQ
>             Build the driver for i.MX8MQ CCM Clock Driver
>
>  config CLK_IMX8QXP
> -       bool "IMX8QXP SCU Clock"
> +       tristate "IMX8QXP SCU Clock"
>         depends on ARCH_MXC && IMX_SCU && ARM64
>         select MXC_CLK_SCU
>         help
> 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..5b6648e 100644
> --- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
> +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
> @@ -231,4 +231,12 @@ static struct platform_driver imx8qxp_lpcg_clk_driver = {
>         .probe = imx8qxp_lpcg_clk_probe,
>  };
>
> -builtin_platform_driver(imx8qxp_lpcg_clk_driver);
> +static int __init imx8qxp_lpcg_clk_init(void)

Does __init work for module?

> +{
> +       return platform_driver_register(&imx8qxp_lpcg_clk_driver);
> +}
> +device_initcall(imx8qxp_lpcg_clk_init);

Any reason to change to device_initcall which looks a bit strange?
Is it because the following line?
+obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o
But it looks to me they're still two modules. Aren't they?

Regards
Aisheng

> +
> +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..9bcf0d1 100644
> --- a/drivers/clk/imx/clk-imx8qxp.c
> +++ b/drivers/clk/imx/clk-imx8qxp.c
> @@ -151,4 +151,13 @@ static struct platform_driver imx8qxp_clk_driver = {
>         },
>         .probe = imx8qxp_clk_probe,
>  };
> -builtin_platform_driver(imx8qxp_clk_driver);
> +
> +static int __init imx8qxp_clk_init(void)
> +{
> +       return platform_driver_register(&imx8qxp_clk_driver);
> +}
> +device_initcall(imx8qxp_clk_init);
> +
> +MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>");
> +MODULE_DESCRIPTION("NXP i.MX8QXP clock 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	[flat|nested] 52+ messages in thread

* RE: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
  2020-07-02  2:50     ` Dong Aisheng
@ 2020-07-02  3:26       ` Anson Huang
  -1 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  3:26 UTC (permalink / raw)
  To: Dong Aisheng
  Cc: Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
	Sascha Hauer, Fabio Estevam, Peng Fan, Arnd Bergmann, Abel Vesa,
	Aisheng Dong, Andy Duan, Daniel Baluta, YueHaibing,
	Stephen Rothwell, linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx


> Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock
> driver as module
> 
> On Thu, Jul 2, 2020 at 10:19 AM Anson Huang <Anson.Huang@nxp.com>
> wrote:
> >
> > 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 V3:
> >         - ONLY include __setup_param() build for built-in, module build no
> need
> >           to have it.
> > ---
> >  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              | 22 +++++++++++++++------
> >  9 files changed, 57 insertions(+), 28 deletions(-)
> >
> > diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig index
> > 09fc8ad..f6ddf76 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
> > @@ -101,24 +101,28 @@ config CLK_VF610  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
> > 394ade7..17f5d12 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..6f2a94d 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.
> > @@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)
> >  static int imx_keep_uart_clocks;
> >  static struct clk ** const *imx_uart_clocks;
> >
> > -static int __init imx_keep_uart_clocks_param(char *str)
> > +static int __maybe_unused imx_keep_uart_clocks_param(char *str)
> >  {
> >         imx_keep_uart_clocks = 1;
> >
> >         return 0;
> >  }
> > +#ifndef MODULE
> >  __setup_param("earlycon", imx_keep_uart_earlycon,
> >               imx_keep_uart_clocks_param, 0);
> >  __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
> >               imx_keep_uart_clocks_param, 0);
> 
> I feel not only the __setup_param, the whole logic of keep_uart_clocks
> are not needed for Module case. Is it true?

Yes, but the 'keep_uart_clocks' is false by default and the function imx_keep_uart_clocks_param()
already has '__maybe_unused', it does NOT impact anything if it is for module build, so I did NOT
add the #ifndef check for them, just to keep code easy and clean.

Thanks,
Anson


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

* RE: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
@ 2020-07-02  3:26       ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  3:26 UTC (permalink / raw)
  To: Dong Aisheng
  Cc: Aisheng Dong, Stephen Rothwell, Peng Fan, Andy Duan, Abel Vesa,
	Arnd Bergmann, Stephen Boyd, Shawn Guo, Michael Turquette,
	YueHaibing, open list, Daniel Baluta, linux-clk, dl-linux-imx,
	Sascha Hauer, Fabio Estevam, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE


> Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock
> driver as module
> 
> On Thu, Jul 2, 2020 at 10:19 AM Anson Huang <Anson.Huang@nxp.com>
> wrote:
> >
> > 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 V3:
> >         - ONLY include __setup_param() build for built-in, module build no
> need
> >           to have it.
> > ---
> >  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              | 22 +++++++++++++++------
> >  9 files changed, 57 insertions(+), 28 deletions(-)
> >
> > diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig index
> > 09fc8ad..f6ddf76 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
> > @@ -101,24 +101,28 @@ config CLK_VF610  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
> > 394ade7..17f5d12 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..6f2a94d 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.
> > @@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)
> >  static int imx_keep_uart_clocks;
> >  static struct clk ** const *imx_uart_clocks;
> >
> > -static int __init imx_keep_uart_clocks_param(char *str)
> > +static int __maybe_unused imx_keep_uart_clocks_param(char *str)
> >  {
> >         imx_keep_uart_clocks = 1;
> >
> >         return 0;
> >  }
> > +#ifndef MODULE
> >  __setup_param("earlycon", imx_keep_uart_earlycon,
> >               imx_keep_uart_clocks_param, 0);
> >  __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
> >               imx_keep_uart_clocks_param, 0);
> 
> I feel not only the __setup_param, the whole logic of keep_uart_clocks
> are not needed for Module case. Is it true?

Yes, but the 'keep_uart_clocks' is false by default and the function imx_keep_uart_clocks_param()
already has '__maybe_unused', it does NOT impact anything if it is for module build, so I did NOT
add the #ifndef check for them, just to keep code easy and clean.

Thanks,
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] 52+ messages in thread

* RE: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock driver as module
  2020-07-02  3:17     ` Dong Aisheng
@ 2020-07-02  3:55       ` Anson Huang
  -1 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  3:55 UTC (permalink / raw)
  To: Dong Aisheng
  Cc: Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
	Sascha Hauer, Fabio Estevam, Peng Fan, Arnd Bergmann, Abel Vesa,
	Aisheng Dong, Andy Duan, Daniel Baluta, YueHaibing,
	Stephen Rothwell, linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx



> Subject: Re: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock
> driver as module
> 
> On Thu, Jul 2, 2020 at 10:20 AM Anson Huang <Anson.Huang@nxp.com>
> wrote:
> >
> > Change configuration to "tristate", use device_initcall() instead of
> > builtin_platform_driver(), 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 V3:
> >         - use device_initcall() instead of builtin_platform_driver();
> >         - add module author/description;
> >         - link common scu/lpcg clock driver to i.MX8QXP clock driver, then
> >           no need to have exports.
> > ---
> >  drivers/clk/imx/Kconfig            |  6 +++---
> >  drivers/clk/imx/Makefile           |  9 ++++-----
> >  drivers/clk/imx/clk-imx8qxp-lpcg.c | 10 +++++++++-
> >  drivers/clk/imx/clk-imx8qxp.c      | 11 ++++++++++-
> >  4 files changed, 26 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig index
> > 1867111..8340dfe 100644
> > --- a/drivers/clk/imx/Kconfig
> > +++ b/drivers/clk/imx/Kconfig
> > @@ -5,8 +5,8 @@ config MXC_CLK
> >         depends on ARCH_MXC
> >
> >  config MXC_CLK_SCU
> > -       bool
> > -       depends on IMX_SCU
> > +       tristate "IMX SCU clock"
> > +       depends on ARCH_MXC && IMX_SCU
> >
> >  config CLK_IMX1
> >           bool "IMX1 CCM Clock Driver"
> > @@ -127,7 +127,7 @@ config CLK_IMX8MQ
> >             Build the driver for i.MX8MQ CCM Clock Driver
> >
> >  config CLK_IMX8QXP
> > -       bool "IMX8QXP SCU Clock"
> > +       tristate "IMX8QXP SCU Clock"
> >         depends on ARCH_MXC && IMX_SCU && ARM64
> >         select MXC_CLK_SCU
> >         help
> > 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..5b6648e 100644
> > --- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
> > +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
> > @@ -231,4 +231,12 @@ static struct platform_driver
> imx8qxp_lpcg_clk_driver = {
> >         .probe = imx8qxp_lpcg_clk_probe,  };
> >
> > -builtin_platform_driver(imx8qxp_lpcg_clk_driver);
> > +static int __init imx8qxp_lpcg_clk_init(void)
> 
> Does __init work for module?

__init is NOT working/necessary for module, but if the driver is built-in, it is better to
have it, checked other drivers which support module build, they all have it, so I think
it is better to keep it especially when the driver supports both built-in and loadable module.

drivers/clk/qcom/gcc-sdm845.c
drivers/clk/qcom/gcc-msm8939.c

> 
> > +{
> > +       return platform_driver_register(&imx8qxp_lpcg_clk_driver);
> > +}
> > +device_initcall(imx8qxp_lpcg_clk_init);
> 
> Any reason to change to device_initcall which looks a bit strange?
> Is it because the following line?
> +obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o
> But it looks to me they're still two modules. Aren't they?

It is suggested by Arnd to NOT use builtin_platform_driver(), in order to support module
unload, although the clock driver normally does NOT support remove, but it is better to
follow the right way.

The change in Makefile is just to link scu/lpcg library to i.MX8QXP clk driver, so that we can
get rid of exports and below 2 .ko are needed for all i.MX SoCs with SCU inside as per your
saying of i.MX8QXP clock driver can be extended for future SoCs with SCU.

clk-imx-lpcg-scu.ko
clk-imx-scu.ko 

Thanks,
Anson

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

* RE: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock driver as module
@ 2020-07-02  3:55       ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  3:55 UTC (permalink / raw)
  To: Dong Aisheng
  Cc: Aisheng Dong, Stephen Rothwell, Peng Fan, Andy Duan, Abel Vesa,
	Arnd Bergmann, Stephen Boyd, Shawn Guo, Michael Turquette,
	YueHaibing, open list, Daniel Baluta, linux-clk, dl-linux-imx,
	Sascha Hauer, Fabio Estevam, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE



> Subject: Re: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock
> driver as module
> 
> On Thu, Jul 2, 2020 at 10:20 AM Anson Huang <Anson.Huang@nxp.com>
> wrote:
> >
> > Change configuration to "tristate", use device_initcall() instead of
> > builtin_platform_driver(), 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 V3:
> >         - use device_initcall() instead of builtin_platform_driver();
> >         - add module author/description;
> >         - link common scu/lpcg clock driver to i.MX8QXP clock driver, then
> >           no need to have exports.
> > ---
> >  drivers/clk/imx/Kconfig            |  6 +++---
> >  drivers/clk/imx/Makefile           |  9 ++++-----
> >  drivers/clk/imx/clk-imx8qxp-lpcg.c | 10 +++++++++-
> >  drivers/clk/imx/clk-imx8qxp.c      | 11 ++++++++++-
> >  4 files changed, 26 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig index
> > 1867111..8340dfe 100644
> > --- a/drivers/clk/imx/Kconfig
> > +++ b/drivers/clk/imx/Kconfig
> > @@ -5,8 +5,8 @@ config MXC_CLK
> >         depends on ARCH_MXC
> >
> >  config MXC_CLK_SCU
> > -       bool
> > -       depends on IMX_SCU
> > +       tristate "IMX SCU clock"
> > +       depends on ARCH_MXC && IMX_SCU
> >
> >  config CLK_IMX1
> >           bool "IMX1 CCM Clock Driver"
> > @@ -127,7 +127,7 @@ config CLK_IMX8MQ
> >             Build the driver for i.MX8MQ CCM Clock Driver
> >
> >  config CLK_IMX8QXP
> > -       bool "IMX8QXP SCU Clock"
> > +       tristate "IMX8QXP SCU Clock"
> >         depends on ARCH_MXC && IMX_SCU && ARM64
> >         select MXC_CLK_SCU
> >         help
> > 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..5b6648e 100644
> > --- a/drivers/clk/imx/clk-imx8qxp-lpcg.c
> > +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c
> > @@ -231,4 +231,12 @@ static struct platform_driver
> imx8qxp_lpcg_clk_driver = {
> >         .probe = imx8qxp_lpcg_clk_probe,  };
> >
> > -builtin_platform_driver(imx8qxp_lpcg_clk_driver);
> > +static int __init imx8qxp_lpcg_clk_init(void)
> 
> Does __init work for module?

__init is NOT working/necessary for module, but if the driver is built-in, it is better to
have it, checked other drivers which support module build, they all have it, so I think
it is better to keep it especially when the driver supports both built-in and loadable module.

drivers/clk/qcom/gcc-sdm845.c
drivers/clk/qcom/gcc-msm8939.c

> 
> > +{
> > +       return platform_driver_register(&imx8qxp_lpcg_clk_driver);
> > +}
> > +device_initcall(imx8qxp_lpcg_clk_init);
> 
> Any reason to change to device_initcall which looks a bit strange?
> Is it because the following line?
> +obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o
> But it looks to me they're still two modules. Aren't they?

It is suggested by Arnd to NOT use builtin_platform_driver(), in order to support module
unload, although the clock driver normally does NOT support remove, but it is better to
follow the right way.

The change in Makefile is just to link scu/lpcg library to i.MX8QXP clk driver, so that we can
get rid of exports and below 2 .ko are needed for all i.MX SoCs with SCU inside as per your
saying of i.MX8QXP clock driver can be extended for future SoCs with SCU.

clk-imx-lpcg-scu.ko
clk-imx-scu.ko 

Thanks,
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] 52+ messages in thread

* Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
  2020-07-02  2:14   ` Anson Huang
  (?)
  (?)
@ 2020-07-02  5:14   ` kernel test robot
  2020-07-02  6:22     ` Arnd Bergmann
  -1 siblings, 1 reply; 52+ messages in thread
From: kernel test robot @ 2020-07-02  5:14 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 7878 bytes --]

Hi Anson,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on shawnguo/for-next]
[also build test ERROR on clk/clk-next v5.8-rc3 next-20200701]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Anson-Huang/Support-building-i-MX8-SoCs-clock-driver-as-module/20200702-102015
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git for-next
config: s390-allyesconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/clk/imx/clk-imx21.c:122:12: warning: no previous prototype for 'mx21_clocks_init' [-Wmissing-prototypes]
     122 | int __init mx21_clocks_init(unsigned long lref, unsigned long href)
         |            ^~~~~~~~~~~~~~~~
   drivers/clk/imx/clk-imx21.c: In function 'mx21_clocks_init':
>> drivers/clk/imx/clk-imx21.c:124:36: error: 'SZ_2K' undeclared (first use in this function)
     124 |  ccm = ioremap(MX21_CCM_BASE_ADDR, SZ_2K);
         |                                    ^~~~~
   drivers/clk/imx/clk-imx21.c:124:36: note: each undeclared identifier is reported only once for each function it appears in
--
   drivers/clk/imx/clk-imx27.c:184:12: warning: no previous prototype for 'mx27_clocks_init' [-Wmissing-prototypes]
     184 | int __init mx27_clocks_init(unsigned long fref)
         |            ^~~~~~~~~~~~~~~~
   drivers/clk/imx/clk-imx27.c: In function 'mx27_clocks_init':
>> drivers/clk/imx/clk-imx27.c:186:36: error: 'SZ_4K' undeclared (first use in this function)
     186 |  ccm = ioremap(MX27_CCM_BASE_ADDR, SZ_4K);
         |                                    ^~~~~
   drivers/clk/imx/clk-imx27.c:186:36: note: each undeclared identifier is reported only once for each function it appears in

vim +/SZ_2K +124 drivers/clk/imx/clk-imx21.c

93421e42277009 arch/arm/mach-imx/clk-imx21.c Sascha Hauer     2012-03-09  121  
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22 @122  int __init mx21_clocks_init(unsigned long lref, unsigned long href)
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  123  {
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22 @124  	ccm = ioremap(MX21_CCM_BASE_ADDR, SZ_2K);
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  125  
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  126  	_mx21_clocks_init(lref, href);
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  127  
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  128  	clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx21-uart.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  129  	clk_register_clkdev(clk[IMX21_CLK_UART1_IPG_GATE], "ipg", "imx21-uart.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  130  	clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx21-uart.1");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  131  	clk_register_clkdev(clk[IMX21_CLK_UART2_IPG_GATE], "ipg", "imx21-uart.1");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  132  	clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx21-uart.2");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  133  	clk_register_clkdev(clk[IMX21_CLK_UART3_IPG_GATE], "ipg", "imx21-uart.2");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  134  	clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx21-uart.3");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  135  	clk_register_clkdev(clk[IMX21_CLK_UART4_IPG_GATE], "ipg", "imx21-uart.3");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  136  	clk_register_clkdev(clk[IMX21_CLK_GPT1_IPG_GATE], "ipg", "imx-gpt.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  137  	clk_register_clkdev(clk[IMX21_CLK_PER1], "per", "imx-gpt.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  138  	clk_register_clkdev(clk[IMX21_CLK_PER2], "per", "imx21-cspi.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  139  	clk_register_clkdev(clk[IMX21_CLK_CSPI1_IPG_GATE], "ipg", "imx21-cspi.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  140  	clk_register_clkdev(clk[IMX21_CLK_PER2], "per", "imx21-cspi.1");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  141  	clk_register_clkdev(clk[IMX21_CLK_CSPI2_IPG_GATE], "ipg", "imx21-cspi.1");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  142  	clk_register_clkdev(clk[IMX21_CLK_PER2], "per", "imx21-cspi.2");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  143  	clk_register_clkdev(clk[IMX21_CLK_CSPI3_IPG_GATE], "ipg", "imx21-cspi.2");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  144  	clk_register_clkdev(clk[IMX21_CLK_PER3], "per", "imx21-fb.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  145  	clk_register_clkdev(clk[IMX21_CLK_LCDC_IPG_GATE], "ipg", "imx21-fb.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  146  	clk_register_clkdev(clk[IMX21_CLK_LCDC_HCLK_GATE], "ahb", "imx21-fb.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  147  	clk_register_clkdev(clk[IMX21_CLK_USB_GATE], "per", "imx21-hcd.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  148  	clk_register_clkdev(clk[IMX21_CLK_USB_HCLK_GATE], "ahb", "imx21-hcd.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  149  	clk_register_clkdev(clk[IMX21_CLK_NFC_GATE], NULL, "imx21-nand.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  150  	clk_register_clkdev(clk[IMX21_CLK_DMA_HCLK_GATE], "ahb", "imx21-dma");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  151  	clk_register_clkdev(clk[IMX21_CLK_DMA_GATE], "ipg", "imx21-dma");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  152  	clk_register_clkdev(clk[IMX21_CLK_WDOG_GATE], NULL, "imx2-wdt.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  153  	clk_register_clkdev(clk[IMX21_CLK_I2C_GATE], NULL, "imx21-i2c.0");
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  154  	clk_register_clkdev(clk[IMX21_CLK_OWIRE_GATE], NULL, "mxc_w1.0");
93421e42277009 arch/arm/mach-imx/clk-imx21.c Sascha Hauer     2012-03-09  155  
0931aff7226abb drivers/clk/imx/clk-imx21.c   Shawn Guo        2015-05-15  156  	mxc_timer_init(MX21_GPT1_BASE_ADDR, MX21_INT_GPT1, GPT_TYPE_IMX21);
2cfb45188a997b arch/arm/mach-imx/clk-imx21.c Sascha Hauer     2012-05-16  157  
93421e42277009 arch/arm/mach-imx/clk-imx21.c Sascha Hauer     2012-03-09  158  	return 0;
93421e42277009 arch/arm/mach-imx/clk-imx21.c Sascha Hauer     2012-03-09  159  }
35bcaf00de2091 arch/arm/mach-imx/clk-imx21.c Alexander Shiyan 2014-06-22  160  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 62692 bytes --]

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

* Re: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock driver as module
  2020-07-02  3:55       ` Anson Huang
@ 2020-07-02  5:29         ` Dong Aisheng
  -1 siblings, 0 replies; 52+ messages in thread
From: Dong Aisheng @ 2020-07-02  5:29 UTC (permalink / raw)
  To: Anson Huang
  Cc: Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
	Sascha Hauer, Fabio Estevam, Peng Fan, Arnd Bergmann, Abel Vesa,
	Aisheng Dong, Andy Duan, Daniel Baluta, YueHaibing,
	Stephen Rothwell, linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx

On Thu, Jul 2, 2020 at 11:55 AM Anson Huang <anson.huang@nxp.com> wrote:
[...]
> > > +{
> > > +       return platform_driver_register(&imx8qxp_lpcg_clk_driver);
> > > +}
> > > +device_initcall(imx8qxp_lpcg_clk_init);
> >
> > Any reason to change to device_initcall which looks a bit strange?
> > Is it because the following line?
> > +obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o
> > But it looks to me they're still two modules. Aren't they?
>
> It is suggested by Arnd to NOT use builtin_platform_driver(), in order to support module
> unload, although the clock driver normally does NOT support remove, but it is better to
> follow the right way.
>

By expanding builtin_platform_driver() marcro, you will find your
patch is exactly doing the same thing
as buildin_platform_driver() which obivously is unneccesary.

#define builtin_platform_driver(__platform_driver) \
        builtin_driver(__platform_driver, platform_driver_register)
#define builtin_driver(__driver, __register, ...) \

static int __init __driver##_init(void) \
{ \
        return __register(&(__driver) , ##__VA_ARGS__); \
} \
device_initcall(__driver##_init);

If we want to support unload, we need a .remove() callback as current
clocks are not allocated by devm_().
If don't support,  we probably can use builtin_platform_driver() first
and switch to module_platform_driver()
in the future once the driver supports release resource properly.

Regards
Aisheng

> The change in Makefile is just to link scu/lpcg library to i.MX8QXP clk driver, so that we can
> get rid of exports and below 2 .ko are needed for all i.MX SoCs with SCU inside as per your
> saying of i.MX8QXP clock driver can be extended for future SoCs with SCU.
>
> clk-imx-lpcg-scu.ko
> clk-imx-scu.ko
>
> Thanks,
> Anson

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

* Re: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock driver as module
@ 2020-07-02  5:29         ` Dong Aisheng
  0 siblings, 0 replies; 52+ messages in thread
From: Dong Aisheng @ 2020-07-02  5:29 UTC (permalink / raw)
  To: Anson Huang
  Cc: Aisheng Dong, Stephen Rothwell, Peng Fan, Andy Duan, Abel Vesa,
	Arnd Bergmann, Stephen Boyd, Shawn Guo, Michael Turquette,
	YueHaibing, open list, Daniel Baluta, linux-clk, dl-linux-imx,
	Sascha Hauer, Fabio Estevam, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

On Thu, Jul 2, 2020 at 11:55 AM Anson Huang <anson.huang@nxp.com> wrote:
[...]
> > > +{
> > > +       return platform_driver_register(&imx8qxp_lpcg_clk_driver);
> > > +}
> > > +device_initcall(imx8qxp_lpcg_clk_init);
> >
> > Any reason to change to device_initcall which looks a bit strange?
> > Is it because the following line?
> > +obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o
> > But it looks to me they're still two modules. Aren't they?
>
> It is suggested by Arnd to NOT use builtin_platform_driver(), in order to support module
> unload, although the clock driver normally does NOT support remove, but it is better to
> follow the right way.
>

By expanding builtin_platform_driver() marcro, you will find your
patch is exactly doing the same thing
as buildin_platform_driver() which obivously is unneccesary.

#define builtin_platform_driver(__platform_driver) \
        builtin_driver(__platform_driver, platform_driver_register)
#define builtin_driver(__driver, __register, ...) \

static int __init __driver##_init(void) \
{ \
        return __register(&(__driver) , ##__VA_ARGS__); \
} \
device_initcall(__driver##_init);

If we want to support unload, we need a .remove() callback as current
clocks are not allocated by devm_().
If don't support,  we probably can use builtin_platform_driver() first
and switch to module_platform_driver()
in the future once the driver supports release resource properly.

Regards
Aisheng

> The change in Makefile is just to link scu/lpcg library to i.MX8QXP clk driver, so that we can
> get rid of exports and below 2 .ko are needed for all i.MX SoCs with SCU inside as per your
> saying of i.MX8QXP clock driver can be extended for future SoCs with SCU.
>
> clk-imx-lpcg-scu.ko
> clk-imx-scu.ko
>
> Thanks,
> 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] 52+ messages in thread

* Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
  2020-07-02  3:26       ` Anson Huang
@ 2020-07-02  5:38         ` Dong Aisheng
  -1 siblings, 0 replies; 52+ messages in thread
From: Dong Aisheng @ 2020-07-02  5:38 UTC (permalink / raw)
  To: Anson Huang
  Cc: Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
	Sascha Hauer, Fabio Estevam, Peng Fan, Arnd Bergmann, Abel Vesa,
	Aisheng Dong, Andy Duan, Daniel Baluta, YueHaibing,
	Stephen Rothwell, linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx

On Thu, Jul 2, 2020 at 11:26 AM Anson Huang <anson.huang@nxp.com> wrote:
[...]
> > > @@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)
> > >  static int imx_keep_uart_clocks;
> > >  static struct clk ** const *imx_uart_clocks;
> > >
> > > -static int __init imx_keep_uart_clocks_param(char *str)
> > > +static int __maybe_unused imx_keep_uart_clocks_param(char *str)
> > >  {
> > >         imx_keep_uart_clocks = 1;
> > >
> > >         return 0;
> > >  }
> > > +#ifndef MODULE
> > >  __setup_param("earlycon", imx_keep_uart_earlycon,
> > >               imx_keep_uart_clocks_param, 0);
> > >  __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
> > >               imx_keep_uart_clocks_param, 0);
> >
> > I feel not only the __setup_param, the whole logic of keep_uart_clocks
> > are not needed for Module case. Is it true?
>
> Yes, but the 'keep_uart_clocks' is false by default and the function imx_keep_uart_clocks_param()
> already has '__maybe_unused', it does NOT impact anything if it is for module build, so I did NOT
> add the #ifndef check for them, just to keep code easy and clean.
>

IMHO do not compile them is a more easy and clean way. Then users
don't have to look into the code logic
which is meaingless for Module case.

BTW, it really does not make any sense to only condionally compile
__setup_parm() but left
the param functions definition to be handled by __maybe_unnused.
They're together part of code, aren't they?

Regards
Aisheng

Regards
Aisheng

> Thanks,
> Anson
>

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

* Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
@ 2020-07-02  5:38         ` Dong Aisheng
  0 siblings, 0 replies; 52+ messages in thread
From: Dong Aisheng @ 2020-07-02  5:38 UTC (permalink / raw)
  To: Anson Huang
  Cc: Aisheng Dong, Stephen Rothwell, Peng Fan, Andy Duan, Abel Vesa,
	Arnd Bergmann, Stephen Boyd, Shawn Guo, Michael Turquette,
	YueHaibing, open list, Daniel Baluta, linux-clk, dl-linux-imx,
	Sascha Hauer, Fabio Estevam, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

On Thu, Jul 2, 2020 at 11:26 AM Anson Huang <anson.huang@nxp.com> wrote:
[...]
> > > @@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)
> > >  static int imx_keep_uart_clocks;
> > >  static struct clk ** const *imx_uart_clocks;
> > >
> > > -static int __init imx_keep_uart_clocks_param(char *str)
> > > +static int __maybe_unused imx_keep_uart_clocks_param(char *str)
> > >  {
> > >         imx_keep_uart_clocks = 1;
> > >
> > >         return 0;
> > >  }
> > > +#ifndef MODULE
> > >  __setup_param("earlycon", imx_keep_uart_earlycon,
> > >               imx_keep_uart_clocks_param, 0);
> > >  __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
> > >               imx_keep_uart_clocks_param, 0);
> >
> > I feel not only the __setup_param, the whole logic of keep_uart_clocks
> > are not needed for Module case. Is it true?
>
> Yes, but the 'keep_uart_clocks' is false by default and the function imx_keep_uart_clocks_param()
> already has '__maybe_unused', it does NOT impact anything if it is for module build, so I did NOT
> add the #ifndef check for them, just to keep code easy and clean.
>

IMHO do not compile them is a more easy and clean way. Then users
don't have to look into the code logic
which is meaingless for Module case.

BTW, it really does not make any sense to only condionally compile
__setup_parm() but left
the param functions definition to be handled by __maybe_unnused.
They're together part of code, aren't they?

Regards
Aisheng

Regards
Aisheng

> Thanks,
> 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] 52+ messages in thread

* RE: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock driver as module
  2020-07-02  5:29         ` Dong Aisheng
@ 2020-07-02  5:50           ` Anson Huang
  -1 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  5:50 UTC (permalink / raw)
  To: Dong Aisheng, Arnd Bergmann
  Cc: Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
	Sascha Hauer, Fabio Estevam, Peng Fan, Abel Vesa, Aisheng Dong,
	Andy Duan, Daniel Baluta, YueHaibing, Stephen Rothwell,
	linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx



> Subject: Re: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock
> driver as module
> 
> On Thu, Jul 2, 2020 at 11:55 AM Anson Huang <anson.huang@nxp.com>
> wrote:
> [...]
> > > > +{
> > > > +       return platform_driver_register(&imx8qxp_lpcg_clk_driver);
> > > > +}
> > > > +device_initcall(imx8qxp_lpcg_clk_init);
> > >
> > > Any reason to change to device_initcall which looks a bit strange?
> > > Is it because the following line?
> > > +obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o
> > > But it looks to me they're still two modules. Aren't they?
> >
> > It is suggested by Arnd to NOT use builtin_platform_driver(), in order
> > to support module unload, although the clock driver normally does NOT
> > support remove, but it is better to follow the right way.
> >
> 
> By expanding builtin_platform_driver() marcro, you will find your patch is
> exactly doing the same thing as buildin_platform_driver() which obivously is
> unneccesary.
> 
> #define builtin_platform_driver(__platform_driver) \
>         builtin_driver(__platform_driver, platform_driver_register) #define
> builtin_driver(__driver, __register, ...) \
> 
> static int __init __driver##_init(void) \ { \
>         return __register(&(__driver) , ##__VA_ARGS__); \ } \
> device_initcall(__driver##_init);
> 
> If we want to support unload, we need a .remove() callback as current clocks
> are not allocated by devm_().
> If don't support,  we probably can use builtin_platform_driver() first and
> switch to module_platform_driver() in the future once the driver supports
> release resource properly.
> 

Yes, that is why I use the device_initcall() to make it exactly same as builtin_driver(),
and also yes that i.MX clock driver does NOT support module unload, so .remove()
is NOT implemented, I am fine with either way, just try to address Arnd's comment.

Hi, Arnd
	What do you think? Do you agree to keep using the builtin_driver()?

Thanks,
Anson

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

* RE: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock driver as module
@ 2020-07-02  5:50           ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  5:50 UTC (permalink / raw)
  To: Dong Aisheng, Arnd Bergmann
  Cc: Aisheng Dong, Stephen Rothwell, Peng Fan, Andy Duan, Abel Vesa,
	Stephen Boyd, Shawn Guo, Michael Turquette, YueHaibing,
	open list, Daniel Baluta, linux-clk, dl-linux-imx, Sascha Hauer,
	Fabio Estevam, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE



> Subject: Re: [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock
> driver as module
> 
> On Thu, Jul 2, 2020 at 11:55 AM Anson Huang <anson.huang@nxp.com>
> wrote:
> [...]
> > > > +{
> > > > +       return platform_driver_register(&imx8qxp_lpcg_clk_driver);
> > > > +}
> > > > +device_initcall(imx8qxp_lpcg_clk_init);
> > >
> > > Any reason to change to device_initcall which looks a bit strange?
> > > Is it because the following line?
> > > +obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o
> > > But it looks to me they're still two modules. Aren't they?
> >
> > It is suggested by Arnd to NOT use builtin_platform_driver(), in order
> > to support module unload, although the clock driver normally does NOT
> > support remove, but it is better to follow the right way.
> >
> 
> By expanding builtin_platform_driver() marcro, you will find your patch is
> exactly doing the same thing as buildin_platform_driver() which obivously is
> unneccesary.
> 
> #define builtin_platform_driver(__platform_driver) \
>         builtin_driver(__platform_driver, platform_driver_register) #define
> builtin_driver(__driver, __register, ...) \
> 
> static int __init __driver##_init(void) \ { \
>         return __register(&(__driver) , ##__VA_ARGS__); \ } \
> device_initcall(__driver##_init);
> 
> If we want to support unload, we need a .remove() callback as current clocks
> are not allocated by devm_().
> If don't support,  we probably can use builtin_platform_driver() first and
> switch to module_platform_driver() in the future once the driver supports
> release resource properly.
> 

Yes, that is why I use the device_initcall() to make it exactly same as builtin_driver(),
and also yes that i.MX clock driver does NOT support module unload, so .remove()
is NOT implemented, I am fine with either way, just try to address Arnd's comment.

Hi, Arnd
	What do you think? Do you agree to keep using the builtin_driver()?

Thanks,
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] 52+ messages in thread

* Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
  2020-07-02  2:14   ` Anson Huang
                     ` (2 preceding siblings ...)
  (?)
@ 2020-07-02  5:52   ` kernel test robot
  2020-07-02  6:55     ` Arnd Bergmann
  -1 siblings, 1 reply; 52+ messages in thread
From: kernel test robot @ 2020-07-02  5:52 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2971 bytes --]

Hi Anson,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on shawnguo/for-next]
[also build test ERROR on clk/clk-next v5.8-rc3 next-20200701]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Anson-Huang/Support-building-i-MX8-SoCs-clock-driver-as-module/20200702-102015
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git for-next
config: nds32-allmodconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   drivers/clk/imx/clk-imx35.c:251:12: warning: no previous prototype for 'mx35_clocks_init' [-Wmissing-prototypes]
     251 | int __init mx35_clocks_init(void)
         |            ^~~~~~~~~~~~~~~~
   drivers/clk/imx/clk-imx35.c: In function 'mx35_clocks_init':
>> drivers/clk/imx/clk-imx35.c:20:24: error: 'NR_IRQS_LEGACY' undeclared (first use in this function)
      20 | #define MX35_INT_GPT  (NR_IRQS_LEGACY + 29)
         |                        ^~~~~~~~~~~~~~
>> drivers/clk/imx/clk-imx35.c:314:38: note: in expansion of macro 'MX35_INT_GPT'
     314 |  mxc_timer_init(MX35_GPT1_BASE_ADDR, MX35_INT_GPT, GPT_TYPE_IMX31);
         |                                      ^~~~~~~~~~~~
   drivers/clk/imx/clk-imx35.c:20:24: note: each undeclared identifier is reported only once for each function it appears in
      20 | #define MX35_INT_GPT  (NR_IRQS_LEGACY + 29)
         |                        ^~~~~~~~~~~~~~
>> drivers/clk/imx/clk-imx35.c:314:38: note: in expansion of macro 'MX35_INT_GPT'
     314 |  mxc_timer_init(MX35_GPT1_BASE_ADDR, MX35_INT_GPT, GPT_TYPE_IMX31);
         |                                      ^~~~~~~~~~~~

vim +/NR_IRQS_LEGACY +20 drivers/clk/imx/clk-imx35.c

0c831317e77b556 arch/arm/mach-imx/clk-imx35.c Shawn Guo 2015-04-25  17  
0c831317e77b556 arch/arm/mach-imx/clk-imx35.c Shawn Guo 2015-04-25  18  #define MX35_CCM_BASE_ADDR	0x53f80000
0c831317e77b556 arch/arm/mach-imx/clk-imx35.c Shawn Guo 2015-04-25  19  #define MX35_GPT1_BASE_ADDR	0x53f90000
0c831317e77b556 arch/arm/mach-imx/clk-imx35.c Shawn Guo 2015-04-25 @20  #define MX35_INT_GPT		(NR_IRQS_LEGACY + 29)
0c831317e77b556 arch/arm/mach-imx/clk-imx35.c Shawn Guo 2015-04-25  21  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 57145 bytes --]

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

* RE: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
  2020-07-02  5:38         ` Dong Aisheng
@ 2020-07-02  6:11           ` Anson Huang
  -1 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  6:11 UTC (permalink / raw)
  To: Dong Aisheng
  Cc: Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
	Sascha Hauer, Fabio Estevam, Peng Fan, Arnd Bergmann, Abel Vesa,
	Aisheng Dong, Andy Duan, Daniel Baluta, YueHaibing,
	Stephen Rothwell, linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx



> Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock
> driver as module
> 
> On Thu, Jul 2, 2020 at 11:26 AM Anson Huang <anson.huang@nxp.com>
> wrote:
> [...]
> > > > @@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)  static int
> > > > imx_keep_uart_clocks;  static struct clk ** const
> > > > *imx_uart_clocks;
> > > >
> > > > -static int __init imx_keep_uart_clocks_param(char *str)
> > > > +static int __maybe_unused imx_keep_uart_clocks_param(char *str)
> > > >  {
> > > >         imx_keep_uart_clocks = 1;
> > > >
> > > >         return 0;
> > > >  }
> > > > +#ifndef MODULE
> > > >  __setup_param("earlycon", imx_keep_uart_earlycon,
> > > >               imx_keep_uart_clocks_param, 0);
> > > > __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
> > > >               imx_keep_uart_clocks_param, 0);
> > >
> > > I feel not only the __setup_param, the whole logic of
> > > keep_uart_clocks are not needed for Module case. Is it true?
> >
> > Yes, but the 'keep_uart_clocks' is false by default and the function
> > imx_keep_uart_clocks_param() already has '__maybe_unused', it does NOT
> > impact anything if it is for module build, so I did NOT add the #ifndef check
> for them, just to keep code easy and clean.
> >
> 
> IMHO do not compile them is a more easy and clean way. Then users don't
> have to look into the code logic which is meaingless for Module case.
> 
> BTW, it really does not make any sense to only condionally compile
> __setup_parm() but left
> the param functions definition to be handled by __maybe_unnused.
> They're together part of code, aren't they?

I am fine of adding the '#ifndef MODULE' to imx_clk_disable_uart() and imx_keep_uart_clocks_param()
as well in next patch series. Others like ' imx_keep_uart_clocks ' and imx_register_uart_clocks() need to
be kept always built, since they are used by each clock driver no matter built-in or module build.

So that means I have to add another 'ifndef MODULE' or I need to adjust some code sequence to make
those code can be built-out in same block and just use single 'ifndef MODULE', I think adjust the code
sequence should be better, will go with this way.

Anson

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

* RE: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
@ 2020-07-02  6:11           ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  6:11 UTC (permalink / raw)
  To: Dong Aisheng
  Cc: Aisheng Dong, Stephen Rothwell, Peng Fan, Andy Duan, Abel Vesa,
	Arnd Bergmann, Stephen Boyd, Shawn Guo, Michael Turquette,
	YueHaibing, open list, Daniel Baluta, linux-clk, dl-linux-imx,
	Sascha Hauer, Fabio Estevam, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE



> Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock
> driver as module
> 
> On Thu, Jul 2, 2020 at 11:26 AM Anson Huang <anson.huang@nxp.com>
> wrote:
> [...]
> > > > @@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)  static int
> > > > imx_keep_uart_clocks;  static struct clk ** const
> > > > *imx_uart_clocks;
> > > >
> > > > -static int __init imx_keep_uart_clocks_param(char *str)
> > > > +static int __maybe_unused imx_keep_uart_clocks_param(char *str)
> > > >  {
> > > >         imx_keep_uart_clocks = 1;
> > > >
> > > >         return 0;
> > > >  }
> > > > +#ifndef MODULE
> > > >  __setup_param("earlycon", imx_keep_uart_earlycon,
> > > >               imx_keep_uart_clocks_param, 0);
> > > > __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
> > > >               imx_keep_uart_clocks_param, 0);
> > >
> > > I feel not only the __setup_param, the whole logic of
> > > keep_uart_clocks are not needed for Module case. Is it true?
> >
> > Yes, but the 'keep_uart_clocks' is false by default and the function
> > imx_keep_uart_clocks_param() already has '__maybe_unused', it does NOT
> > impact anything if it is for module build, so I did NOT add the #ifndef check
> for them, just to keep code easy and clean.
> >
> 
> IMHO do not compile them is a more easy and clean way. Then users don't
> have to look into the code logic which is meaingless for Module case.
> 
> BTW, it really does not make any sense to only condionally compile
> __setup_parm() but left
> the param functions definition to be handled by __maybe_unnused.
> They're together part of code, aren't they?

I am fine of adding the '#ifndef MODULE' to imx_clk_disable_uart() and imx_keep_uart_clocks_param()
as well in next patch series. Others like ' imx_keep_uart_clocks ' and imx_register_uart_clocks() need to
be kept always built, since they are used by each clock driver no matter built-in or module build.

So that means I have to add another 'ifndef MODULE' or I need to adjust some code sequence to make
those code can be built-out in same block and just use single 'ifndef MODULE', I think adjust the code
sequence should be better, will go with this way.

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] 52+ messages in thread

* Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
  2020-07-02  5:14   ` kernel test robot
@ 2020-07-02  6:22     ` Arnd Bergmann
  2020-07-02  6:27       ` Anson Huang
  0 siblings, 1 reply; 52+ messages in thread
From: Arnd Bergmann @ 2020-07-02  6:22 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

On Thu, Jul 2, 2020 at 7:15 AM kernel test robot <lkp@intel.com> wrote:
>
> All errors (new ones prefixed by >>):
>
>    drivers/clk/imx/clk-imx21.c:122:12: warning: no previous prototype for 'mx21_clocks_init' [-Wmissing-prototypes]
>      122 | int __init mx21_clocks_init(unsigned long lref, unsigned long href)

I'd suggest you add the prototypes in drivers/clk/imx/clk.h, even
though the caller doesn't
see it there.

>          |            ^~~~~~~~~~~~~~~~
>    drivers/clk/imx/clk-imx21.c: In function 'mx21_clocks_init':
> >> drivers/clk/imx/clk-imx21.c:124:36: error: 'SZ_2K' undeclared (first use in this function)
>      124 |  ccm = ioremap(MX21_CCM_BASE_ADDR, SZ_2K);

This needs an "#include <linux/sizes.h>

        Arnd

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

* Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
  2020-07-02  6:11           ` Anson Huang
@ 2020-07-02  6:25             ` Dong Aisheng
  -1 siblings, 0 replies; 52+ messages in thread
From: Dong Aisheng @ 2020-07-02  6:25 UTC (permalink / raw)
  To: Anson Huang
  Cc: Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
	Sascha Hauer, Fabio Estevam, Peng Fan, Arnd Bergmann, Abel Vesa,
	Aisheng Dong, Andy Duan, Daniel Baluta, YueHaibing,
	Stephen Rothwell, linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx

On Thu, Jul 2, 2020 at 2:11 PM Anson Huang <anson.huang@nxp.com> wrote:
>
> > Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock
> > driver as module
> >
> > On Thu, Jul 2, 2020 at 11:26 AM Anson Huang <anson.huang@nxp.com>
> > wrote:
> > [...]
> > > > > @@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)  static int
> > > > > imx_keep_uart_clocks;  static struct clk ** const
> > > > > *imx_uart_clocks;
> > > > >
> > > > > -static int __init imx_keep_uart_clocks_param(char *str)
> > > > > +static int __maybe_unused imx_keep_uart_clocks_param(char *str)
> > > > >  {
> > > > >         imx_keep_uart_clocks = 1;
> > > > >
> > > > >         return 0;
> > > > >  }
> > > > > +#ifndef MODULE
> > > > >  __setup_param("earlycon", imx_keep_uart_earlycon,
> > > > >               imx_keep_uart_clocks_param, 0);
> > > > > __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
> > > > >               imx_keep_uart_clocks_param, 0);
> > > >
> > > > I feel not only the __setup_param, the whole logic of
> > > > keep_uart_clocks are not needed for Module case. Is it true?
> > >
> > > Yes, but the 'keep_uart_clocks' is false by default and the function
> > > imx_keep_uart_clocks_param() already has '__maybe_unused', it does NOT
> > > impact anything if it is for module build, so I did NOT add the #ifndef check
> > for them, just to keep code easy and clean.
> > >
> >
> > IMHO do not compile them is a more easy and clean way. Then users don't
> > have to look into the code logic which is meaingless for Module case.
> >
> > BTW, it really does not make any sense to only condionally compile
> > __setup_parm() but left
> > the param functions definition to be handled by __maybe_unnused.
> > They're together part of code, aren't they?
>
> I am fine of adding the '#ifndef MODULE' to imx_clk_disable_uart() and imx_keep_uart_clocks_param()
> as well in next patch series. Others like ' imx_keep_uart_clocks ' and imx_register_uart_clocks() need to
> be kept always built, since they are used by each clock driver no matter built-in or module build.
>
> So that means I have to add another 'ifndef MODULE' or I need to adjust some code sequence to make
> those code can be built-out in same block and just use single 'ifndef MODULE', I think adjust the code
> sequence should be better, will go with this way.

What if we  condionally compile it in clk.h? Will that be easiser?

Regards
Aisheng

>
> Anson

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

* Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
@ 2020-07-02  6:25             ` Dong Aisheng
  0 siblings, 0 replies; 52+ messages in thread
From: Dong Aisheng @ 2020-07-02  6:25 UTC (permalink / raw)
  To: Anson Huang
  Cc: Aisheng Dong, Stephen Rothwell, Peng Fan, Andy Duan, Abel Vesa,
	Arnd Bergmann, Stephen Boyd, Shawn Guo, Michael Turquette,
	YueHaibing, open list, Daniel Baluta, linux-clk, dl-linux-imx,
	Sascha Hauer, Fabio Estevam, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

On Thu, Jul 2, 2020 at 2:11 PM Anson Huang <anson.huang@nxp.com> wrote:
>
> > Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock
> > driver as module
> >
> > On Thu, Jul 2, 2020 at 11:26 AM Anson Huang <anson.huang@nxp.com>
> > wrote:
> > [...]
> > > > > @@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)  static int
> > > > > imx_keep_uart_clocks;  static struct clk ** const
> > > > > *imx_uart_clocks;
> > > > >
> > > > > -static int __init imx_keep_uart_clocks_param(char *str)
> > > > > +static int __maybe_unused imx_keep_uart_clocks_param(char *str)
> > > > >  {
> > > > >         imx_keep_uart_clocks = 1;
> > > > >
> > > > >         return 0;
> > > > >  }
> > > > > +#ifndef MODULE
> > > > >  __setup_param("earlycon", imx_keep_uart_earlycon,
> > > > >               imx_keep_uart_clocks_param, 0);
> > > > > __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
> > > > >               imx_keep_uart_clocks_param, 0);
> > > >
> > > > I feel not only the __setup_param, the whole logic of
> > > > keep_uart_clocks are not needed for Module case. Is it true?
> > >
> > > Yes, but the 'keep_uart_clocks' is false by default and the function
> > > imx_keep_uart_clocks_param() already has '__maybe_unused', it does NOT
> > > impact anything if it is for module build, so I did NOT add the #ifndef check
> > for them, just to keep code easy and clean.
> > >
> >
> > IMHO do not compile them is a more easy and clean way. Then users don't
> > have to look into the code logic which is meaingless for Module case.
> >
> > BTW, it really does not make any sense to only condionally compile
> > __setup_parm() but left
> > the param functions definition to be handled by __maybe_unnused.
> > They're together part of code, aren't they?
>
> I am fine of adding the '#ifndef MODULE' to imx_clk_disable_uart() and imx_keep_uart_clocks_param()
> as well in next patch series. Others like ' imx_keep_uart_clocks ' and imx_register_uart_clocks() need to
> be kept always built, since they are used by each clock driver no matter built-in or module build.
>
> So that means I have to add another 'ifndef MODULE' or I need to adjust some code sequence to make
> those code can be built-out in same block and just use single 'ifndef MODULE', I think adjust the code
> sequence should be better, will go with this way.

What if we  condionally compile it in clk.h? Will that be easiser?

Regards
Aisheng

>
> 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] 52+ messages in thread

* Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
  2020-07-02  6:22     ` Arnd Bergmann
@ 2020-07-02  6:27       ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  6:27 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

Hi, Arnd

> Subject: Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7
> platforms
> 
> On Thu, Jul 2, 2020 at 7:15 AM kernel test robot <lkp@intel.com> wrote:
> >
> > All errors (new ones prefixed by >>):
> >
> >    drivers/clk/imx/clk-imx21.c:122:12: warning: no previous prototype for
> 'mx21_clocks_init' [-Wmissing-prototypes]
> >      122 | int __init mx21_clocks_init(unsigned long lref, unsigned
> > long href)
> 
> I'd suggest you add the prototypes in drivers/clk/imx/clk.h, even though the
> caller doesn't see it there.
> 
> >          |            ^~~~~~~~~~~~~~~~
> >    drivers/clk/imx/clk-imx21.c: In function 'mx21_clocks_init':
> > >> drivers/clk/imx/clk-imx21.c:124:36: error: 'SZ_2K' undeclared
> > >> (first use in this function)
> >      124 |  ccm = ioremap(MX21_CCM_BASE_ADDR, SZ_2K);
> 
> This needs an "#include <linux/sizes.h>
> 

But I wonder do we really need to add COMPILE_TEST for these clk drivers?
it seems like all i.MX clock drivers do NOT have this build coverage support so far.
The other concern is I am NOT sure if there is other build error will occur, since
I can NOT cover all arch's build.

Do you think it is acceptable if we just drop the COMPILE_TEST support?

Thanks,
Anson

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

* RE: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
  2020-07-02  6:25             ` Dong Aisheng
@ 2020-07-02  6:42               ` Anson Huang
  -1 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  6:42 UTC (permalink / raw)
  To: Dong Aisheng
  Cc: Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
	Sascha Hauer, Fabio Estevam, Peng Fan, Arnd Bergmann, Abel Vesa,
	Aisheng Dong, Andy Duan, Daniel Baluta, YueHaibing,
	Stephen Rothwell, linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx



> Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock
> driver as module
> 
> On Thu, Jul 2, 2020 at 2:11 PM Anson Huang <anson.huang@nxp.com> wrote:
> >
> > > Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common
> > > clock driver as module
> > >
> > > On Thu, Jul 2, 2020 at 11:26 AM Anson Huang <anson.huang@nxp.com>
> > > wrote:
> > > [...]
> > > > > > @@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)  static
> > > > > > int imx_keep_uart_clocks;  static struct clk ** const
> > > > > > *imx_uart_clocks;
> > > > > >
> > > > > > -static int __init imx_keep_uart_clocks_param(char *str)
> > > > > > +static int __maybe_unused imx_keep_uart_clocks_param(char
> > > > > > +*str)
> > > > > >  {
> > > > > >         imx_keep_uart_clocks = 1;
> > > > > >
> > > > > >         return 0;
> > > > > >  }
> > > > > > +#ifndef MODULE
> > > > > >  __setup_param("earlycon", imx_keep_uart_earlycon,
> > > > > >               imx_keep_uart_clocks_param, 0);
> > > > > > __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
> > > > > >               imx_keep_uart_clocks_param, 0);
> > > > >
> > > > > I feel not only the __setup_param, the whole logic of
> > > > > keep_uart_clocks are not needed for Module case. Is it true?
> > > >
> > > > Yes, but the 'keep_uart_clocks' is false by default and the
> > > > function
> > > > imx_keep_uart_clocks_param() already has '__maybe_unused', it does
> > > > NOT impact anything if it is for module build, so I did NOT add
> > > > the #ifndef check
> > > for them, just to keep code easy and clean.
> > > >
> > >
> > > IMHO do not compile them is a more easy and clean way. Then users
> > > don't have to look into the code logic which is meaingless for Module case.
> > >
> > > BTW, it really does not make any sense to only condionally compile
> > > __setup_parm() but left
> > > the param functions definition to be handled by __maybe_unnused.
> > > They're together part of code, aren't they?
> >
> > I am fine of adding the '#ifndef MODULE' to imx_clk_disable_uart() and
> > imx_keep_uart_clocks_param() as well in next patch series. Others like
> > ' imx_keep_uart_clocks ' and imx_register_uart_clocks() need to be kept
> always built, since they are used by each clock driver no matter built-in or
> module build.
> >
> > So that means I have to add another 'ifndef MODULE' or I need to
> > adjust some code sequence to make those code can be built-out in same
> > block and just use single 'ifndef MODULE', I think adjust the code sequence
> should be better, will go with this way.
> 
> What if we  condionally compile it in clk.h? Will that be easiser?

Adjust the function sequence looks like NOT complicated, just need to exchange the
imx_register_uart_clocks() and imx_clk_disable_uart(), then I can use single '#ifndef MODULE',
will go with this way in V5.

Anson

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

* RE: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
@ 2020-07-02  6:42               ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  6:42 UTC (permalink / raw)
  To: Dong Aisheng
  Cc: Aisheng Dong, Stephen Rothwell, Peng Fan, Andy Duan, Abel Vesa,
	Arnd Bergmann, Stephen Boyd, Shawn Guo, Michael Turquette,
	YueHaibing, open list, Daniel Baluta, linux-clk, dl-linux-imx,
	Sascha Hauer, Fabio Estevam, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE



> Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock
> driver as module
> 
> On Thu, Jul 2, 2020 at 2:11 PM Anson Huang <anson.huang@nxp.com> wrote:
> >
> > > Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common
> > > clock driver as module
> > >
> > > On Thu, Jul 2, 2020 at 11:26 AM Anson Huang <anson.huang@nxp.com>
> > > wrote:
> > > [...]
> > > > > > @@ -143,16 +148,18 @@ void imx_cscmr1_fixup(u32 *val)  static
> > > > > > int imx_keep_uart_clocks;  static struct clk ** const
> > > > > > *imx_uart_clocks;
> > > > > >
> > > > > > -static int __init imx_keep_uart_clocks_param(char *str)
> > > > > > +static int __maybe_unused imx_keep_uart_clocks_param(char
> > > > > > +*str)
> > > > > >  {
> > > > > >         imx_keep_uart_clocks = 1;
> > > > > >
> > > > > >         return 0;
> > > > > >  }
> > > > > > +#ifndef MODULE
> > > > > >  __setup_param("earlycon", imx_keep_uart_earlycon,
> > > > > >               imx_keep_uart_clocks_param, 0);
> > > > > > __setup_param("earlyprintk", imx_keep_uart_earlyprintk,
> > > > > >               imx_keep_uart_clocks_param, 0);
> > > > >
> > > > > I feel not only the __setup_param, the whole logic of
> > > > > keep_uart_clocks are not needed for Module case. Is it true?
> > > >
> > > > Yes, but the 'keep_uart_clocks' is false by default and the
> > > > function
> > > > imx_keep_uart_clocks_param() already has '__maybe_unused', it does
> > > > NOT impact anything if it is for module build, so I did NOT add
> > > > the #ifndef check
> > > for them, just to keep code easy and clean.
> > > >
> > >
> > > IMHO do not compile them is a more easy and clean way. Then users
> > > don't have to look into the code logic which is meaingless for Module case.
> > >
> > > BTW, it really does not make any sense to only condionally compile
> > > __setup_parm() but left
> > > the param functions definition to be handled by __maybe_unnused.
> > > They're together part of code, aren't they?
> >
> > I am fine of adding the '#ifndef MODULE' to imx_clk_disable_uart() and
> > imx_keep_uart_clocks_param() as well in next patch series. Others like
> > ' imx_keep_uart_clocks ' and imx_register_uart_clocks() need to be kept
> always built, since they are used by each clock driver no matter built-in or
> module build.
> >
> > So that means I have to add another 'ifndef MODULE' or I need to
> > adjust some code sequence to make those code can be built-out in same
> > block and just use single 'ifndef MODULE', I think adjust the code sequence
> should be better, will go with this way.
> 
> What if we  condionally compile it in clk.h? Will that be easiser?

Adjust the function sequence looks like NOT complicated, just need to exchange the
imx_register_uart_clocks() and imx_clk_disable_uart(), then I can use single '#ifndef MODULE',
will go with this way in V5.

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] 52+ messages in thread

* Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
  2020-07-02  5:52   ` kernel test robot
@ 2020-07-02  6:55     ` Arnd Bergmann
  0 siblings, 0 replies; 52+ messages in thread
From: Arnd Bergmann @ 2020-07-02  6:55 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4943 bytes --]

On Thu, Jul 2, 2020 at 7:53 AM kernel test robot <lkp@intel.com> wrote:
>
>    drivers/clk/imx/clk-imx35.c:251:12: warning: no previous prototype for 'mx35_clocks_init' [-Wmissing-prototypes]
>      251 | int __init mx35_clocks_init(void)
>          |            ^~~~~~~~~~~~~~~~
>    drivers/clk/imx/clk-imx35.c: In function 'mx35_clocks_init':
> >> drivers/clk/imx/clk-imx35.c:20:24: error: 'NR_IRQS_LEGACY' undeclared (first use in this function)
>       20 | #define MX35_INT_GPT  (NR_IRQS_LEGACY + 29)
>          |                        ^~~~~~~~~~~~~~
> >> drivers/clk/imx/clk-imx35.c:314:38: note: in expansion of macro 'MX35_INT_GPT'
>      314 |  mxc_timer_init(MX35_GPT1_BASE_ADDR, MX35_INT_GPT, GPT_TYPE_IMX31);
>          |                                      ^~~~~~~~~~~~
>    drivers/clk/imx/clk-imx35.c:20:24: note: each undeclared identifier is reported only once for each function it appears in
>       20 | #define MX35_INT_GPT  (NR_IRQS_LEGACY + 29)
>          |                        ^~~~~~~~~~~~~~
> >> drivers/clk/imx/clk-imx35.c:314:38: note: in expansion of macro 'MX35_INT_GPT'
>      314 |  mxc_timer_init(MX35_GPT1_BASE_ADDR, MX35_INT_GPT, GPT_TYPE_IMX31);
>          |                                      ^~~~~~~~~~~~
>

This is the initialization for non-DT board files calling
mx35_clocks_init(). I think this
can also be fixed trivially by moving those lines back into callers,
in particular since
the clk driver really should not hardcode IRQ numbers for the timer device!
See below for the imx35 patch I have in mind. The same would need to be done for
mx21/27/31 of course, but all these changes are trivial.

Alternatively, we could consider just dropping the remaining i.mx3 board files
that have not been converted to DT yet. There was some effort to clean them
up years ago, but that eventually stalled and I would guess that nobody who
has this hardware would ever upgrade kernels any more (as opposed to
i.mx5 and i.mx21/27, which were more popular to start with).

       Arnd

diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 7e2e31302f17..0f908785c3e8 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -39,6 +39,7 @@ int mx21_clocks_init(unsigned long lref, unsigned long fref);
 int mx27_clocks_init(unsigned long fref);
 int mx31_clocks_init(unsigned long fref);
 int mx35_clocks_init(void);
+void mx35_timer_init(void);
 struct platform_device *mxc_register_gpio(char *name, int id,
        resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
 void mxc_set_cpu_type(unsigned int type);
diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c
b/arch/arm/mach-imx/mach-mx35_3ds.c
index 967249d8dc67..691457fede99 100644
--- a/arch/arm/mach-imx/mach-mx35_3ds.c
+++ b/arch/arm/mach-imx/mach-mx35_3ds.c
@@ -505,6 +505,7 @@ static void __init mx35_3ds_late_init(void)
 static void __init mx35pdk_timer_init(void)
 {
        mx35_clocks_init();
+       mx35_timer_init();
 }

 MACHINE_START(MX35_3DS, "Freescale MX35PDK")
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index e1d149501253..0055e943c15d 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -400,6 +400,7 @@ static void __init pcm043_late_init(void)
 static void __init pcm043_timer_init(void)
 {
        mx35_clocks_init();
+       mx35_timer_init();
 }

 MACHINE_START(PCM043, "Phytec Phycore pcm043")
diff --git a/arch/arm/mach-imx/mach-vpr200.c b/arch/arm/mach-imx/mach-vpr200.c
index 0b6d854accd2..d49806c4221e 100644
--- a/arch/arm/mach-imx/mach-vpr200.c
+++ b/arch/arm/mach-imx/mach-vpr200.c
@@ -294,6 +294,7 @@ static void __init vpr200_late_init(void)
 static void __init vpr200_timer_init(void)
 {
        mx35_clocks_init();
+       mx35_timer_init();
 }

 MACHINE_START(VPR200, "VPR200")
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
index 5a3b68a62f44..c30faccab917 100644
--- a/arch/arm/mach-imx/mm-imx3.c
+++ b/arch/arm/mach-imx/mm-imx3.c
@@ -73,6 +73,11 @@ static void __iomem
*imx3_ioremap_caller(phys_addr_t phys_addr, size_t size,
        return __arm_ioremap_caller(phys_addr, size, mtype, caller);
 }

+void __init imx35_timer_init(void)
+{
+       mxc_timer_init(MX35_GPT1_BASE_ADDR, MX35_INT_GPT, GPT_TYPE_IMX31);
+}
+
 static void __init imx3_init_l2x0(void)
 {
 #ifdef CONFIG_CACHE_L2X0
diff --git a/drivers/clk/imx/clk-imx35.c b/drivers/clk/imx/clk-imx35.c
index bf5534cdccb5..60db8cd67043 100644
--- a/drivers/clk/imx/clk-imx35.c
+++ b/drivers/clk/imx/clk-imx35.c
@@ -312,8 +312,6 @@ int __init mx35_clocks_init(void)
        clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0");
        clk_register_clkdev(clk[admux_gate], "audmux", NULL);

-       mxc_timer_init(MX35_GPT1_BASE_ADDR, MX35_INT_GPT, GPT_TYPE_IMX31);
-
        return 0;
 }

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

* Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
  2020-07-02  6:25             ` Dong Aisheng
@ 2020-07-02  7:03               ` Arnd Bergmann
  -1 siblings, 0 replies; 52+ messages in thread
From: Arnd Bergmann @ 2020-07-02  7:03 UTC (permalink / raw)
  To: Dong Aisheng
  Cc: Anson Huang, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Sascha Hauer, Fabio Estevam, Peng Fan, Abel Vesa,
	Aisheng Dong, Andy Duan, Daniel Baluta, YueHaibing,
	Stephen Rothwell, linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx

On Thu, Jul 2, 2020 at 8:40 AM Dong Aisheng <dongas86@gmail.com> wrote:
> On Thu, Jul 2, 2020 at 2:11 PM Anson Huang <anson.huang@nxp.com> wrote:
> > > Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock
> >
> > I am fine of adding the '#ifndef MODULE' to imx_clk_disable_uart() and imx_keep_uart_clocks_param()
> > as well in next patch series. Others like ' imx_keep_uart_clocks ' and imx_register_uart_clocks() need to
> > be kept always built, since they are used by each clock driver no matter built-in or module build.
> >
> > So that means I have to add another 'ifndef MODULE' or I need to adjust some code sequence to make
> > those code can be built-out in same block and just use single 'ifndef MODULE', I think adjust the code
> > sequence should be better, will go with this way.
>
> What if we  condionally compile it in clk.h? Will that be easiser?

Yes, that's what I expected to see in v4 after the previous discussion. If
imx_register_uart_clocks() is an empty inline function, then the arrays
passed to it are unused and also get dropped by the compiler.

The question is whether the #ifdef check in the header to test for MODULE
(only calling it if this particular soc has a built-in clk driver,
which is sufficient)
or for IS_MODULE(CONFIG_MXC_CLK) (call it if _any_ clk driver is built-in
and the function exists, which leaves extra code in the driver but is a more
conventional check).

     Arnd

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

* Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
@ 2020-07-02  7:03               ` Arnd Bergmann
  0 siblings, 0 replies; 52+ messages in thread
From: Arnd Bergmann @ 2020-07-02  7:03 UTC (permalink / raw)
  To: Dong Aisheng
  Cc: Aisheng Dong, Stephen Rothwell, Peng Fan, Andy Duan, Abel Vesa,
	Anson Huang, Stephen Boyd, Fabio Estevam, Michael Turquette,
	YueHaibing, open list, Daniel Baluta, linux-clk, dl-linux-imx,
	Sascha Hauer, Shawn Guo, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

On Thu, Jul 2, 2020 at 8:40 AM Dong Aisheng <dongas86@gmail.com> wrote:
> On Thu, Jul 2, 2020 at 2:11 PM Anson Huang <anson.huang@nxp.com> wrote:
> > > Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock
> >
> > I am fine of adding the '#ifndef MODULE' to imx_clk_disable_uart() and imx_keep_uart_clocks_param()
> > as well in next patch series. Others like ' imx_keep_uart_clocks ' and imx_register_uart_clocks() need to
> > be kept always built, since they are used by each clock driver no matter built-in or module build.
> >
> > So that means I have to add another 'ifndef MODULE' or I need to adjust some code sequence to make
> > those code can be built-out in same block and just use single 'ifndef MODULE', I think adjust the code
> > sequence should be better, will go with this way.
>
> What if we  condionally compile it in clk.h? Will that be easiser?

Yes, that's what I expected to see in v4 after the previous discussion. If
imx_register_uart_clocks() is an empty inline function, then the arrays
passed to it are unused and also get dropped by the compiler.

The question is whether the #ifdef check in the header to test for MODULE
(only calling it if this particular soc has a built-in clk driver,
which is sufficient)
or for IS_MODULE(CONFIG_MXC_CLK) (call it if _any_ clk driver is built-in
and the function exists, which leaves extra code in the driver but is a more
conventional check).

     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] 52+ messages in thread

* RE: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
  2020-07-02  7:03               ` Arnd Bergmann
@ 2020-07-02  7:12                 ` Anson Huang
  -1 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  7:12 UTC (permalink / raw)
  To: Arnd Bergmann, Dong Aisheng
  Cc: Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
	Sascha Hauer, Fabio Estevam, Peng Fan, Abel Vesa, Aisheng Dong,
	Andy Duan, Daniel Baluta, YueHaibing, Stephen Rothwell,
	linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx

Hi, Arnd


> Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock
> driver as module
> 
> On Thu, Jul 2, 2020 at 8:40 AM Dong Aisheng <dongas86@gmail.com> wrote:
> > On Thu, Jul 2, 2020 at 2:11 PM Anson Huang <anson.huang@nxp.com>
> wrote:
> > > > Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common
> > > > clock
> > >
> > > I am fine of adding the '#ifndef MODULE' to imx_clk_disable_uart()
> > > and imx_keep_uart_clocks_param() as well in next patch series.
> > > Others like ' imx_keep_uart_clocks ' and imx_register_uart_clocks() need to
> be kept always built, since they are used by each clock driver no matter
> built-in or module build.
> > >
> > > So that means I have to add another 'ifndef MODULE' or I need to
> > > adjust some code sequence to make those code can be built-out in
> > > same block and just use single 'ifndef MODULE', I think adjust the code
> sequence should be better, will go with this way.
> >
> > What if we  condionally compile it in clk.h? Will that be easiser?
> 
> Yes, that's what I expected to see in v4 after the previous discussion. If
> imx_register_uart_clocks() is an empty inline function, then the arrays passed
> to it are unused and also get dropped by the compiler.
> 
> The question is whether the #ifdef check in the header to test for MODULE
> (only calling it if this particular soc has a built-in clk driver, which is sufficient)
> or for IS_MODULE(CONFIG_MXC_CLK) (call it if _any_ clk driver is built-in and
> the function exists, which leaves extra code in the driver but is a more
> conventional check).
> 

So you prefer to add an empty inline function for imx_register_uart_clocks() with check
of MODULE build? Even with this, we still need to add MODULE build check to whole block
of this earlycon uart clock handler in imx/clk.c.

Thanks,
Anson

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

* RE: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
@ 2020-07-02  7:12                 ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  7:12 UTC (permalink / raw)
  To: Arnd Bergmann, Dong Aisheng
  Cc: Aisheng Dong, Stephen Rothwell, Peng Fan, Andy Duan, Abel Vesa,
	Stephen Boyd, Shawn Guo, Michael Turquette, YueHaibing,
	open list, Daniel Baluta, linux-clk, dl-linux-imx, Sascha Hauer,
	Fabio Estevam, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

Hi, Arnd


> Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock
> driver as module
> 
> On Thu, Jul 2, 2020 at 8:40 AM Dong Aisheng <dongas86@gmail.com> wrote:
> > On Thu, Jul 2, 2020 at 2:11 PM Anson Huang <anson.huang@nxp.com>
> wrote:
> > > > Subject: Re: [PATCH V4 3/5] clk: imx: Support building i.MX common
> > > > clock
> > >
> > > I am fine of adding the '#ifndef MODULE' to imx_clk_disable_uart()
> > > and imx_keep_uart_clocks_param() as well in next patch series.
> > > Others like ' imx_keep_uart_clocks ' and imx_register_uart_clocks() need to
> be kept always built, since they are used by each clock driver no matter
> built-in or module build.
> > >
> > > So that means I have to add another 'ifndef MODULE' or I need to
> > > adjust some code sequence to make those code can be built-out in
> > > same block and just use single 'ifndef MODULE', I think adjust the code
> sequence should be better, will go with this way.
> >
> > What if we  condionally compile it in clk.h? Will that be easiser?
> 
> Yes, that's what I expected to see in v4 after the previous discussion. If
> imx_register_uart_clocks() is an empty inline function, then the arrays passed
> to it are unused and also get dropped by the compiler.
> 
> The question is whether the #ifdef check in the header to test for MODULE
> (only calling it if this particular soc has a built-in clk driver, which is sufficient)
> or for IS_MODULE(CONFIG_MXC_CLK) (call it if _any_ clk driver is built-in and
> the function exists, which leaves extra code in the driver but is a more
> conventional check).
> 

So you prefer to add an empty inline function for imx_register_uart_clocks() with check
of MODULE build? Even with this, we still need to add MODULE build check to whole block
of this earlycon uart clock handler in imx/clk.c.

Thanks,
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] 52+ messages in thread

* Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
  2020-07-02  7:12                 ` Anson Huang
@ 2020-07-02  7:43                   ` Arnd Bergmann
  -1 siblings, 0 replies; 52+ messages in thread
From: Arnd Bergmann @ 2020-07-02  7:43 UTC (permalink / raw)
  To: Anson Huang
  Cc: Dong Aisheng, Michael Turquette, Stephen Boyd, Shawn Guo,
	Sascha Hauer, Sascha Hauer, Fabio Estevam, Peng Fan, Abel Vesa,
	Aisheng Dong, Andy Duan, Daniel Baluta, YueHaibing,
	Stephen Rothwell, linux-clk, open list,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	dl-linux-imx

On Thu, Jul 2, 2020 at 9:12 AM Anson Huang <anson.huang@nxp.com> wrote:
> >
> > The question is whether the #ifdef check in the header to test for MODULE
> > (only calling it if this particular soc has a built-in clk driver, which is sufficient)
> > or for IS_MODULE(CONFIG_MXC_CLK) (call it if _any_ clk driver is built-in and
> > the function exists, which leaves extra code in the driver but is a more
> > conventional check).
> >
>
> So you prefer to add an empty inline function for imx_register_uart_clocks() with check
> of MODULE build?

Yes, I want the empty inline stub, but either symbol check would work

> Even with this, we still need to add MODULE build check to whole block
> of this earlycon uart clock handler in imx/clk.c.

Correct.

      Arnd

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

* Re: [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module
@ 2020-07-02  7:43                   ` Arnd Bergmann
  0 siblings, 0 replies; 52+ messages in thread
From: Arnd Bergmann @ 2020-07-02  7:43 UTC (permalink / raw)
  To: Anson Huang
  Cc: Aisheng Dong, Stephen Rothwell, Peng Fan, Andy Duan,
	Dong Aisheng, Stephen Boyd, Fabio Estevam, Michael Turquette,
	YueHaibing, open list, Daniel Baluta, linux-clk, dl-linux-imx,
	Sascha Hauer, Shawn Guo, Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Abel Vesa

On Thu, Jul 2, 2020 at 9:12 AM Anson Huang <anson.huang@nxp.com> wrote:
> >
> > The question is whether the #ifdef check in the header to test for MODULE
> > (only calling it if this particular soc has a built-in clk driver, which is sufficient)
> > or for IS_MODULE(CONFIG_MXC_CLK) (call it if _any_ clk driver is built-in and
> > the function exists, which leaves extra code in the driver but is a more
> > conventional check).
> >
>
> So you prefer to add an empty inline function for imx_register_uart_clocks() with check
> of MODULE build?

Yes, I want the empty inline stub, but either symbol check would work

> Even with this, we still need to add MODULE build check to whole block
> of this earlycon uart clock handler in imx/clk.c.

Correct.

      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] 52+ messages in thread

* Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
       [not found] <DB3PR0402MB3916FF11D39F358FCC302484F56D0@DB3PR0402MB3916.eurprd04.prod.outlook.com>
@ 2020-07-02  8:03 ` Arnd Bergmann
  0 siblings, 0 replies; 52+ messages in thread
From: Arnd Bergmann @ 2020-07-02  8:03 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2342 bytes --]

On Thu, Jul 2, 2020 at 9:52 AM Anson Huang <anson.huang@nxp.com> wrote:
> > Subject: Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7
> > platforms
> >
> > On Thu, Jul 2, 2020 at 9:01 AM Anson Huang <anson.huang@nxp.com> wrote:
> > > > Subject: Re: [PATCH V4 2/5] clk: imx: Add clock configuration for
> > > > ARMv7 platforms On Thu, Jul 2, 2020 at 8:27 AM Anson Huang
> > <anson.huang@nxp.com> wrote:
> > > > > Do you think it is acceptable if we just drop the COMPILE_TEST support?
> > > >
> > > > The entire point of COMPILE_TEST is to find bugs in rarely used code.
> > > > As you say, these drivers are rarely used, and compile-testing them
> > > > found a
> > > > (harmless) bug, so I think that should be addressed and COMPILE_TEST
> > > > left around.
> > >
> > > I understand the COMPILE_TEST is useful/important, and I think this
> > > support should be done for all i.MX clock drivers, so do you think if
> > > we can use another patch series to support it for all i.MX clock drivers? I will
> > do that of cause.
> >
> > Right, there needs to be a limit to how much you can be assumed to fix at
> > once ;-)
> >
> > This is how I'd draw the lines:
> >
> > - on i.MX21/27/31/35, which are still called from board files and cannot be
> >   loadable modules until the pre-DT support is gone, leave them as
> >   "def_bool SOC_MXyx", without COMPILE_TEST
> > - on i.MX5/6/7/8, make the options tristate and add ||COMPILE_TEST
> >   to the dependency
> > - leave all at "default y" to have them enabled whenever COMPILE_TEST
> >   is not set but the respective platform is
> > - hide all  i.MX5/6/7/8 clk options so they cannot be made =m without
> >   compile testing as long as there are still drivers that depend on them
> >   being built-in such as the PCI host on i.MX8, and document which
> >   drivers are known to depend on them.
>
> Thank you very much for the detail suggestion, this still looks like a new feature/change
> which is NOT that closed to this patch series, so I will add another patch or series very soon
> to implement this feature/change.

What I meant to say is that you can limit the number of necessary bugfixes
and changes in the way I suggested to keep the current series shorter by not
also addressing the things you got reports for.

    Arnd

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

* Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
  2020-07-02  7:41 ` Arnd Bergmann
@ 2020-07-02  7:52   ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  7:52 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2011 bytes --]

Hi, Arnd


> Subject: Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7
> platforms
> 
> On Thu, Jul 2, 2020 at 9:01 AM Anson Huang <anson.huang@nxp.com> wrote:
> > > Subject: Re: [PATCH V4 2/5] clk: imx: Add clock configuration for
> > > ARMv7 platforms On Thu, Jul 2, 2020 at 8:27 AM Anson Huang
> <anson.huang@nxp.com> wrote:
> > > > Do you think it is acceptable if we just drop the COMPILE_TEST support?
> > >
> > > The entire point of COMPILE_TEST is to find bugs in rarely used code.
> > > As you say, these drivers are rarely used, and compile-testing them
> > > found a
> > > (harmless) bug, so I think that should be addressed and COMPILE_TEST
> > > left around.
> >
> > I understand the COMPILE_TEST is useful/important, and I think this
> > support should be done for all i.MX clock drivers, so do you think if
> > we can use another patch series to support it for all i.MX clock drivers? I will
> do that of cause.
> 
> Right, there needs to be a limit to how much you can be assumed to fix at
> once ;-)
> 
> This is how I'd draw the lines:
> 
> - on i.MX21/27/31/35, which are still called from board files and cannot be
>   loadable modules until the pre-DT support is gone, leave them as
>   "def_bool SOC_MXyx", without COMPILE_TEST
> - on i.MX5/6/7/8, make the options tristate and add ||COMPILE_TEST
>   to the dependency
> - leave all at "default y" to have them enabled whenever COMPILE_TEST
>   is not set but the respective platform is
> - hide all  i.MX5/6/7/8 clk options so they cannot be made =m without
>   compile testing as long as there are still drivers that depend on them
>   being built-in such as the PCI host on i.MX8, and document which
>   drivers are known to depend on them.

Thank you very much for the detail suggestion, this still looks like a new feature/change
which is NOT that closed to this patch series, so I will add another patch or series very soon
to implement this feature/change.

Thanks,
Anson

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

* Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
       [not found] <DB3PR0402MB3916DD6BD7E8608E4BEA2E25F56D0@DB3PR0402MB3916.eurprd04.prod.outlook.com>
@ 2020-07-02  7:41 ` Arnd Bergmann
  2020-07-02  7:52   ` Anson Huang
  0 siblings, 1 reply; 52+ messages in thread
From: Arnd Bergmann @ 2020-07-02  7:41 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]

On Thu, Jul 2, 2020 at 9:01 AM Anson Huang <anson.huang@nxp.com> wrote:
> > Subject: Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
> > On Thu, Jul 2, 2020 at 8:27 AM Anson Huang <anson.huang@nxp.com> wrote:
> > > Do you think it is acceptable if we just drop the COMPILE_TEST support?
> >
> > The entire point of COMPILE_TEST is to find bugs in rarely used code.
> > As you say, these drivers are rarely used, and compile-testing them found a
> > (harmless) bug, so I think that should be addressed and COMPILE_TEST left
> > around.
>
> I understand the COMPILE_TEST is useful/important, and I think this support should be
> done for all i.MX clock drivers, so do you think if we can use another patch series to support
> it for all i.MX clock drivers? I will do that of cause.

Right, there needs to be a limit to how much you can be assumed to fix
at once ;-)

This is how I'd draw the lines:

- on i.MX21/27/31/35, which are still called from board files and cannot be
  loadable modules until the pre-DT support is gone, leave them as
  "def_bool SOC_MXyx", without COMPILE_TEST
- on i.MX5/6/7/8, make the options tristate and add ||COMPILE_TEST
  to the dependency
- leave all at "default y" to have them enabled whenever COMPILE_TEST
  is not set but the respective platform is
- hide all  i.MX5/6/7/8 clk options so they cannot be made =m without
  compile testing as long as there are still drivers that depend on them
  being built-in such as the PCI host on i.MX8, and document which
  drivers are known to depend on them.

     Arnd

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

* Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
  2020-07-02  6:56 ` [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms Arnd Bergmann
@ 2020-07-02  7:01   ` Anson Huang
  0 siblings, 0 replies; 52+ messages in thread
From: Anson Huang @ 2020-07-02  7:01 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2048 bytes --]

Hi, Arnd

> Subject: Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7
> platforms
> 
> On Thu, Jul 2, 2020 at 8:27 AM Anson Huang <anson.huang@nxp.com> wrote:
> > > Subject: Re: [PATCH V4 2/5] clk: imx: Add clock configuration for
> > > ARMv7 platforms
> > >
> > > On Thu, Jul 2, 2020 at 7:15 AM kernel test robot <lkp@intel.com> wrote:
> > > >
> > > > All errors (new ones prefixed by >>):
> > > >
> > > >    drivers/clk/imx/clk-imx21.c:122:12: warning: no previous
> > > > prototype for
> > > 'mx21_clocks_init' [-Wmissing-prototypes]
> > > >      122 | int __init mx21_clocks_init(unsigned long lref,
> > > > unsigned long href)
> > >
> > > I'd suggest you add the prototypes in drivers/clk/imx/clk.h, even
> > > though the caller doesn't see it there.
> > >
> > > >          |            ^~~~~~~~~~~~~~~~
> > > >    drivers/clk/imx/clk-imx21.c: In function 'mx21_clocks_init':
> > > > >> drivers/clk/imx/clk-imx21.c:124:36: error: 'SZ_2K' undeclared
> > > > >> (first use in this function)
> > > >      124 |  ccm = ioremap(MX21_CCM_BASE_ADDR, SZ_2K);
> > >
> > > This needs an "#include <linux/sizes.h>
> > >
> >
> > But I wonder do we really need to add COMPILE_TEST for these clk drivers?
> > it seems like all i.MX clock drivers do NOT have this build coverage support
> so far.
> > The other concern is I am NOT sure if there is other build error will
> > occur, since I can NOT cover all arch's build.
> >
> > Do you think it is acceptable if we just drop the COMPILE_TEST support?
> 
> The entire point of COMPILE_TEST is to find bugs in rarely used code.
> As you say, these drivers are rarely used, and compile-testing them found a
> (harmless) bug, so I think that should be addressed and COMPILE_TEST left
> around.

I understand the COMPILE_TEST is useful/important, and I think this support should be
done for all i.MX clock drivers, so do you think if we can use another patch series to support
it for all i.MX clock drivers? I will do that of cause.

Thanks,
Anson

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

* Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms
       [not found] <DB3PR0402MB39160138993884DA7BFA1F4BF56D0@DB3PR0402MB3916.eurprd04.prod.outlook.com>
@ 2020-07-02  6:56 ` Arnd Bergmann
  2020-07-02  7:01   ` Anson Huang
  0 siblings, 1 reply; 52+ messages in thread
From: Arnd Bergmann @ 2020-07-02  6:56 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1611 bytes --]

On Thu, Jul 2, 2020 at 8:27 AM Anson Huang <anson.huang@nxp.com> wrote:
> > Subject: Re: [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7
> > platforms
> >
> > On Thu, Jul 2, 2020 at 7:15 AM kernel test robot <lkp@intel.com> wrote:
> > >
> > > All errors (new ones prefixed by >>):
> > >
> > >    drivers/clk/imx/clk-imx21.c:122:12: warning: no previous prototype for
> > 'mx21_clocks_init' [-Wmissing-prototypes]
> > >      122 | int __init mx21_clocks_init(unsigned long lref, unsigned
> > > long href)
> >
> > I'd suggest you add the prototypes in drivers/clk/imx/clk.h, even though the
> > caller doesn't see it there.
> >
> > >          |            ^~~~~~~~~~~~~~~~
> > >    drivers/clk/imx/clk-imx21.c: In function 'mx21_clocks_init':
> > > >> drivers/clk/imx/clk-imx21.c:124:36: error: 'SZ_2K' undeclared
> > > >> (first use in this function)
> > >      124 |  ccm = ioremap(MX21_CCM_BASE_ADDR, SZ_2K);
> >
> > This needs an "#include <linux/sizes.h>
> >
>
> But I wonder do we really need to add COMPILE_TEST for these clk drivers?
> it seems like all i.MX clock drivers do NOT have this build coverage support so far.
> The other concern is I am NOT sure if there is other build error will occur, since
> I can NOT cover all arch's build.
>
> Do you think it is acceptable if we just drop the COMPILE_TEST support?

The entire point of COMPILE_TEST is to find bugs in rarely used code.
As you say, these drivers are rarely used, and compile-testing them found
a (harmless) bug, so I think that should be addressed and COMPILE_TEST
left around.

     Arnd

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

end of thread, other threads:[~2020-07-02  8:03 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02  2:14 [PATCH V4 0/5] Support building i.MX8 SoCs clock driver as module Anson Huang
2020-07-02  2:14 ` Anson Huang
2020-07-02  2:14 ` [PATCH V4 1/5] clk: composite: Export clk_hw_register_composite() Anson Huang
2020-07-02  2:14   ` Anson Huang
2020-07-02  2:14 ` [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms Anson Huang
2020-07-02  2:14   ` Anson Huang
2020-07-02  2:38   ` Aisheng Dong
2020-07-02  2:38     ` Aisheng Dong
2020-07-02  5:14   ` kernel test robot
2020-07-02  6:22     ` Arnd Bergmann
2020-07-02  6:27       ` Anson Huang
2020-07-02  5:52   ` kernel test robot
2020-07-02  6:55     ` Arnd Bergmann
2020-07-02  2:14 ` [PATCH V4 3/5] clk: imx: Support building i.MX common clock driver as module Anson Huang
2020-07-02  2:14   ` Anson Huang
2020-07-02  2:50   ` Dong Aisheng
2020-07-02  2:50     ` Dong Aisheng
2020-07-02  3:26     ` Anson Huang
2020-07-02  3:26       ` Anson Huang
2020-07-02  5:38       ` Dong Aisheng
2020-07-02  5:38         ` Dong Aisheng
2020-07-02  6:11         ` Anson Huang
2020-07-02  6:11           ` Anson Huang
2020-07-02  6:25           ` Dong Aisheng
2020-07-02  6:25             ` Dong Aisheng
2020-07-02  6:42             ` Anson Huang
2020-07-02  6:42               ` Anson Huang
2020-07-02  7:03             ` Arnd Bergmann
2020-07-02  7:03               ` Arnd Bergmann
2020-07-02  7:12               ` Anson Huang
2020-07-02  7:12                 ` Anson Huang
2020-07-02  7:43                 ` Arnd Bergmann
2020-07-02  7:43                   ` Arnd Bergmann
2020-07-02  2:14 ` [PATCH V4 4/5] clk: imx8m: Support module build Anson Huang
2020-07-02  2:14   ` Anson Huang
2020-07-02  2:51   ` Dong Aisheng
2020-07-02  2:51     ` Dong Aisheng
2020-07-02  2:14 ` [PATCH V4 5/5] clk: imx8qxp: Support building i.MX8QXP clock driver as module Anson Huang
2020-07-02  2:14   ` Anson Huang
2020-07-02  3:17   ` Dong Aisheng
2020-07-02  3:17     ` Dong Aisheng
2020-07-02  3:55     ` Anson Huang
2020-07-02  3:55       ` Anson Huang
2020-07-02  5:29       ` Dong Aisheng
2020-07-02  5:29         ` Dong Aisheng
2020-07-02  5:50         ` Anson Huang
2020-07-02  5:50           ` Anson Huang
     [not found] <DB3PR0402MB39160138993884DA7BFA1F4BF56D0@DB3PR0402MB3916.eurprd04.prod.outlook.com>
2020-07-02  6:56 ` [PATCH V4 2/5] clk: imx: Add clock configuration for ARMv7 platforms Arnd Bergmann
2020-07-02  7:01   ` Anson Huang
     [not found] <DB3PR0402MB3916DD6BD7E8608E4BEA2E25F56D0@DB3PR0402MB3916.eurprd04.prod.outlook.com>
2020-07-02  7:41 ` Arnd Bergmann
2020-07-02  7:52   ` Anson Huang
     [not found] <DB3PR0402MB3916FF11D39F358FCC302484F56D0@DB3PR0402MB3916.eurprd04.prod.outlook.com>
2020-07-02  8:03 ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.