Skip to contentSkip to conversation

Allow COMMON_CLK to be selectable

PATCH Superseded Stephen Boyd 8 participants 18 messages Apr 5, 2020 – Apr 7, 2020 1 message not in the archive

Subsystems (12)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Stephen Boyd

author maintainer
#0 lore raw

cover Allow COMMON_CLK to be selectable

This patch series cleans up a handful of selects that were redundant and deletes presumably dead code with the goal of making it possible to add kunit tests for the CCF in the future. To do that, we introduce a "legacy" clk Kconfig option to mark code that hasn't migrated to the common clk framework and then make the COMMON_CLK config option visible in the menuconfig as long as that legacy option isn't enabled. I've also included a couple patches at the end that may be more controversial but helped me consolidate all this logic/code.

I haven't done more than compile test a few configs for arm, arm64, h8300, and mips. More testing is welcome.

The plan is that I'll just merge the whole pile through the clk tree. If the first five patches or the last three patches are better going through another tree like arm-soc or architecture trees that's fine too, but there are potential conflicts between trees so maybe it's better to just leave it all in one tree.

Stephen Boyd (9):
ARM: Remove redundant COMMON_CLK selects
ARM: Remove redundant CLKDEV_LOOKUP selects
arm64: tegra: Remove redundant CLKDEV_LOOKUP selects
h8300: Remove redundant CLKDEV_LOOKUP selects
MIPS: Remove redundant CLKDEV_LOOKUP selects
clk: Allow the common clk framework to be selectable
ARM: mmp: Remove legacy clk code
MIPS: Loongson64: Drop asm/clock.h include
clk: Move HAVE_CLK config out of architecture layer

Cc Alexander Shiyan <[email protected]>
Cc "Andreas Färber" <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Aurelien Jacquiot <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Guan Xuetao <[email protected]>
Cc Jiaxun Yang <[email protected]>
Cc Lubomir Rintel <[email protected]>
Cc Manivannan Sadhasivam <[email protected]>
Cc Mark Brown <[email protected]>
Cc Mark Salter <[email protected]>
Cc Paul Burton <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Rich Felker <[email protected]>
Cc Russell King <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Thomas Bogendoerfer <[email protected]>
Cc Tony Prisk <[email protected]>
Cc Will Deacon <[email protected]>
Cc Yoshinori Sato <[email protected]>
 arch/Kconfig                     |   6 --
 arch/arm/Kconfig                 |   5 +-
 arch/arm/mach-actions/Kconfig    |   1 -
 arch/arm/mach-clps711x/Kconfig   |   1 -
 arch/arm/mach-mmp/Kconfig        |   1 -
 arch/arm/mach-mmp/Makefile       |   6 --
 arch/arm/mach-mmp/clock-mmp2.c   | 114 -------------------------------
 arch/arm/mach-mmp/clock-pxa168.c |  94 -------------------------
 arch/arm/mach-mmp/clock-pxa910.c |  70 -------------------
 arch/arm/mach-mmp/clock.c        | 105 ----------------------------
 arch/arm/mach-mmp/clock.h        |  65 ------------------
 arch/arm/mach-vt8500/Kconfig     |   1 -
 arch/arm64/Kconfig.platforms     |   1 -
 arch/c6x/Kconfig                 |   1 +
 arch/h8300/Kconfig               |   1 -
 arch/m68k/Kconfig.cpu            |   2 +-
 arch/mips/Kconfig                |   8 +--
 arch/mips/loongson2ef/Kconfig    |   2 +-
 arch/mips/loongson64/smp.c       |   1 -
 arch/sh/boards/Kconfig           |   5 ++
 arch/unicore32/Kconfig           |   2 +-
 drivers/clk/Kconfig              |  23 +++++--
 22 files changed, 34 insertions(+), 481 deletions(-)
 delete mode 100644 arch/arm/mach-mmp/clock-mmp2.c
 delete mode 100644 arch/arm/mach-mmp/clock-pxa168.c
 delete mode 100644 arch/arm/mach-mmp/clock-pxa910.c
 delete mode 100644 arch/arm/mach-mmp/clock.c
 delete mode 100644 arch/arm/mach-mmp/clock.h

base-commit: 7111951b8d4973bda27ff663f2cf18b663d15b48

Signature · 1 line
Sent by a computer, using git, on the internet
author maintainer
#9 lore raw

PATCH 6/9 clk: Allow the common clk framework to be selectable

Enable build testing and configuration control of the common clk framework so that more code coverage and testing can be done on the common clk framework across various architectures. This also nicely removes the requirement that architectures must select the framework when they don't use it in architecture code.

There's one snag with doing this, and that's making sure that randconfig builds don't select this option when some architecture or platform implements 'struct clk' outside of the common clk framework. Introduce a new config option 'HAVE_LEGACY_CLK' to indicate those platforms that haven't migrated to the common clk framework and therefore shouldn't be allowed to select this new config option. Also add a note that we hope one day to remove this config entirely.

Based on a patch by Mark Brown <[email protected]>.

Cc Mark Brown <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Mark Salter <[email protected]>
Cc Aurelien Jacquiot <[email protected]>
Cc Jiaxun Yang <[email protected]>
Cc Guan Xuetao <[email protected]>
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Yoshinori Sato <[email protected]>
Cc Rich Felker <[email protected]>
Cc Thomas Bogendoerfer <[email protected]>
---
 arch/arm/Kconfig              |  2 ++
 arch/c6x/Kconfig              |  1 +
 arch/m68k/Kconfig.cpu         |  2 +-
 arch/mips/Kconfig             |  6 ++++--
 arch/mips/loongson2ef/Kconfig |  2 +-
 arch/sh/boards/Kconfig        |  5 +++++
 arch/unicore32/Kconfig        |  2 +-
 drivers/clk/Kconfig           | 17 +++++++++++++----
 8 files changed, 28 insertions(+), 9 deletions(-)
