u-boot-amlogic archives
 help / color / mirror / Atom feed
* [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot
@ 2026-03-19 20:56 Casey Connolly
  2026-03-19 20:56 ` [PATCH RFC 01/40] vsprintf: add %pOF Casey Connolly
                   ` (12 more replies)
  0 siblings, 13 replies; 15+ messages in thread
From: Casey Connolly @ 2026-03-19 20:56 UTC (permalink / raw)
  To: u-boot, Lukasz Majewski, u-boot-qcom, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg
  Cc: Tom Rini, Casey Connolly, Neil Armstrong, Andrew Goodbody,
	Stephen Boyd, Ilias Apalodimas, Simon Glass, Raphael Gallais-Pou,
	Patrice Chotard, Yannick Fertre, Romain Gantois, Raymond Mao,
	Michael Trimarchi, Christian Marangi, Jaehoon Chung, Peng Fan,
	Yao Zi, Leo Yu-Chi Liang, Patrick Delaunay, Michal Simek,
	Quentin Schulz, Peter Korsgaard, Greg Malysa, Vasileios Bimpikas,
	Arturs Artamonovs, Ryan Chen, Chia-Wei Wang, Eugeniy Paltsev,
	Sean Anderson, Liviu Dudau, Ryder Lee, Weijie Gao, Chunfeng Yun,
	Igor Belwon, Stefan Roese, Manivannan Sadhasivam, Robert Marko,
	Aswin Murugan, Balaji Selvanathan, Nobuhiro Iwamatsu,
	Philipp Tomsich, Kever Yang, Minda Chen, Hal Feng, Thierry Reding,
	Svyatoslav Ryhel, Kunihiko Hayashi, Philip Molloy,
	Mikhail Kshevetskiy, Ryan Wanner, Varshini Rajendran,
	Manikandan Muralidharan, Jorge Ramirez-Ortiz, Luca Weiss,
	Jens Reidel, David Wronek, Miquel Raynal, David Lechner,
	Nishanth Menon, Alice Guo, Valentin Caron,
	Senthil Nathan Thangaraj, Naman Trivedi, Venkatesh Yadav Abbarapu,
	Padmarao Begari, Jonathan Currier, Sam Shih, Conor Dooley,
	Stephan Gerhold, Varadarajan Narayanan, Loic Poulain, Sam Day,
	Rui Miguel Silva, Mattijs Korpershoek, Shmuel Leib Melamud,
	Jonas Karlman, Finley Xiao, Joseph Chen, Elaine Zhang,
	Heiko Stuebner, Gabriel Fernandez, Andrew Davis, Manorit Chawdhry,
	Udit Kumar, Heiko Schocher, Markus Schneider-Pargmann (TI.com),
	Dinesh Maniyam, Paul Sajna, Marek Vasut

This RFC provides a proof of concept for using the full Linux CCF in
U-Boot and consequently porting full Linux clock drivers with extremely
minimal changes.

== Overview ==

This RFC is pretty long but can be separated into a few chunks. The
first patches relate to Linux API compatibility and just contain small
self contained changes, these can go upstream regardless of CCF.

The next group of changes prepare for importing CCF from Linux, the
standalone fixed clock drivers are moved to clk/basic, the existing
U-Boot CCF drivers are moved to clk/uccf, and struct clk_ops is renamed
to clk_ops_uboot.

Additionally, clk_set_rate() is changed so that it returns a signed
long, since it can return negative values. This is also done to align
with CCF but it's a standalone improvement nonetheless.

The next changes import CCF from Linux 6.19 and then adjust it to
compile and work with U-Boot. These commits are split up mostly to
try and reduce the size. Finally clk-uclass is adjusted for CCF, this
definitely will need some additional passes to be a bit cleaner.

With CCF done, sandbox clk-ccf driver gets a CCF_FULL port, the clk_ccf
tests are adjusted to pass.

Lastly, a PoC port of Qualcomms Linux clock drivers is done, this
only has sm8650 clocks but they serve the desired purpose. The changes
necessary to the Linux drivers are mostly to deal with U-Boots driver
model, the actual platform specific clock drivers require essentially
zero changes!

=== Feedback ===

I'd like to get feedback on the overall architecture and ideas, feel
free to point out any dead code or printf's I forgot about, but I'll for
sure do a more detailed cleanup before the next revision.

I would definitely like to input on how to deal with clk-uclass, since
it's now supporting 3 different clock frameworks, but I'm now sure how
best to separate the code out without duplicating code.

In terms of overall architecture, CCF is a departure from the uclass
model that U-Boot has stuck too for so long. If this is a success then
I think it could make a lot of sense to make similar changes for power
domains and resets. I think this change offers a lot of additional
flexibility which has been sorely missed.

== Motivation ==

There were quite a few motivating factors behind this effort which I
think provide useful context for this series:

1. Existing UCLASS_CLK support in U-Boot (even with U-Boots minimal CCF)
   doesn't provide a fully cohesive API nor implement the necessary
   functionality to support complex modern platforms without a lot of
   additional effort.

2. While trying to enable display support on Qualcomm, it became clear
   that U-Boots clock framework was a severe limiting factor,
   particularly for more complicated setups like "bonded" dual-DSI.

3. The current state of Qualcomm clock drivers in U-Boot is pretty poor,
   as the old very basic driver code is being expected to support more
   and more complicated usecases. Clock support is generally the most
   complicated part of bringing up any new Qualcomm platform, so being
   able to properly reuse Linux drivers with the familiar API greatly
   reduces the amount of friction when working on U-Boot support for
   complicated peripherals like the display.

Consequently, My aim with this effort was primarily to provide API
compatibility with Linux as much as possible, minimising the changes
that have to be made to clock drivers to port them from Linux, and
reducing the chance of introducing U-Boot specific bugs.

=== clk_ops/UCLASS_CLK ===

CCF_FULL drivers should NOT use UCLASS_CLK, since CCF uses a totally
independent clock API. If the clocks are provided by another device like
a phy, they can simply be registered with the clk core the same way they
are in Linux. Standalone clock drivers should use UCLASS_NOP.

Clocks must all be registered during driver probe, the CCF will ensure
that a given clock provider is probed (via a global ofnode -> device
lookup) before checking the of_providers, thus making sure the clocks
are registered so that the consumer can use them. There is currently no
special handling for cyclical dependencies.

=== struct clk ===

It's definitely debatable if it makes sense to have 3 different structs
for each clk (clk_hw, clk_core and clk). I do think clk_hw and clk_core
are justified, since clk_hw is more tied to the hardware description and
typically nested in a clk-specific descriptor while clk_core contains
the internal runtime state of the clk which should remain private to
CCF core.

It could make sense to merge clk and clk_core, but since struct clk is
public in U-Boot, where it's an opaque pointer in Linux this would be
a substantial effort. In Linux struct clk objects are allocated inside
CCF, but in U-Boot they're allocated by the driver, this would need to
be resolved before we investigate combining these structs.

=== Memory/perf overhead ===

The memory and size overhead of CCF is undoubtably bigger than uCCF,
although I suspect the difference is less than it might seem at
first glance. In particular: clk_core is only ~50 bytes larger than
struct udevice on ARM64, and an additional 120 bytes is saved for each
U_BOOT_DRIVER used by uCCF.

On the other hand, the CPU overhead is probably more significant,
but not an unreasonable cost to ensure correctness and propagate rate
changes across the clock tree.

Just comparing the binary size of sandbox64_defconfig with uCCF vs
CCF_FULL, CCF_FULL results in a 135k size increase in the binary. I
haven't done any more detailed analysis here (still haven't got buildman
to play nice...).

=== SPL ===

This RFC doesn't have any SPL specific support, I think this role is
better fulfilled by UCLASS_CLK.

=== U-Boot's old CCF port ===

The original CCF port done for IMX platforms is vastly different in API,
scope, and function to CCF_FULL, to differentiate I refer to it
as "uCCF".

I have kept support for this in and made it mutually exclusive with
CCF_FULL. uCCF drivers have been moved to drivers/clk/uccf, with the new
CCF port in drivers/clk/ccf.

Included near the end of this series is a port of Sandbox's clk-ccf
driver from uCCF over to CCF_FULL, this might be a useful reference for
other drivers (although it's probably better to just adapt the Linux
drivers).

=== Compat shim ===

Lastly, this series includes a compat shim which allows UCLASS_CLK
drivers to somewhat work with CCF, I would imagine this being useful
if some generic peripheral device provides a clock for example, but in
almost all cases I think it's better to implement a proper CCF clock
device. Unless there is a particular usecase for this I would probably
not include it in the next revision.

== TODO/Outstanding issues ==

* Clean up clk-uclass.c, does it make sense to somewhow split it in two?
* Assess test coverage, have basic sandbox tests, would like to mostly
  use integration tests (i.e. diff the clk summary) once more platforms
  are supported.
* pre-relocation support is currently missing, on Qualcomm at least I
  would prefer to completely skip FDT scanning pre-reloc, there is a
  patch in this series which does that. It is very non-trivial to try
  and handle clocks pre-reloc.

