public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] clk: scmi: DT support for SCMI clock rate rounding modes (per‑clock policy)
@ 2026-03-06  6:20 Peng Fan (OSS)
  2026-03-06  6:20 ` [PATCH RFC 1/2] dt-bindings: clock: Add SCMI clock rounding mode declarations Peng Fan (OSS)
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Peng Fan (OSS) @ 2026-03-06  6:20 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Sudeep Holla, Cristian Marussi
  Cc: linux-kernel, linux-clk, devicetree, arm-scmi, linux-arm-kernel,
	Peng Fan

The ARM SCMI specification (DEN0056E) defines rounding‑mode flags for the
CLOCK_RATE_SET command, allowing a client to request that the firmware
round a requested clock rate down, up, or autonomously choose the
closest achievable rate.
This series introduces DT support in the SCMI clock provider to carry a
per‑clock rounding policy from the device tree into the SCMI protocol.

Patch 1 adds dt‑bindings constants for rounding modes:
ROUND_DOWN, ROUND_UP, ROUND_AUTO.

Patch 2 extends the SCMI clock provider to optionally support
"#clock-cells = <2>", where the second cell encodes the rounding mode.
The first consumer that references a given clock latches the per‑clock
policy. Subsequent consumers of the same clock must specify the same
mode; otherwise, the request is rejected to avoid non‑deterministic
behavior. The selected mode is passed through to the SCMI Clock protocol
and mapped to the corresponding CLOCK_SET_* flag.

Patch 2 includes changes to drivers/clk/clk-scmi.c and drivers/firmware
arm_scmi/clock.c, it is hard to separate the changes without breaking,
so I put the changes in one patch.

This design adopts a per‑clock policy model, not per‑consumer. The rounding
mode is applied by the provider per clock (index).
All consumers of the same clock must agree on the rounding mode.
Conflicting per‑consumer requests for the same clock are invalid and
are rejected during phandle translation.

This avoids silent clobbering and preserves deterministic behavior.

Existing device trees using #clock-cells = <1> continue to work and
default to ROUND_DOWN, exactly as before.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Peng Fan (2):
      dt-bindings: clock: Add SCMI clock rounding mode declarations
      clk: scmi: Add support for two #clock-cells to pass rate rounding mode

 drivers/clk/clk-scmi.c            | 62 +++++++++++++++++++++++++++++++++++++--
 drivers/firmware/arm_scmi/clock.c | 15 ++++++++--
 include/dt-bindings/clock/scmi.h  | 13 ++++++++
 include/linux/scmi_protocol.h     |  8 ++++-
 4 files changed, 92 insertions(+), 6 deletions(-)
---
base-commit: 3f9cd19e764b782706dbaacc69e502099cb014ba
change-id: 20260306-scmi-clk-round-1615258cf0fa

Best regards,
-- 
Peng Fan <peng.fan@nxp.com>


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

end of thread, other threads:[~2026-04-06 15:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06  6:20 [PATCH RFC 0/2] clk: scmi: DT support for SCMI clock rate rounding modes (per‑clock policy) Peng Fan (OSS)
2026-03-06  6:20 ` [PATCH RFC 1/2] dt-bindings: clock: Add SCMI clock rounding mode declarations Peng Fan (OSS)
2026-03-06  6:20 ` [PATCH RFC 2/2] clk: scmi: Add support for two #clock-cells to pass rate rounding mode Peng Fan (OSS)
2026-04-04  1:53 ` [PATCH RFC 0/2] clk: scmi: DT support for SCMI clock rate rounding modes (per‑clock policy) Peng Fan
2026-04-06 15:38 ` Brian Masney

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