arch/arm/Kconfig +2 -0
index eeabdc5a3dd2..0606e1bbd7b6 100644
@@ -364,6 +364,7 @@ config ARCH_EP93XX
 	select CPU_ARM920T
 	select GENERIC_CLOCKEVENTS
 	select GPIOLIB
+	select HAVE_LEGACY_CLK
 	help
 	  This enables support for the Cirrus EP93xx series of CPUs.
 
@@ -522,6 +523,7 @@ config ARCH_OMAP1
 	select GENERIC_IRQ_MULTI_HANDLER
 	select GPIOLIB
 	select HAVE_IDE
+	select HAVE_LEGACY_CLK
 	select IRQ_DOMAIN
 	select NEED_MACH_IO_H if PCCARD
 	select NEED_MACH_MEMORY_H
arch/c6x/Kconfig +1 -0
index e65e8d82442a..6444ebfd06a6 100644
@@ -11,6 +11,7 @@ config C6X
 	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select CLKDEV_LOOKUP
+	select HAVE_LEGACY_CLK
 	select GENERIC_ATOMIC64
 	select GENERIC_IRQ_SHOW
 	select HAVE_ARCH_TRACEHOOK
arch/m68k/Kconfig.cpu +1 -1
index 60ac1cd8b96f..bd2d29c22a10 100644
@@ -28,7 +28,7 @@ config COLDFIRE
 	select CPU_HAS_NO_MULDIV64
 	select GENERIC_CSUM
 	select GPIOLIB
-	select HAVE_CLK
+	select HAVE_LEGACY_CLK
 
 endchoice
 
arch/mips/Kconfig +4 -2
index e53a8dd5c19b..fa02c715ab25 100644
@@ -181,7 +181,7 @@ config AR7
 	select SYS_SUPPORTS_ZBOOT_UART16550
 	select GPIOLIB
 	select VLYNQ
-	select HAVE_CLK
+	select HAVE_LEGACY_CLK
 	help
 	  Support for the Texas Instruments AR7 System-on-a-Chip
 	  family: TNETD7100, 7200 and 7300.
@@ -296,9 +296,9 @@ config BCM63XX
 	select SYS_HAS_EARLY_PRINTK
 	select SWAP_IO_SPACE
 	select GPIOLIB
-	select HAVE_CLK
 	select MIPS_L1_CACHE_SHIFT_4
 	select CLKDEV_LOOKUP
+	select HAVE_LEGACY_CLK
 	help
 	  Support for BCM63XX based boards
 
@@ -419,6 +419,7 @@ config LANTIQ
 	select SWAP_IO_SPACE
 	select BOOT_RAW
 	select CLKDEV_LOOKUP
+	select HAVE_LEGACY_CLK
 	select USE_OF
 	select PINCTRL
 	select PINCTRL_LANTIQ
@@ -656,6 +657,7 @@ config RALINK
 	select SYS_SUPPORTS_MIPS16
 	select SYS_HAS_EARLY_PRINTK
 	select CLKDEV_LOOKUP
+	select HAVE_LEGACY_CLK
 	select ARCH_HAS_RESET_CONTROLLER
 	select RESET_CONTROLLER
 
arch/mips/loongson2ef/Kconfig +1 -1
index 595dd48e1e4d..c9ec43afde73 100644
@@ -46,7 +46,7 @@ config LEMOTE_MACH2F
 	select CSRC_R4K if ! MIPS_EXTERNAL_TIMER
 	select DMA_NONCOHERENT
 	select GENERIC_ISA_DMA_SUPPORT_BROKEN
-	select HAVE_CLK
+	select HAVE_LEGACY_CLK
 	select FORCE_PCI
 	select I8259
 	select IRQ_MIPS_CPU
arch/sh/boards/Kconfig +5 -0
index cee24c308337..fb0ca0c1efe1 100644
@@ -7,6 +7,11 @@ config SOLUTION_ENGINE
 config SH_ALPHA_BOARD
 	bool
 
+config SH_CUSTOM_CLK
+	def_bool y
+	depends on !SH_DEVICE_TREE
+	select HAVE_LEGACY_CLK
+
 config SH_DEVICE_TREE
 	bool
 	select OF
arch/unicore32/Kconfig +1 -1
index 41fe944005f8..11ba1839d198 100644
@@ -70,7 +70,7 @@ config ARCH_PUV3
 	def_bool y
 	select CPU_UCV2
 	select GENERIC_CLOCKEVENTS
-	select HAVE_CLK
+	select HAVE_LEGACY_CLK
 	select GPIOLIB
 
 # CONFIGs for ARCH_PUV3
drivers/clk/Kconfig +13 -4
index bcb257baed06..890bed62196d 100644
@@ -7,8 +7,18 @@ config CLKDEV_LOOKUP
 config HAVE_CLK_PREPARE
 	bool
 
-config COMMON_CLK
+config HAVE_LEGACY_CLK # TODO: Remove once all legacy users are migrated
 	bool
+	select HAVE_CLK
+	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'.
+
+menuconfig COMMON_CLK
+	bool "Common Clock Framework"
+	depends on !HAVE_LEGACY_CLK
 	select HAVE_CLK_PREPARE
 	select CLKDEV_LOOKUP
 	select SRCU
@@ -20,8 +30,7 @@ config COMMON_CLK
 	  Architectures utilizing the common struct clk should select
 	  this option.
 
-menu "Common Clock Framework"
-	depends on COMMON_CLK
+if COMMON_CLK
 
 config COMMON_CLK_WM831X
 	tristate "Clock driver for WM831x/2x PMICs"
@@ -362,4 +371,4 @@ source "drivers/clk/ti/Kconfig"
 source "drivers/clk/uniphier/Kconfig"
 source "drivers/clk/zynqmp/Kconfig"
 