---
Casey Connolly (40):
      vsprintf: add %pOF
      common: add an option to skip DM pre-relocation
      serial: msm-geni: allow invalid clock
      qcom: rpmh: don't error for SLEEP requests
      string: add strdup_const and kstrdup_const
      ofnode: add read_u64_array and count_elems_of_size
      linux/compat: add PTR_ERR_OR_ZERO
      compat: add kref implementation
      compat: add dev_name()
      compat: add linux/regmap.h symlink
      devres: add devm_krealloc
      regmap: add regmap_assign_bits
      compat: regulator: add enable/disable macros
      compat: math64: add abs_diff()
      clk: restrict clk/imx to MACH_IMX
      clk: move U-Boot CCF to clk/uccf
      clk: rename clk_ops to clk_ops_uboot
      clk: move fixed clocks to clk/basic
      clk: make clk_set_rate() return signed long
      clk: make clk_get_parent_rate return signed long
      clk: import full CCF from Linux
      clk: move clock flags to common clk-provider.h
      clk/ccf: adapt clk-conf for U-Boot
      clk/ccf: adapt CCF core for U-Boot
      clk/ccf: adapt CCF generic clocks for U-Boot
      clk/clk-uclass: adapt for CCF_FULL
      RFC: clk/ccf: add UCLASS_CLK compat shim
      clk/sandbox: add a CCF_FULL port of clk_sandbox
      WIP: test: adjust tests for CCF_FULL
      configs: add sandbox CCF_FULL defconfig
      cmd/clk: add CCF_FULL support
      clk/qcom: move existing clock drivers to clk/qcom/basic
      clk/qcom: drop in Linux Qualcomm CCF drivers
      clk/qcom/ccf: drop in Linux rpmh clock driver
      clk/qcom/ccf: add sm8650 GCC, dispcc and tcsrcc.
      clk/qcom/ccf: add uboot common code
      clk/qcom/ccf: adapt common, gdsc, and reset code for U-Boot
      clk/qcom/ccf: adapt clocks for U-Boot
      clk/qcom/ccf: adjust sm8650 clock drivers for U-Boot
      TEST: configs: qcom_sm8650_ccf_defconfig: add a CCF sm8650 defconfig

 Kconfig                                            |   12 +
 arch/arm/cpu/armv7/bcm281xx/clk-core.c             |    8 +-
 arch/arm/cpu/armv7/bcm281xx/clk-core.h             |   14 +-
 arch/arm/dts/sm8650-hdk-u-boot.dtsi                |   26 +
 arch/sandbox/dts/test.dts                          |    4 +-
 arch/sandbox/include/asm/clk.h                     |    2 +-
 cmd/clk.c                                          |   21 +-
 common/board_f.c                                   |   11 +-
 configs/qcom_sm8650_ccf_defconfig                  |   24 +
 configs/sandbox64_ccf_full_defconfig               |    5 +
 drivers/clk/Kconfig                                |   52 +-
 drivers/clk/Makefile                               |   20 +-
 drivers/clk/adi/clk-adi-pll.c                      |    2 +-
 drivers/clk/adi/clk-shared.c                       |    4 +-
 drivers/clk/adi/clk.h                              |    2 +-
 drivers/clk/airoha/clk-airoha.c                    |    4 +-
 drivers/clk/altera/clk-agilex.c                    |    2 +-
 drivers/clk/altera/clk-agilex5.c                   |    2 +-
 drivers/clk/altera/clk-arria10.c                   |    2 +-
 drivers/clk/altera/clk-mem-n5x.c                   |    2 +-
 drivers/clk/altera/clk-n5x.c                       |    2 +-
 drivers/clk/aspeed/clk_ast2500.c                   |    4 +-
 drivers/clk/aspeed/clk_ast2600.c                   |    4 +-
 drivers/clk/at91/clk-generic.c                     |    4 +-
 drivers/clk/at91/clk-main.c                        |    8 +-
 drivers/clk/at91/clk-master.c                      |    8 +-
 drivers/clk/at91/clk-peripheral.c                  |    6 +-
 drivers/clk/at91/clk-programmable.c                |    4 +-
 drivers/clk/at91/clk-sam9x60-pll.c                 |   10 +-
 drivers/clk/at91/clk-sam9x60-usb.c                 |    4 +-
 drivers/clk/at91/clk-system.c                      |    2 +-
 drivers/clk/at91/clk-utmi.c                        |    4 +-
 drivers/clk/at91/compat.c                          |   30 +-
 drivers/clk/at91/pmc.c                             |    2 +-
 drivers/clk/at91/pmc.h                             |    2 +-
 drivers/clk/at91/sckc.c                            |    4 +-
 drivers/clk/basic/Makefile                         |    7 +
 drivers/clk/{ => basic}/clk_fixed_factor.c         |    2 +-
 drivers/clk/{ => basic}/clk_fixed_rate.c           |    4 +-
 drivers/clk/ccf/Kconfig                            |   15 +
 drivers/clk/ccf/Makefile                           |   19 +
 drivers/clk/ccf/clk-composite.c                    |  495 +++
 drivers/clk/ccf/clk-conf.c                         |  189 +
 drivers/clk/ccf/clk-divider.c                      |  663 ++++
 drivers/clk/ccf/clk-fixed-factor.c                 |  409 +++
 drivers/clk/ccf/clk-fixed-rate.c                   |  217 ++
 drivers/clk/ccf/clk-gate.c                         |  260 ++
 drivers/clk/ccf/clk-mux.c                          |  282 ++
 drivers/clk/ccf/clk.c                              | 3208 ++++++++++++++++
 drivers/clk/ccf/clk.h                              |   59 +
 drivers/clk/ccf/clk_sandbox_ccf_full.c             |  220 ++
 drivers/clk/ccf/compat.c                           |  227 ++
 drivers/clk/clk-cdce9xx.c                          |    4 +-
 drivers/clk/clk-gpio.c                             |    2 +-
 drivers/clk/clk-hsdk-cgu.c                         |    4 +-
 drivers/clk/clk-stub.c                             |    4 +-
 drivers/clk/clk-uclass.c                           |  326 +-
 drivers/clk/clk-xlnx-clock-wizard.c                |    4 +-
 drivers/clk/clk_bcm6345.c                          |    2 +-
 drivers/clk/clk_boston.c                           |    2 +-
 drivers/clk/clk_k210.c                             |    8 +-
 drivers/clk/clk_octeon.c                           |    2 +-
 drivers/clk/clk_pic32.c                            |    4 +-
 drivers/clk/clk_sandbox.c                          |   47 +-
 drivers/clk/clk_sandbox_test.c                     |    2 +-
 drivers/clk/clk_scmi.c                             |    6 +-
 drivers/clk/clk_versaclock.c                       |   22 +-
 drivers/clk/clk_versal.c                           |    4 +-
 drivers/clk/clk_vexpress_osc.c                     |    4 +-
 drivers/clk/clk_zynq.c                             |    8 +-
 drivers/clk/clk_zynqmp.c                           |    6 +-
 drivers/clk/exynos/clk-exynos7420.c                |    6 +-
 drivers/clk/exynos/clk-pll.c                       |    4 +-
 drivers/clk/exynos/clk.h                           |    2 +-
 drivers/clk/ics8n3qv01.c                           |    4 +-
 drivers/clk/imx/clk-composite-8m.c                 |    6 +-
 drivers/clk/imx/clk-composite-93.c                 |    2 +-
 drivers/clk/imx/clk-fracn-gppll.c                  |    4 +-
 drivers/clk/imx/clk-gate-93.c                      |    4 +-
 drivers/clk/imx/clk-gate2.c                        |    4 +-
 drivers/clk/imx/clk-imx6q.c                        |    2 +-
 drivers/clk/imx/clk-imx6ul.c                       |    2 +-
 drivers/clk/imx/clk-imx8.c                         |    4 +-
 drivers/clk/imx/clk-imx8.h                         |    2 +-
 drivers/clk/imx/clk-imx8qm.c                       |    2 +-
 drivers/clk/imx/clk-imx8qxp.c                      |    2 +-
 drivers/clk/imx/clk-imxrt1020.c                    |    2 +-
 drivers/clk/imx/clk-imxrt1170.c                    |    4 +-
 drivers/clk/imx/clk-pfd.c                          |    4 +-
 drivers/clk/imx/clk-pll14xx.c                      |    8 +-
 drivers/clk/imx/clk-pllv3.c                        |   18 +-
 drivers/clk/intel/clk_intel.c                      |    2 +-
 drivers/clk/mediatek/clk-mtk.c                     |   14 +-
 drivers/clk/mediatek/clk-mtk.h                     |   10 +-
 drivers/clk/meson/a1.c                             |    8 +-
 drivers/clk/meson/axg-ao.c                         |    2 +-
 drivers/clk/meson/axg.c                            |    2 +-
 drivers/clk/meson/clk-measure.c                    |    2 +-
 drivers/clk/meson/g12a-ao.c                        |    2 +-
 drivers/clk/meson/g12a.c                           |   10 +-
 drivers/clk/meson/gxbb.c                           |    8 +-
 drivers/clk/microchip/mpfs_clk_cfg.c               |    4 +-
 drivers/clk/microchip/mpfs_clk_msspll.c            |    2 +-
 drivers/clk/microchip/mpfs_clk_periph.c            |    2 +-
 drivers/clk/mpc83xx_clk.c                          |    2 +-
 drivers/clk/mtmips/clk-mt7620.c                    |    2 +-
 drivers/clk/mtmips/clk-mt7621.c                    |    2 +-
 drivers/clk/mtmips/clk-mt7628.c                    |    2 +-
 drivers/clk/mvebu/armada-37xx-periph.c             |    4 +-
 drivers/clk/mvebu/armada-37xx-tbg.c                |    2 +-
 drivers/clk/nuvoton/clk_npcm.c                     |    4 +-
 drivers/clk/nuvoton/clk_npcm.h                     |    2 +-
 drivers/clk/owl/clk_owl.c                          |    6 +-
 drivers/clk/qcom/Kconfig                           |    1 +
 drivers/clk/qcom/Makefile                          |   28 +-
 drivers/clk/qcom/basic/Makefile                    |   25 +
 drivers/clk/qcom/{ => basic}/clock-apq8016.c       |    2 +-
 drivers/clk/qcom/{ => basic}/clock-apq8096.c       |    2 +-
 drivers/clk/qcom/{ => basic}/clock-ipq4019.c       |    2 +-
 drivers/clk/qcom/{ => basic}/clock-ipq5424.c       |    2 +-
 drivers/clk/qcom/{ => basic}/clock-ipq9574.c       |    2 +-
 drivers/clk/qcom/{ => basic}/clock-qcm2290.c       |    2 +-
 drivers/clk/qcom/{ => basic}/clock-qcom.c          |    4 +-
 drivers/clk/qcom/{ => basic}/clock-qcom.h          |    2 +-
 drivers/clk/qcom/{ => basic}/clock-qcs404.c        |    2 +-
 drivers/clk/qcom/{ => basic}/clock-qcs615.c        |    2 +-
 drivers/clk/qcom/{ => basic}/clock-qcs8300.c       |    2 +-
 drivers/clk/qcom/{ => basic}/clock-sa8775p.c       |    2 +-
 drivers/clk/qcom/{ => basic}/clock-sc7280.c        |    2 +-
 drivers/clk/qcom/{ => basic}/clock-sdm845.c        |    4 +-
 drivers/clk/qcom/{ => basic}/clock-sm6115.c        |    2 +-
 drivers/clk/qcom/{ => basic}/clock-sm6350.c        |    2 +-
 drivers/clk/qcom/{ => basic}/clock-sm7150.c        |    2 +-
 drivers/clk/qcom/{ => basic}/clock-sm8150.c        |    2 +-
 drivers/clk/qcom/{ => basic}/clock-sm8250.c        |    2 +-
 drivers/clk/qcom/{ => basic}/clock-sm8550.c        |    4 +-
 drivers/clk/qcom/{ => basic}/clock-sm8650.c        |    4 +-
 drivers/clk/qcom/{ => basic}/clock-x1e80100.c      |    4 +-
 drivers/clk/qcom/ccf/Makefile                      |   21 +
 drivers/clk/qcom/ccf/clk-alpha-pll.c               | 3196 ++++++++++++++++
 drivers/clk/qcom/ccf/clk-alpha-pll.h               |  251 ++
 drivers/clk/qcom/ccf/clk-branch.c                  |  203 ++
 drivers/clk/qcom/ccf/clk-branch.h                  |  125 +
 drivers/clk/qcom/ccf/clk-rcg.h                     |  217 ++
 drivers/clk/qcom/ccf/clk-rcg2.c                    | 1765 +++++++++
 drivers/clk/qcom/ccf/clk-regmap-divider.c          |   90 +
 drivers/clk/qcom/ccf/clk-regmap-divider.h          |   22 +
 drivers/clk/qcom/ccf/clk-regmap-mux-div.c          |  232 ++
 drivers/clk/qcom/ccf/clk-regmap-mux-div.h          |   44 +
 drivers/clk/qcom/ccf/clk-regmap-mux.c              |   57 +
 drivers/clk/qcom/ccf/clk-regmap-mux.h              |   23 +
 drivers/clk/qcom/ccf/clk-regmap-phy-mux.c          |   62 +
 drivers/clk/qcom/ccf/clk-regmap-phy-mux.h          |   33 +
 drivers/clk/qcom/ccf/clk-regmap.c                  |  104 +
 drivers/clk/qcom/ccf/clk-regmap.h                  |   38 +
 drivers/clk/qcom/ccf/clk-rpmh.c                    | 1030 ++++++
 drivers/clk/qcom/ccf/common-uboot.c                |  188 +
 drivers/clk/qcom/ccf/common-uboot.h                |   38 +
 drivers/clk/qcom/ccf/common.c                      |  252 ++
 drivers/clk/qcom/ccf/common.h                      |  106 +
 drivers/clk/qcom/ccf/dispcc-sm8550.c               | 1825 ++++++++++
 drivers/clk/qcom/ccf/gcc-sm8650.c                  | 3846 ++++++++++++++++++++
 drivers/clk/qcom/ccf/gdsc.c                        |  545 +++
 drivers/clk/qcom/ccf/gdsc.h                        |  103 +
 drivers/clk/qcom/ccf/reset.c                       |  112 +
 drivers/clk/qcom/ccf/reset.h                       |   29 +
 drivers/clk/qcom/ccf/tcsrcc-sm8650.c               |  174 +
 drivers/clk/renesas/clk-rcar-gen2.c                |    4 +-
 drivers/clk/renesas/clk-rcar-gen3.c                |    4 +-
 drivers/clk/renesas/compound-clock.c               |    4 +-
 drivers/clk/renesas/r9a06g032-clocks.c             |    6 +-
 drivers/clk/renesas/rcar-gen2-cpg.h                |    2 +-
 drivers/clk/renesas/rcar-gen3-cpg.h                |    2 +-
 drivers/clk/renesas/rzg2l-cpg.c                    |    8 +-
 drivers/clk/rockchip/clk_px30.c                    |   12 +-
 drivers/clk/rockchip/clk_rk3036.c                  |    4 +-
 drivers/clk/rockchip/clk_rk3066.c                  |    4 +-
 drivers/clk/rockchip/clk_rk3128.c                  |    4 +-
 drivers/clk/rockchip/clk_rk3188.c                  |    4 +-
 drivers/clk/rockchip/clk_rk322x.c                  |    4 +-
 drivers/clk/rockchip/clk_rk3288.c                  |    4 +-
 drivers/clk/rockchip/clk_rk3308.c                  |    4 +-
 drivers/clk/rockchip/clk_rk3328.c                  |    4 +-
 drivers/clk/rockchip/clk_rk3368.c                  |    4 +-
 drivers/clk/rockchip/clk_rk3399.c                  |    8 +-
 drivers/clk/rockchip/clk_rk3528.c                  |   10 +-
 drivers/clk/rockchip/clk_rk3568.c                  |   14 +-
 drivers/clk/rockchip/clk_rk3576.c                  |    8 +-
 drivers/clk/rockchip/clk_rk3588.c                  |   12 +-
 drivers/clk/rockchip/clk_rv1108.c                  |    4 +-
 drivers/clk/rockchip/clk_rv1126.c                  |   12 +-
 drivers/clk/sifive/sifive-prci.c                   |    4 +-
 drivers/clk/sophgo/clk-cv1800b.c                   |    4 +-
 drivers/clk/sophgo/clk-ip.c                        |   30 +-
 drivers/clk/sophgo/clk-ip.h                        |   18 +-
 drivers/clk/sophgo/clk-pll.c                       |    8 +-
 drivers/clk/sophgo/clk-pll.h                       |    4 +-
 drivers/clk/starfive/clk-jh7110-pll.c              |    4 +-
 drivers/clk/starfive/clk.h                         |    2 +-
 drivers/clk/stm32/clk-stm32-core.c                 |   22 +-
 drivers/clk/stm32/clk-stm32-core.h                 |    2 +-
 drivers/clk/stm32/clk-stm32f.c                     |    4 +-
 drivers/clk/stm32/clk-stm32h7.c                    |    2 +-
 drivers/clk/stm32/clk-stm32mp1.c                   |    4 +-
 drivers/clk/sunxi/clk_sun6i_rtc.c                  |    2 +-
 drivers/clk/sunxi/clk_sunxi.c                      |    2 +-
 drivers/clk/tegra/tegra-car-clk.c                  |    4 +-
 drivers/clk/tegra/tegra186-clk.c                   |    4 +-
 drivers/clk/thead/clk-th1520-ap.c                  |    8 +-
 drivers/clk/ti/clk-am3-dpll-x2.c                   |    2 +-
 drivers/clk/ti/clk-am3-dpll.c                      |    4 +-
 drivers/clk/ti/clk-ctrl.c                          |    2 +-
 drivers/clk/ti/clk-divider.c                       |    4 +-
 drivers/clk/ti/clk-gate.c                          |    2 +-
 drivers/clk/ti/clk-k3-pll.c                        |    4 +-
 drivers/clk/ti/clk-k3.c                            |    6 +-
 drivers/clk/ti/clk-mux.c                           |    4 +-
 drivers/clk/ti/clk-sci.c                           |    4 +-
 drivers/clk/uccf/Kconfig                           |   22 +
 drivers/clk/uccf/Makefile                          |   11 +
 drivers/clk/{ => uccf}/clk-composite.c             |   20 +-
 drivers/clk/{ => uccf}/clk-divider.c               |    4 +-
 drivers/clk/{ => uccf}/clk-fixed-factor.c          |    2 +-
 drivers/clk/{ => uccf}/clk-gate.c                  |    2 +-
 drivers/clk/{ => uccf}/clk-mux.c                   |    2 +-
 drivers/clk/{ => uccf}/clk.c                       |    4 +-
 .../{clk_sandbox_ccf.c => uccf/clk_sandbox_uccf.c} |    8 +-
 drivers/clk/uniphier/clk-uniphier-core.c           |    6 +-
 drivers/core/devres.c                              |   83 +-
 drivers/core/of_access.c                           |   52 +
 drivers/core/ofnode.c                              |   48 +
 drivers/phy/cadence/phy-cadence-sierra.c           |    2 +-
 drivers/phy/cadence/phy-cadence-torrent.c          |    2 +-
 drivers/phy/phy-stm32-usbphyc.c                    |    2 +-
 drivers/phy/phy-ti-am654.c                         |    2 +-
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c      |    2 +-
 drivers/phy/ti/phy-j721e-wiz.c                     |    6 +-
 drivers/power/domain/imx8mp-hsiomix.c              |    2 +-
 drivers/serial/serial_msm_geni.c                   |   15 +-
 drivers/soc/qcom/rpmh-rsc.c                        |    8 +-
 drivers/soc/qcom/rpmh.c                            |    4 +-
 include/asm-generic/sections.h                     |   19 +
 include/clk-uclass.h                               |    6 +-
 include/clk.h                                      |   34 +-
 include/clk/sunxi.h                                |    2 +-
 include/dm/devres.h                                |   10 +
 include/dm/of_access.h                             |   20 +
 include/dm/ofnode.h                                |   50 +
 include/fdtdec.h                                   |   16 +
 include/linux/clk-provider-ccf_full.h              | 1461 ++++++++
 include/linux/clk-provider-uccf.h                  |  251 ++
 include/linux/clk-provider.h                       |  247 +-
 include/linux/clk/clk-conf.h                       |   22 +
 include/linux/compat.h                             |   13 +
 include/linux/device.h                             |   29 +
 include/linux/err.h                                |   25 +
 include/linux/kref.h                               |  124 +
 include/linux/math64.h                             |   19 +
 include/linux/regmap.h                             |    1 +
 include/linux/string.h                             |    2 +
 include/power/regulator.h                          |    3 +
 include/regmap.h                                   |    9 +
 include/sandbox-clk.h                              |    5 +-
 lib/fdtdec.c                                       |   18 +
 lib/string.c                                       |   31 +
 lib/vsprintf.c                                     |   37 +
 test/dm/Makefile                                   |    5 +-
 test/dm/clk_ccf.c                                  |  117 +-
 test/test-main.c                                   |    6 +
 269 files changed, 24338 insertions(+), 932 deletions(-)
---
base-commit: ba7bf918dafcd093ad733b07ba490baeb20cf5da

// Casey (she/they)



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

