[PATCH 1/2] clk: make COMMON_CLK a visible symbol

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Jan 18 01:07:17 PST 2024


So far, we expected platforms to select COMMON_CLK if they have a clock
controller that's covered by the common clk framework and HAVE_CLK if
they have a legacy clock driver.

With the addition of SCMI clocks, platforms, especially virtualized ones,
that previously didn't need clock support may now want access to them.

Instead of having to select COMMON_CLK from such platforms on the
off-chance that SCMI clocks may need to be used, just make COMMON_CLK
user visible, so it can be selected as needed. As COMMON_CLK needs to
conflict with legacy clock support, we also add a symbol for that and
start selecting it where appropriate,

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/arm/Kconfig            |  5 +----
 arch/arm/mach-at91/Kconfig  |  4 ++++
 arch/arm/mach-at91/Makefile |  4 +---
 drivers/clk/Kconfig         | 21 ++++++++++++++++++++-
 4 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 089ce43c88bd..34415cd2cea0 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -120,7 +120,7 @@ config ARCH_NOMADIK
 	depends on 32BIT
 	select CPU_ARM926T
 	select CLOCKSOURCE_NOMADIK
-	select HAVE_CLK
+	select HAVE_LEGACY_CLK
 	help
 	  Support for the Nomadik platform by ST-Ericsson
 
@@ -229,7 +229,6 @@ config ARCH_K3
 	select CLKDEV_LOOKUP
 	select HAVE_PBL_MULTI_IMAGES
 	select HAS_DEBUG_LL
-	select HAVE_CLK
 	select COMMON_CLK_OF_PROVIDER
 	select PM_GENERIC_DOMAINS
 
@@ -281,7 +280,6 @@ config ARCH_STM32MP
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
 	select HAS_DEBUG_LL
-	select HAVE_CLK
 	select GPIOLIB
 	select ARCH_HAS_RESET_CONTROLLER
 	select ARM_AMBA
@@ -294,7 +292,6 @@ config ARCH_VERSATILE
 	select GPIOLIB
 	select ARM_AMBA
 	select AMBA_SP804
-	select HAVE_CLK
 	select HAS_DEBUG_LL
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 94e8e525a2f0..1049eb69570d 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -20,6 +20,10 @@ config MACH_AT91SAM9263EK_DT
 	  Enabled for at91sam9263ek - evaluation kit.
 	  But only if we need the device tree (bootstrap do not use DT)
 
+config HAVE_AT91_LEGACY_CLK
+	def_bool !COMMON_CLK_OF_PROVIDER
+	select HAVE_LEGACY_CLK
+
 config HAVE_AT91_SMD
 	bool
 
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index c4532959556e..7d7f27749f65 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -4,9 +4,7 @@ obj-y += setup.o aic.o
 lwl-y += at91_pmc_ll.o ddramc_ll.o at91sam9_sdramc_ll.o matrix.o
 lwl-$(CONFIG_CLOCKSOURCE_ATMEL_PIT) += early_udelay.o
 
-ifeq ($(CONFIG_COMMON_CLK_OF_PROVIDER),)
-obj-y += clock.o
-endif
+obj-$(CONFIG_HAVE_AT91_LEGACY_CLK) += clock.o
 
 obj-$(CONFIG_CMD_AT91_BOOT_TEST) += boot_test_cmd.o
 
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 3e032469d09b..685b34565d53 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -1,13 +1,32 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config HAVE_CLK
 	bool
+	help
+	  The <linux/clk.h> calls support software clock gating and
+	  thus are a key power management tool on many systems.
+
+config HAVE_LEGACY_CLK
+	select HAVE_CLK
+	bool
+	help
+	  Select this option when the clock API in <linux/clk.h> is implemented
+	  by platform/architecture code. This method is deprecated. Modern
+	  code should select COMMON_CLK instead and not define a custom
+	  'struct clk'.
 
 config CLKDEV_LOOKUP
 	bool
 
 config COMMON_CLK
+	bool "Common Clock Framework"
+	depends on !HAVE_LEGACY_CLK
 	select HAVE_CLK
-	bool
+	help
+	  The common clock framework is a single definition of struct
+	  clk, useful across many platforms, as well as an
+	  implementation of the clock API in include/linux/clk.h.
+	  Architectures utilizing the common struct clk should select
+	  this option.
 
 config COMMON_CLK_OF_PROVIDER
 	bool
-- 
2.39.2




More information about the barebox mailing list