-endmenu
+endif
Signature · 1 line
Sent by a computer, using git, on the internet
author maintainer
#1 lore raw

PATCH 1/9 ARM: Remove redundant COMMON_CLK selects

In reply to Stephen Boyd

The mulitplatform config already selects COMMON_CLK, so selecting it again is not useful. Remove these selects from ARM platforms that are part of the multiplatform build.

Cc "Andreas Färber" <[email protected]>
Cc Manivannan Sadhasivam <[email protected]>
Cc Russell King <[email protected]>
Cc Alexander Shiyan <[email protected]>
Cc Lubomir Rintel <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 arch/arm/mach-actions/Kconfig  | 1 -
 arch/arm/mach-clps711x/Kconfig | 1 -
 arch/arm/mach-mmp/Kconfig      | 1 -
 3 files changed, 3 deletions(-)
arch/arm/mach-actions/Kconfig +0 -1
index b5e0ac965ec0..00fb4babccdd 100644
@@ -7,7 +7,6 @@ menuconfig ARCH_ACTIONS
 	select ARM_GLOBAL_TIMER
 	select CACHE_L2X0
 	select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
-	select COMMON_CLK
 	select GENERIC_IRQ_CHIP
 	select HAVE_ARM_SCU if SMP
 	select HAVE_ARM_TWD if SMP
arch/arm/mach-clps711x/Kconfig +0 -1
index fc9188b54dd6..ba497a2032e9 100644
@@ -5,7 +5,6 @@ menuconfig ARCH_CLPS711X
 	select AUTO_ZRELADDR
 	select TIMER_OF
 	select CLPS711X_TIMER
-	select COMMON_CLK
 	select CPU_ARM720T
 	select GENERIC_CLOCKEVENTS
 	select GPIOLIB
arch/arm/mach-mmp/Kconfig +0 -1
index b58a03b18bde..6fe1550f43ec 100644
@@ -110,7 +110,6 @@ config MACH_MMP_DT
 	depends on ARCH_MULTI_V5
 	select PINCTRL
 	select PINCTRL_SINGLE
-	select COMMON_CLK
 	select ARCH_HAS_RESET_CONTROLLER
 	select CPU_MOHAWK
 	help
Signature · 1 line
Sent by a computer, using git, on the internet
author maintainer
#4 lore raw

PATCH 2/9 ARM: Remove redundant CLKDEV_LOOKUP selects

In reply to Stephen Boyd

These platforms select COMMON_CLK indirectly through use of the ARCH_MULTIPLATFORM config option that they depend on implicitly via some V7/V6/V5 multi platform config option. The COMMON_CLK config option already selects CLKDEV_LOOKUP so it's redundant to have this selected again.

Cc Tony Prisk <[email protected]>
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 arch/arm/Kconfig             | 3 ---
 arch/arm/mach-vt8500/Kconfig | 1 -
 2 files changed, 4 deletions(-)
arch/arm/Kconfig +0 -3
index 97864aabc2a6..eeabdc5a3dd2 100644
@@ -435,7 +435,6 @@ config ARCH_PXA
 	select ARM_CPU_SUSPEND if PM
 	select AUTO_ZRELADDR
 	select COMMON_CLK
-	select CLKDEV_LOOKUP
 	select CLKSRC_PXA
 	select CLKSRC_MMIO
 	select TIMER_OF
@@ -474,7 +473,6 @@ config ARCH_SA1100
 	bool "SA1100-based"
 	select ARCH_MTD_XIP
 	select ARCH_SPARSEMEM_ENABLE
-	select CLKDEV_LOOKUP
 	select CLKSRC_MMIO
 	select CLKSRC_PXA
 	select TIMER_OF if OF
@@ -495,7 +493,6 @@ config ARCH_SA1100
 config ARCH_S3C24XX
 	bool "Samsung S3C24XX SoCs"
 	select ATAGS
-	select CLKDEV_LOOKUP
 	select CLKSRC_SAMSUNG_PWM
 	select GENERIC_CLOCKEVENTS
 	select GPIO_SAMSUNG
arch/arm/mach-vt8500/Kconfig +0 -1
index 8841199058ea..d01cdd9ad9c7 100644
@@ -2,7 +2,6 @@
 config ARCH_VT8500
 	bool
 	select GPIOLIB
-	select CLKDEV_LOOKUP
 	select VT8500_TIMER
 	select PINCTRL
 	help
Signature · 1 line
Sent by a computer, using git, on the internet
author maintainer
#8 lore raw

PATCH 5/9 MIPS: Remove redundant CLKDEV_LOOKUP selects

In reply to Stephen Boyd

The ATH79 config selects COMMON_CLK already, and the COMMON_CLK config option already selects CLKDEV_LOOKUP, and CLKDEV_LOOKUP already selects HAVE_CLK so it's redundant to have these selected again.

---
 arch/mips/Kconfig | 2 --
 1 file changed, 2 deletions(-)
arch/mips/Kconfig +0 -2
index 797d7f1ad5fe..e53a8dd5c19b 100644
@@ -209,9 +209,7 @@ config ATH79
 	select DMA_NONCOHERENT
 	select GPIOLIB
 	select PINCTRL
-	select HAVE_CLK
 	select COMMON_CLK
-	select CLKDEV_LOOKUP
 	select IRQ_MIPS_CPU
 	select SYS_HAS_CPU_MIPS32_R2
 	select SYS_HAS_EARLY_PRINTK
Signature · 1 line
Sent by a computer, using git, on the internet
author maintainer
#16 lore raw

PATCH 7/9 ARM: mmp: Remove legacy clk code

In reply to Stephen Boyd

