From: Cristian Marussi <cristian.marussi@arm.com>
To: Peng Fan <peng.fan@oss.nxp.com>
Cc: Cristian Marussi <cristian.marussi@arm.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, arm-scmi@vger.kernel.org,
linux-clk@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
sudeep.holla@arm.com, philip.radford@arm.com,
james.quinlan@broadcom.com, f.fainelli@gmail.com,
vincent.guittot@linaro.org, etienne.carriere@foss.st.com,
michal.simek@amd.com, dan.carpenter@linaro.org,
geert+renesas@glider.be, kuninori.morimoto.gx@renesas.com,
marek.vasut+renesas@gmail.com, Brian Masney <bmasney@redhat.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>
Subject: Re: [PATCH 02/11] clk: scmi: Use new determine_rate clock operation
Date: Sat, 28 Feb 2026 10:23:54 +0000 [thread overview]
Message-ID: <aaLCOstT89XQEP6P@pluto> (raw)
In-Reply-To: <aaI9JBwWaMmfBbd/@shlinux89>
On Sat, Feb 28, 2026 at 08:56:04AM +0800, Peng Fan wrote:
> On Fri, Feb 27, 2026 at 03:32:16PM +0000, Cristian Marussi wrote:
> >Use the Clock protocol layer determine_rate logic to calculate the closest
> >rate that can be supported by a specific clock.
> >
> >No functional change.
> >
> >Cc: Brian Masney <bmasney@redhat.com>
> >Cc: Michael Turquette <mturquette@baylibre.com>
> >Cc: Stephen Boyd <sboyd@kernel.org>
> >Cc: linux-clk@vger.kernel.org
> >Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> >---
> >Note that the calculation logic in the protocol layer is exactly the same
> >as it wes here.
> >
> >@Brian I suppose once your CLK_ROUNDING_FW_MANAGED sereis is merged I can flag
> >such SCMI clocks.
>
> Per my reading of Brain's thread, if ->determine_rate exists,
> ->determine_rate() will be used.
>
> } else if (core->ops->determine_rate) {
> return core->ops->determine_rate(core->hw, req);
> + } else if (clk_is_rounding_fw_managed(core)) {
> + return 0;
>
> So unless update scmi_clk_determine_rate() to something:
> --------
> if (clk & CLK_ROUNDING_FW_MANAGED)
> return 0;
>
> return scmi_proto_clk_ops->determine_rate(clk->ph, clk->id, &req->rate);
> --------
>
> It maybe better to update Brain's patch to move clk_is_rounding_fw_managed()
> above the check of core->ops->determine_rate().
Indeed, I may have not fully understood Brian patch, since it appeared
while I was already reworking this...
I suppose I could also refrain from registering a determine_rate and
use the new flag when I know the rate will be rounded by FW...in the
future simply there will be the possibility to ask the firmware first
for a final 'clock rate determination' upfront in some of the cases in
which now we rely on FW rounding..
>
> >---
> > drivers/clk/clk-scmi.c | 31 ++++++-------------------------
> > 1 file changed, 6 insertions(+), 25 deletions(-)
> >
> >diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c
> >index 6b286ea6f121..c223e4ef1dd1 100644
> >--- a/drivers/clk/clk-scmi.c
> >+++ b/drivers/clk/clk-scmi.c
> >@@ -12,7 +12,6 @@
> > #include <linux/of.h>
> > #include <linux/module.h>
> > #include <linux/scmi_protocol.h>
> >-#include <asm/div64.h>
> >
> > #define NOT_ATOMIC false
> > #define ATOMIC true
> >@@ -57,35 +56,17 @@ static unsigned long scmi_clk_recalc_rate(struct clk_hw *hw,
> > static int scmi_clk_determine_rate(struct clk_hw *hw,
> > struct clk_rate_request *req)
> > {
> >- u64 fmin, fmax, ftmp;
> >+ int ret;
> > struct scmi_clk *clk = to_scmi_clk(hw);
> >
> > /*
> >- * We can't figure out what rate it will be, so just return the
> >- * rate back to the caller. scmi_clk_recalc_rate() will be called
> >- * after the rate is set and we'll know what rate the clock is
> >+ * If we could not get a better rate scmi_clk_recalc_rate() will be
> >+ * called after the rate is set and we'll know what rate the clock is
> > * running at then.
> > */
> >- if (clk->info->rate_discrete)
> >- return 0;
> >-
> >- fmin = clk->info->range.min_rate;
> >- fmax = clk->info->range.max_rate;
> >- if (req->rate <= fmin) {
> >- req->rate = fmin;
> >-
> >- return 0;
> >- } else if (req->rate >= fmax) {
> >- req->rate = fmax;
> >-
> >- return 0;
> >- }
> >-
> >- ftmp = req->rate - fmin;
> >- ftmp += clk->info->range.step_size - 1; /* to round up */
> >- do_div(ftmp, clk->info->range.step_size);
> >-
> >- req->rate = ftmp * clk->info->range.step_size + fmin;
> >+ ret = scmi_proto_clk_ops->determine_rate(clk->ph, clk->id, &req->rate);
> >+ if (ret)
> >+ return ret;
>
> nit:
> "return scmi_proto_clk_ops->determine_rate(clk->ph, clk->id, &req->rate);"
..oh yes...
>
> Otherwise:
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
>
Thanks,
Cristian
next prev parent reply other threads:[~2026-02-28 10:24 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 15:32 [PATCH 00/11] SCMI Clock rates discovery rework Cristian Marussi
2026-02-27 15:32 ` [PATCH 01/11] firmware: arm_scmi: Add clock determine_rate operation Cristian Marussi
2026-02-27 16:50 ` Jonathan Cameron
2026-02-28 10:07 ` Cristian Marussi
2026-02-28 0:27 ` Peng Fan
2026-02-28 10:13 ` Cristian Marussi
2026-03-02 12:37 ` Geert Uytterhoeven
2026-03-03 12:46 ` Cristian Marussi
2026-02-27 15:32 ` [PATCH 02/11] clk: scmi: Use new determine_rate clock operation Cristian Marussi
2026-02-28 0:56 ` Peng Fan
2026-02-28 10:23 ` Cristian Marussi [this message]
2026-03-02 17:11 ` Brian Masney
2026-03-03 2:54 ` Peng Fan
2026-03-03 12:47 ` Cristian Marussi
2026-03-02 12:39 ` Geert Uytterhoeven
2026-03-03 12:49 ` Cristian Marussi
2026-02-27 15:32 ` [PATCH 03/11] firmware: arm_scmi: Simplify clock rates exposed interface Cristian Marussi
2026-02-28 2:07 ` Peng Fan
2026-02-28 10:34 ` Cristian Marussi
2026-03-02 12:48 ` Geert Uytterhoeven
2026-03-02 13:09 ` Geert Uytterhoeven
2026-03-03 12:42 ` Cristian Marussi
2026-03-03 12:40 ` Cristian Marussi
2026-02-27 15:32 ` [PATCH 04/11] clk: scmi: Use new simplified per-clock rate properties Cristian Marussi
2026-02-28 2:12 ` Peng Fan
2026-02-27 15:32 ` [PATCH 05/11] firmware: arm_scmi: Drop unused clock rate interfaces Cristian Marussi
2026-02-28 2:13 ` Peng Fan
2026-02-27 15:32 ` [PATCH 06/11] firmware: arm_scmi: Make clock rates allocation dynamic Cristian Marussi
2026-02-28 2:29 ` Peng Fan
2026-02-28 10:36 ` Cristian Marussi
2026-02-27 15:32 ` [PATCH 07/11] firmware: arm_scmi: Harden clock parents discovery Cristian Marussi
2026-02-28 2:39 ` Peng Fan
2026-02-28 10:37 ` Cristian Marussi
2026-02-27 15:32 ` [PATCH 08/11] firmware: arm_scmi: Refactor iterators internal allocation Cristian Marussi
2026-02-27 15:32 ` [PATCH 09/11] firmware: arm_scmi: Add bound iterators support Cristian Marussi
2026-02-28 2:44 ` Peng Fan
2026-02-28 2:43 ` Peng Fan (OSS)
2026-02-28 10:42 ` Cristian Marussi
2026-02-27 15:32 ` [PATCH 10/11] firmware: arm_scmi: Use bound iterators to minimize discovered rates Cristian Marussi
2026-02-27 16:53 ` Jonathan Cameron
2026-02-28 10:43 ` Cristian Marussi
2026-02-27 15:32 ` [PATCH 11/11] firmware: arm_scmi: Introduce all_rates_get clock operation Cristian Marussi
2026-02-28 2:49 ` Peng Fan
2026-02-28 10:47 ` Cristian Marussi
2026-03-02 7:18 ` Peng Fan
2026-03-02 10:47 ` Cristian Marussi
2026-03-02 13:25 ` [PATCH 00/11] SCMI Clock rates discovery rework Geert Uytterhoeven
2026-03-03 13:08 ` Cristian Marussi
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=aaLCOstT89XQEP6P@pluto \
--to=cristian.marussi@arm.com \
--cc=arm-scmi@vger.kernel.org \
--cc=bmasney@redhat.com \
--cc=dan.carpenter@linaro.org \
--cc=etienne.carriere@foss.st.com \
--cc=f.fainelli@gmail.com \
--cc=geert+renesas@glider.be \
--cc=james.quinlan@broadcom.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=marek.vasut+renesas@gmail.com \
--cc=michal.simek@amd.com \
--cc=mturquette@baylibre.com \
--cc=peng.fan@oss.nxp.com \
--cc=philip.radford@arm.com \
--cc=sboyd@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=vincent.guittot@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.