[PATCH v3 2/2] clk: scmi: add compatibility for clock version 3.0 and onwards
    Kamlesh Gurudasani 
    kamlesh at ti.com
       
    Wed Oct  8 14:27:40 CEST 2025
    
    
  
Maxim Kochetkov <fido_max at inbox.ru> writes:
> 09.09.2025 13:18, Dhruva Gole wrote:
>> On Aug 25, 2025 at 16:49:30 +0300, Maxim Kochetkov wrote:
>>> 19.08.2025 10:33, 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.
>>>>
>>>> The SCMI server with clock version 3.0 rejects the message if
>>>> they don't have this field.
>>>>
>>>> Add support so that both SCMI server with clock version 2.0 and 3.0
>>>> can be handled.
>>>>
>>>> Signed-off-by: Kamlesh Gurudasani <kamlesh at ti.com>
>>>> ---
>>>>    drivers/clk/clk_scmi.c   | 43 ++++++++++++++++++++++++++++++-------------
>>>>    include/scmi_protocols.h |  6 ++++++
>>>>    2 files changed, 36 insertions(+), 13 deletions(-)
>>>>
>>>> diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c
>>>> index 83ea7bb4286..b33cc05685d 100644
>>>> --- a/drivers/clk/clk_scmi.c
>>>> +++ b/drivers/clk/clk_scmi.c
>>>> @@ -131,19 +131,36 @@ 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 = dev_get_priv(clk->dev);
>>>
>>> struct scmi_clock_priv *priv = dev_get_priv(clk->dev->parent);
>>>
>> 
>> Could you elaborate?
>> I think clk->dev should be fine, similar to other instances in the same
>> file. Maybe I am missing something?
>> 
>
> clk->dev points to hw clock device. It has no struct scmi_clock_priv
> stored in priv data. So we have to step up to parent device to get SCMI
> protocol device to get struct scmi_clock_priv to get protocol version
> priv->version.
Hi Maxim,
in probe function, we are making sure that priv data is available
	struct scmi_clock_priv *priv = dev_get_priv(dev);
	size_t num_clocks, i;
	int ret;
	ret = devm_scmi_of_get_channel(dev);
	if (ret)
		return ret;
	ret = scmi_generic_protocol_version(dev, SCMI_PROTOCOL_ID_CLOCK,
					    &priv->version);
Also, the code is working just fine and returns correct version with
clk->dev
Let me know if I missed something
Regards,
Kamlesh
    
    
More information about the U-Boot
mailing list