Remove all the legacy clk code that supports a non-common clk framework implementation of 'struct clk' in mach-mmp. This code doesn't look to be compiled anymore given that the MMP is fully supported in the multi-platform config via ARCH_MULTIPLATFORM as of commit 377524dc4d77 ("ARM: mmp: move into ARCH_MULTIPLATFORM"). The ARCH_MULTIPLATFORM config selects COMMON_CLK and therefore the Makefile rule can never actually compile the code in these files.

Cc Lubomir Rintel <[email protected]>
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 arch/arm/mach-mmp/Makefile       |   6 --
 arch/arm/mach-mmp/clock-mmp2.c   | 114 -------------------------------
 arch/arm/mach-mmp/clock-pxa168.c |  94 -------------------------
 arch/arm/mach-mmp/clock-pxa910.c |  70 -------------------
 arch/arm/mach-mmp/clock.c        | 105 ----------------------------
 arch/arm/mach-mmp/clock.h        |  65 ------------------
 6 files changed, 454 deletions(-)
 delete mode 100644 arch/arm/mach-mmp/clock-mmp2.c
 delete mode 100644 arch/arm/mach-mmp/clock-pxa168.c
 delete mode 100644 arch/arm/mach-mmp/clock-pxa910.c
 delete mode 100644 arch/arm/mach-mmp/clock.c
 delete mode 100644 arch/arm/mach-mmp/clock.h
arch/arm/mach-mmp/Makefile +0 -6
index 7b3a7f979eec..e3758f7e1fe7 100644
@@ -12,12 +12,6 @@ obj-$(CONFIG_CPU_PXA910)	+= pxa910.o
 obj-$(CONFIG_CPU_MMP2)		+= mmp2.o
 obj-$(CONFIG_MMP_SRAM)		+= sram.o
 
-ifeq ($(CONFIG_COMMON_CLK), )
-obj-y				+= clock.o
-obj-$(CONFIG_CPU_PXA168)	+= clock-pxa168.o
-obj-$(CONFIG_CPU_PXA910)	+= clock-pxa910.o
-obj-$(CONFIG_CPU_MMP2)		+= clock-mmp2.o
-endif
 ifeq ($(CONFIG_PM),y)
 obj-$(CONFIG_CPU_PXA910)	+= pm-pxa910.o
 obj-$(CONFIG_CPU_MMP2)		+= pm-mmp2.o
arch/arm/mach-mmp/clock-mmp2.c deleted +0 -114

114 lines not on this page · raw message

arch/arm/mach-mmp/clock-pxa168.c deleted +0 -94

94 lines not on this page · raw message

arch/arm/mach-mmp/clock-pxa910.c deleted +0 -70

70 lines not on this page · raw message

arch/arm/mach-mmp/clock.c deleted +0 -105

105 lines not on this page · raw message

arch/arm/mach-mmp/clock.h deleted +0 -65

65 lines not on this page · raw message

Signature · 1 line
Sent by a computer, using git, on the internet
author maintainer
#18 lore raw

PATCH 9/9 clk: Move HAVE_CLK config out of architecture layer

In reply to Stephen Boyd

The implementation of 'struct clk' is not really an architectual detail anymore now that most architectures have migrated to the common clk framework. To sway new architecture ports away from trying to implement their own 'struct clk', move the config next to the common clk framework config.

Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 arch/Kconfig        | 6 ------
 drivers/clk/Kconfig | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)
arch/Kconfig +0 -6
index 17fe351cdde0..903ac5547ee8 100644
@@ -321,12 +321,6 @@ config HAVE_FUNCTION_ARG_ACCESS_API
 	  the API needed to access function arguments from pt_regs,
 	  declared in asm/ptrace.h
 
-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_HW_BREAKPOINT
 	bool
 	depends on PERF_EVENTS
drivers/clk/Kconfig +6 -0
index 890bed62196d..6ea0631e3956 100644
@@ -1,5 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0
 
+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 CLKDEV_LOOKUP
 	bool
 	select HAVE_CLK
Signature · 1 line
Sent by a computer, using git, on the internet
author maintainer
#5 lore raw

PATCH 3/9 arm64: tegra: Remove redundant CLKDEV_LOOKUP selects

In reply to Stephen Boyd

The arm64 architecture selects COMMON_CLK at the toplevel ARM64 config. The COMMON_CLK config option already selects CLKDEV_LOOKUP so it's redundant to have this selected again for the Tegra specific config.

Cc Paul Walmsley <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 arch/arm64/Kconfig.platforms | 1 -
 1 file changed, 1 deletion(-)
arch/arm64/Kconfig.platforms +0 -1
index b2b504ea6fd6..5d5d91feca44 100644
@@ -236,7 +236,6 @@ config ARCH_TEGRA
 	bool "NVIDIA Tegra SoC Family"
 	select ARCH_HAS_RESET_CONTROLLER
 	select ARM_GIC_PM
-	select CLKDEV_LOOKUP
 	select CLKSRC_MMIO
 	select TIMER_OF
 	select GENERIC_CLOCKEVENTS
Signature · 7 lines
Sent by a computer, using git, on the internet


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#17 lore raw

PATCH 8/9 MIPS: Loongson64: Drop asm/clock.h include

In reply to Stephen Boyd

This include isn't used by this file, so just remove it.

---
 arch/mips/loongson64/smp.c | 1 -
 1 file changed, 1 deletion(-)
arch/mips/loongson64/smp.c +0 -1
index de8e0741ce2d..b48d9c566c5a 100644
@@ -14,7 +14,6 @@
 #include <linux/kexec.h>
 #include <asm/processor.h>
 #include <asm/time.h>
-#include <asm/clock.h>
 #include <asm/tlbflush.h>
 #include <asm/cacheflush.h>
 #include <loongson.h>
Signature · 1 line
Sent by a computer, using git, on the internet
author maintainer
#7 lore raw

PATCH 4/9 h8300: Remove redundant CLKDEV_LOOKUP selects

In reply to Stephen Boyd

