clk: spacemit: Fix module build for spacemit common ccu driver
Subsystems (3)
v4 cover clk: spacemit: Fix module build for spacemit common ccu driver
Currently, the SPACEMIT_CCU entry is only a switch for enabling entry SPACEMIT_K1_CCU. It does not guide the build for common clock codes even if it is a tristate entry. This makes this entry useless.
Change the Makefile to add a separate build for common clock logic, so the SPACEMIT_CCU entry takes effect, also add necessary MODULE_LICENSE()/MODULE_DESCRIPTION()/EXPORT_SYMBOL() for the module build.
This patch mostly fix the build problem, and it should serve as a basic for the incoming K3 clock driver. See link.
Change from v3:
1. patch 1: change Makefile to trigger module build actually
2. patch 2: new patch for remove internal Kconfig entry
Change from v2:
1. change namespace name to CLK_SPACEMIT
Change from v1:
1. Use EXPORT_SYMBOL_NS_GPL to export clock ops
Inochi Amaoto (2):
clk: spacemit: Respect Kconfig setting when building modules
clk: spacemit: Hide common clock driver from user controller
drivers/clk/spacemit/Kconfig | 14 ++++++-------- drivers/clk/spacemit/Makefile | 9 +++++++-- drivers/clk/spacemit/ccu-k1.c | 1 + drivers/clk/spacemit/ccu_common.c | 6 ++++++ drivers/clk/spacemit/ccu_ddn.c | 1 + drivers/clk/spacemit/ccu_mix.c | 9 +++++++++ drivers/clk/spacemit/ccu_pll.c | 1 + 7 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 drivers/clk/spacemit/ccu_common.c
--
2.52.0
PATCH v4 1/2 clk: spacemit: Respect Kconfig setting when building modules
Currently, the SPACEMIT_CCU entry is only a switch for enabling entry SPACEMIT_K1_CCU. It does not guide the build for common clock codes even if it is a tristate entry. This makes this entry useless.
Change the Makefile to add a separate build for common clock logic, so the SPACEMIT_CCU entry takes effect, also add necessary MODULE_LICENSE()/MODULE_DESCRIPTION()/EXPORT_SYMBOL() for the module build.
--- drivers/clk/spacemit/Makefile | 9 +++++++-- drivers/clk/spacemit/ccu-k1.c | 1 + drivers/clk/spacemit/ccu_common.c | 6 ++++++ drivers/clk/spacemit/ccu_ddn.c | 1 + drivers/clk/spacemit/ccu_mix.c | 9 +++++++++ drivers/clk/spacemit/ccu_pll.c | 1 + 6 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 drivers/clk/spacemit/ccu_common.c
drivers/clk/spacemit/Makefile +7 -2
@@ -1,5 +1,10 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_SPACEMIT_K1_CCU) = spacemit-ccu-k1.o -spacemit-ccu-k1-y = ccu_pll.o ccu_mix.o ccu_ddn.o +obj-$(CONFIG_SPACEMIT_CCU) += spacemit-ccu.o +spacemit-ccu-y += ccu_common.o +spacemit-ccu-y += ccu_pll.o +spacemit-ccu-y += ccu_mix.o +spacemit-ccu-y += ccu_ddn.o + +obj-$(CONFIG_SPACEMIT_K1_CCU) += spacemit-ccu-k1.o spacemit-ccu-k1-y += ccu-k1.o
drivers/clk/spacemit/ccu-k1.c +1 -0
@@ -1204,6 +1204,7 @@ static struct platform_driver k1_ccu_driver = { };module_platform_driver (k1_ccu_driver); +MODULE_IMPORT_NS ("CLK_SPACEMIT" );MODULE_DESCRIPTION ("SpacemiT K1 CCU driver" );MODULE_AUTHOR ("Haylen Chu <[email protected]>" );MODULE_LICENSE ("GPL" );
drivers/clk/spacemit/ccu_common.c new file +6 -0
@@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include <linux/module.h> + +MODULE_DESCRIPTION ("SpacemiT CCU common clock driver" ); +MODULE_LICENSE ("GPL" );
drivers/clk/spacemit/ccu_ddn.c +1 -0
@@ -84,3 +84,4 @@ const struct clk_ops spacemit_ccu_ddn_ops = { .determine_rate = ccu_ddn_determine_rate, .set_rate = ccu_ddn_set_rate, }; +EXPORT_SYMBOL_NS_GPL (spacemit_ccu_ddn_ops,"CLK_SPACEMIT" );
drivers/clk/spacemit/ccu_mix.c +9 -0
@@ -198,24 +198,28 @@ const struct clk_ops spacemit_ccu_gate_ops = { .enable = ccu_gate_enable, .is_enabled = ccu_gate_is_enabled, }; +EXPORT_SYMBOL_NS_GPL (spacemit_ccu_gate_ops,"CLK_SPACEMIT" );const struct clk_ops spacemit_ccu_factor_ops = { .determine_rate = ccu_factor_determine_rate, .recalc_rate = ccu_factor_recalc_rate, .set_rate = ccu_factor_set_rate, }; +EXPORT_SYMBOL_NS_GPL (spacemit_ccu_factor_ops,"CLK_SPACEMIT" );const struct clk_ops spacemit_ccu_mux_ops = { .determine_rate = ccu_mix_determine_rate, .get_parent = ccu_mux_get_parent, .set_parent = ccu_mux_set_parent, }; +EXPORT_SYMBOL_NS_GPL (spacemit_ccu_mux_ops,"CLK_SPACEMIT" );const struct clk_ops spacemit_ccu_div_ops = { .determine_rate = ccu_mix_determine_rate, .recalc_rate = ccu_div_recalc_rate, .set_rate = ccu_mix_set_rate, }; +EXPORT_SYMBOL_NS_GPL (spacemit_ccu_div_ops,"CLK_SPACEMIT" );const struct clk_ops spacemit_ccu_factor_gate_ops = { .disable = ccu_gate_disable,
@@ -226,6 +230,7 @@ const struct clk_ops spacemit_ccu_factor_gate_ops = { .recalc_rate = ccu_factor_recalc_rate, .set_rate = ccu_factor_set_rate, }; +EXPORT_SYMBOL_NS_GPL (spacemit_ccu_factor_gate_ops,"CLK_SPACEMIT" );const struct clk_ops spacemit_ccu_mux_gate_ops = { .disable = ccu_gate_disable,
@@ -236,6 +241,7 @@ const struct clk_ops spacemit_ccu_mux_gate_ops = { .get_parent = ccu_mux_get_parent, .set_parent = ccu_mux_set_parent, }; +EXPORT_SYMBOL_NS_GPL (spacemit_ccu_mux_gate_ops,"CLK_SPACEMIT" );const struct clk_ops spacemit_ccu_div_gate_ops = { .disable = ccu_gate_disable,
@@ -246,6 +252,7 @@ const struct clk_ops spacemit_ccu_div_gate_ops = { .recalc_rate = ccu_div_recalc_rate, .set_rate = ccu_mix_set_rate, }; +EXPORT_SYMBOL_NS_GPL (spacemit_ccu_div_gate_ops,"CLK_SPACEMIT" );const struct clk_ops spacemit_ccu_mux_div_gate_ops = { .disable = ccu_gate_disable,
@@ -259,6 +266,7 @@ const struct clk_ops spacemit_ccu_mux_div_gate_ops = { .recalc_rate = ccu_div_recalc_rate, .set_rate = ccu_mix_set_rate, }; +EXPORT_SYMBOL_NS_GPL (spacemit_ccu_mux_div_gate_ops,"CLK_SPACEMIT" );const struct clk_ops spacemit_ccu_mux_div_ops = { .get_parent = ccu_mux_get_parent,
@@ -268,3 +276,4 @@ const struct clk_ops spacemit_ccu_mux_div_ops = { .recalc_rate = ccu_div_recalc_rate, .set_rate = ccu_mix_set_rate, }; +EXPORT_SYMBOL_NS_GPL (spacemit_ccu_mux_div_ops,"CLK_SPACEMIT" );
drivers/clk/spacemit/ccu_pll.c +1 -0
@@ -157,3 +157,4 @@ const struct clk_ops spacemit_ccu_pll_ops = { .determine_rate = ccu_pll_determine_rate, .is_enabled = ccu_pll_is_enabled, }; +EXPORT_SYMBOL_NS_GPL (spacemit_ccu_pll_ops,"CLK_SPACEMIT" );
Signature · 1 line
2.52.0
PATCH v4 2/2 clk: spacemit: Hide common clock driver from user controller
In reply to Inochi AmaotoSince the common clock driver is only a dependency for other spacemit clock driver, it should not be enabled individually, so hide this in the Kconfig UI and let other spacemit clock driver select it.
--- drivers/clk/spacemit/Kconfig | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/clk/spacemit/Kconfig +6 -8
@@ -1,19 +1,17 @@ # SPDX-License-Identifier: GPL-2.0-only +menu "Clock support for SpacemiT platforms" + depends on ARCH_SPACEMIT || COMPILE_TEST + config SPACEMIT_CCU - tristate "Clock support for SpacemiT SoCs" - depends on ARCH_SPACEMIT || COMPILE_TEST + tristate select AUXILIARY_BUS select MFD_SYSCON - help - Say Y to enable clock controller unit support for SpacemiT SoCs. - -if SPACEMIT_CCU config SPACEMIT_K1_CCU tristate "Support for SpacemiT K1 SoC" - depends on ARCH_SPACEMIT || COMPILE_TEST + select SPACEMIT_CCU help Support for clock controller unit in SpacemiT K1 SoC. -endif +endmenu
Signature · 1 line
2.52.0
Hi Inochi,
Quoted 9 lines · Inochi Amaoto
Currently, the
SPACEMIT_CCUentry is only a switch for enabling entrySPACEMIT_K1_CCU. It does not guide the build for common clock codes even if it is a tristate entry. This makes this entry useless.Change the
Makefileto add a separate build for common clock logic, so theSPACEMIT_CCUentry takes effect, also add necessary MODULE_LICENSE()/MODULE_DESCRIPTION()/EXPORT_SYMBOL() for the module build.
Quoted 5 lines
This patch mostly fix the build problem, and it should serve as a basic for the incoming K3 clock driver. See link.
this series looks good to me, so
Signature · 1 line
Yixun Lan (dlan)
Yixun Lan
AppliedQuoted 10 lines · Inochi Amaoto
Currently, the
SPACEMIT_CCUentry is only a switch for enabling entrySPACEMIT_K1_CCU. It does not guide the build for common clock codes even if it is a tristate entry. This makes this entry useless.Change the
Makefileto add a separate build for common clock logic, so theSPACEMIT_CCUentry takes effect, also add necessary MODULE_LICENSE()/MODULE_DESCRIPTION()/EXPORT_SYMBOL() for the module build.[...]
Applied, thanks!
[1/2] clk: spacemit: Respect Kconfig setting when building modules
https://github.com/spacemit-com/linux/commit/5ec8cbbc54c82c0bdae4dbf0e5aecf9817bde2b9 [2/2] clk: spacemit: Hide common clock driver from user controller https://github.com/spacemit-com/linux/commit/99735a742f7e9a3e7f4cb6c58edf1b38101e7657
Best regards,
Signature · 1 line
Yixun Lan