* [PATCH RFC 01/40] vsprintf: add %pOF
  2026-03-19 20:56 [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Casey Connolly
@ 2026-03-19 20:56 ` Casey Connolly
  2026-03-19 20:56 ` [PATCH RFC 10/40] compat: add linux/regmap.h symlink Casey Connolly
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Casey Connolly @ 2026-03-19 20:56 UTC (permalink / raw)
  To: u-boot, Lukasz Majewski, u-boot-qcom, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg
  Cc: Tom Rini, Casey Connolly, Neil Armstrong, Andrew Goodbody,
	Stephen Boyd, Ilias Apalodimas, Simon Glass, Raphael Gallais-Pou,
	Patrice Chotard, Yannick Fertre, Romain Gantois, Raymond Mao,
	Michael Trimarchi, Christian Marangi, Jaehoon Chung, Peng Fan,
	Yao Zi, Leo Yu-Chi Liang, Patrick Delaunay, Michal Simek,
	Quentin Schulz, Peter Korsgaard, Greg Malysa, Vasileios Bimpikas,
	Arturs Artamonovs, Ryan Chen, Chia-Wei Wang, Eugeniy Paltsev,
	Sean Anderson, Liviu Dudau, Ryder Lee, Weijie Gao, Chunfeng Yun,
	Igor Belwon, Stefan Roese, Manivannan Sadhasivam, Robert Marko,
	Aswin Murugan, Balaji Selvanathan, Nobuhiro Iwamatsu,
	Philipp Tomsich, Kever Yang, Minda Chen, Hal Feng, Thierry Reding,
	Svyatoslav Ryhel, Kunihiko Hayashi, Philip Molloy,
	Mikhail Kshevetskiy, Ryan Wanner, Varshini Rajendran,
	Manikandan Muralidharan, Jorge Ramirez-Ortiz, Luca Weiss,
	Jens Reidel, David Wronek, Miquel Raynal, David Lechner,
	Nishanth Menon, Alice Guo, Valentin Caron,
	Senthil Nathan Thangaraj, Naman Trivedi, Venkatesh Yadav Abbarapu,
	Padmarao Begari, Jonathan Currier, Sam Shih, Conor Dooley,
	Stephan Gerhold, Varadarajan Narayanan, Loic Poulain, Sam Day,
	Rui Miguel Silva, Mattijs Korpershoek, Shmuel Leib Melamud,
	Jonas Karlman, Finley Xiao, Joseph Chen, Elaine Zhang,
	Heiko Stuebner, Gabriel Fernandez, Andrew Davis, Manorit Chawdhry,
	Udit Kumar, Heiko Schocher, Markus Schneider-Pargmann (TI.com),
	Dinesh Maniyam, Paul Sajna, Marek Vasut

This prints a full ofnode path.

Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
---
 lib/vsprintf.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index c7340a047b2e..49dc9c38c652 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -25,8 +25,13 @@
 #include <linux/err.h>
 #include <linux/types.h>
 #include <linux/string.h>
 
+/* For %pOF */
+#if CONFIG_IS_ENABLED(OF_CONTROL)
+#include <dm/ofnode.h>
+#endif
+
 /* we use this so that we can do without the ctype library */
 #define is_digit(c)	((c) >= '0' && (c) <= '9')
 
 static int skip_atoi(const char **s)
@@ -437,8 +442,32 @@ static char *uuid_string(char *buf, char *end, u8 *addr, int field_width,
 	return string(buf, end, uuid, field_width, precision, flags);
 }
 #endif
 
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !defined(API_BUILD)
+static char *ofnode_string(char *buf, char *end, ofnode *dp, int field_width,
+				int precision, int flags)
+{
+#define NP_PATH_MAX 64
+	char str[NP_PATH_MAX] = { 0 };
+	const char *err = "...";
+
+	/* If dp == NULL output the string '<NULL>' */
+	if (!dp || !ofnode_valid(*dp))
+		return string(buf, end, NULL, field_width, precision, flags);
+
+	/* Get the path and indicate if it got cut off */
+	if (ofnode_get_path(*dp, str, NP_PATH_MAX)) {
+		str[NP_PATH_MAX - 1] = '\0';
+		char *p = str + min((NP_PATH_MAX - 2) - strlen(err), strlen(str));
+		memcpy(p, err, strlen(err) + 1);
+	}
+
+	return string(buf, end, str, field_width, precision, flags);
+#undef NP_PATH_MAX
+}
+#endif
+
 /*
  * Show a '%p' thing.  A kernel extension is that the '%p' is followed
  * by an extra set of alphanumeric characters that are extended format
  * specifiers.
@@ -472,8 +501,16 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
 #if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT) && !defined(API_BUILD)
 	case 'D':
 		return device_path_string(buf, end, ptr, field_width,
 					  precision, flags);
+#endif
+/* Device paths only exist in the EFI context. */
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !defined(API_BUILD)
+	case 'O':
+		if (fmt[1] == 'F')
+			return ofnode_string(buf, end, ptr, field_width,
+					  precision, flags);
+		break;
 #endif
 	case 'a':
 		flags |= SPECIAL | ZEROPAD;
 

-- 
2.51.0



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

* [PATCH RFC 10/40] compat: add linux/regmap.h symlink
  2026-03-19 20:56 [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Casey Connolly
  2026-03-19 20:56 ` [PATCH RFC 01/40] vsprintf: add %pOF Casey Connolly
@ 2026-03-19 20:56 ` Casey Connolly
  2026-03-19 20:56 ` [PATCH RFC 11/40] devres: add devm_krealloc Casey Connolly
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Casey Connolly @ 2026-03-19 20:56 UTC (permalink / raw)
  To: u-boot, Lukasz Majewski, u-boot-qcom, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg
  Cc: Tom Rini, Casey Connolly, Neil Armstrong, Andrew Goodbody,
	Stephen Boyd, Ilias Apalodimas, Simon Glass, Raphael Gallais-Pou,
	Patrice Chotard, Yannick Fertre, Romain Gantois, Raymond Mao,
	Michael Trimarchi, Christian Marangi, Jaehoon Chung, Peng Fan,
	Yao Zi, Leo Yu-Chi Liang, Patrick Delaunay, Michal Simek,
	Quentin Schulz, Peter Korsgaard, Greg Malysa, Vasileios Bimpikas,
	Arturs Artamonovs, Ryan Chen, Chia-Wei Wang, Eugeniy Paltsev,
	Sean Anderson, Liviu Dudau, Ryder Lee, Weijie Gao, Chunfeng Yun,
	Igor Belwon, Stefan Roese, Manivannan Sadhasivam, Robert Marko,
	Aswin Murugan, Balaji Selvanathan, Nobuhiro Iwamatsu,
	Philipp Tomsich, Kever Yang, Minda Chen, Hal Feng, Thierry Reding,
	Svyatoslav Ryhel, Kunihiko Hayashi, Philip Molloy,
	Mikhail Kshevetskiy, Ryan Wanner, Varshini Rajendran,
	Manikandan Muralidharan, Jorge Ramirez-Ortiz, Luca Weiss,
	Jens Reidel, David Wronek, Miquel Raynal, David Lechner,
	Nishanth Menon, Alice Guo, Valentin Caron,
	Senthil Nathan Thangaraj, Naman Trivedi, Venkatesh Yadav Abbarapu,
	Padmarao Begari, Jonathan Currier, Sam Shih, Conor Dooley,
	Stephan Gerhold, Varadarajan Narayanan, Loic Poulain, Sam Day,
	Rui Miguel Silva, Mattijs Korpershoek, Shmuel Leib Melamud,
	Jonas Karlman, Finley Xiao, Joseph Chen, Elaine Zhang,
	Heiko Stuebner, Gabriel Fernandez, Andrew Davis, Manorit Chawdhry,
	Udit Kumar, Heiko Schocher, Markus Schneider-Pargmann (TI.com),
	Dinesh Maniyam, Paul Sajna, Marek Vasut

Add a symlink to the Linux regmap.h path so that drivers ported from
Linux don't all need additional changes to include the U-Boot specific
path.

Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
---
 include/linux/regmap.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/regmap.h b/include/linux/regmap.h
new file mode 120000
index 000000000000..8a3780b5cebd
--- /dev/null
+++ b/include/linux/regmap.h
@@ -0,0 +1 @@
+../regmap.h
\ No newline at end of file

-- 
2.51.0



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

* [PATCH RFC 11/40] devres: add devm_krealloc
  2026-03-19 20:56 [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Casey Connolly
  2026-03-19 20:56 ` [PATCH RFC 01/40] vsprintf: add %pOF Casey Connolly
  2026-03-19 20:56 ` [PATCH RFC 10/40] compat: add linux/regmap.h symlink Casey Connolly
@ 2026-03-19 20:56 ` Casey Connolly
  2026-03-19 20:56 ` [PATCH RFC 16/40] clk: move U-Boot CCF to clk/uccf Casey Connolly
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Casey Connolly @ 2026-03-19 20:56 UTC (permalink / raw)
  To: u-boot, Lukasz Majewski, u-boot-qcom, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg
  Cc: Tom Rini, Casey Connolly, Neil Armstrong, Andrew Goodbody,
	Stephen Boyd, Ilias Apalodimas, Simon Glass, Raphael Gallais-Pou,
	Patrice Chotard, Yannick Fertre, Romain Gantois, Raymond Mao,
	Michael Trimarchi, Christian Marangi, Jaehoon Chung, Peng Fan,
	Yao Zi, Leo Yu-Chi Liang, Patrick Delaunay, Michal Simek,
	Quentin Schulz, Peter Korsgaard, Greg Malysa, Vasileios Bimpikas,
	Arturs Artamonovs, Ryan Chen, Chia-Wei Wang, Eugeniy Paltsev,
	Sean Anderson, Liviu Dudau, Ryder Lee, Weijie Gao, Chunfeng Yun,
	Igor Belwon, Stefan Roese, Manivannan Sadhasivam, Robert Marko,
	Aswin Murugan, Balaji Selvanathan, Nobuhiro Iwamatsu,
	Philipp Tomsich, Kever Yang, Minda Chen, Hal Feng, Thierry Reding,
	Svyatoslav Ryhel, Kunihiko Hayashi, Philip Molloy,
	Mikhail Kshevetskiy, Ryan Wanner, Varshini Rajendran,
	Manikandan Muralidharan, Jorge Ramirez-Ortiz, Luca Weiss,
	Jens Reidel, David Wronek, Miquel Raynal, David Lechner,
	Nishanth Menon, Alice Guo, Valentin Caron,
	Senthil Nathan Thangaraj, Naman Trivedi, Venkatesh Yadav Abbarapu,
	Padmarao Begari, Jonathan Currier, Sam Shih, Conor Dooley,
	Stephan Gerhold, Varadarajan Narayanan, Loic Poulain, Sam Day,
	Rui Miguel Silva, Mattijs Korpershoek, Shmuel Leib Melamud,
	Jonas Karlman, Finley Xiao, Joseph Chen, Elaine Zhang,
	Heiko Stuebner, Gabriel Fernandez, Andrew Davis, Manorit Chawdhry,
	Udit Kumar, Heiko Schocher, Markus Schneider-Pargmann (TI.com),
	Dinesh Maniyam, Paul Sajna, Marek Vasut

Loosely based on the Linux version, this makes it possible to krealloc()
devm managed memory. Currently it depends on tracking the allocation
size in struct devres even when DEBUG_DEVRES is disabled, but it's a
relatively small tradeoff for the additional functionality.

Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
---
 drivers/core/devres.c | 83 ++++++++++++++++++++++++++++++++++++++++++++-------
 include/dm/devres.h   | 10 +++++++
 2 files changed, 83 insertions(+), 10 deletions(-)

diff --git a/drivers/core/devres.c b/drivers/core/devres.c
index 8df08b91021c..88f7c832f43e 100644
--- a/drivers/core/devres.c
+++ b/drivers/core/devres.c
@@ -45,18 +45,17 @@ struct devres {
 	dr_release_t			release;
 	enum devres_phase		phase;
 #ifdef CONFIG_DEBUG_DEVRES
 	const char			*name;
-	size_t				size;
 #endif
+	size_t				size;
 	unsigned long long		data[];
 };
 
 #ifdef CONFIG_DEBUG_DEVRES
-static void set_node_dbginfo(struct devres *dr, const char *name, size_t size)
+static void set_node_dbginfo(struct devres *dr, const char *name)
 {
 	dr->name = name;
-	dr->size = size;
 }
 
 static void devres_log(struct udevice *dev, struct devres *dr,
 		       const char *op)
@@ -64,9 +63,9 @@ static void devres_log(struct udevice *dev, struct devres *dr,
 	log_debug("%s: DEVRES %3s %p %s (%lu bytes)\n", dev->name, op, dr,
 		  dr->name, (unsigned long)dr->size);
 }
 #else /* CONFIG_DEBUG_DEVRES */
-#define set_node_dbginfo(dr, n, s)	do {} while (0)
+#define set_node_dbginfo(dr, n)	do {} while (0)
 #define devres_log(dev, dr, op)		do {} while (0)
 #endif
 
 #if CONFIG_DEBUG_DEVRES
@@ -84,9 +83,10 @@ void *_devres_alloc(dr_release_t release, size_t size, gfp_t gfp)
 		return NULL;
 
 	INIT_LIST_HEAD(&dr->entry);
 	dr->release = release;
-	set_node_dbginfo(dr, name, size);
+	dr->size = size;
+	set_node_dbginfo(dr, name);
 
 	return dr->data;
 }
 
@@ -99,23 +99,35 @@ void devres_free(void *res)
 		kfree(dr);
 	}
 }
 
-void devres_add(struct udevice *dev, void *res)
+static void devres_set_phase(struct udevice *dev, struct devres *dr)
 {
-	struct devres *dr = container_of(res, struct devres, data);
-
-	devres_log(dev, dr, "ADD");
-	assert_noisy(list_empty(&dr->entry));
 	if (dev_get_flags(dev) & DM_FLAG_PLATDATA_VALID)
 		dr->phase = DEVRES_PHASE_PROBE;
 	else if (dev_get_flags(dev) & DM_FLAG_BOUND)
 		dr->phase = DEVRES_PHASE_OFDATA;
 	else
 		dr->phase = DEVRES_PHASE_BIND;
+}
+
+void devres_add(struct udevice *dev, void *res)
+{
+	struct devres *dr = container_of(res, struct devres, data);
+
+	devres_log(dev, dr, "ADD");
+	assert_noisy(list_empty(&dr->entry));
+	devres_set_phase(dev, dr);
 	list_add_tail(&dr->entry, &dev->devres_head);
 }
 
+static void devres_replace(struct udevice *dev, struct devres *old, struct devres *new)
+{
+	devres_log(dev, old, "REPLACE");
+	devres_set_phase(dev, new);
+	list_replace(&old->entry, &new->entry);
+}
+
 void *devres_find(struct udevice *dev, dr_release_t release,
 		  dr_match_t match, void *match_data)
 {
 	struct devres *dr;
@@ -290,4 +302,55 @@ void devm_kfree(struct udevice *dev, void *p)
 
 	rc = devres_destroy(dev, devm_kmalloc_release, devm_kmalloc_match, p);
 	assert_noisy(!rc);
 }
+
+/**
+ * devm_krealloc - Resource-managed krealloc()
+ * @dev: Device to re-allocate memory for
+ * @ptr: Pointer to the memory chunk to re-allocate
+ * @new_size: New allocation size
+ * @gfp: Allocation gfp flags
+ *
+ * Managed krealloc(). Resizes the memory chunk allocated with devm_kmalloc().
+ * Behaves similarly to regular krealloc(): if @ptr is NULL or ZERO_SIZE_PTR,
+ * it's the equivalent of devm_kmalloc(). If new_size is zero, it frees the
+ * previously allocated memory and returns ZERO_SIZE_PTR. This function doesn't
+ * change the order in which the release callback for the re-alloc'ed devres
+ * will be called (except when falling back to devm_kmalloc() or when freeing
+ * resources when new_size is zero). The contents of the memory are preserved
+ * up to the lesser of new and old sizes.
+ */
+void *devm_krealloc(struct udevice *dev, void *ptr, size_t new_size, gfp_t gfp)
+{
+	struct devres *old_dr, *new_dr;
+
+	if (unlikely(!new_size)) {
+		devm_kfree(dev, ptr);
+		return NULL;
+	}
+
+	if (unlikely(!ptr))
+		return devm_kmalloc(dev, new_size, gfp);
+
+	old_dr = devres_find(dev, devm_kmalloc_release, devm_kmalloc_match, ptr);
+	if (!old_dr) {
+		printf("Devres realloc failed, memory chunk not managed or managed by a different device\n");
+		return NULL;
+	}
+
+	/* No need to realloc to shrink */
+	if (old_dr->size < new_size)
+		return old_dr->data;
+
+	new_dr = _devres_alloc(devm_kmalloc_release, new_size, gfp);
+	if (!new_dr)
+		return NULL;
+
+	devres_replace(dev, old_dr, new_dr);
+	memcpy(new_dr->data, old_dr->data,
+	       old_dr->size);
+
+	devres_free(old_dr->data);
+
+	return new_dr->data;
+}
diff --git a/include/dm/devres.h b/include/dm/devres.h
index 406d18686f4d..13d7d0eec43a 100644
--- a/include/dm/devres.h
+++ b/include/dm/devres.h
@@ -194,8 +194,18 @@ static inline void *devm_kcalloc(struct udevice *dev,
 {
 	return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
 }
 
+void *devm_krealloc(struct udevice *dev, void *ptr, size_t new_size, gfp_t gfp);
+
+static inline void *devm_krealloc_array(struct udevice *dev, void *p, size_t new_n, size_t new_size, gfp_t flags)
+{
+	if (new_size != 0 && new_n > SIZE_MAX / new_size)
+		return NULL;
+
+	return devm_krealloc(dev, p, new_n * new_size, flags);
+}
+
 /**
  * devm_kfree() - Resource-managed kfree
  * @dev: Device this memory belongs to
  * @ptr: Memory to free

-- 
2.51.0



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

* [PATCH RFC 16/40] clk: move U-Boot CCF to clk/uccf
  2026-03-19 20:56 [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Casey Connolly
                   ` (2 preceding siblings ...)
  2026-03-19 20:56 ` [PATCH RFC 11/40] devres: add devm_krealloc Casey Connolly
@ 2026-03-19 20:56 ` Casey Connolly
  2026-03-19 20:56 ` [PATCH RFC 18/40] clk: move fixed clocks to clk/basic Casey Connolly
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Casey Connolly @ 2026-03-19 20:56 UTC (permalink / raw)
  To: u-boot, Lukasz Majewski, u-boot-qcom, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg
  Cc: Tom Rini, Casey Connolly, Neil Armstrong, Andrew Goodbody,
	Stephen Boyd, Ilias Apalodimas, Simon Glass, Raphael Gallais-Pou,
	Patrice Chotard, Yannick Fertre, Romain Gantois, Raymond Mao,
	Michael Trimarchi, Christian Marangi, Jaehoon Chung, Peng Fan,
	Yao Zi, Leo Yu-Chi Liang, Patrick Delaunay, Michal Simek,
	Quentin Schulz, Peter Korsgaard, Greg Malysa, Vasileios Bimpikas,
	Arturs Artamonovs, Ryan Chen, Chia-Wei Wang, Eugeniy Paltsev,
	Sean Anderson, Liviu Dudau, Ryder Lee, Weijie Gao, Chunfeng Yun,
	Igor Belwon, Stefan Roese, Manivannan Sadhasivam, Robert Marko,
	Aswin Murugan, Balaji Selvanathan, Nobuhiro Iwamatsu,
	Philipp Tomsich, Kever Yang, Minda Chen, Hal Feng, Thierry Reding,
	Svyatoslav Ryhel, Kunihiko Hayashi, Philip Molloy,
	Mikhail Kshevetskiy, Ryan Wanner, Varshini Rajendran,
	Manikandan Muralidharan, Jorge Ramirez-Ortiz, Luca Weiss,
	Jens Reidel, David Wronek, Miquel Raynal, David Lechner,
	Nishanth Menon, Alice Guo, Valentin Caron,
	Senthil Nathan Thangaraj, Naman Trivedi, Venkatesh Yadav Abbarapu,
	Padmarao Begari, Jonathan Currier, Sam Shih, Conor Dooley,
	Stephan Gerhold, Varadarajan Narayanan, Loic Poulain, Sam Day,
	Rui Miguel Silva, Mattijs Korpershoek, Shmuel Leib Melamud,
	Jonas Karlman, Finley Xiao, Joseph Chen, Elaine Zhang,
	Heiko Stuebner, Gabriel Fernandez, Andrew Davis, Manorit Chawdhry,
	Udit Kumar, Heiko Schocher, Markus Schneider-Pargmann (TI.com),
	Dinesh Maniyam, Paul Sajna, Marek Vasut

Prepare for the introduction of full CCF support by moving the existing
U-Boot CCF support to a uccf subdirectory.

Due to a number of incompatibilities it won't be possible to support
existing U-Boot CCF clocks with the full CCF, this allows us to support
both. While it may make sense to remove U-Boot CCF in the future, it may
be necessary to continue supporting it to meet space/memory requirements
in SPL for some platforms.

Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
---
 drivers/clk/Kconfig                                | 51 +++++++---------------
 drivers/clk/Makefile                               |  7 ++-
 drivers/clk/uccf/Kconfig                           | 22 ++++++++++
 drivers/clk/uccf/Makefile                          | 11 +++++
 drivers/clk/{ => uccf}/clk-composite.c             |  0
 drivers/clk/{ => uccf}/clk-divider.c               |  0
 drivers/clk/{ => uccf}/clk-fixed-factor.c          |  0
 drivers/clk/{ => uccf}/clk-gate.c                  |  0
 drivers/clk/{ => uccf}/clk-mux.c                   |  0
 drivers/clk/{ => uccf}/clk.c                       |  0
 .../{clk_sandbox_ccf.c => uccf/clk_sandbox_uccf.c} |  2 +-
 include/sandbox-clk.h                              |  2 +-
 12 files changed, 54 insertions(+), 41 deletions(-)

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index c88931c8ec4d..5cc76cd55cc8 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -10,8 +10,24 @@ config CLK
 	  a particular clock rate and check on available clocks. Clocks can
 	  feed into other clocks in a tree structure, with multiplexers to
 	  choose the source for each clock.
 
+source "drivers/clk/uccf/Kconfig"
+
+config SANDBOX_CLK_CCF
+	bool "Sandbox U-Boot Common Clock Framework [uCCF] support"
+	depends on SANDBOX && (CLK_CCF || CLK_CCF_FULL)
+	help
+	  Enable this option if you want to test the Linux kernel's Common
+	  Clock Framework [CCF] code in U-Boot's Sandbox clock driver.
+
+config CLK_COMPOSITE_CCF
+	bool "Common Clock Framework [CCF] composite clk support"
+	depends on CLK_CCF || CLK_CCF_FULL
+	help
+	  Enable this option if you want to (re-)use the Linux kernel's Common
+	  Clock Framework [CCF] composite code in U-Boot's clock driver.
+
 config CLK_AUTO_ID
 	bool "Enable support of an unique clock id with several provider"
 	depends on CLK
 	help
@@ -66,35 +82,8 @@ config CLK_BOSTON
 	select SYSCON
 	help
 	  Enable this to support the clocks
 
-config SPL_CLK_CCF
-	bool "SPL Common Clock Framework [CCF] support"
-	depends on SPL
-	help
-	  Enable this option if you want to (re-)use the Linux kernel's Common
-	  Clock Framework [CCF] code in U-Boot's SPL.
-
-config SPL_CLK_COMPOSITE_CCF
-	bool "SPL Common Clock Framework [CCF] composite clk support"
-	depends on SPL_CLK_CCF
-	help
-	  Enable this option if you want to (re-)use the Linux kernel's Common
-	  Clock Framework [CCF] composite code in U-Boot's SPL.
-
-config CLK_CCF
-	bool "Common Clock Framework [CCF] support"
-	help
-	  Enable this option if you want to (re-)use the Linux kernel's Common
-	  Clock Framework [CCF] code in U-Boot's clock driver.
-
-config CLK_COMPOSITE_CCF
-	bool "Common Clock Framework [CCF] composite clk support"
-	depends on CLK_CCF
-	help
-	  Enable this option if you want to (re-)use the Linux kernel's Common
-	  Clock Framework [CCF] composite code in U-Boot's clock driver.
-
 config CLK_GPIO
 	bool "GPIO-controlled clock gate driver"
 	depends on CLK
 	help
@@ -180,16 +169,8 @@ config CLK_OCTEON
 	default y
 	help
 	  Enable this to support the clocks on Octeon MIPS platforms.
 
-config SANDBOX_CLK_CCF
-	bool "Sandbox Common Clock Framework [CCF] support"
-	depends on SANDBOX
-	select CLK_CCF
-	help
-	  Enable this option if you want to test the Linux kernel's Common
-	  Clock Framework [CCF] code in U-Boot's Sandbox clock driver.
-
 config CLK_SCMI
 	bool "Enable SCMI clock driver"
 	depends on CLK
 	depends on SCMI_FIRMWARE
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index f96d57a3223a..30991e9f55d7 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -6,14 +6,14 @@
 
 obj-$(CONFIG_$(PHASE_)CLK) += clk-uclass.o
 obj-$(CONFIG_$(PHASE_)CLK) += clk_fixed_rate.o
 obj-$(CONFIG_$(PHASE_)CLK) += clk_fixed_factor.o
-obj-$(CONFIG_$(PHASE_)CLK_CCF) += clk.o clk-divider.o clk-mux.o clk-gate.o
-obj-$(CONFIG_$(PHASE_)CLK_CCF) += clk-fixed-factor.o
-obj-$(CONFIG_$(PHASE_)CLK_COMPOSITE_CCF) += clk-composite.o
 obj-$(CONFIG_$(PHASE_)CLK_GPIO) += clk-gpio.o
 obj-$(CONFIG_$(PHASE_)CLK_STUB) += clk-stub.o
 
+# U-Boot/IMX "micro" CCF port
+obj-$(CONFIG_$(PHASE_)CLK_CCF) += uccf/
+
 obj-y += adi/
 obj-y += airoha/
 obj-y += analogbits/
 obj-$(CONFIG_$(PHASE_)MACH_IMX) += imx/
@@ -57,7 +57,6 @@ obj-$(CONFIG_CLK_XLNX_CLKWZRD) += clk-xlnx-clock-wizard.o
 obj-$(CONFIG_CLK_ZYNQ) += clk_zynq.o
 obj-$(CONFIG_CLK_ZYNQMP) += clk_zynqmp.o
 obj-$(CONFIG_CLK_ICS8N3QV01) += ics8n3qv01.o
 obj-$(CONFIG_MACH_PIC32) += clk_pic32.o
-obj-$(CONFIG_SANDBOX_CLK_CCF) += clk_sandbox_ccf.o
 obj-$(CONFIG_SANDBOX) += clk_sandbox.o
 obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o
diff --git a/drivers/clk/uccf/Kconfig b/drivers/clk/uccf/Kconfig
new file mode 100644
index 000000000000..bf4a634a403f
--- /dev/null
+++ b/drivers/clk/uccf/Kconfig
@@ -0,0 +1,22 @@
+
+
+config SPL_CLK_CCF
+	bool "SPL U-Boot Common Clock Framework [uCCF] support"
+	depends on SPL
+	help
+	  Enable this option if you want to (re-)use the Linux kernel's Common
+	  Clock Framework [CCF] code in U-Boot's SPL.
+
+config SPL_CLK_COMPOSITE_CCF
+	bool "SPL U-Boot Common Clock Framework [uCCF] composite clk support"
+	depends on SPL_CLK_CCF
+	help
+	  Enable this option if you want to (re-)use the Linux kernel's Common
+	  Clock Framework [CCF] composite code in U-Boot's SPL.
+
+config CLK_CCF
+	bool "U-Boot Common Clock Framework [uCCF] support"
+	help
+	  Enable this option if you want to (re-)use the Linux kernel's Common
+	  Clock Framework [CCF] code in U-Boot's clock driver.
+
diff --git a/drivers/clk/uccf/Makefile b/drivers/clk/uccf/Makefile
new file mode 100644
index 000000000000..02440b5e322c
--- /dev/null
+++ b/drivers/clk/uccf/Makefile
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (c) 2015 Google, Inc
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+
+obj-$(CONFIG_$(PHASE_)CLK_CCF) += clk.o clk-divider.o clk-mux.o clk-gate.o
+obj-$(CONFIG_$(PHASE_)CLK_CCF) += clk-fixed-factor.o
+obj-$(CONFIG_$(PHASE_)CLK_COMPOSITE_CCF) += clk-composite.o
+
+obj-$(CONFIG_SANDBOX_CLK_CCF) += clk_sandbox_uccf.o
diff --git a/drivers/clk/clk-composite.c b/drivers/clk/uccf/clk-composite.c
similarity index 100%
rename from drivers/clk/clk-composite.c
rename to drivers/clk/uccf/clk-composite.c
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/uccf/clk-divider.c
similarity index 100%
rename from drivers/clk/clk-divider.c
rename to drivers/clk/uccf/clk-divider.c
diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/uccf/clk-fixed-factor.c
similarity index 100%
rename from drivers/clk/clk-fixed-factor.c
rename to drivers/clk/uccf/clk-fixed-factor.c
diff --git a/drivers/clk/clk-gate.c b/drivers/clk/uccf/clk-gate.c
similarity index 100%
rename from drivers/clk/clk-gate.c
rename to drivers/clk/uccf/clk-gate.c
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/uccf/clk-mux.c
similarity index 100%
rename from drivers/clk/clk-mux.c
rename to drivers/clk/uccf/clk-mux.c
diff --git a/drivers/clk/clk.c b/drivers/clk/uccf/clk.c
similarity index 100%
rename from drivers/clk/clk.c
rename to drivers/clk/uccf/clk.c
diff --git a/drivers/clk/clk_sandbox_ccf.c b/drivers/clk/uccf/clk_sandbox_uccf.c
similarity index 98%
rename from drivers/clk/clk_sandbox_ccf.c
rename to drivers/clk/uccf/clk_sandbox_uccf.c
index 9b8036d41aac..9c74ed940acd 100644
--- a/drivers/clk/clk_sandbox_ccf.c
+++ b/drivers/clk/uccf/clk_sandbox_uccf.c
@@ -112,9 +112,9 @@ static const struct clk_ops clk_gate2_ops = {
 	.disable = clk_gate2_disable,
 	.get_rate = clk_generic_get_rate,
 };
 
-struct clk *sandbox_clk_register_gate2(struct device *dev, const char *name,
+struct clk *sandbox_clk_register_gate2(struct udevice *dev, const char *name,
 				       const char *parent_name,
 				       unsigned long flags, void __iomem *reg,
 				       u8 bit_idx, u8 cgr_val,
 				       u8 clk_gate2_flags)
diff --git a/include/sandbox-clk.h b/include/sandbox-clk.h
index c2616c27a44a..eb02a474c741 100644
--- a/include/sandbox-clk.h
+++ b/include/sandbox-clk.h
@@ -57,9 +57,9 @@ static inline struct clk *sandbox_clk_gate(const char *name, const char *parent,
 	return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT,
 				 reg, bit_idx, clk_gate_flags, NULL);
 }
 
-struct clk *sandbox_clk_register_gate2(struct device *dev, const char *name,
+struct clk *sandbox_clk_register_gate2(struct udevice *dev, const char *name,
 				       const char *parent_name,
 				       unsigned long flags,
 				       void __iomem *reg, u8 bit_idx,
 				       u8 cgr_val, u8 clk_gate_flags);

-- 
2.51.0



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

* [PATCH RFC 18/40] clk: move fixed clocks to clk/basic
  2026-03-19 20:56 [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Casey Connolly
                   ` (3 preceding siblings ...)
  2026-03-19 20:56 ` [PATCH RFC 16/40] clk: move U-Boot CCF to clk/uccf Casey Connolly
@ 2026-03-19 20:56 ` Casey Connolly
  2026-03-19 20:56 ` [PATCH RFC 26/40] clk/clk-uclass: adapt for CCF_FULL Casey Connolly
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Casey Connolly @ 2026-03-19 20:56 UTC (permalink / raw)
  To: u-boot, Lukasz Majewski, u-boot-qcom, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg
  Cc: Tom Rini, Casey Connolly, Neil Armstrong, Andrew Goodbody,
	Stephen Boyd, Ilias Apalodimas, Simon Glass, Raphael Gallais-Pou,
	Patrice Chotard, Yannick Fertre, Romain Gantois, Raymond Mao,
	Michael Trimarchi, Christian Marangi, Jaehoon Chung, Peng Fan,
	Yao Zi, Leo Yu-Chi Liang, Patrick Delaunay, Michal Simek,
	Quentin Schulz, Peter Korsgaard, Greg Malysa, Vasileios Bimpikas,
	Arturs Artamonovs, Ryan Chen, Chia-Wei Wang, Eugeniy Paltsev,
	Sean Anderson, Liviu Dudau, Ryder Lee, Weijie Gao, Chunfeng Yun,
	Igor Belwon, Stefan Roese, Manivannan Sadhasivam, Robert Marko,
	Aswin Murugan, Balaji Selvanathan, Nobuhiro Iwamatsu,
	Philipp Tomsich, Kever Yang, Minda Chen, Hal Feng, Thierry Reding,
	Svyatoslav Ryhel, Kunihiko Hayashi, Philip Molloy,
	Mikhail Kshevetskiy, Ryan Wanner, Varshini Rajendran,
	Manikandan Muralidharan, Jorge Ramirez-Ortiz, Luca Weiss,
	Jens Reidel, David Wronek, Miquel Raynal, David Lechner,
	Nishanth Menon, Alice Guo, Valentin Caron,
	Senthil Nathan Thangaraj, Naman Trivedi, Venkatesh Yadav Abbarapu,
	Padmarao Begari, Jonathan Currier, Sam Shih, Conor Dooley,
	Stephan Gerhold, Varadarajan Narayanan, Loic Poulain, Sam Day,
	Rui Miguel Silva, Mattijs Korpershoek, Shmuel Leib Melamud,
	Jonas Karlman, Finley Xiao, Joseph Chen, Elaine Zhang,
	Heiko Stuebner, Gabriel Fernandez, Andrew Davis, Manorit Chawdhry,
	Udit Kumar, Heiko Schocher, Markus Schneider-Pargmann (TI.com),
	Dinesh Maniyam, Paul Sajna, Marek Vasut

Linux CCF has incompatible implementations of fixed-rate/fixed-factor
clocks, move the U-Boot versions of these drivers to clk/basic and only
build them if CCF_FULL is not enabled.

Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
---
 drivers/clk/Makefile                       | 8 ++++++--
 drivers/clk/basic/Makefile                 | 7 +++++++
 drivers/clk/{ => basic}/clk_fixed_factor.c | 0
 drivers/clk/{ => basic}/clk_fixed_rate.c   | 0
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 30991e9f55d7..23f381eb0d9f 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -4,16 +4,20 @@
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 #
 
 obj-$(CONFIG_$(PHASE_)CLK) += clk-uclass.o
-obj-$(CONFIG_$(PHASE_)CLK) += clk_fixed_rate.o
-obj-$(CONFIG_$(PHASE_)CLK) += clk_fixed_factor.o
 obj-$(CONFIG_$(PHASE_)CLK_GPIO) += clk-gpio.o
 obj-$(CONFIG_$(PHASE_)CLK_STUB) += clk-stub.o
 
 # U-Boot/IMX "micro" CCF port
 obj-$(CONFIG_$(PHASE_)CLK_CCF) += uccf/
 
+# U-Boot basic fixed clocks, full CCF has a
+# different and incompatible implementation
+ifndef CONFIG_CLK_CCF_FULL
+obj-y += basic/
+endif
+
 obj-y += adi/
 obj-y += airoha/
 obj-y += analogbits/
 obj-$(CONFIG_$(PHASE_)MACH_IMX) += imx/
diff --git a/drivers/clk/basic/Makefile b/drivers/clk/basic/Makefile
new file mode 100644
index 000000000000..4cf9469d2312
--- /dev/null
+++ b/drivers/clk/basic/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (c) 2026 Linaro Ltd.
+#
+
+obj-$(CONFIG_$(PHASE_)CLK) += clk_fixed_rate.o
+obj-$(CONFIG_$(PHASE_)CLK) += clk_fixed_factor.o
diff --git a/drivers/clk/clk_fixed_factor.c b/drivers/clk/basic/clk_fixed_factor.c
similarity index 100%
rename from drivers/clk/clk_fixed_factor.c
rename to drivers/clk/basic/clk_fixed_factor.c
diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/basic/clk_fixed_rate.c
similarity index 100%
rename from drivers/clk/clk_fixed_rate.c
rename to drivers/clk/basic/clk_fixed_rate.c

-- 
2.51.0



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

* [PATCH RFC 26/40] clk/clk-uclass: adapt for CCF_FULL
  2026-03-19 20:56 [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Casey Connolly
                   ` (4 preceding siblings ...)
  2026-03-19 20:56 ` [PATCH RFC 18/40] clk: move fixed clocks to clk/basic Casey Connolly
@ 2026-03-19 20:56 ` Casey Connolly
  2026-03-19 20:56 ` [PATCH RFC 31/40] cmd/clk: add CCF_FULL support Casey Connolly
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Casey Connolly @ 2026-03-19 20:56 UTC (permalink / raw)
  To: u-boot, Lukasz Majewski, u-boot-qcom, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg
  Cc: Tom Rini, Casey Connolly, Neil Armstrong, Andrew Goodbody,
	Stephen Boyd, Ilias Apalodimas, Simon Glass, Raphael Gallais-Pou,
	Patrice Chotard, Yannick Fertre, Romain Gantois, Raymond Mao,
	Michael Trimarchi, Christian Marangi, Jaehoon Chung, Peng Fan,
	Yao Zi, Leo Yu-Chi Liang, Patrick Delaunay, Michal Simek,
	Quentin Schulz, Peter Korsgaard, Greg Malysa, Vasileios Bimpikas,
	Arturs Artamonovs, Ryan Chen, Chia-Wei Wang, Eugeniy Paltsev,
	Sean Anderson, Liviu Dudau, Ryder Lee, Weijie Gao, Chunfeng Yun,
	Igor Belwon, Stefan Roese, Manivannan Sadhasivam, Robert Marko,
	Aswin Murugan, Balaji Selvanathan, Nobuhiro Iwamatsu,
	Philipp Tomsich, Kever Yang, Minda Chen, Hal Feng, Thierry Reding,
	Svyatoslav Ryhel, Kunihiko Hayashi, Philip Molloy,
	Mikhail Kshevetskiy, Ryan Wanner, Varshini Rajendran,
	Manikandan Muralidharan, Jorge Ramirez-Ortiz, Luca Weiss,
	Jens Reidel, David Wronek, Miquel Raynal, David Lechner,
	Nishanth Menon, Alice Guo, Valentin Caron,
	Senthil Nathan Thangaraj, Naman Trivedi, Venkatesh Yadav Abbarapu,
	Padmarao Begari, Jonathan Currier, Sam Shih, Conor Dooley,
	Stephan Gerhold, Varadarajan Narayanan, Loic Poulain, Sam Day,
	Rui Miguel Silva, Mattijs Korpershoek, Shmuel Leib Melamud,
	Jonas Karlman, Finley Xiao, Joseph Chen, Elaine Zhang,
	Heiko Stuebner, Gabriel Fernandez, Andrew Davis, Manorit Chawdhry,
	Udit Kumar, Heiko Schocher, Markus Schneider-Pargmann (TI.com),
	Dinesh Maniyam, Paul Sajna, Marek Vasut

When building U-Boot with CCF_FULL support, most clk operations
are implemented in clk/ccf/clk.c, so we can remove the conflicting
definitions in clk-uclass.c.

Additionally, registering clock consumers works quite differently, so we
adapt clk_get_by_name() and similar functions to call into CCF. Notably
while in Linux the struct clk handle is allocated inside CCF (since
it's an opaque cookie), in U-Boot struct clk is public and typically
allocated by the consumer driver, so we need a small adjustment to allow
CCF to populate an already-allocated struct clk.

Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
---
 drivers/clk/clk-uclass.c | 297 +++++++++++++++++++++++++++--------------------
 1 file changed, 172 insertions(+), 125 deletions(-)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 095329e25f15..d54d76745560 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -23,8 +23,11 @@
 #include <linux/bug.h>
 #include <linux/clk-provider.h>
 #include <linux/err.h>
 
+#include <linux/clk/clk-conf.h>
+#include "ccf/clk.h"
+
 static inline const struct clk_ops_uboot *clk_dev_ops(struct udevice *dev)
 {
 	return (const struct clk_ops_uboot *)dev->driver->ops;
 }
@@ -74,9 +77,9 @@ static int clk_of_xlate_default(struct clk *clk,
 
 	return 0;
 }
 
-static int clk_get_by_index_tail(int ret, ofnode node,
+static int __maybe_unused clk_get_by_index_tail(int ret, ofnode node,
 				 struct ofnode_phandle_args *args,
 				 const char *list_name, int index,
 				 struct clk *clk)
 {
@@ -115,47 +118,30 @@ err:
 
 	return log_msg_ret("prop", ret);
 }
 
-static int clk_get_by_indexed_prop(struct udevice *dev, const char *prop_name,
-				   int index, struct clk *clk)
-{
-	int ret;
-	struct ofnode_phandle_args args;
-
-	debug("%s(dev=%s, index=%d, clk=%p)\n", __func__, dev_read_name(dev),
-	      index, clk);
-
-	assert(clk);
-	clk->dev = NULL;
-
-	ret = dev_read_phandle_with_args(dev, prop_name, "#clock-cells", 0,
-					 index, &args);
-	if (ret) {
-		debug("%s: fdtdec_parse_phandle_with_args failed: err=%d\n",
-		      __func__, ret);
-		return log_ret(ret);
-	}
-
-	return clk_get_by_index_tail(ret, dev_ofnode(dev), &args, "clocks",
-				     index, clk);
-}
-
 int clk_get_by_index(struct udevice *dev, int index, struct clk *clk)
 {
 	return clk_get_by_index_nodev(dev_ofnode(dev), index, clk);
 }
 
 int clk_get_by_index_nodev(ofnode node, int index, struct clk *clk)
 {
+#if CONFIG_IS_ENABLED(CLK_CCF_FULL)
+	struct clk_hw *hw;
+
+	hw = of_clk_get_hw(node, index, NULL);
+	return clk_hw_create_clk_uboot(clk, hw);
+#else
 	struct ofnode_phandle_args args;
 	int ret;
 
 	ret = ofnode_parse_phandle_with_args(node, "clocks", "#clock-cells", 0,
 					     index, &args);
 
 	return clk_get_by_index_tail(ret, node, &args, "clocks",
 				     index, clk);
+#endif
 }
 
 int clk_get_bulk(struct udevice *dev, struct clk_bulk *bulk)
 {
@@ -189,8 +175,86 @@ bulk_get_err:
 
 	return ret;
 }
 
+int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk)
+{
+#if CONFIG_IS_ENABLED(CLK_CCF_FULL)
+	struct clk_hw *hw;
+
+	hw = of_clk_get_hw(dev_ofnode(dev), 0, name);
+	return clk_hw_create_clk_uboot(clk, hw);
+#else
+	return clk_get_by_name_nodev(dev_ofnode(dev), name, clk);
+#endif
+}
+#endif /* OF_REAL */
+
+int clk_get_by_name_nodev(ofnode node, const char *name, struct clk *clk)
+{
+	int index = 0;
+
+	debug("%s(node=%s, name=%s, clk=%p)\n", __func__,
+		ofnode_get_name(node), name, clk);
+	clk->dev = NULL;
+
+	if (name) {
+		index = ofnode_stringlist_search(node, "clock-names", name);
+		if (index < 0) {
+			debug("fdt_stringlist_search() failed: %d\n", index);
+			return index;
+		}
+	}
+
+	return clk_get_by_index_nodev(node, index, clk);
+}
+
+int clk_release_all(struct clk *clk, unsigned int count)
+{
+	unsigned int i;
+	int ret;
+
+	for (i = 0; i < count; i++) {
+		debug("%s(clk[%u]=%p)\n", __func__, i, &clk[i]);
+
+		/* check if clock has been previously requested */
+		if (!clk[i].dev)
+			continue;
+
+		ret = clk_disable(&clk[i]);
+		if (ret && ret != -ENOSYS)
+			return ret;
+	}
+
+	return 0;
+}
+
+/* Full CCF has its own versions of these functions */
+#if !CONFIG_IS_ENABLED(CLK_CCF_FULL)
+static int clk_get_by_indexed_prop(struct udevice *dev, const char *prop_name,
+				   int index, struct clk *clk)
+{
+	int ret;
+	struct ofnode_phandle_args args;
+
+	debug("%s(dev=%s, index=%d, clk=%p)\n", __func__, dev_read_name(dev),
+	      index, clk);
+
+	assert(clk);
+	clk->dev = NULL;
+
+	ret = dev_read_phandle_with_args(dev, prop_name, "#clock-cells", 0,
+					 index, &args);
+	if (ret) {
+		debug("%s: fdtdec_parse_phandle_with_args failed: err=%d\n",
+		      __func__, ret);
+		return log_ret(ret);
+	}
+
+	return clk_get_by_index_tail(ret, dev_ofnode(dev), &args, "clocks",
+				     index, clk);
+}
+
 static struct clk *clk_set_default_get_by_id(struct clk *clk)
 {
 	struct clk *c = clk;
 
@@ -371,62 +435,8 @@ fail:
 	free(rates);
 	return ret;
 }
 
-int clk_set_defaults(struct udevice *dev, enum clk_defaults_stage stage)
-{
-	int ret;
-
-	if (!dev_has_ofnode(dev))
-		return 0;
-
-	/*
-	 * To avoid setting defaults twice, don't set them before relocation.
-	 * However, still set them for SPL. And still set them if explicitly
-	 * asked.
-	 */
-	if (!(IS_ENABLED(CONFIG_XPL_BUILD) || (gd->flags & GD_FLG_RELOC)))
-		if (stage != CLK_DEFAULTS_POST_FORCE)
-			return 0;
-
-	debug("%s(%s)\n", __func__, dev_read_name(dev));
-
-	ret = clk_set_default_parents(dev, stage);
-	if (ret)
-		return ret;
-
-	ret = clk_set_default_rates(dev, stage);
-	if (ret < 0)
-		return ret;
-
-	return 0;
-}
-
-int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk)
-{
-	return clk_get_by_name_nodev(dev_ofnode(dev), name, clk);
-}
-#endif /* OF_REAL */
-
-int clk_get_by_name_nodev(ofnode node, const char *name, struct clk *clk)
-{
-	int index = 0;
-
-	debug("%s(node=%s, name=%s, clk=%p)\n", __func__,
-		ofnode_get_name(node), name, clk);
-	clk->dev = NULL;
-
-	if (name) {
-		index = ofnode_stringlist_search(node, "clock-names", name);
-		if (index < 0) {
-			debug("fdt_stringlist_search() failed: %d\n", index);
-			return index;
-		}
-	}
-
-	return clk_get_by_index_nodev(node, index, clk);
-}
-
 const char *
 clk_resolve_parent_clk(struct udevice *dev, const char *name)
 {
 	struct udevice *parent;
@@ -443,28 +453,8 @@ clk_resolve_parent_clk(struct udevice *dev, const char *name)
 
 	return clk.dev->name;
 }
 
-int clk_release_all(struct clk *clk, unsigned int count)
-{
-	unsigned int i;
-	int ret;
-
-	for (i = 0; i < count; i++) {
-		debug("%s(clk[%u]=%p)\n", __func__, i, &clk[i]);
-
-		/* check if clock has been previously requested */
-		if (!clk[i].dev)
-			continue;
-
-		ret = clk_disable(&clk[i]);
-		if (ret && ret != -ENOSYS)
-			return ret;
-	}
-
-	return 0;
-}
-
 int clk_request(struct udevice *dev, struct clk *clk)
 {
 	const struct clk_ops_uboot *ops;
 
@@ -704,21 +694,8 @@ int clk_enable(struct clk *clk)
 
 	return 0;
 }
 
-int clk_enable_bulk(struct clk_bulk *bulk)
-{
-	int i, ret;
-
-	for (i = 0; i < bulk->count; i++) {
-		ret = clk_enable(&bulk->clks[i]);
-		if (ret < 0 && ret != -ENOSYS)
-			return ret;
-	}
-
-	return 0;
-}
-
 int clk_disable(struct clk *clk)
 {
 	const struct clk_ops_uboot *ops;
 	struct clk *clkp = NULL;
@@ -769,21 +746,8 @@ int clk_disable(struct clk *clk)
 
 	return 0;
 }
 
-int clk_disable_bulk(struct clk_bulk *bulk)
-{
-	int i, ret;
-
-	for (i = 0; i < bulk->count; i++) {
-		ret = clk_disable(&bulk->clks[i]);
-		if (ret < 0 && ret != -ENOSYS)
-			return ret;
-	}
-
-	return 0;
-}
-
 int clk_get_by_id(ulong id, struct clk **clkp)
 {
 	struct udevice *dev;
 	struct uclass *uc;
@@ -820,8 +784,65 @@ bool clk_is_match(const struct clk *p, const struct clk *q)
 		return true;
 
 	return false;
 }
+#else
+long clk_get_parent_rate(struct clk *clk)
+{
+	struct clk *pclk;
+
+	if (!clk)
+		return -EINVAL;
+
+	pclk = clk_get_parent(clk);
+	return clk_get_rate(pclk);
+}
+
+static int clk_set_default_parents(struct udevice *dev,
+				   enum clk_defaults_stage stage)
+{
+	return -ENOSYS;
+}
+
+static int clk_set_default_rates(struct udevice *dev,
+				 enum clk_defaults_stage stage)
+{
+	return -ENOSYS;
+}
+#endif
+
+int clk_set_defaults(struct udevice *dev, enum clk_defaults_stage stage)
+{
+	int ret;
+
+	if (!dev_has_ofnode(dev))
+		return 0;
+
+	/*
+	 * To avoid setting defaults twice, don't set them before relocation.
+	 * However, still set them for SPL. And still set them if explicitly
+	 * asked.
+	 */
+	if (!(IS_ENABLED(CONFIG_XPL_BUILD) || (gd->flags & GD_FLG_RELOC)))
+		if (stage != CLK_DEFAULTS_POST_FORCE)
+			return 0;
+
+	debug("%s(%s)\n", __func__, dev_read_name(dev));
+
+	if (CONFIG_IS_ENABLED(CLK_CCF_FULL)) {
+		return of_clk_set_defaults(dev_ofnode(dev), false);
+	} else {
+		ret = clk_set_default_parents(dev, stage);
+		if (ret)
+			return ret;
+
+		ret = clk_set_default_rates(dev, stage);
+		if (ret < 0)
+			return ret;
+	}
+
+	return 0;
+}
 
 struct clk *devm_clk_get(struct udevice *dev, const char *id)
 {
 	int rc;
@@ -837,8 +858,34 @@ struct clk *devm_clk_get(struct udevice *dev, const char *id)
 
 	return clk;
 }
 
+int clk_enable_bulk(struct clk_bulk *bulk)
+{
+	int i, ret;
+
+	for (i = 0; i < bulk->count; i++) {
+		ret = clk_enable(&bulk->clks[i]);
+		if (ret < 0 && ret != -ENOSYS)
+			return ret;
+	}
+
+	return 0;
+}
+
+int clk_disable_bulk(struct clk_bulk *bulk)
+{
+	int i, ret;
+
+	for (i = 0; i < bulk->count; i++) {
+		ret = clk_disable(&bulk->clks[i]);
+		if (ret < 0 && ret != -ENOSYS)
+			return ret;
+	}
+
+	return 0;
+}
+
 int clk_uclass_post_probe(struct udevice *dev)
 {
 	/*
 	 * when a clock provider is probed. Call clk_set_defaults()

-- 
2.51.0



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

* [PATCH RFC 31/40] cmd/clk: add CCF_FULL support
  2026-03-19 20:56 [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Casey Connolly
                   ` (5 preceding siblings ...)
  2026-03-19 20:56 ` [PATCH RFC 26/40] clk/clk-uclass: adapt for CCF_FULL Casey Connolly
@ 2026-03-19 20:56 ` Casey Connolly
  2026-03-19 20:56 ` [PATCH RFC 32/40] clk/qcom: move existing clock drivers to clk/qcom/basic Casey Connolly
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Casey Connolly @ 2026-03-19 20:56 UTC (permalink / raw)
  To: u-boot, Lukasz Majewski, u-boot-qcom, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg
  Cc: Tom Rini, Casey Connolly, Neil Armstrong, Andrew Goodbody,
	Stephen Boyd, Ilias Apalodimas, Simon Glass, Raphael Gallais-Pou,
	Patrice Chotard, Yannick Fertre, Romain Gantois, Raymond Mao,
	Michael Trimarchi, Christian Marangi, Jaehoon Chung, Peng Fan,
	Yao Zi, Leo Yu-Chi Liang, Patrick Delaunay, Michal Simek,
	Quentin Schulz, Peter Korsgaard, Greg Malysa, Vasileios Bimpikas,
	Arturs Artamonovs, Ryan Chen, Chia-Wei Wang, Eugeniy Paltsev,
	Sean Anderson, Liviu Dudau, Ryder Lee, Weijie Gao, Chunfeng Yun,
	Igor Belwon, Stefan Roese, Manivannan Sadhasivam, Robert Marko,
	Aswin Murugan, Balaji Selvanathan, Nobuhiro Iwamatsu,
	Philipp Tomsich, Kever Yang, Minda Chen, Hal Feng, Thierry Reding,
	Svyatoslav Ryhel, Kunihiko Hayashi, Philip Molloy,
	Mikhail Kshevetskiy, Ryan Wanner, Varshini Rajendran,
	Manikandan Muralidharan, Jorge Ramirez-Ortiz, Luca Weiss,
	Jens Reidel, David Wronek, Miquel Raynal, David Lechner,
	Nishanth Menon, Alice Guo, Valentin Caron,
	Senthil Nathan Thangaraj, Naman Trivedi, Venkatesh Yadav Abbarapu,
	Padmarao Begari, Jonathan Currier, Sam Shih, Conor Dooley,
	Stephan Gerhold, Varadarajan Narayanan, Loic Poulain, Sam Day,
	Rui Miguel Silva, Mattijs Korpershoek, Shmuel Leib Melamud,
	Jonas Karlman, Finley Xiao, Joseph Chen, Elaine Zhang,
	Heiko Stuebner, Gabriel Fernandez, Andrew Davis, Manorit Chawdhry,
	Udit Kumar, Heiko Schocher, Markus Schneider-Pargmann (TI.com),
	Dinesh Maniyam, Paul Sajna, Marek Vasut

This functionality can be expanded later, for now just support calling
clk_summary_show() to dump CCF state.

Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
---
 cmd/clk.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/cmd/clk.c b/cmd/clk.c
index 1210a84ca2aa..1f1888b8fd94 100644
--- a/cmd/clk.c
+++ b/cmd/clk.c
@@ -9,8 +9,9 @@
 #include <dm/root.h>
 #include <dm/device-internal.h>
 #include <linux/clk-provider.h>
 
+#if !CONFIG_IS_ENABLED(CLK_CCF_FULL)
 static void show_clks(struct udevice *dev, int depth, int last_flag)
 {
 	int i, is_last;
 	struct udevice *child;
@@ -119,8 +120,26 @@ static int do_clk_setfreq(struct cmd_tbl *cmdtp, int flag, int argc,
 
 	printf("set_rate returns %u\n", freq);
 	return 0;
 }
+#else
+
+void clk_summary_show(void);
+
+static int do_clk_dump(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
+{
+	clk_summary_show();
+	return 0;
+}
+
+static int do_clk_setfreq(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
+{
+	return 0;
+}
+
+#endif
 
 static struct cmd_tbl cmd_clk_sub[] = {
 	U_BOOT_CMD_MKENT(dump, 1, 1, do_clk_dump, "", ""),
 	U_BOOT_CMD_MKENT(setfreq, 3, 1, do_clk_setfreq, "", ""),

-- 
2.51.0



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

* [PATCH RFC 32/40] clk/qcom: move existing clock drivers to clk/qcom/basic
  2026-03-19 20:56 [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Casey Connolly
                   ` (6 preceding siblings ...)
  2026-03-19 20:56 ` [PATCH RFC 31/40] cmd/clk: add CCF_FULL support Casey Connolly
@ 2026-03-19 20:56 ` Casey Connolly
       [not found] ` <20260319-casey-ccf-upstream-v1-15-4df2ee2226da@linaro.org>
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Casey Connolly @ 2026-03-19 20:56 UTC (permalink / raw)
  To: u-boot, Lukasz Majewski, u-boot-qcom, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg
  Cc: Tom Rini, Casey Connolly, Neil Armstrong, Andrew Goodbody,
	Stephen Boyd, Ilias Apalodimas, Simon Glass, Raphael Gallais-Pou,
	Patrice Chotard, Yannick Fertre, Romain Gantois, Raymond Mao,
	Michael Trimarchi, Christian Marangi, Jaehoon Chung, Peng Fan,
	Yao Zi, Leo Yu-Chi Liang, Patrick Delaunay, Michal Simek,
	Quentin Schulz, Peter Korsgaard, Greg Malysa, Vasileios Bimpikas,
	Arturs Artamonovs, Ryan Chen, Chia-Wei Wang, Eugeniy Paltsev,
	Sean Anderson, Liviu Dudau, Ryder Lee, Weijie Gao, Chunfeng Yun,
	Igor Belwon, Stefan Roese, Manivannan Sadhasivam, Robert Marko,
	Aswin Murugan, Balaji Selvanathan, Nobuhiro Iwamatsu,
	Philipp Tomsich, Kever Yang, Minda Chen, Hal Feng, Thierry Reding,
	Svyatoslav Ryhel, Kunihiko Hayashi, Philip Molloy,
	Mikhail Kshevetskiy, Ryan Wanner, Varshini Rajendran,
	Manikandan Muralidharan, Jorge Ramirez-Ortiz, Luca Weiss,
	Jens Reidel, David Wronek, Miquel Raynal, David Lechner,
	Nishanth Menon, Alice Guo, Valentin Caron,
	Senthil Nathan Thangaraj, Naman Trivedi, Venkatesh Yadav Abbarapu,
	Padmarao Begari, Jonathan Currier, Sam Shih, Conor Dooley,
	Stephan Gerhold, Varadarajan Narayanan, Loic Poulain, Sam Day,
	Rui Miguel Silva, Mattijs Korpershoek, Shmuel Leib Melamud,
	Jonas Karlman, Finley Xiao, Joseph Chen, Elaine Zhang,
	Heiko Stuebner, Gabriel Fernandez, Andrew Davis, Manorit Chawdhry,
	Udit Kumar, Heiko Schocher, Markus Schneider-Pargmann (TI.com),
	Dinesh Maniyam, Paul Sajna, Marek Vasut

These drivers will be deprecated and removed in favour of CCF.

Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
---
 drivers/clk/qcom/Makefile                     | 28 ++++++---------------------
 drivers/clk/qcom/basic/Makefile               | 25 ++++++++++++++++++++++++
 drivers/clk/qcom/{ => basic}/clock-apq8016.c  |  0
 drivers/clk/qcom/{ => basic}/clock-apq8096.c  |  0
 drivers/clk/qcom/{ => basic}/clock-ipq4019.c  |  0
 drivers/clk/qcom/{ => basic}/clock-ipq5424.c  |  0
 drivers/clk/qcom/{ => basic}/clock-ipq9574.c  |  0
 drivers/clk/qcom/{ => basic}/clock-qcm2290.c  |  0
 drivers/clk/qcom/{ => basic}/clock-qcom.c     |  0
 drivers/clk/qcom/{ => basic}/clock-qcom.h     |  0
 drivers/clk/qcom/{ => basic}/clock-qcs404.c   |  0
 drivers/clk/qcom/{ => basic}/clock-qcs615.c   |  0
 drivers/clk/qcom/{ => basic}/clock-qcs8300.c  |  0
 drivers/clk/qcom/{ => basic}/clock-sa8775p.c  |  0
 drivers/clk/qcom/{ => basic}/clock-sc7280.c   |  0
 drivers/clk/qcom/{ => basic}/clock-sdm845.c   |  0
 drivers/clk/qcom/{ => basic}/clock-sm6115.c   |  0
 drivers/clk/qcom/{ => basic}/clock-sm6350.c   |  0
 drivers/clk/qcom/{ => basic}/clock-sm7150.c   |  0
 drivers/clk/qcom/{ => basic}/clock-sm8150.c   |  0
 drivers/clk/qcom/{ => basic}/clock-sm8250.c   |  0
 drivers/clk/qcom/{ => basic}/clock-sm8550.c   |  0
 drivers/clk/qcom/{ => basic}/clock-sm8650.c   |  0
 drivers/clk/qcom/{ => basic}/clock-x1e80100.c |  0
 24 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile
index 82a5b166196c..71b0bf7f44a7 100644
--- a/drivers/clk/qcom/Makefile
+++ b/drivers/clk/qcom/Makefile
@@ -1,25 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
-# (C) Copyright 2023 Linaro
+# (C) Copyright 2026 Linaro
 
-obj-y += clock-qcom.o
-obj-$(CONFIG_CLK_QCOM_SDM845) += clock-sdm845.o
-obj-$(CONFIG_CLK_QCOM_APQ8016) += clock-apq8016.o
-obj-$(CONFIG_CLK_QCOM_APQ8096) += clock-apq8096.o
-obj-$(CONFIG_CLK_QCOM_IPQ4019) += clock-ipq4019.o
-obj-$(CONFIG_CLK_QCOM_IPQ5424) += clock-ipq5424.o
-obj-$(CONFIG_CLK_QCOM_IPQ9574) += clock-ipq9574.o
-obj-$(CONFIG_CLK_QCOM_QCM2290) += clock-qcm2290.o
-obj-$(CONFIG_CLK_QCOM_QCS404) += clock-qcs404.o
-obj-$(CONFIG_CLK_QCOM_QCS8300) += clock-qcs8300.o
-obj-$(CONFIG_CLK_QCOM_QCS615) += clock-qcs615.o
-obj-$(CONFIG_CLK_QCOM_SA8775P) += clock-sa8775p.o
-obj-$(CONFIG_CLK_QCOM_SC7280) += clock-sc7280.o
-obj-$(CONFIG_CLK_QCOM_SM6115) += clock-sm6115.o
-obj-$(CONFIG_CLK_QCOM_SM6350) += clock-sm6350.o
-obj-$(CONFIG_CLK_QCOM_SM7150) += clock-sm7150.o
-obj-$(CONFIG_CLK_QCOM_SM8150) += clock-sm8150.o
-obj-$(CONFIG_CLK_QCOM_SM8250) += clock-sm8250.o
-obj-$(CONFIG_CLK_QCOM_SM8550) += clock-sm8550.o
-obj-$(CONFIG_CLK_QCOM_SM8650) += clock-sm8650.o
-obj-$(CONFIG_CLK_QCOM_X1E80100) += clock-x1e80100.o
+ifndef CONFIG_CLK_CCF_FULL
+obj-y += basic/
+else
+obj-y += ccf/
+endif
diff --git a/drivers/clk/qcom/basic/Makefile b/drivers/clk/qcom/basic/Makefile
new file mode 100644
index 000000000000..82a5b166196c
--- /dev/null
+++ b/drivers/clk/qcom/basic/Makefile
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2023 Linaro
+
+obj-y += clock-qcom.o
+obj-$(CONFIG_CLK_QCOM_SDM845) += clock-sdm845.o
+obj-$(CONFIG_CLK_QCOM_APQ8016) += clock-apq8016.o
+obj-$(CONFIG_CLK_QCOM_APQ8096) += clock-apq8096.o
+obj-$(CONFIG_CLK_QCOM_IPQ4019) += clock-ipq4019.o
+obj-$(CONFIG_CLK_QCOM_IPQ5424) += clock-ipq5424.o
+obj-$(CONFIG_CLK_QCOM_IPQ9574) += clock-ipq9574.o
+obj-$(CONFIG_CLK_QCOM_QCM2290) += clock-qcm2290.o
+obj-$(CONFIG_CLK_QCOM_QCS404) += clock-qcs404.o
+obj-$(CONFIG_CLK_QCOM_QCS8300) += clock-qcs8300.o
+obj-$(CONFIG_CLK_QCOM_QCS615) += clock-qcs615.o
+obj-$(CONFIG_CLK_QCOM_SA8775P) += clock-sa8775p.o
+obj-$(CONFIG_CLK_QCOM_SC7280) += clock-sc7280.o
+obj-$(CONFIG_CLK_QCOM_SM6115) += clock-sm6115.o
+obj-$(CONFIG_CLK_QCOM_SM6350) += clock-sm6350.o
+obj-$(CONFIG_CLK_QCOM_SM7150) += clock-sm7150.o
+obj-$(CONFIG_CLK_QCOM_SM8150) += clock-sm8150.o
+obj-$(CONFIG_CLK_QCOM_SM8250) += clock-sm8250.o
+obj-$(CONFIG_CLK_QCOM_SM8550) += clock-sm8550.o
+obj-$(CONFIG_CLK_QCOM_SM8650) += clock-sm8650.o
+obj-$(CONFIG_CLK_QCOM_X1E80100) += clock-x1e80100.o
diff --git a/drivers/clk/qcom/clock-apq8016.c b/drivers/clk/qcom/basic/clock-apq8016.c
similarity index 100%
rename from drivers/clk/qcom/clock-apq8016.c
rename to drivers/clk/qcom/basic/clock-apq8016.c
diff --git a/drivers/clk/qcom/clock-apq8096.c b/drivers/clk/qcom/basic/clock-apq8096.c
similarity index 100%
rename from drivers/clk/qcom/clock-apq8096.c
rename to drivers/clk/qcom/basic/clock-apq8096.c
diff --git a/drivers/clk/qcom/clock-ipq4019.c b/drivers/clk/qcom/basic/clock-ipq4019.c
similarity index 100%
rename from drivers/clk/qcom/clock-ipq4019.c
rename to drivers/clk/qcom/basic/clock-ipq4019.c
diff --git a/drivers/clk/qcom/clock-ipq5424.c b/drivers/clk/qcom/basic/clock-ipq5424.c
similarity index 100%
rename from drivers/clk/qcom/clock-ipq5424.c
rename to drivers/clk/qcom/basic/clock-ipq5424.c
diff --git a/drivers/clk/qcom/clock-ipq9574.c b/drivers/clk/qcom/basic/clock-ipq9574.c
similarity index 100%
rename from drivers/clk/qcom/clock-ipq9574.c
rename to drivers/clk/qcom/basic/clock-ipq9574.c
diff --git a/drivers/clk/qcom/clock-qcm2290.c b/drivers/clk/qcom/basic/clock-qcm2290.c
similarity index 100%
rename from drivers/clk/qcom/clock-qcm2290.c
rename to drivers/clk/qcom/basic/clock-qcm2290.c
diff --git a/drivers/clk/qcom/clock-qcom.c b/drivers/clk/qcom/basic/clock-qcom.c
similarity index 100%
rename from drivers/clk/qcom/clock-qcom.c
rename to drivers/clk/qcom/basic/clock-qcom.c
diff --git a/drivers/clk/qcom/clock-qcom.h b/drivers/clk/qcom/basic/clock-qcom.h
similarity index 100%
rename from drivers/clk/qcom/clock-qcom.h
rename to drivers/clk/qcom/basic/clock-qcom.h
diff --git a/drivers/clk/qcom/clock-qcs404.c b/drivers/clk/qcom/basic/clock-qcs404.c
similarity index 100%
rename from drivers/clk/qcom/clock-qcs404.c
rename to drivers/clk/qcom/basic/clock-qcs404.c
diff --git a/drivers/clk/qcom/clock-qcs615.c b/drivers/clk/qcom/basic/clock-qcs615.c
similarity index 100%
rename from drivers/clk/qcom/clock-qcs615.c
rename to drivers/clk/qcom/basic/clock-qcs615.c
diff --git a/drivers/clk/qcom/clock-qcs8300.c b/drivers/clk/qcom/basic/clock-qcs8300.c
similarity index 100%
rename from drivers/clk/qcom/clock-qcs8300.c
rename to drivers/clk/qcom/basic/clock-qcs8300.c
diff --git a/drivers/clk/qcom/clock-sa8775p.c b/drivers/clk/qcom/basic/clock-sa8775p.c
similarity index 100%
rename from drivers/clk/qcom/clock-sa8775p.c
rename to drivers/clk/qcom/basic/clock-sa8775p.c
diff --git a/drivers/clk/qcom/clock-sc7280.c b/drivers/clk/qcom/basic/clock-sc7280.c
similarity index 100%
rename from drivers/clk/qcom/clock-sc7280.c
rename to drivers/clk/qcom/basic/clock-sc7280.c
diff --git a/drivers/clk/qcom/clock-sdm845.c b/drivers/clk/qcom/basic/clock-sdm845.c
similarity index 100%
rename from drivers/clk/qcom/clock-sdm845.c
rename to drivers/clk/qcom/basic/clock-sdm845.c
diff --git a/drivers/clk/qcom/clock-sm6115.c b/drivers/clk/qcom/basic/clock-sm6115.c
similarity index 100%
rename from drivers/clk/qcom/clock-sm6115.c
rename to drivers/clk/qcom/basic/clock-sm6115.c
diff --git a/drivers/clk/qcom/clock-sm6350.c b/drivers/clk/qcom/basic/clock-sm6350.c
similarity index 100%
rename from drivers/clk/qcom/clock-sm6350.c
rename to drivers/clk/qcom/basic/clock-sm6350.c
diff --git a/drivers/clk/qcom/clock-sm7150.c b/drivers/clk/qcom/basic/clock-sm7150.c
similarity index 100%
rename from drivers/clk/qcom/clock-sm7150.c
rename to drivers/clk/qcom/basic/clock-sm7150.c
diff --git a/drivers/clk/qcom/clock-sm8150.c b/drivers/clk/qcom/basic/clock-sm8150.c
similarity index 100%
rename from drivers/clk/qcom/clock-sm8150.c
rename to drivers/clk/qcom/basic/clock-sm8150.c
diff --git a/drivers/clk/qcom/clock-sm8250.c b/drivers/clk/qcom/basic/clock-sm8250.c
similarity index 100%
rename from drivers/clk/qcom/clock-sm8250.c
rename to drivers/clk/qcom/basic/clock-sm8250.c
diff --git a/drivers/clk/qcom/clock-sm8550.c b/drivers/clk/qcom/basic/clock-sm8550.c
similarity index 100%
rename from drivers/clk/qcom/clock-sm8550.c
rename to drivers/clk/qcom/basic/clock-sm8550.c
diff --git a/drivers/clk/qcom/clock-sm8650.c b/drivers/clk/qcom/basic/clock-sm8650.c
similarity index 100%
rename from drivers/clk/qcom/clock-sm8650.c
rename to drivers/clk/qcom/basic/clock-sm8650.c
diff --git a/drivers/clk/qcom/clock-x1e80100.c b/drivers/clk/qcom/basic/clock-x1e80100.c
similarity index 100%
rename from drivers/clk/qcom/clock-x1e80100.c
rename to drivers/clk/qcom/basic/clock-x1e80100.c

-- 
2.51.0



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

* Re: [PATCH RFC 15/40] clk: restrict clk/imx to MACH_IMX
       [not found] ` <20260319-casey-ccf-upstream-v1-15-4df2ee2226da@linaro.org>
@ 2026-03-19 21:25   ` Ferass El Hafidi
  2026-03-20 15:09     ` Tom Rini
  0 siblings, 1 reply; 15+ messages in thread
From: Ferass El Hafidi @ 2026-03-19 21:25 UTC (permalink / raw)
  To: u-boot-qcom, u-boot, Lukasz Majewski, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg
  Cc: Tom Rini, Casey Connolly, Neil Armstrong, Andrew Goodbody,
	Stephen Boyd, Ilias Apalodimas, Simon Glass, Paul Sajna,
	Marek Vasut

On Thu, 19 Mar 2026 20:56, "Casey Connolly via groups.io" <casey.connolly=linaro.org@groups.io> wrote:
>Only build IMX clocks when MACH_IMX is enabled, otherwise IMX clock
>drivers get compiled for all platforms with CLK_CCF enabled.
>
>Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
>---
> drivers/clk/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
>index 5f0c0d8a5c28..f96d57a3223a 100644
>--- a/drivers/clk/Makefile
>+++ b/drivers/clk/Makefile
>@@ -15,9 +15,9 @@ obj-$(CONFIG_$(PHASE_)CLK_STUB) += clk-stub.o
> 
> obj-y += adi/
> obj-y += airoha/
> obj-y += analogbits/
>-obj-y += imx/
>+obj-$(CONFIG_$(PHASE_)MACH_IMX) += imx/

I think this is not necessary. drivers/clk/imx/Makefile already requires
that imx config options be enabled for the driver to be compiled in.

Best regards,
Ferass

[PS: had to remove a few people from CC, because my email provider does
     not let me CC that many people, sorry!]

> obj-$(CONFIG_CLK_JH7110) += starfive/
> obj-y += tegra/
> obj-y += ti/
> obj-$(CONFIG_CLK_THEAD) += thead/
>
>-- 
>2.51.0
>
>
>
>-=-=-=-=-=-=-=-=-=-=-=-
>Groups.io Links: You receive all messages sent to this group.
>View/Reply Online (#2906): https://groups.io/g/u-boot-qcom/message/2906
>Mute This Topic: https://groups.io/mt/118408050/8399868
>Group Owner: u-boot-qcom+owner@groups.io
>Unsubscribe: https://groups.io/g/u-boot-qcom/leave/13198341/8399868/797498721/xyzzy [funderscore@postmarketos.org]
>-=-=-=-=-=-=-=-=-=-=-=-
>
>


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

* Re: [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot
  2026-03-19 20:56 [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Casey Connolly
                   ` (8 preceding siblings ...)
       [not found] ` <20260319-casey-ccf-upstream-v1-15-4df2ee2226da@linaro.org>
@ 2026-03-19 21:30 ` Ferass El Hafidi
  2026-03-20  8:45 ` Svyatoslav Ryhel
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Ferass El Hafidi @ 2026-03-19 21:30 UTC (permalink / raw)
  To: u-boot-qcom, u-boot, Lukasz Majewski, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg
  Cc: Tom Rini, Casey Connolly, Neil Armstrong, Andrew Goodbody,
	Stephen Boyd, Ilias Apalodimas, Simon Glass, Raphael Gallais-Pou,
	Patrice Chotard, Peng Fan, Yao Zi, Leo Yu-Chi Liang,
	Patrick Delaunay, Michal Simek, Manikandan Muralidharan,
	Jorge Ramirez-Ortiz, Luca Weiss, Jens Reidel, David Wronek,
	Naman Trivedi, Venkatesh Yadav Abbarapu, Conor Dooley,
	Stephan Gerhold, Varadarajan Narayanan, Paul Sajna, Marek Vasut

Hi,

On Thu, 19 Mar 2026 20:56, "Casey Connolly via groups.io" <casey.connolly=linaro.org@groups.io> wrote:

>    This RFC provides a proof of concept for using the full Linux CCF in
>    U-Boot and consequently porting full Linux clock drivers with extremely
>    minimal changes.
>
>    [...]
>
>    === Memory/perf overhead ===
>
>    The memory and size overhead of CCF is undoubtably bigger than uCCF,
>    although I suspect the difference is less than it might seem at
>    first glance. In particular: clk_core is only ~50 bytes larger than
>    struct udevice on ARM64, and an additional 120 bytes is saved for each
>    U_BOOT_DRIVER used by uCCF.
>
>    On the other hand, the CPU overhead is probably more significant,
>    but not an unreasonable cost to ensure correctness and propagate rate
>    changes across the clock tree.
>
>    Just comparing the binary size of sandbox64_defconfig with uCCF vs
>    CCF_FULL, CCF_FULL results in a 135k size increase in the binary. I
>    haven't done any more detailed analysis here (still haven't got buildman
>    to play nice...).
>
>    === SPL ===
>
>    This RFC doesn't have any SPL specific support, I think this role is
>    better fulfilled by UCLASS_CLK.

It is worth noting that not a lot of boards actually use the existing
CCF port under SPL.

	configs$ git grep "CONFIG_SPL=y" | wc -l
	550
	configs$ git grep "CONFIG_SPL_CLK=y" | wc -l
	179
	configs$ git grep "CONFIG_SPL_CLK_CCF=y" | wc -l
	25

As far as I know, this is most likely because that existing CCF is
already quite huge for such a small environment like SPL (SPL_CLK is
already quite big, especially with its dependency on driver model, which
is fine but some devices are so restricted when SPL runs that even
DM is too big to fit). So I wouldn't bother trying to support SPL with
this.

Just wanted to share this, FYI.

Best regards,
Ferass

[PS: had to remove some people from CC, because my email provider does
     not let me CC that many people. Also sorry for those who got this
     email twice]


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

* Re: [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot
  2026-03-19 20:56 [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Casey Connolly
                   ` (9 preceding siblings ...)
  2026-03-19 21:30 ` [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Ferass El Hafidi
@ 2026-03-20  8:45 ` Svyatoslav Ryhel
  2026-03-20 16:52 ` Simon Glass
  2026-04-06 12:18 ` Sumit Garg
  12 siblings, 0 replies; 15+ messages in thread
From: Svyatoslav Ryhel @ 2026-03-20  8:45 UTC (permalink / raw)
  To: Casey Connolly
  Cc: u-boot, Lukasz Majewski, u-boot-qcom, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg,
	Tom Rini, Neil Armstrong, Andrew Goodbody, Stephen Boyd,
	Ilias Apalodimas, Simon Glass, Raphael Gallais-Pou,
	Patrice Chotard, Yannick Fertre, Romain Gantois, Raymond Mao,
	Michael Trimarchi, Christian Marangi, Jaehoon Chung, Peng Fan,
	Yao Zi, Leo Yu-Chi Liang, Patrick Delaunay, Michal Simek,
	Quentin Schulz, Peter Korsgaard, Greg Malysa, Vasileios Bimpikas,
	Arturs Artamonovs, Ryan Chen, Chia-Wei Wang, Eugeniy Paltsev,
	Sean Anderson, Liviu Dudau, Ryder Lee, Weijie Gao, Chunfeng Yun,
	Igor Belwon, Stefan Roese, Manivannan Sadhasivam, Robert Marko,
	Aswin Murugan, Balaji Selvanathan, Nobuhiro Iwamatsu,
	Philipp Tomsich, Kever Yang, Minda Chen, Hal Feng, Thierry Reding,
	Kunihiko Hayashi, Philip Molloy, Mikhail Kshevetskiy, Ryan Wanner,
	Varshini Rajendran, Manikandan Muralidharan, Jorge Ramirez-Ortiz,
	Luca Weiss, Jens Reidel, David Wronek, Miquel Raynal,
	David Lechner, Nishanth Menon, Alice Guo, Valentin Caron,
	Senthil Nathan Thangaraj, Naman Trivedi, Venkatesh Yadav Abbarapu,
	Padmarao Begari, Jonathan Currier, Sam Shih, Conor Dooley,
	Stephan Gerhold, Varadarajan Narayanan, Loic Poulain, Sam Day,
	Rui Miguel Silva, Mattijs Korpershoek, Shmuel Leib Melamud,
	Jonas Karlman, Finley Xiao, Joseph Chen, Elaine Zhang,
	Heiko Stuebner, Gabriel Fernandez, Andrew Davis, Manorit Chawdhry,
	Udit Kumar, Heiko Schocher, Markus Schneider-Pargmann (TI.com),
	Dinesh Maniyam, Paul Sajna, Marek Vasut

чт, 19 бер. 2026 р. о 22:56 Casey Connolly <casey.connolly@linaro.org> пише:
>
> This RFC provides a proof of concept for using the full Linux CCF in
> U-Boot and consequently porting full Linux clock drivers with extremely
> minimal changes.
>

Hello Casey,

Patchset is incomplete (32 patches only). Split it up into smaller chunks.


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

* Re: [PATCH RFC 15/40] clk: restrict clk/imx to MACH_IMX
  2026-03-19 21:25   ` [PATCH RFC 15/40] clk: restrict clk/imx to MACH_IMX Ferass El Hafidi
@ 2026-03-20 15:09     ` Tom Rini
  0 siblings, 0 replies; 15+ messages in thread
From: Tom Rini @ 2026-03-20 15:09 UTC (permalink / raw)
  To: Ferass El Hafidi
  Cc: u-boot-qcom, u-boot, Lukasz Majewski, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg,
	Casey Connolly, Neil Armstrong, Andrew Goodbody, Stephen Boyd,
	Ilias Apalodimas, Simon Glass, Paul Sajna, Marek Vasut

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

On Thu, Mar 19, 2026 at 09:25:14PM +0000, Ferass El Hafidi wrote:
> On Thu, 19 Mar 2026 20:56, "Casey Connolly via groups.io" <casey.connolly=linaro.org@groups.io> wrote:
> > Only build IMX clocks when MACH_IMX is enabled, otherwise IMX clock
> > drivers get compiled for all platforms with CLK_CCF enabled.
> > 
> > Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
> > ---
> > drivers/clk/Makefile | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
> > index 5f0c0d8a5c28..f96d57a3223a 100644
> > --- a/drivers/clk/Makefile
> > +++ b/drivers/clk/Makefile
> > @@ -15,9 +15,9 @@ obj-$(CONFIG_$(PHASE_)CLK_STUB) += clk-stub.o
> > 
> > obj-y += adi/
> > obj-y += airoha/
> > obj-y += analogbits/
> > -obj-y += imx/
> > +obj-$(CONFIG_$(PHASE_)MACH_IMX) += imx/
> 
> I think this is not necessary. drivers/clk/imx/Makefile already requires
> that imx config options be enabled for the driver to be compiled in.

Almost all of them do. I see:
$ rg obj.*CLK_CCF drivers/clk/
drivers/clk/Makefile
10:obj-$(CONFIG_$(PHASE_)CLK_CCF) += clk.o clk-divider.o clk-mux.o clk-gate.o
11:obj-$(CONFIG_$(PHASE_)CLK_CCF) += clk-fixed-factor.o
61:obj-$(CONFIG_SANDBOX_CLK_CCF) += clk_sandbox_ccf.o

drivers/clk/exynos/Makefile
10:obj-$(CONFIG_$(PHASE_)CLK_CCF)       += clk.o clk-pll.o

drivers/clk/imx/Makefile
5:obj-$(CONFIG_$(PHASE_)CLK_CCF) += clk-gate2.o clk-pllv3.o clk-pfd.o

But exynos is guarded by CONFIG_CLK_EXYNOS to start with. So I think
this is right, and also something that could just be standalone and
picked up shortly as it's a build cleanup.

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot
  2026-03-19 20:56 [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Casey Connolly
                   ` (10 preceding siblings ...)
  2026-03-20  8:45 ` Svyatoslav Ryhel
@ 2026-03-20 16:52 ` Simon Glass
  2026-04-06 12:18 ` Sumit Garg
  12 siblings, 0 replies; 15+ messages in thread
From: Simon Glass @ 2026-03-20 16:52 UTC (permalink / raw)
  To: Casey Connolly
  Cc: u-boot, Lukasz Majewski, u-boot-qcom, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Sumit Garg,
	Tom Rini, Neil Armstrong, Andrew Goodbody, Stephen Boyd,
	Ilias Apalodimas, Raphael Gallais-Pou, Patrice Chotard,
	Yannick Fertre, Romain Gantois, Raymond Mao, Michael Trimarchi,
	Christian Marangi, Jaehoon Chung, Peng Fan, Yao Zi,
	Leo Yu-Chi Liang, Patrick Delaunay, Michal Simek, Quentin Schulz,
	Peter Korsgaard, Greg Malysa, Vasileios Bimpikas,
	Arturs Artamonovs, Ryan Chen, Chia-Wei Wang, Eugeniy Paltsev,
	Sean Anderson, Liviu Dudau, Ryder Lee, Weijie Gao, Chunfeng Yun,
	Igor Belwon, Stefan Roese, Manivannan Sadhasivam, Robert Marko,
	Aswin Murugan, Balaji Selvanathan, Nobuhiro Iwamatsu,
	Philipp Tomsich, Kever Yang, Minda Chen, Hal Feng, Thierry Reding,
	Svyatoslav Ryhel, Kunihiko Hayashi, Philip Molloy,
	Mikhail Kshevetskiy, Ryan Wanner, Varshini Rajendran,
	Manikandan Muralidharan, Jorge Ramirez-Ortiz, Luca Weiss,
	Jens Reidel, David Wronek, Miquel Raynal, David Lechner,
	Nishanth Menon, Alice Guo, Valentin Caron,
	Senthil Nathan Thangaraj, Naman Trivedi, Venkatesh Yadav Abbarapu,
	Padmarao Begari, Jonathan Currier, Sam Shih, Conor Dooley,
	Stephan Gerhold, Varadarajan Narayanan, Loic Poulain, Sam Day,
	Rui Miguel Silva, Mattijs Korpershoek, Shmuel Leib Melamud,
	Jonas Karlman, Finley Xiao, Joseph Chen, Elaine Zhang,
	Heiko Stuebner, Gabriel Fernandez, Andrew Davis, Manorit Chawdhry,
	Udit Kumar, Heiko Schocher, Markus Schneider-Pargmann (TI.com),
	Dinesh Maniyam, Paul Sajna, Marek Vasut

Hi Casey,

On Thu, 19 Mar 2026 at 14:56, Casey Connolly <casey.connolly@linaro.org> wrote:
>
> This RFC provides a proof of concept for using the full Linux CCF in
> U-Boot and consequently porting full Linux clock drivers with extremely
> minimal changes.

As a general question, what is the boot flow for the Qualcomm devices
you are are targeting, i.e. where does U-Boot come in the chain from
reset? Does it use xPL?

>
> == Overview ==
>
> This RFC is pretty long but can be separated into a few chunks. The
> first patches relate to Linux API compatibility and just contain small
> self contained changes, these can go upstream regardless of CCF.
>
> The next group of changes prepare for importing CCF from Linux, the
> standalone fixed clock drivers are moved to clk/basic, the existing
> U-Boot CCF drivers are moved to clk/uccf, and struct clk_ops is renamed
> to clk_ops_uboot.
>
> Additionally, clk_set_rate() is changed so that it returns a signed
> long, since it can return negative values. This is also done to align
> with CCF but it's a standalone improvement nonetheless.

Agreed.

>
> The next changes import CCF from Linux 6.19 and then adjust it to
> compile and work with U-Boot. These commits are split up mostly to
> try and reduce the size. Finally clk-uclass is adjusted for CCF, this
> definitely will need some additional passes to be a bit cleaner.
>
> With CCF done, sandbox clk-ccf driver gets a CCF_FULL port, the clk_ccf
> tests are adjusted to pass.

Minor point - perhaps CLK_LINUX ? CCF_FULL seems cryptic to me and
some would argue that the existing CLK_CCF is already full..

>
> Lastly, a PoC port of Qualcomms Linux clock drivers is done, this
> only has sm8650 clocks but they serve the desired purpose. The changes
> necessary to the Linux drivers are mostly to deal with U-Boots driver
> model, the actual platform specific clock drivers require essentially
> zero changes!
>
> === Feedback ===
>
> I'd like to get feedback on the overall architecture and ideas, feel
> free to point out any dead code or printf's I forgot about, but I'll for
> sure do a more detailed cleanup before the next revision.
>
> I would definitely like to input on how to deal with clk-uclass, since
> it's now supporting 3 different clock frameworks, but I'm now sure how
> best to separate the code out without duplicating code.

Perhaps a justification can be expressed in terms of code size / capabilities:

Small - can boot in xPL from limited SRAM, only simple clocks
Medium - smaller code size but still provides good access to clocks
Large - Linux compatible, full capability but lots of code

>
> In terms of overall architecture, CCF is a departure from the uclass
> model that U-Boot has stuck too for so long. If this is a success then
> I think it could make a lot of sense to make similar changes for power
> domains and resets. I think this change offers a lot of additional
> flexibility which has been sorely missed.

While those are separate, does this mean that there will be a
significant delta from Linux's clock drivers on Qualcomm, or will it
be minor?
>
> == Motivation ==
>
> There were quite a few motivating factors behind this effort which I
> think provide useful context for this series:
>
> 1. Existing UCLASS_CLK support in U-Boot (even with U-Boots minimal CCF)
>    doesn't provide a fully cohesive API nor implement the necessary
>    functionality to support complex modern platforms without a lot of
>    additional effort.
>
> 2. While trying to enable display support on Qualcomm, it became clear
>    that U-Boots clock framework was a severe limiting factor,
>    particularly for more complicated setups like "bonded" dual-DSI.

It seems that 1 and 2 could be merged? The question here is how much
effort would someone want to put in. Providing an easy way to pull in
the Linux clock driver makes sense. Some people may wish to put in
effort to at least support the basic clocks for xPL, etc.

>
> 3. The current state of Qualcomm clock drivers in U-Boot is pretty poor,
>    as the old very basic driver code is being expected to support more
>    and more complicated usecases. Clock support is generally the most
>    complicated part of bringing up any new Qualcomm platform, so being
>    able to properly reuse Linux drivers with the familiar API greatly
>    reduces the amount of friction when working on U-Boot support for
>    complicated peripherals like the display.
>
> Consequently, My aim with this effort was primarily to provide API
> compatibility with Linux as much as possible, minimising the changes
> that have to be made to clock drivers to port them from Linux, and
> reducing the chance of introducing U-Boot specific bugs.
>
> === clk_ops/UCLASS_CLK ===
>
> CCF_FULL drivers should NOT use UCLASS_CLK, since CCF uses a totally
> independent clock API. If the clocks are provided by another device like
> a phy, they can simply be registered with the clk core the same way they
> are in Linux. Standalone clock drivers should use UCLASS_NOP.

Bypassing UCLASS_CLK entirely is a big departure. It means DM can't
track these clock devices properly - no uclass_find_device(), no
sequence numbers, no standard device iteration.

The suggestion to do the same for power domains and resets would
fragment driver model further.

How about having a single UCLASS_CLK_LINUX device?

>
> Clocks must all be registered during driver probe, the CCF will ensure
> that a given clock provider is probed (via a global ofnode -> device
> lookup) before checking the of_providers, thus making sure the clocks
> are registered so that the consumer can use them. There is currently no
> special handling for cyclical dependencies.

Driver model normally registers devices during a bind step, which
helps to remove the problem of cyclic dependencies. Is there any need
to wait until probe()? Also, can we statically declare it, to save
code size? Most of the definitions are static

The global ofnode -> device lookup to force probe ordering is
reinventing what DM already does with uclass probing. This feels like
it should integrate with DM rather than work around it.

>
> === struct clk ===
>
> It's definitely debatable if it makes sense to have 3 different structs
> for each clk (clk_hw, clk_core and clk). I do think clk_hw and clk_core
> are justified, since clk_hw is more tied to the hardware description and
> typically nested in a clk-specific descriptor while clk_core contains
> the internal runtime state of the clk which should remain private to
> CCF core.

Probably we should follow Linux, since we would start to lose the
benefit of your series if we merged two structs.

>
> It could make sense to merge clk and clk_core, but since struct clk is
> public in U-Boot, where it's an opaque pointer in Linux this would be
> a substantial effort. In Linux struct clk objects are allocated inside
> CCF, but in U-Boot they're allocated by the driver, this would need to
> be resolved before we investigate combining these structs.
>
> === Memory/perf overhead ===
>
> The memory and size overhead of CCF is undoubtably bigger than uCCF,
> although I suspect the difference is less than it might seem at
> first glance. In particular: clk_core is only ~50 bytes larger than
> struct udevice on ARM64, and an additional 120 bytes is saved for each
> U_BOOT_DRIVER used by uCCF.
>
> On the other hand, the CPU overhead is probably more significant,
> but not an unreasonable cost to ensure correctness and propagate rate
> changes across the clock tree.

We already struggle with slow pre-relocation performance, something I
have never really dug into.

>
> Just comparing the binary size of sandbox64_defconfig with uCCF vs
> CCF_FULL, CCF_FULL results in a 135k size increase in the binary. I
> haven't done any more detailed analysis here (still haven't got buildman
> to play nice...).

Sandbox may overestimate the size here, not sure. Ping on irc if you
need update with the buildman setup.

>
> === SPL ===
>
> This RFC doesn't have any SPL specific support, I think this role is
> better fulfilled by UCLASS_CLK.
>
> === U-Boot's old CCF port ===
>
> The original CCF port done for IMX platforms is vastly different in API,
> scope, and function to CCF_FULL, to differentiate I refer to it
> as "uCCF".
>
> I have kept support for this in and made it mutually exclusive with
> CCF_FULL. uCCF drivers have been moved to drivers/clk/uccf, with the new
> CCF port in drivers/clk/ccf.
>
> Included near the end of this series is a port of Sandbox's clk-ccf
> driver from uCCF over to CCF_FULL, this might be a useful reference for
> other drivers (although it's probably better to just adapt the Linux
> drivers).
>
> === Compat shim ===
>
> Lastly, this series includes a compat shim which allows UCLASS_CLK
> drivers to somewhat work with CCF, I would imagine this being useful
> if some generic peripheral device provides a clock for example, but in
> almost all cases I think it's better to implement a proper CCF clock
> device. Unless there is a particular usecase for this I would probably
> not include it in the next revision.
>
> == TODO/Outstanding issues ==
>
> * Clean up clk-uclass.c, does it make sense to somewhow split it in two?
> * Assess test coverage, have basic sandbox tests, would like to mostly
>   use integration tests (i.e. diff the clk summary) once more platforms
>   are supported.
> * pre-relocation support is currently missing, on Qualcomm at least I
>   would prefer to completely skip FDT scanning pre-reloc, there is a
>   patch in this series which does that. It is very non-trivial to try
>   and handle clocks pre-reloc.

Does this mean that only serial is needed and the clock for it is
already set up by some pre-U-Boot phase?

Regards,
SImon


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

* Re: [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot
  2026-03-19 20:56 [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Casey Connolly
                   ` (11 preceding siblings ...)
  2026-03-20 16:52 ` Simon Glass
@ 2026-04-06 12:18 ` Sumit Garg
  12 siblings, 0 replies; 15+ messages in thread
From: Sumit Garg @ 2026-04-06 12:18 UTC (permalink / raw)
  To: Casey Connolly
  Cc: u-boot, Lukasz Majewski, u-boot-qcom, Aspeed BMC SW team,
	Joel Stanley, GSS_MTK_Uboot_upstream, Paul Barker, Dai Okamura,
	linux, uboot-snps-arc, u-boot-amlogic, uboot-stm32, Tom Rini,
	Neil Armstrong, Andrew Goodbody, Stephen Boyd, Ilias Apalodimas,
	Simon Glass, Raphael Gallais-Pou, Patrice Chotard, Yannick Fertre,
	Romain Gantois, Raymond Mao, Michael Trimarchi, Christian Marangi,
	Jaehoon Chung, Peng Fan, Yao Zi, Leo Yu-Chi Liang,
	Patrick Delaunay, Michal Simek, Quentin Schulz, Peter Korsgaard,
	Greg Malysa, Vasileios Bimpikas, Arturs Artamonovs, Ryan Chen,
	Chia-Wei Wang, Eugeniy Paltsev, Sean Anderson, Liviu Dudau,
	Ryder Lee, Weijie Gao, Chunfeng Yun, Igor Belwon, Stefan Roese,
	Manivannan Sadhasivam, Robert Marko, Aswin Murugan,
	Balaji Selvanathan, Nobuhiro Iwamatsu, Philipp Tomsich,
	Kever Yang, Minda Chen, Hal Feng, Thierry Reding,
	Svyatoslav Ryhel, Kunihiko Hayashi, Philip Molloy,
	Mikhail Kshevetskiy, Ryan Wanner, Varshini Rajendran,
	Manikandan Muralidharan, Jorge Ramirez-Ortiz, Luca Weiss,
	Jens Reidel, David Wronek, Miquel Raynal, David Lechner,
	Nishanth Menon, Alice Guo, Valentin Caron,
	Senthil Nathan Thangaraj, Naman Trivedi, Venkatesh Yadav Abbarapu,
	Padmarao Begari, Jonathan Currier, Sam Shih, Conor Dooley,
	Stephan Gerhold, Varadarajan Narayanan, Loic Poulain, Sam Day,
	Rui Miguel Silva, Mattijs Korpershoek, Shmuel Leib Melamud,
	Jonas Karlman, Finley Xiao, Joseph Chen, Elaine Zhang,
	Heiko Stuebner, Gabriel Fernandez, Andrew Davis, Manorit Chawdhry,
	Udit Kumar, Heiko Schocher, Markus Schneider-Pargmann (TI.com),
	Dinesh Maniyam, Paul Sajna, Marek Vasut

On Thu, Mar 19, 2026 at 09:56:22PM +0100, Casey Connolly wrote:
> This RFC provides a proof of concept for using the full Linux CCF in
> U-Boot and consequently porting full Linux clock drivers with extremely
> minimal changes.
> 
> == Overview ==
> 
> This RFC is pretty long but can be separated into a few chunks. The
> first patches relate to Linux API compatibility and just contain small
> self contained changes, these can go upstream regardless of CCF.
> 
> The next group of changes prepare for importing CCF from Linux, the
> standalone fixed clock drivers are moved to clk/basic, the existing
> U-Boot CCF drivers are moved to clk/uccf, and struct clk_ops is renamed
> to clk_ops_uboot.
> 
> Additionally, clk_set_rate() is changed so that it returns a signed
> long, since it can return negative values. This is also done to align
> with CCF but it's a standalone improvement nonetheless.
> 
> The next changes import CCF from Linux 6.19 and then adjust it to
> compile and work with U-Boot. These commits are split up mostly to
> try and reduce the size. Finally clk-uclass is adjusted for CCF, this
> definitely will need some additional passes to be a bit cleaner.
> 
> With CCF done, sandbox clk-ccf driver gets a CCF_FULL port, the clk_ccf
> tests are adjusted to pass.
> 
> Lastly, a PoC port of Qualcomms Linux clock drivers is done, this
> only has sm8650 clocks but they serve the desired purpose. The changes
> necessary to the Linux drivers are mostly to deal with U-Boots driver
> model, the actual platform specific clock drivers require essentially
> zero changes!
> 
> === Feedback ===
> 
> I'd like to get feedback on the overall architecture and ideas, feel
> free to point out any dead code or printf's I forgot about, but I'll for
> sure do a more detailed cleanup before the next revision.
> 
> I would definitely like to input on how to deal with clk-uclass, since
> it's now supporting 3 different clock frameworks, but I'm now sure how
> best to separate the code out without duplicating code.
> 
> In terms of overall architecture, CCF is a departure from the uclass
> model that U-Boot has stuck too for so long. If this is a success then
> I think it could make a lot of sense to make similar changes for power
> domains and resets. I think this change offers a lot of additional
> flexibility which has been sorely missed.
> 
> == Motivation ==
> 
> There were quite a few motivating factors behind this effort which I
> think provide useful context for this series:
> 
> 1. Existing UCLASS_CLK support in U-Boot (even with U-Boots minimal CCF)
>    doesn't provide a fully cohesive API nor implement the necessary
>    functionality to support complex modern platforms without a lot of
>    additional effort.
> 
> 2. While trying to enable display support on Qualcomm, it became clear
>    that U-Boots clock framework was a severe limiting factor,
>    particularly for more complicated setups like "bonded" dual-DSI.
> 
> 3. The current state of Qualcomm clock drivers in U-Boot is pretty poor,
>    as the old very basic driver code is being expected to support more
>    and more complicated usecases. Clock support is generally the most
>    complicated part of bringing up any new Qualcomm platform, so being
>    able to properly reuse Linux drivers with the familiar API greatly
>    reduces the amount of friction when working on U-Boot support for
>    complicated peripherals like the display.
> 
> Consequently, My aim with this effort was primarily to provide API
> compatibility with Linux as much as possible, minimising the changes
> that have to be made to clock drivers to port them from Linux, and
> reducing the chance of introducing U-Boot specific bugs.
> 
> === clk_ops/UCLASS_CLK ===
> 
> CCF_FULL drivers should NOT use UCLASS_CLK, since CCF uses a totally
> independent clock API. If the clocks are provided by another device like
> a phy, they can simply be registered with the clk core the same way they
> are in Linux. Standalone clock drivers should use UCLASS_NOP.
> 
> Clocks must all be registered during driver probe, the CCF will ensure
> that a given clock provider is probed (via a global ofnode -> device
> lookup) before checking the of_providers, thus making sure the clocks
> are registered so that the consumer can use them. There is currently no
> special handling for cyclical dependencies.
> 
> === struct clk ===
> 
> It's definitely debatable if it makes sense to have 3 different structs
> for each clk (clk_hw, clk_core and clk). I do think clk_hw and clk_core
> are justified, since clk_hw is more tied to the hardware description and
> typically nested in a clk-specific descriptor while clk_core contains
> the internal runtime state of the clk which should remain private to
> CCF core.
> 
> It could make sense to merge clk and clk_core, but since struct clk is
> public in U-Boot, where it's an opaque pointer in Linux this would be
> a substantial effort. In Linux struct clk objects are allocated inside
> CCF, but in U-Boot they're allocated by the driver, this would need to
> be resolved before we investigate combining these structs.
> 
> === Memory/perf overhead ===
> 
> The memory and size overhead of CCF is undoubtably bigger than uCCF,
> although I suspect the difference is less than it might seem at
> first glance. In particular: clk_core is only ~50 bytes larger than
> struct udevice on ARM64, and an additional 120 bytes is saved for each
> U_BOOT_DRIVER used by uCCF.
> 
> On the other hand, the CPU overhead is probably more significant,
> but not an unreasonable cost to ensure correctness and propagate rate
> changes across the clock tree.
> 
> Just comparing the binary size of sandbox64_defconfig with uCCF vs
> CCF_FULL, CCF_FULL results in a 135k size increase in the binary. I
> haven't done any more detailed analysis here (still haven't got buildman
> to play nice...).
> 
> === SPL ===
> 
> This RFC doesn't have any SPL specific support, I think this role is
> better fulfilled by UCLASS_CLK.
>

SPL support on Qualcomm platforms is coming for real. I see a patch-set
already posted and more to come. So we really need to see how Linux CCF
can be reused to support SPL limitations on Qcom SoCs while executing
from on-chip RAM.

If it turns out to be separate clock drivers, Linux CCF for U-Boot
proper and UCLASS_CLK for U-Boot SPL for the same SoC then it's much
more maintainence overhead as compared to just pulling in clk driver
from Linux.

It would be better if somehow Linux CCF can be stripped down to meet SPL
needs too.

-Sumit


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

end of thread, other threads:[~2026-04-07 14:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 20:56 [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 01/40] vsprintf: add %pOF Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 10/40] compat: add linux/regmap.h symlink Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 11/40] devres: add devm_krealloc Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 16/40] clk: move U-Boot CCF to clk/uccf Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 18/40] clk: move fixed clocks to clk/basic Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 26/40] clk/clk-uclass: adapt for CCF_FULL Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 31/40] cmd/clk: add CCF_FULL support Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 32/40] clk/qcom: move existing clock drivers to clk/qcom/basic Casey Connolly
     [not found] ` <20260319-casey-ccf-upstream-v1-15-4df2ee2226da@linaro.org>
2026-03-19 21:25   ` [PATCH RFC 15/40] clk: restrict clk/imx to MACH_IMX Ferass El Hafidi
2026-03-20 15:09     ` Tom Rini
2026-03-19 21:30 ` [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot Ferass El Hafidi
2026-03-20  8:45 ` Svyatoslav Ryhel
2026-03-20 16:52 ` Simon Glass
2026-04-06 12:18 ` Sumit Garg

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