The h8300 architecture selects COMMON_CLK already, and the COMMON_CLK config option already selects CLKDEV_LOOKUP so it's redundant to have this selected again.

---
 arch/h8300/Kconfig | 1 -
 1 file changed, 1 deletion(-)
arch/h8300/Kconfig +0 -1
index ec800e9d5aad..d11666d538fe 100644
@@ -13,7 +13,6 @@ config H8300
 	select GENERIC_CPU_DEVICES
 	select MODULES_USE_ELF_RELA
 	select GENERIC_CLOCKEVENTS
-	select CLKDEV_LOOKUP
 	select COMMON_CLK
 	select ARCH_WANT_FRAME_POINTERS
 	select OF
Signature · 1 line
Sent by a computer, using git, on the internet
Acked-by on v1 1/9
#2 lore raw

Re: [PATCH 1/9] ARM: Remove redundant COMMON_CLK selects

In reply to Stephen Boyd
Quoted 4 lines · Stephen Boyd

The mulitplatform config already selects COMMON_CLK, so selecting it again is not useful. Remove these selects from ARM platforms that are part of the multiplatform build.

Quoted 8 lines
Cc "Andreas Färber" <[email protected]>
Cc Manivannan Sadhasivam <[email protected]>
Cc Russell King <[email protected]>
Cc Alexander Shiyan <[email protected]>
Cc Lubomir Rintel <[email protected]>
Cc Arnd Bergmann <[email protected]>

For Actions,

Thanks,
Mani

Quoted 45 lines
---
 arch/arm/mach-actions/Kconfig  | 1 -
 arch/arm/mach-clps711x/Kconfig | 1 -
 arch/arm/mach-mmp/Kconfig      | 1 -
 3 files changed, 3 deletions(-)
arch/arm/mach-actions/Kconfig +0 -1
index b5e0ac965ec0..00fb4babccdd 100644
@@ -7,7 +7,6 @@ menuconfig ARCH_ACTIONS
 	select ARM_GLOBAL_TIMER
 	select CACHE_L2X0
 	select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
-	select COMMON_CLK
 	select GENERIC_IRQ_CHIP
 	select HAVE_ARM_SCU if SMP
 	select HAVE_ARM_TWD if SMP
arch/arm/mach-clps711x/Kconfig +0 -1
index fc9188b54dd6..ba497a2032e9 100644
@@ -5,7 +5,6 @@ menuconfig ARCH_CLPS711X
 	select AUTO_ZRELADDR
 	select TIMER_OF
 	select CLPS711X_TIMER
-	select COMMON_CLK
 	select CPU_ARM720T
 	select GENERIC_CLOCKEVENTS
 	select GPIOLIB
arch/arm/mach-mmp/Kconfig +0 -1
index b58a03b18bde..6fe1550f43ec 100644
@@ -110,7 +110,6 @@ config MACH_MMP_DT
 	depends on ARCH_MULTI_V5
 	select PINCTRL
 	select PINCTRL_SINGLE
-	select COMMON_CLK
 	select ARCH_HAS_RESET_CONTROLLER
 	select CPU_MOHAWK
 	help
Signature · 1 line
Sent by a computer, using git, on the internet
#10 lore raw

Re: [PATCH 6/9] clk: Allow the common clk framework to be selectable

In reply to Stephen Boyd
Quoted 7 lines · Stephen Boyd

There's one snag with doing this, and that's making sure that randconfig builds don't select this option when some architecture or platform implements 'struct clk' outside of the common clk framework. Introduce a new config option 'HAVE_LEGACY_CLK' to indicate those platforms that haven't migrated to the common clk framework and therefore shouldn't be allowed to select this new config option. Also add a note that we hope one day to remove this config entirely.

Good idea!

I've looked through the individual ones and commented a bit on what I think may or may not happen with them.

ralink SOC_MT7621 is the only one that I think you got wrong, as it already has common-clk support.

Quoted 23 lines
 arch/arm/Kconfig              |  2 ++
 arch/c6x/Kconfig              |  1 +
 arch/m68k/Kconfig.cpu         |  2 +-
 arch/mips/Kconfig             |  6 ++++--
 arch/mips/loongson2ef/Kconfig |  2 +-
 arch/sh/boards/Kconfig        |  5 +++++
 arch/unicore32/Kconfig        |  2 +-
 drivers/clk/Kconfig           | 17 +++++++++++++----
 8 files changed, 28 insertions(+), 9 deletions(-)
arch/arm/Kconfig +1 -0
index eeabdc5a3dd2..0606e1bbd7b6 100644
@@ -364,6 +364,7 @@ config ARCH_EP93XX
        select CPU_ARM920T
        select GENERIC_CLOCKEVENTS
        select GPIOLIB
+       select HAVE_LEGACY_CLK
        help
          This enables support for the Cirrus EP93xx series of CPUs.
 

arch/arm/Kconfig config ARCH_OMAP1 · line 529

Quoted 7 lines
arch/arm/Kconfig +1 -0
@@ -522,6 +523,7 @@ config ARCH_OMAP1
        select GENERIC_IRQ_MULTI_HANDLER
        select GPIOLIB
        select HAVE_IDE
+       select HAVE_LEGACY_CLK
        select IRQ_DOMAIN
        select NEED_MACH_IO_H if PCCARD
        select NEED_MACH_MEMORY_H

Ah nice, I thought there were more than two implementations left. I need to refresh the series for OMAP1 that I did last year and debug the regression that caused. I think Linus Walleij has looked into the ep93xx one at some point.

arch/c6x/Kconfig config C6X · line 17

Quoted 12 lines
arch/c6x/Kconfig +1 -0
index e65e8d82442a..6444ebfd06a6 100644
@@ -11,6 +11,7 @@ config C6X
        select ARCH_HAS_SYNC_DMA_FOR_CPU
        select ARCH_HAS_SYNC_DMA_FOR_DEVICE
        select CLKDEV_LOOKUP
