public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sumit Garg <sumit.garg@kernel.org>
To: Casey Connolly <casey.connolly@linaro.org>
Cc: u-boot@lists.denx.de, Lukasz Majewski <lukma@denx.de>,
	u-boot-qcom@groups.io, Aspeed BMC SW team <BMC-SW@aspeedtech.com>,
	Joel Stanley <joel@jms.id.au>,
	GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>,
	Paul Barker <paul@pbarker.dev>,
	Dai Okamura <okamura.dai@socionext.com>,
	linux@analog.com, uboot-snps-arc@synopsys.com,
	u-boot-amlogic@groups.io,
	uboot-stm32@st-md-mailman.stormreply.com,
	Tom Rini <trini@konsulko.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Andrew Goodbody <andrew.goodbody@linaro.org>,
	Stephen Boyd <swboyd@chromium.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Simon Glass <sjg@chromium.org>,
	Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Yannick Fertre <yannick.fertre@foss.st.com>,
	Romain Gantois <romain.gantois@bootlin.com>,
	Raymond Mao <raymondmaoca@gmail.com>,
	Michael Trimarchi <michael@amarulasolutions.com>,
	Christian Marangi <ansuelsmth@gmail.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Peng Fan <peng.fan@nxp.com>, Yao Zi <me@ziyao.cc>,
	Leo Yu-Chi Liang <ycliang@andestech.com>,
	Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Michal Simek <michal.simek@amd.com>,
	Quentin Schulz <quentin.schulz@cherry.de>,
	Peter Korsgaard <peter@korsgaard.com>,
	Greg Malysa <malysagreg@gmail.com>,
	Vasileios Bimpikas <vasileios.bimpikas@analog.com>,
	Arturs Artamonovs <arturs.artamonovs@analog.com>,
	Ryan Chen <ryan_chen@aspeedtech.com>,
	Chia-Wei Wang <chiawei_wang@aspeedtech.com>,
	Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>,
	Sean Anderson <seanga2@gmail.com>,
	Liviu Dudau <liviu.dudau@foss.arm.com>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Weijie Gao <weijie.gao@mediatek.com>,
	Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Igor Belwon <igor.belwon@mentallysanemainliners.org>,
	Stefan Roese <stefan.roese@mailbox.org>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	Robert Marko <robert.marko@sartura.hr>,
	Aswin Murugan <aswin.murugan@oss.qualcomm.com>,
	Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>,
	Nobuhiro Iwamatsu <iwamatsu@nigauri.org>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>,
	Kever Yang <kever.yang@rock-chips.com>,
	Minda Chen <minda.chen@starfivetech.com>,
	Hal Feng <hal.feng@starfivetech.com>,
	Thierry Reding <treding@nvidia.com>,
	Svyatoslav Ryhel <clamor95@gmail.com>,
	Kunihiko Hayashi <hayashi.kunihiko@socionext.com>,
	Philip Molloy <philip.molloy@analog.com>,
	Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>,
	Ryan Wanner <Ryan.Wanner@microchip.com>,
	Varshini Rajendran <varshini.rajendran@microchip.com>,
	Manikandan Muralidharan <manikandan.m@microchip.com>,
	Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>,
	Luca Weiss <luca.weiss@fairphone.com>,
	Jens Reidel <adrian@mainlining.org>,
	David Wronek <david.wronek@mainlining.org>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	David Lechner <dlechner@baylibre.com>, Nishanth Menon <nm@ti.com>,
	Alice Guo <alice.guo@nxp.com>,
	Valentin Caron <valentin.caron@foss.st.com>,
	Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>,
	Naman Trivedi <naman.trivedimanojbhai@amd.com>,
	Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>,
	Padmarao Begari <padmarao.begari@amd.com>,
	Jonathan Currier <dullfire@yahoo.com>,
	Sam Shih <sam.shih@mediatek.com>,
	Conor Dooley <conor.dooley@microchip.com>,
	Stephan Gerhold <stephan.gerhold@linaro.org>,
	Varadarajan Narayanan <quic_varada@quicinc.com>,
	Loic Poulain <loic.poulain@oss.qualcomm.com>,
	Sam Day <me@samcday.com>, Rui Miguel Silva <rui.silva@linaro.org>,
	Mattijs Korpershoek <mkorpershoek@kernel.org>,
	Shmuel Leib Melamud <smelamud@redhat.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Finley Xiao <finley.xiao@rock-chips.com>,
	Joseph Chen <chenjh@rock-chips.com>,
	Elaine Zhang <zhangqing@rock-chips.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Gabriel Fernandez <gabriel.fernandez@foss.st.com>,
	Andrew Davis <afd@ti.com>, Manorit Chawdhry <m-chawdhry@ti.com>,
	Udit Kumar <u-kumar1@ti.com>, Heiko Schocher <hs@nabladev.com>,
	"Markus Schneider-Pargmann (TI.com)" <msp@baylibre.com>,
	Dinesh Maniyam <dinesh.maniyam@altera.com>,
	Paul Sajna <sajattack@postmarketos.org>,
	Marek Vasut <marex@denx.de>
Subject: Re: [PATCH RFC 00/40] clk: port full Linux Common Clock Framework to U-Boot
Date: Mon, 6 Apr 2026 17:48:15 +0530	[thread overview]
Message-ID: <adOkh0qBBLfVWB87@sumit-xelite> (raw)
In-Reply-To: <20260319-casey-ccf-upstream-v1-0-4df2ee2226da@linaro.org>

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

      parent reply	other threads:[~2026-04-06 13:04 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 02/40] common: add an option to skip DM pre-relocation Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 03/40] serial: msm-geni: allow invalid clock Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 04/40] qcom: rpmh: don't error for SLEEP requests Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 05/40] string: add strdup_const and kstrdup_const Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 06/40] ofnode: add read_u64_array and count_elems_of_size Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 07/40] linux/compat: add PTR_ERR_OR_ZERO Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 08/40] compat: add kref implementation Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 09/40] compat: add dev_name() 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 12/40] regmap: add regmap_assign_bits Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 13/40] compat: regulator: add enable/disable macros Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 14/40] compat: math64: add abs_diff() Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 15/40] clk: restrict clk/imx to MACH_IMX Casey Connolly
2026-03-19 21:25   ` Ferass El Hafidi
2026-03-20 15:09     ` Tom Rini
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 17/40] clk: rename clk_ops to clk_ops_uboot 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 19/40] clk: make clk_set_rate() return signed long Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 20/40] clk: make clk_get_parent_rate " Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 21/40] clk: import full CCF from Linux Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 22/40] clk: move clock flags to common clk-provider.h Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 23/40] clk/ccf: adapt clk-conf for U-Boot Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 24/40] clk/ccf: adapt CCF core " Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 25/40] clk/ccf: adapt CCF generic clocks " 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 27/40] RFC: clk/ccf: add UCLASS_CLK compat shim Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 28/40] clk/sandbox: add a CCF_FULL port of clk_sandbox Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 29/40] WIP: test: adjust tests for CCF_FULL Casey Connolly
2026-03-19 20:56 ` [PATCH RFC 30/40] configs: add sandbox CCF_FULL defconfig 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
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-03-20 17:55   ` Neil Armstrong
2026-03-20 19:20     ` Casey Connolly
2026-03-20 19:05   ` Casey Connolly
2026-04-06 12:18 ` Sumit Garg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adOkh0qBBLfVWB87@sumit-xelite \
    --to=sumit.garg@kernel.org \
    --cc=BMC-SW@aspeedtech.com \
    --cc=Eugeniy.Paltsev@synopsys.com \
    --cc=GSS_MTK_Uboot_upstream@mediatek.com \
    --cc=Ryan.Wanner@microchip.com \
    --cc=adrian@mainlining.org \
    --cc=afd@ti.com \
    --cc=alice.guo@nxp.com \
    --cc=andrew.goodbody@linaro.org \
    --cc=ansuelsmth@gmail.com \
    --cc=arturs.artamonovs@analog.com \
    --cc=aswin.murugan@oss.qualcomm.com \
    --cc=balaji.selvanathan@oss.qualcomm.com \
    --cc=casey.connolly@linaro.org \
    --cc=chenjh@rock-chips.com \
    --cc=chiawei_wang@aspeedtech.com \
    --cc=chunfeng.yun@mediatek.com \
    --cc=clamor95@gmail.com \
    --cc=conor.dooley@microchip.com \
    --cc=david.wronek@mainlining.org \
    --cc=dinesh.maniyam@altera.com \
    --cc=dlechner@baylibre.com \
    --cc=dullfire@yahoo.com \
    --cc=finley.xiao@rock-chips.com \
    --cc=gabriel.fernandez@foss.st.com \
    --cc=hal.feng@starfivetech.com \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=heiko@sntech.de \
    --cc=hs@nabladev.com \
    --cc=igor.belwon@mentallysanemainliners.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=iwamatsu@nigauri.org \
    --cc=jh80.chung@samsung.com \
    --cc=joel@jms.id.au \
    --cc=jonas@kwiboo.se \
    --cc=jorge.ramirez@oss.qualcomm.com \
    --cc=kever.yang@rock-chips.com \
    --cc=linux@analog.com \
    --cc=liviu.dudau@foss.arm.com \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=luca.weiss@fairphone.com \
    --cc=lukma@denx.de \
    --cc=m-chawdhry@ti.com \
    --cc=malysagreg@gmail.com \
    --cc=manikandan.m@microchip.com \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=marex@denx.de \
    --cc=me@samcday.com \
    --cc=me@ziyao.cc \
    --cc=michael@amarulasolutions.com \
    --cc=michal.simek@amd.com \
    --cc=mikhail.kshevetskiy@iopsys.eu \
    --cc=minda.chen@starfivetech.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mkorpershoek@kernel.org \
    --cc=msp@baylibre.com \
    --cc=naman.trivedimanojbhai@amd.com \
    --cc=neil.armstrong@linaro.org \
    --cc=nm@ti.com \
    --cc=okamura.dai@socionext.com \
    --cc=padmarao.begari@amd.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=paul@pbarker.dev \
    --cc=peng.fan@nxp.com \
    --cc=peter@korsgaard.com \
    --cc=philip.molloy@analog.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=quentin.schulz@cherry.de \
    --cc=quic_varada@quicinc.com \
    --cc=raphael.gallais-pou@foss.st.com \
    --cc=raymondmaoca@gmail.com \
    --cc=robert.marko@sartura.hr \
    --cc=romain.gantois@bootlin.com \
    --cc=rui.silva@linaro.org \
    --cc=ryan_chen@aspeedtech.com \
    --cc=ryder.lee@mediatek.com \
    --cc=sajattack@postmarketos.org \
    --cc=sam.shih@mediatek.com \
    --cc=seanga2@gmail.com \
    --cc=senthilnathan.thangaraj@amd.com \
    --cc=sjg@chromium.org \
    --cc=smelamud@redhat.com \
    --cc=stefan.roese@mailbox.org \
    --cc=stephan.gerhold@linaro.org \
    --cc=swboyd@chromium.org \
    --cc=treding@nvidia.com \
    --cc=trini@konsulko.com \
    --cc=u-boot-amlogic@groups.io \
    --cc=u-boot-qcom@groups.io \
    --cc=u-boot@lists.denx.de \
    --cc=u-kumar1@ti.com \
    --cc=uboot-snps-arc@synopsys.com \
    --cc=uboot-stm32@st-md-mailman.stormreply.com \
    --cc=valentin.caron@foss.st.com \
    --cc=varshini.rajendran@microchip.com \
    --cc=vasileios.bimpikas@analog.com \
    --cc=venkatesh.abbarapu@amd.com \
    --cc=weijie.gao@mediatek.com \
    --cc=yannick.fertre@foss.st.com \
    --cc=ycliang@andestech.com \
    --cc=zhangqing@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox