public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v3 0/6] clk: support arbitrary clk_register() sequence
@ 2026-01-19 19:07 Yang Xiwen via B4 Relay
  2026-01-19 19:07 ` [PATCH v3 1/6] drivers: core: device: set new parent when old parent is NULL Yang Xiwen via B4 Relay
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Yang Xiwen via B4 Relay @ 2026-01-19 19:07 UTC (permalink / raw)
  To: Simon Glass, Tom Rini, Lukasz Majewski, Sean Anderson
  Cc: u-boot, Yang Xiwen, Simon Glass

Currently, the U-Boot clk framework mandates that clock registration
begins at the root and proceeds to children. This creates an additional
requirement that does not exist in the Linux kernel, making the porting
of clk drivers more difficult.

This series handles the dependency entirely within the clk framework,
allowing drivers the freedom to register clocks in any order.

This is achieved by assigning the parent "lazily". The framework caches
the parent name in the core clk struct and attempts to resolve the
actual parent when clk consumers call clk_get_parent(). The process is
transparent to clk consumers as long as they use standard clk framework
APIs.

I've run `ut dm clk*` and verified these commits do not break any
existing test cases. It also passes the new test case.

This feature is disabled for xPLs by default. I have not found a clean
way to enable this separately for xPLs without introducing a repetitive
Kconfig entry (e.g., xPL_CLK_LAZY_REPARENT), which looks very ugly.

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
---
Changes in v3:
- dm: core: drop Simon's rb because the logic is incompelete and broken.
  I forgot to add the child to the parent's child_node list which fails
  the test I've written for the dev_reparent() change. (Simon)
- test: dm: add tests for device_reparent()
- test: clk: rebase onto master, clk_dm() -> dev_clk_dm(), add required
  CLK_ID() macro.
- Link to v2: https://lore.kernel.org/r/20260101-clk-reparent-v2-0-3eb42b78c7f1@outlook.com

Changes in v2:
- tests: add a simple test for this feature
- clk: restrict this feature to only U-Boot proper, excluding xPLs from
  support (Tom)
- clk: some minor tweaks that should not matter too much
- Link to v1: https://lore.kernel.org/r/20250621-clk-reparent-v1-0-48a7f2f31c59@outlook.com

---
Yang Xiwen (6):
      drivers: core: device: set new parent when old parent is NULL
      test: dm: core: add some assertions for device_reparent()
      clk: add uclass id check to clk_get_parent()
      clk: use clk_get_parent() helper in clk_en(dis)able()
      clk: allow assigning parent lazily
      test: clk: add test for CLK_LAZY_REPARENT

 drivers/clk/Kconfig           | 12 ++++++++
 drivers/clk/clk-uclass.c      | 72 +++++++++++++++++++++++++++++++++++--------
 drivers/clk/clk.c             | 14 +++++++--
 drivers/clk/clk_sandbox_ccf.c | 10 ++++++
 drivers/core/device.c         |  8 +++++
 include/clk.h                 |  2 ++
 include/sandbox-clk.h         |  2 ++
 test/dm/clk_ccf.c             | 40 ++++++++++++++++++++++++
 test/dm/core.c                | 34 ++++++++++++++++++--
 9 files changed, 178 insertions(+), 16 deletions(-)
---
base-commit: 6b2d05748cf3cd6ba417a96c00602b0122e10af6
change-id: 20250621-clk-reparent-89d75f6a8e09

Best regards,
-- 
Yang Xiwen <forbidden405@outlook.com>



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

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

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-19 19:07 [PATCH v3 0/6] clk: support arbitrary clk_register() sequence Yang Xiwen via B4 Relay
2026-01-19 19:07 ` [PATCH v3 1/6] drivers: core: device: set new parent when old parent is NULL Yang Xiwen via B4 Relay
2026-02-04  0:23   ` Simon Glass
2026-01-19 19:07 ` [PATCH v3 2/6] test: dm: core: add some assertions for device_reparent() Yang Xiwen via B4 Relay
2026-02-04  0:23   ` Simon Glass
2026-01-19 19:07 ` [PATCH v3 3/6] clk: add uclass id check to clk_get_parent() Yang Xiwen via B4 Relay
2026-01-19 19:07 ` [PATCH v3 4/6] clk: use clk_get_parent() helper in clk_en(dis)able() Yang Xiwen via B4 Relay
2026-01-19 19:07 ` [PATCH v3 5/6] clk: allow assigning parent lazily Yang Xiwen via B4 Relay
2026-01-19 19:07 ` [PATCH v3 6/6] test: clk: add test for CLK_LAZY_REPARENT Yang Xiwen via B4 Relay
2026-02-04  0:23   ` Simon Glass
2026-02-02 20:17 ` [PATCH v3 0/6] clk: support arbitrary clk_register() sequence Tom Rini
2026-02-03 15:28   ` Yang Xiwen
2026-02-03 16:15     ` Tom Rini
2026-02-07 14:58       ` Yang Xiwen
2026-02-09 14:23         ` Tom Rini

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