+       select HAVE_LEGACY_CLK
        select GENERIC_ATOMIC64
        select GENERIC_IRQ_SHOW
        select HAVE_ARCH_TRACEHOOK

This was last touched in 2012 when TMS320C6678 support was added. It seems to be based on the original same code as omap1 and omap2 that eventually turned into the common clock subsystem, so it would clearly be possible to do a step-by-step conversion like I did for omap1, but I suspect we can wait for all of c6x-linux to become obsolete enough.

arch/m68k/Kconfig.cpu config COLDFIRE · line 33

Quoted 12 lines
arch/m68k/Kconfig.cpu +1 -1
index 60ac1cd8b96f..bd2d29c22a10 100644
@@ -28,7 +28,7 @@ config COLDFIRE
        select CPU_HAS_NO_MULDIV64
        select GENERIC_CSUM
        select GPIOLIB
-       select HAVE_CLK
+       select HAVE_LEGACY_CLK
 
 endchoice

The coldfire clock implementation looks rather simple compared to chips from the 2010s: most chips have only fixed clocks, and three of them have one of two registers of clock gates.

It shouldn't be hard to convert, but enabling common-clk will cause a noticeable kernel size increase on the fairly limited hardware.

Simply enabling COMMON_CLK in m5475evb_defconfig results in a 1.7% or 40KB growth in kernel size, plus there would be additional dynamic memory usage:

text data bss dec hex filename
1934726 263616 83284 2281626 22d09a obj/vmlinux-before
1971989 266192 83308 2321489 236c51 obj/vmlinux-after

arch/mips/Kconfig config AR7 · line 187

Quoted 13 lines
arch/mips/Kconfig +1 -1
index e53a8dd5c19b..fa02c715ab25 100644
@@ -181,7 +181,7 @@ config AR7
        select SYS_SUPPORTS_ZBOOT_UART16550
        select GPIOLIB
        select VLYNQ
-       select HAVE_CLK
+       select HAVE_LEGACY_CLK
        help
          Support for the Texas Instruments AR7 System-on-a-Chip
          family: TNETD7100, 7200 and 7300.

I suspect this platform is fairly dead, OpenWRT dropped support for it, and the known machines have at most 16MB of RAM, which limits the number of use cases that also want to build recent kernels.

Quoted 20 lines
arch/mips/Kconfig +2 -1
@@ -296,9 +296,9 @@ config BCM63XX
        select SYS_HAS_EARLY_PRINTK
        select SWAP_IO_SPACE
        select GPIOLIB
-       select HAVE_CLK
        select MIPS_L1_CACHE_SHIFT_4
        select CLKDEV_LOOKUP
+       select HAVE_LEGACY_CLK
        help
          Support for BCM63XX based boards
 
@@ -419,6 +419,7 @@ config LANTIQ
        select SWAP_IO_SPACE
        select BOOT_RAW
        select CLKDEV_LOOKUP
+       select HAVE_LEGACY_CLK
        select USE_OF
        select PINCTRL
        select PINCTRL_LANTIQ

arch/mips/Kconfig config RALINK · line 662

Quoted 6 lines
arch/mips/Kconfig +1 -0
@@ -656,6 +657,7 @@ config RALINK
        select SYS_SUPPORTS_MIPS16
        select SYS_HAS_EARLY_PRINTK
        select CLKDEV_LOOKUP
+       select HAVE_LEGACY_CLK
        select ARCH_HAS_RESET_CONTROLLER
        select RESET_CONTROLLER

All three of these are older platforms that still have a number of machines supported in OpenWRT, so there is hope that someone would do the work to add common-clk support. Both Lantiq and Ralink have been converted to device tree not too long ago.

I think the RALINK entry needs to be changed, as this includes SOC_MT7621, which already uses COMMON_CLK.

arch/mips/loongson2ef/Kconfig config LEMOTE_MACH2F · line 52

Quoted 13 lines
arch/mips/loongson2ef/Kconfig +1 -1
index 595dd48e1e4d..c9ec43afde73 100644
@@ -46,7 +46,7 @@ config LEMOTE_MACH2F
        select CSRC_R4K if ! MIPS_EXTERNAL_TIMER
        select DMA_NONCOHERENT
        select GENERIC_ISA_DMA_SUPPORT_BROKEN
-       select HAVE_CLK
+       select HAVE_LEGACY_CLK
        select FORCE_PCI
        select I8259
        select IRQ_MIPS_CPU

For all I can tell, this driver only uses the clock interface for its cpufreq driver, and the actual API definition looks bogus.

Half of it could be folded into the cpufreq driver, and the rest of it removed, along with arch/mips/include/asm/clock.h

Quoted 6 lines
arch/sh/boards/Kconfig +0 -0
index cee24c308337..fb0ca0c1efe1 100644
@@ -7,6 +7,11 @@ config SOLUTION_ENGINE
 config SH_ALPHA_BOARD

arch/sh/boards/Kconfig config SOLUTION_ENGINE · line 17

Quoted 10 lines
arch/sh/boards/Kconfig +5 -0
        bool
 
+config SH_CUSTOM_CLK
+       def_bool y
+       depends on !SH_DEVICE_TREE
+       select HAVE_LEGACY_CLK
+
 config SH_DEVICE_TREE
        bool
        select OF

It's going to be hard to find anyone willing to touch this, as the code is very large but has few users these days.

drivers/sh/clk/ is basically a generic clk subsystem on its own, and there are at least 28 different arch/sh SoCs with drivers for it.

Arnd

#15 lore raw

Re: [PATCH 6/9] clk: Allow the common clk framework to be selectable

In reply to Stephen Boyd
I love your patch! Yet something to improve:

Hi Stephen,

I love your patch! Yet something to improve:

[auto build test ERROR on arm-soc/for-next]
[also build test ERROR on clk/clk-next arm/for-next linus/master v5.6 next-20200405] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Stephen-Boyd/Allow-COMMON_CLK-to-be-selectable/20200405-105253
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git for-next
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.0

reproduce:
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
GCC_VERSION=9.3.0 make.cross ARCH=sparc

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

sparc64-linux-ld: drivers/mmc/host/meson-mx-sdio.o: in function `meson_mx_mmc_remove':

>> meson-mx-sdio.c:(.text+0x70): undefined reference to `of_platform_device_destroy'
   sparc64-linux-ld: drivers/mmc/host/meson-mx-sdio.o: in function `meson_mx_mmc_probe':
>> meson-mx-sdio.c:(.text+0x9e4): undefined reference to `of_platform_device_create'
>> sparc64-linux-ld: meson-mx-sdio.c:(.text+0xdd4): undefined reference to `of_platform_device_destroy'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

#12 lore raw

Re: [PATCH 6/9] clk: Allow the common clk framework to be selectable

In reply to a message not in the archive
Quoted 16 lines · Stephen Boyd

Quoting Arnd Bergmann (2020-04-05 05:45:20)

Quoted 14 lines · Stephen Boyd
Quoted 7 lines

There's one snag with doing this, and that's making sure that randconfig builds don't select this option when some architecture or platform implements 'struct clk' outside of the common clk framework. Introduce a new config option 'HAVE_LEGACY_CLK' to indicate those platforms that haven't migrated to the common clk framework and therefore shouldn't be allowed to select this new config option. Also add a note that we hope one day to remove this config entirely.

Good idea!

I've looked through the individual ones and commented a bit on what I think may or may not happen with them.

Quoted 6 lines
Quoted 2 lines

ralink SOC_MT7621 is the only one that I think you got wrong, as it already has common-clk support.

Ah I missed that it was inside a big if RALINK. Thanks. I suppose I should just remove the select then for that config and not worry about the duplication of clkdev and common clk configs.

Won't that cause build failures in those configurations that have both implementations?

According to the Makefile, the clk.c file is built whenever CONFIG_MIPS_GIC is unset, so I think we need

select HAVE_LEGACY_CLK if !MIPS_GIC

or maybe move the select into the per-chip configs that need it:
RT288X, RT305X, RT3883, and MT7620.

Quoted 17 lines
Quoted 17 lines

arch/m68k/Kconfig.cpu

Quoted 4 lines
arch/m68k/Kconfig.cpu +0 -0
index 60ac1cd8b96f..bd2d29c22a10 100644

text data bss dec hex filename
1934726 263616 83284 2281626 22d09a obj/vmlinux-before
1971989 266192 83308 2321489 236c51 obj/vmlinux-after

The coldfire clock implementation looks rather simple compared to chips from the 2010s: most chips have only fixed clocks, and three of them have one of two registers of clock gates.

It shouldn't be hard to convert, but enabling common-clk will cause a noticeable kernel size increase on the fairly limited hardware.

Quoted 7 lines
Quoted 3 lines

Simply enabling COMMON_CLK in m5475evb_defconfig results in a 1.7% or 40KB growth in kernel size, plus there would be additional dynamic memory usage:

There could certainly be some work done to reduce the code size of the CCF. I haven't looked but perhaps we could save some memory by making the basic types selectable too and then push a bunch of kconfig updates through for that.

Right, that might help. Another possibility would be to support both the common clk layer and the custom clk implementation on coldfire until we remove the other custom implementations, by which point even fewer people will care about coldfire.

Let's see what Geert and Greg think would be the best path for coldfire, maybe the added 40KB is less of a problem after all.

Arnd

Acked-by on v1 3/9
#6 lore raw

Re: [PATCH 3/9] arm64: tegra: Remove redundant CLKDEV_LOOKUP selects

In reply to Stephen Boyd
Quoted 11 lines · Stephen Boyd

The arm64 architecture selects COMMON_CLK at the toplevel ARM64 config. The COMMON_CLK config option already selects CLKDEV_LOOKUP so it's redundant to have this selected again for the Tegra specific config.

Cc Paul Walmsley <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Arnd Bergmann <[email protected]>
Quoted 3 lines
---
 arch/arm64/Kconfig.platforms | 1 -
 1 file changed, 1 deletion(-)

We rarely touch this, so I think it's fine for this to go through the clock tree. I'll make a mental note just in case there's going to be something touching this area in the next release, but I'm sure it'll be all minor so we could easily work that out:

maintainer Reviewed-by on v1 1/9
#3 lore raw

Re: [PATCH 1/9] ARM: Remove redundant COMMON_CLK selects

In reply to Stephen Boyd

Am 05.04.20 um 04:51 schrieb Stephen Boyd:

Quoted 23 lines

The mulitplatform config already selects COMMON_CLK, so selecting it again is not useful. Remove these selects from ARM platforms that are part of the multiplatform build.

Cc "Andreas Färber" <[email protected]>
Cc Manivannan Sadhasivam <[email protected]>
Cc Russell King <[email protected]>
Cc Alexander Shiyan <[email protected]>
Cc Lubomir Rintel <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
  arch/arm/mach-actions/Kconfig  | 1 -
  arch/arm/mach-clps711x/Kconfig | 1 -
  arch/arm/mach-mmp/Kconfig      | 1 -
  3 files changed, 3 deletions(-)
arch/arm/mach-actions/Kconfig +0 -0
index b5e0ac965ec0..00fb4babccdd 100644

arch/arm/mach-actions/Kconfig menuconfig ARCH_ACTIONS · line 12

Quoted 7 lines
arch/arm/mach-actions/Kconfig +0 -1
@@ -7,7 +7,6 @@ menuconfig ARCH_ACTIONS
  	select ARM_GLOBAL_TIMER
  	select CACHE_L2X0
  	select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
-	select COMMON_CLK
  	select GENERIC_IRQ_CHIP
  	select HAVE_ARM_SCU if SMP
  	select HAVE_ARM_TWD if SMP

New targets such as Realtek or Sunplus don't select it anymore, but it seems we didn't clean up all the old ones yet.

Thanks,
Andreas

Signature · 4 lines
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer
HRB 36809 (AG Nürnberg)
#13 lore raw

Re: [PATCH 6/9] clk: Allow the common clk framework to be selectable

In reply to Arnd Bergmann

Hi Arnd, Stephen

Quoted 59 lines · Arnd Bergmann
Quoted 15 lines · Stephen Boyd

Quoting Arnd Bergmann (2020-04-05 05:45:20)

Quoted 14 lines · Stephen Boyd
Quoted 7 lines

There's one snag with doing this, and that's making sure that randconfig builds don't select this option when some architecture or platform implements 'struct clk' outside of the common clk framework. Introduce a new config option 'HAVE_LEGACY_CLK' to indicate those platforms that haven't migrated to the common clk framework and therefore shouldn't be allowed to select this new config option. Also add a note that we hope one day to remove this config entirely.

Good idea!

I've looked through the individual ones and commented a bit on what I think may or may not happen with them.

Quoted 6 lines
Quoted 2 lines

ralink SOC_MT7621 is the only one that I think you got wrong, as it already has common-clk support.

Ah I missed that it was inside a big if RALINK. Thanks. I suppose I should just remove the select then for that config and not worry about the duplication of clkdev and common clk configs.

Won't that cause build failures in those configurations that have both implementations?

According to the Makefile, the clk.c file is built whenever CONFIG_MIPS_GIC is unset, so I think we need

select HAVE_LEGACY_CLK if !MIPS_GIC

or maybe move the select into the per-chip configs that need it:
RT288X, RT305X, RT3883, and MT7620.

Quoted 17 lines
Quoted 17 lines

arch/m68k/Kconfig.cpu

Quoted 4 lines
arch/m68k/Kconfig.cpu +0 -0
index 60ac1cd8b96f..bd2d29c22a10 100644

text data bss dec hex filename
1934726 263616 83284 2281626 22d09a obj/vmlinux-before
1971989 266192 83308 2321489 236c51 obj/vmlinux-after

The coldfire clock implementation looks rather simple compared to chips from the 2010s: most chips have only fixed clocks, and three of them have one of two registers of clock gates.

It shouldn't be hard to convert, but enabling common-clk will cause a noticeable kernel size increase on the fairly limited hardware.

Quoted 7 lines
Quoted 3 lines

Simply enabling COMMON_CLK in m5475evb_defconfig results in a 1.7% or 40KB growth in kernel size, plus there would be additional dynamic memory usage:

There could certainly be some work done to reduce the code size of the CCF. I haven't looked but perhaps we could save some memory by making the basic types selectable too and then push a bunch of kconfig updates through for that.

Quoted 7 lines

Right, that might help. Another possibility would be to support both the common clk layer and the custom clk implementation on coldfire until we remove the other custom implementations, by which point even fewer people will care about coldfire.

Let's see what Geert and Greg think would be the best path for coldfire, maybe the added 40KB is less of a problem after all.

Losing another 40k is not ideal, but not the end of the world. It would not stop me running it on any platforms I regularly run on. For sure some of the really old hardware just doesn't have the RAM to spare.

Any way, I say we have to move forward and and move to using the common clock framework for ColdFire sooner than later.

Regards
Greg

#14 lore raw

Re: [PATCH 6/9] clk: Allow the common clk framework to be selectable

Hi Greg,

Quoted 43 lines · Greg Ungerer
Quoted 34 lines · Arnd Bergmann
Quoted 25 lines · Stephen Boyd

Quoting Arnd Bergmann (2020-04-05 05:45:20)

Quoted 24 lines · Stephen Boyd

arch/m68k/Kconfig.cpu

Quoted 10 lines

There's one snag with doing this, and that's making sure that randconfig builds don't select this option when some architecture or platform implements 'struct clk' outside of the common clk framework. Introduce a new config option 'HAVE_LEGACY_CLK' to indicate those platforms that haven't migrated to the common clk framework and therefore shouldn't be allowed to select this new config option. Also add a note that we hope one day to remove this config entirely.

arch/m68k/Kconfig.cpu +0 -0

text data bss dec hex filename
1934726 263616 83284 2281626 22d09a obj/vmlinux-before
1971989 266192 83308 2321489 236c51 obj/vmlinux-after

The coldfire clock implementation looks rather simple compared to chips from the 2010s: most chips have only fixed clocks, and three of them have one of two registers of clock gates.

It shouldn't be hard to convert, but enabling common-clk will cause a noticeable kernel size increase on the fairly limited hardware.

Quoted 7 lines
Quoted 3 lines

Simply enabling COMMON_CLK in m5475evb_defconfig results in a 1.7% or 40KB growth in kernel size, plus there would be additional dynamic memory usage:

There could certainly be some work done to reduce the code size of the CCF. I haven't looked but perhaps we could save some memory by making the basic types selectable too and then push a bunch of kconfig updates through for that.

Quoted 7 lines

Right, that might help. Another possibility would be to support both the common clk layer and the custom clk implementation on coldfire until we remove the other custom implementations, by which point even fewer people will care about coldfire.

Let's see what Geert and Greg think would be the best path for coldfire, maybe the added 40KB is less of a problem after all.

Quoted 7 lines

Losing another 40k is not ideal, but not the end of the world. It would not stop me running it on any platforms I regularly run on. For sure some of the really old hardware just doesn't have the RAM to spare.

Any way, I say we have to move forward and and move to using the common clock framework for ColdFire sooner than later.

Fine for me.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds