* [PATCH v4 0/2] Add compatibility for scmi clock protocol version 3.0
@ 2025-11-04 11:19 Kamlesh Gurudasani
2025-11-04 11:19 ` [PATCH v4 1/2] clk: scmi: fix set_parent support when CCF is not being used Kamlesh Gurudasani
2025-11-04 11:19 ` [PATCH v4 2/2] clk: scmi: add compatibility for clock version 3.0 and onwards Kamlesh Gurudasani
0 siblings, 2 replies; 7+ messages in thread
From: Kamlesh Gurudasani @ 2025-11-04 11:19 UTC (permalink / raw)
To: Lukasz Majewski, Sean Anderson, Tom Rini, Peng Fan, Ye Li,
Alice Guo, Maxim Kochetkov, d-gole
Cc: u-boot, Kamlesh Gurudasani
Clock version 3.0 specified in ARM SCMI Platform design document
v3.2, adds extended_config_val parameter in CLOCK_CONFIG_SET.
The SCMI server with clock version 3.0 rejects the message if
it doesn't have this field.
Add support so that both SCMI server with clock version 2.0 and 3.0
can be handled.
While at it, fix the set_parent support for non CCF flow.
Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
---
Changes in v4:
- Added seperate handling for CCF and non CCF versions
- Link to v3: https://lore.kernel.org/r/20250819-b4-scmi-v1-v3-0-360145076b3b@ti.com
Changes in v3:
- Removed a checkpatch warning, which helped avoid reuse of code
- Link to v2: https://lore.kernel.org/r/20250818-b4-scmi-v1-v2-0-e0351c4d839e@ti.com
Changes in v2:
- Fixed the code according to review comments
- Link to v1: https://lore.kernel.org/r/20250813-b4-scmi-v1-v1-0-bef20fc32d4b@ti.com
---
Kamlesh Gurudasani (2):
clk: scmi: fix set_parent support when CCF is not being used
clk: scmi: add compatibility for clock version 3.0 and onwards
drivers/clk/clk_scmi.c | 54 ++++++++++++++++++++++++++++++++++++++++--------------
include/scmi_protocols.h | 6 ++++++
2 files changed, 46 insertions(+), 14 deletions(-)
---
base-commit: 4e4a9de31de2a5f395ee25c59e4026422fbcb27e
change-id: 20250813-b4-scmi-v1-b3deb87fa712
Best regards,
--
Kamlesh Gurudasani <kamlesh@ti.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 1/2] clk: scmi: fix set_parent support when CCF is not being used
2025-11-04 11:19 [PATCH v4 0/2] Add compatibility for scmi clock protocol version 3.0 Kamlesh Gurudasani
@ 2025-11-04 11:19 ` Kamlesh Gurudasani
2025-11-07 3:32 ` Peng Fan
2025-11-07 3:41 ` Peng Fan
2025-11-04 11:19 ` [PATCH v4 2/2] clk: scmi: add compatibility for clock version 3.0 and onwards Kamlesh Gurudasani
1 sibling, 2 replies; 7+ messages in thread
From: Kamlesh Gurudasani @ 2025-11-04 11:19 UTC (permalink / raw)
To: Lukasz Majewski, Sean Anderson, Tom Rini, Peng Fan, Ye Li,
Alice Guo, Maxim Kochetkov, d-gole
Cc: u-boot, Kamlesh Gurudasani
When not using Common clock framework(CCF), calls to
scmi_clk_set_parent returns -ENOTSUPP, which should not be the case.
Fix that.
Fixes: 15fdfef6642c ("clk: scmi: check the clock state/parent/rate
control permissions)
Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
---
drivers/clk/clk_scmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c
index 0c9a81cabcc..83ea7bb4286 100644
--- a/drivers/clk/clk_scmi.c
+++ b/drivers/clk/clk_scmi.c
@@ -359,7 +359,7 @@ static int scmi_clk_set_parent(struct clk *clk, struct clk *parent)
int ret;
if (!CONFIG_IS_ENABLED(CLK_CCF))
- return -ENOTSUPP;
+ return __scmi_clk_set_parent(clk, parent);
ret = clk_get_by_id(clk->id, &c);
if (ret)
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v4 2/2] clk: scmi: add compatibility for clock version 3.0 and onwards
2025-11-04 11:19 [PATCH v4 0/2] Add compatibility for scmi clock protocol version 3.0 Kamlesh Gurudasani
2025-11-04 11:19 ` [PATCH v4 1/2] clk: scmi: fix set_parent support when CCF is not being used Kamlesh Gurudasani
@ 2025-11-04 11:19 ` Kamlesh Gurudasani
2025-11-07 3:39 ` Peng Fan
2025-11-11 6:34 ` Maxim Kochetkov
1 sibling, 2 replies; 7+ messages in thread
From: Kamlesh Gurudasani @ 2025-11-04 11:19 UTC (permalink / raw)
To: Lukasz Majewski, Sean Anderson, Tom Rini, Peng Fan, Ye Li,
Alice Guo, Maxim Kochetkov, d-gole
Cc: u-boot, Kamlesh Gurudasani
Clock version 3.0 specified in ARM SCMI Platform design document
v3.2, adds extended_config_val parameter in CLOCK_CONFIG_SET and
CLOCK_CONFIG_GET. Add support for that.
Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
---
drivers/clk/clk_scmi.c | 52 +++++++++++++++++++++++++++++++++++++++-------------
include/scmi_protocols.h | 6 ++++++
2 files changed, 45 insertions(+), 13 deletions(-)
diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c
index 83ea7bb4286..6d47cc6cd01 100644
--- a/drivers/clk/clk_scmi.c
+++ b/drivers/clk/clk_scmi.c
@@ -131,19 +131,45 @@ static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name,
static int scmi_clk_gate(struct clk *clk, int enable)
{
- struct scmi_clk_state_in in = {
- .clock_id = clk_get_id(clk),
- .attributes = enable,
- };
+ struct scmi_clock_priv *priv;
struct scmi_clk_state_out out;
- struct scmi_msg msg = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK,
- SCMI_CLOCK_CONFIG_SET,
- in, out);
int ret;
- ret = devm_scmi_process_msg(clk->dev, &msg);
- if (ret)
- return ret;
+ if (CONFIG_IS_ENABLED(CLK_CCF)) {
+ /* CCF: version info is in parent device */
+ priv = dev_get_priv(clk->dev->parent);
+ } else {
+ /* Non-CCF: version info is in current device */
+ priv = dev_get_priv(clk->dev);
+ }
+
+ if (priv->version >= CLOCK_PROTOCOL_VERSION_3_0) {
+ struct scmi_clk_state_in_v2 in = {
+ .clock_id = clk->id,
+ .attributes = enable,
+ .extended_config_val = 0,
+ };
+ struct scmi_msg msg = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK,
+ SCMI_CLOCK_CONFIG_SET,
+ in, out);
+
+ ret = devm_scmi_process_msg(clk->dev, &msg);
+ if (ret)
+ return ret;
+
+ } else {
+ struct scmi_clk_state_in in = {
+ .clock_id = clk->id,
+ .attributes = enable,
+ };
+ struct scmi_msg msg = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK,
+ SCMI_CLOCK_CONFIG_SET,
+ in, out);
+
+ ret = devm_scmi_process_msg(clk->dev, &msg);
+ if (ret)
+ return ret;
+ }
return scmi_to_linux_errno(out.status);
}
@@ -275,12 +301,12 @@ static int scmi_clk_probe(struct udevice *dev)
if (ret)
return ret;
- if (!CONFIG_IS_ENABLED(CLK_CCF))
- return 0;
-
ret = scmi_generic_protocol_version(dev, SCMI_PROTOCOL_ID_CLOCK,
&priv->version);
+ if (!CONFIG_IS_ENABLED(CLK_CCF))
+ return 0;
+
/* register CCF children: CLK UCLASS, no probed again */
if (device_get_uclass_id(dev->parent) == UCLASS_CLK)
return 0;
diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h
index 762a1032c37..a4d1a4c80c8 100644
--- a/include/scmi_protocols.h
+++ b/include/scmi_protocols.h
@@ -807,6 +807,12 @@ struct scmi_clk_state_in {
u32 attributes;
};
+struct scmi_clk_state_in_v2 {
+ u32 clock_id;
+ u32 attributes;
+ u32 extended_config_val;
+};
+
/**
* struct scmi_clk_state_out - Response payload for CLOCK_CONFIG_SET command
* @status: SCMI command status
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/2] clk: scmi: fix set_parent support when CCF is not being used
2025-11-04 11:19 ` [PATCH v4 1/2] clk: scmi: fix set_parent support when CCF is not being used Kamlesh Gurudasani
@ 2025-11-07 3:32 ` Peng Fan
2025-11-07 3:41 ` Peng Fan
1 sibling, 0 replies; 7+ messages in thread
From: Peng Fan @ 2025-11-07 3:32 UTC (permalink / raw)
To: Kamlesh Gurudasani
Cc: Lukasz Majewski, Sean Anderson, Tom Rini, Peng Fan, Ye Li,
Alice Guo, Maxim Kochetkov, d-gole, u-boot
On Tue, Nov 04, 2025 at 04:49:30PM +0530, Kamlesh Gurudasani wrote:
>When not using Common clock framework(CCF), calls to
>scmi_clk_set_parent returns -ENOTSUPP, which should not be the case.
>Fix that.
>
>Fixes: 15fdfef6642c ("clk: scmi: check the clock state/parent/rate
>control permissions)
>
>Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/2] clk: scmi: add compatibility for clock version 3.0 and onwards
2025-11-04 11:19 ` [PATCH v4 2/2] clk: scmi: add compatibility for clock version 3.0 and onwards Kamlesh Gurudasani
@ 2025-11-07 3:39 ` Peng Fan
2025-11-11 6:34 ` Maxim Kochetkov
1 sibling, 0 replies; 7+ messages in thread
From: Peng Fan @ 2025-11-07 3:39 UTC (permalink / raw)
To: Kamlesh Gurudasani
Cc: Lukasz Majewski, Sean Anderson, Tom Rini, Peng Fan, Ye Li,
Alice Guo, Maxim Kochetkov, d-gole, u-boot
On Tue, Nov 04, 2025 at 04:49:31PM +0530, Kamlesh Gurudasani wrote:
>Clock version 3.0 specified in ARM SCMI Platform design document
>v3.2, adds extended_config_val parameter in CLOCK_CONFIG_SET and
>CLOCK_CONFIG_GET. Add support for that.
>
>Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
>---
> drivers/clk/clk_scmi.c | 52 +++++++++++++++++++++++++++++++++++++++-------------
> include/scmi_protocols.h | 6 ++++++
> 2 files changed, 45 insertions(+), 13 deletions(-)
>
>diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c
>index 83ea7bb4286..6d47cc6cd01 100644
>--- a/drivers/clk/clk_scmi.c
>+++ b/drivers/clk/clk_scmi.c
>@@ -131,19 +131,45 @@ static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name,
>
> static int scmi_clk_gate(struct clk *clk, int enable)
> {
>- struct scmi_clk_state_in in = {
>- .clock_id = clk_get_id(clk),
>- .attributes = enable,
>- };
>+ struct scmi_clock_priv *priv;
> struct scmi_clk_state_out out;
>- struct scmi_msg msg = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK,
>- SCMI_CLOCK_CONFIG_SET,
>- in, out);
> int ret;
>
>- ret = devm_scmi_process_msg(clk->dev, &msg);
>- if (ret)
>- return ret;
>+ if (CONFIG_IS_ENABLED(CLK_CCF)) {
>+ /* CCF: version info is in parent device */
>+ priv = dev_get_priv(clk->dev->parent);
This is wrong, please use dev_get_parent_priv after
you rebase with fsl-qoirq/next. There is conflict, I could
not directly apply this patch and change this line at my side.
Thanks,
Peng
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/2] clk: scmi: fix set_parent support when CCF is not being used
2025-11-04 11:19 ` [PATCH v4 1/2] clk: scmi: fix set_parent support when CCF is not being used Kamlesh Gurudasani
2025-11-07 3:32 ` Peng Fan
@ 2025-11-07 3:41 ` Peng Fan
1 sibling, 0 replies; 7+ messages in thread
From: Peng Fan @ 2025-11-07 3:41 UTC (permalink / raw)
To: Kamlesh Gurudasani
Cc: Lukasz Majewski, Sean Anderson, Tom Rini, Peng Fan, Ye Li,
Alice Guo, Maxim Kochetkov, d-gole, u-boot
On Tue, Nov 04, 2025 at 04:49:30PM +0530, Kamlesh Gurudasani wrote:
>When not using Common clock framework(CCF), calls to
>scmi_clk_set_parent returns -ENOTSUPP, which should not be the case.
>Fix that.
>
>Fixes: 15fdfef6642c ("clk: scmi: check the clock state/parent/rate
>control permissions)
>
>Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
Applied to fsl-qoirq/next!
Please only send patch 2 next time.
Thanks,
Peng
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/2] clk: scmi: add compatibility for clock version 3.0 and onwards
2025-11-04 11:19 ` [PATCH v4 2/2] clk: scmi: add compatibility for clock version 3.0 and onwards Kamlesh Gurudasani
2025-11-07 3:39 ` Peng Fan
@ 2025-11-11 6:34 ` Maxim Kochetkov
1 sibling, 0 replies; 7+ messages in thread
From: Maxim Kochetkov @ 2025-11-11 6:34 UTC (permalink / raw)
To: Kamlesh Gurudasani, Lukasz Majewski, Sean Anderson, Tom Rini,
Peng Fan, Ye Li, Alice Guo, d-gole
Cc: u-boot
04.11.2025 14:19, Kamlesh Gurudasani wrote:
> Clock version 3.0 specified in ARM SCMI Platform design document
> v3.2, adds extended_config_val parameter in CLOCK_CONFIG_SET and
> CLOCK_CONFIG_GET. Add support for that.
>
> Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
> ---
> drivers/clk/clk_scmi.c | 52 +++++++++++++++++++++++++++++++++++++++-------------
> include/scmi_protocols.h | 6 ++++++
> 2 files changed, 45 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c
> index 83ea7bb4286..6d47cc6cd01 100644
> --- a/drivers/clk/clk_scmi.c
> +++ b/drivers/clk/clk_scmi.c
> @@ -131,19 +131,45 @@ static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name,
>
> static int scmi_clk_gate(struct clk *clk, int enable)
> {
> - struct scmi_clk_state_in in = {
> - .clock_id = clk_get_id(clk),
> - .attributes = enable,
> - };
> + struct scmi_clock_priv *priv;
> struct scmi_clk_state_out out;
> - struct scmi_msg msg = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK,
> - SCMI_CLOCK_CONFIG_SET,
> - in, out);
> int ret;
>
> - ret = devm_scmi_process_msg(clk->dev, &msg);
> - if (ret)
> - return ret;
> + if (CONFIG_IS_ENABLED(CLK_CCF)) {
> + /* CCF: version info is in parent device */
> + priv = dev_get_priv(clk->dev->parent);
> + } else {
> + /* Non-CCF: version info is in current device */
> + priv = dev_get_priv(clk->dev);
> + }
> +
> + if (priv->version >= CLOCK_PROTOCOL_VERSION_3_0) {
> + struct scmi_clk_state_in_v2 in = {
> + .clock_id = clk->id,
.clock_id = clk_get_id(clk),
> + .attributes = enable,
> + .extended_config_val = 0,
> + };
> + struct scmi_msg msg = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK,
> + SCMI_CLOCK_CONFIG_SET,
> + in, out);
> +
> + ret = devm_scmi_process_msg(clk->dev, &msg);
> + if (ret)
> + return ret;
> +
> + } else {
> + struct scmi_clk_state_in in = {
> + .clock_id = clk->id,
.clock_id = clk_get_id(clk),
> + .attributes = enable,
> + };
> + struct scmi_msg msg = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK,
> + SCMI_CLOCK_CONFIG_SET,
> + in, out);
> +
> + ret = devm_scmi_process_msg(clk->dev, &msg);
> + if (ret)
> + return ret;
> + }
>
> return scmi_to_linux_errno(out.status);
> }
> @@ -275,12 +301,12 @@ static int scmi_clk_probe(struct udevice *dev)
> if (ret)
> return ret;
>
> - if (!CONFIG_IS_ENABLED(CLK_CCF))
> - return 0;
> -
> ret = scmi_generic_protocol_version(dev, SCMI_PROTOCOL_ID_CLOCK,
> &priv->version);
>
> + if (!CONFIG_IS_ENABLED(CLK_CCF))
> + return 0;
> +
> /* register CCF children: CLK UCLASS, no probed again */
> if (device_get_uclass_id(dev->parent) == UCLASS_CLK)
> return 0;
> diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h
> index 762a1032c37..a4d1a4c80c8 100644
> --- a/include/scmi_protocols.h
> +++ b/include/scmi_protocols.h
> @@ -807,6 +807,12 @@ struct scmi_clk_state_in {
> u32 attributes;
> };
>
> +struct scmi_clk_state_in_v2 {
> + u32 clock_id;
> + u32 attributes;
> + u32 extended_config_val;
> +};
> +
> /**
> * struct scmi_clk_state_out - Response payload for CLOCK_CONFIG_SET command
> * @status: SCMI command status
>
Reviewed-by: Maxim Kochetkov <fido_max@inbox.ru>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-11-11 13:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-04 11:19 [PATCH v4 0/2] Add compatibility for scmi clock protocol version 3.0 Kamlesh Gurudasani
2025-11-04 11:19 ` [PATCH v4 1/2] clk: scmi: fix set_parent support when CCF is not being used Kamlesh Gurudasani
2025-11-07 3:32 ` Peng Fan
2025-11-07 3:41 ` Peng Fan
2025-11-04 11:19 ` [PATCH v4 2/2] clk: scmi: add compatibility for clock version 3.0 and onwards Kamlesh Gurudasani
2025-11-07 3:39 ` Peng Fan
2025-11-11 6:34 ` Maxim Kochetkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox