mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] clk: make COMMON_CLK a visible symbol
@ 2024-01-18  9:07 Ahmad Fatoum
  2024-01-18  9:07 ` [PATCH 2/2] clk: select CLKDEV_LOOKUP from COMMON_CLK Ahmad Fatoum
  2024-01-19  6:50 ` [PATCH 1/2] clk: make COMMON_CLK a visible symbol Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-01-18  9:07 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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




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

* [PATCH 2/2] clk: select CLKDEV_LOOKUP from COMMON_CLK
  2024-01-18  9:07 [PATCH 1/2] clk: make COMMON_CLK a visible symbol Ahmad Fatoum
@ 2024-01-18  9:07 ` Ahmad Fatoum
  2024-01-19  6:50 ` [PATCH 1/2] clk: make COMMON_CLK a visible symbol Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-01-18  9:07 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

All platforms that select COMMON_CLK also select CLKDEV_LOOKUP,
therefore just select it in drivers/clk/Kconfig and drop the
CLKDEV_LOOKUP all over the place.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/Kconfig                | 14 --------------
 arch/arm/mach-imx/Kconfig       |  1 -
 arch/arm/mach-pxa/Kconfig       |  1 -
 arch/arm/mach-versatile/Kconfig |  1 -
 arch/arm/mach-zynq/Kconfig      |  1 -
 arch/kvx/Kconfig                |  1 -
 arch/mips/Kconfig               |  3 ---
 arch/riscv/Kconfig              |  1 -
 drivers/clk/Kconfig             |  1 +
 9 files changed, 1 insertion(+), 23 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 34415cd2cea0..86fc912ac49f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -56,7 +56,6 @@ config ARCH_AT91
 config ARCH_CLPS711X
 	bool "Cirrus Logic EP711x/EP721x/EP731x"
 	depends on 32BIT
-	select CLKDEV_LOOKUP
 	select CLOCKSOURCE_CLPS711X
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
@@ -95,7 +94,6 @@ config ARCH_MVEBU
 	depends on 32BIT
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
-	select CLKDEV_LOOKUP
 	select GPIOLIB
 	select HAS_DEBUG_LL
 	select HAVE_PBL_MULTI_IMAGES
@@ -111,7 +109,6 @@ config ARCH_MXS
 	select GPIOLIB
 	select GENERIC_GPIO
 	select COMMON_CLK
-	select CLKDEV_LOOKUP
 	select HAS_DEBUG_LL
 	select HAVE_PBL_MULTI_IMAGES
 
@@ -141,7 +138,6 @@ config ARCH_SOCFPGA
 	select ARM_SMP_TWD
 	select CPU_V7
 	select COMMON_CLK
-	select CLKDEV_LOOKUP
 
 config ARCH_TEGRA
 	bool "NVIDIA Tegra"
@@ -151,7 +147,6 @@ config ARCH_TEGRA
 	select HW_HAS_PCI
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
-	select CLKDEV_LOOKUP
 	select GPIOLIB
 	select GPIO_TEGRA
 	select HAVE_PBL_MULTI_IMAGES
@@ -167,7 +162,6 @@ config ARCH_UEMD
 	select CPU_ARM1176
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
-	select CLKDEV_LOOKUP
 	select OFDEVICE
 	select OFTREE
 	select CLOCKSOURCE_UEMD
@@ -198,7 +192,6 @@ config ARCH_ARM64_VIRT
 config ARCH_BCM283X
 	bool "Broadcom BCM283x based boards"
 	select GPIOLIB
-	select CLKDEV_LOOKUP
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
 	select CLOCKSOURCE_BCM283X
@@ -214,7 +207,6 @@ config ARCH_IMX
 	depends on ARCH_MULTIARCH
 	select GPIOLIB
 	select COMMON_CLK
-	select CLKDEV_LOOKUP
 	select WATCHDOG_IMX_RESET_SOURCE
 	select HAS_DEBUG_LL
 	select HAVE_PBL_MULTI_IMAGES
@@ -226,7 +218,6 @@ config ARCH_K3
 	select CPU_V8
 	select GPIOLIB
 	select COMMON_CLK
-	select CLKDEV_LOOKUP
 	select HAVE_PBL_MULTI_IMAGES
 	select HAS_DEBUG_LL
 	select COMMON_CLK_OF_PROVIDER
@@ -239,7 +230,6 @@ config ARCH_LAYERSCAPE
 	select HAS_DEBUG_LL
 	select HAVE_PBL_MULTI_IMAGES
 	select COMMON_CLK
-	select CLKDEV_LOOKUP
 	select COMMON_CLK_OF_PROVIDER
 	select HW_HAS_PCI
 	select OFTREE
@@ -260,7 +250,6 @@ config ARCH_ROCKCHIP
 	bool "Rockchip RX3xxx"
 	depends on ARCH_MULTIARCH
 	select COMMON_CLK
-	select CLKDEV_LOOKUP
 	select COMMON_CLK_OF_PROVIDER
 	select GPIOLIB
 	select PINCTRL
@@ -276,7 +265,6 @@ config ARCH_STM32MP
 	select ARCH_STM32
 	select CPU_V7
 	select HAVE_PBL_MULTI_IMAGES
-	select CLKDEV_LOOKUP
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
 	select HAS_DEBUG_LL
@@ -304,7 +292,6 @@ config ARCH_VEXPRESS
 	select CPU_V7
 	select ARM_AMBA
 	select AMBA_SP804
-	select CLKDEV_LOOKUP
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
 	select OFTREE
@@ -321,7 +308,6 @@ config ARCH_ZYNQMP
 	select ARM_SMCCC
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
-	select CLKDEV_LOOKUP
 	select GPIOLIB
 	select OFDEVICE
 	select OFTREE
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 5429b80b0fdf..b6936a755421 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -577,7 +577,6 @@ config MACH_VF610_TWR
 config MACH_ZII_VF610_DEV
 	bool "ZII VF610 Dev Family"
 	select ARCH_VF610
-	select CLKDEV_LOOKUP
 	select MACH_ZII_COMMON
 	select ARM_USE_COMPRESSED_DTB
 
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 711f8ed8d83c..a506c8e892d9 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -20,7 +20,6 @@ config ARCH_PXA3XX
        bool
        select CPU_XSC3
        select HAVE_CLK
-       select CLKDEV_LOOKUP
        select COMMON_CLK
 
 config ARCH_PXA310
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig
index 755f2e1dcc8c..89f50c270e43 100644
--- a/arch/arm/mach-versatile/Kconfig
+++ b/arch/arm/mach-versatile/Kconfig
@@ -9,7 +9,6 @@ config MACH_VERSATILEPB
 	bool
 	default y
 	select ARM_AMBA
-	select CLKDEV_LOOKUP
 	select CPU_ARM926T
 	select CPU_ARM1176
 
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig
index 3aac4506e390..451a344b2e64 100644
--- a/arch/arm/mach-zynq/Kconfig
+++ b/arch/arm/mach-zynq/Kconfig
@@ -13,7 +13,6 @@ config ZYNQ_DEBUG_LL_UART_BASE
 config ARCH_ZYNQ7000
 	bool
 	select CPU_V7
-	select CLKDEV_LOOKUP
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
 	select ARM_SMP_TWD
diff --git a/arch/kvx/Kconfig b/arch/kvx/Kconfig
index e18d02fffc11..2dea8cff8259 100644
--- a/arch/kvx/Kconfig
+++ b/arch/kvx/Kconfig
@@ -7,7 +7,6 @@ config KVX
 	select BOOTM_ELF
 	select BOOTM_OFTREE
 	select BOOTM_INITRD
-	select CLKDEV_LOOKUP
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
 	select ELF
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 89fc16be1335..63ba6aa9d5a7 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -81,7 +81,6 @@ config MACH_MIPS_MALTA
 	select HAS_DEBUG_LL
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
-	select CLKDEV_LOOKUP
 	select GPIOLIB
 	select HW_HAS_PCI
 	select HAVE_PBL_IMAGE
@@ -106,7 +105,6 @@ config MACH_MIPS_ATH79
 	select HAS_DEBUG_LL
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
-	select CLKDEV_LOOKUP
 	select OFTREE
 	select GPIOLIB
 
@@ -181,7 +179,6 @@ config CPU_LOONGSON1B
 	bool "Loongson 1B"
 	depends on SYS_HAS_CPU_LOONGSON1B
 	select CPU_GS232
-	select CLKDEV_LOOKUP
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
 	help
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index c31c39454a25..8f2cd089a213 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -8,7 +8,6 @@ config RISCV
 	select OFDEVICE
 	select COMMON_CLK
 	select COMMON_CLK_OF_PROVIDER
-	select CLKDEV_LOOKUP
 	select HAS_DMA
 	select ARCH_DMA_DEFAULT_COHERENT
 	select HAVE_PBL_IMAGE
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 685b34565d53..d2a61329e125 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -21,6 +21,7 @@ config COMMON_CLK
 	bool "Common Clock Framework"
 	depends on !HAVE_LEGACY_CLK
 	select HAVE_CLK
+	select CLKDEV_LOOKUP
 	help
 	  The common clock framework is a single definition of struct
 	  clk, useful across many platforms, as well as an
-- 
2.39.2




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

* Re: [PATCH 1/2] clk: make COMMON_CLK a visible symbol
  2024-01-18  9:07 [PATCH 1/2] clk: make COMMON_CLK a visible symbol Ahmad Fatoum
  2024-01-18  9:07 ` [PATCH 2/2] clk: select CLKDEV_LOOKUP from COMMON_CLK Ahmad Fatoum
@ 2024-01-19  6:50 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-01-19  6:50 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Thu, 18 Jan 2024 10:07:17 +0100, Ahmad Fatoum wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/2] clk: make COMMON_CLK a visible symbol
      https://git.pengutronix.de/cgit/barebox/commit/?id=98a65c0d6af8 (link may not be stable)
[2/2] clk: select CLKDEV_LOOKUP from COMMON_CLK
      https://git.pengutronix.de/cgit/barebox/commit/?id=f9c6eb75f564 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2024-01-19  6:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-18  9:07 [PATCH 1/2] clk: make COMMON_CLK a visible symbol Ahmad Fatoum
2024-01-18  9:07 ` [PATCH 2/2] clk: select CLKDEV_LOOKUP from COMMON_CLK Ahmad Fatoum
2024-01-19  6:50 ` [PATCH 1/2] clk: make COMMON_CLK a visible symbol Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox