Subject: Re: [PATCH RFC 0/2] clk: scmi: DT support for SCMI clock rate rounding modes (per‑clock policy)

From: Peng Fan <[email-masked]>
Date: Wed, 8 Apr 2026 21:58:52 +0800

Hi Brian,
On Mon, Apr 06, 2026 at 11:38:30AM -0400, Brian Masney wrote:
>Hi Peng,
>
>On Fri, Mar 06, 2026 at 02:20:11PM +0800, Peng Fan (OSS) wrote:
>> 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 <[email-masked]>
>
>My high level feedback about this:
>
>1) Since you are making changes to the DT schema for the clock-cells,
>   does the SCMI DT schema document also need to be updated to allow
>   clock-cells to be 1 or 2?

You are right.

>
>2) For the ROUND_XXX constants, I would prefix them with something
>   since the existing ROUND names are fairly generic sounding. Maybe
>   CLK_SCMI_?

sounds good.

I will wait a few more days to see if there are other comments, then
will post out next version.

Thanks,
Peng

>Brian