diff options
author | Peng Fan <peng.fan@nxp.com> | 2025-04-28 18:37:30 +0800 |
---|---|---|
committer | Fabio Estevam <festevam@gmail.com> | 2025-05-03 16:55:32 -0300 |
commit | af2a671f78ee230dd81679b944ef02e9ffe2ec45 (patch) | |
tree | f7b5a9069bfe4101803432e709590c747ea78e9b /drivers/clk/clk_scmi.c | |
parent | ba0f560432b5c6607ece882a37fa6a6dfffc9bc7 (diff) |
clk: scmi: add the command CLOCK_PARENT_SET
This patch adds the command CLOCK_PARENT_SET that can be used to set the
parent of a clock. ARM SCMI Version 3.2 supports to change the parent of
a clock device.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'drivers/clk/clk_scmi.c')
-rw-r--r-- | drivers/clk/clk_scmi.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c index b8d40cc9653..af5e8679003 100644 --- a/drivers/clk/clk_scmi.c +++ b/drivers/clk/clk_scmi.c @@ -179,11 +179,31 @@ static int scmi_clk_probe(struct udevice *dev) return 0; } +static int scmi_clk_set_parent(struct clk *clk, struct clk *parent) +{ + struct scmi_clk_parent_set_in in = { + .clock_id = clk->id, + .parent_clk = parent->id, + }; + struct scmi_clk_parent_set_out out; + struct scmi_msg msg = SCMI_MSG_IN(SCMI_PROTOCOL_ID_CLOCK, + SCMI_CLOCK_PARENT_SET, + in, out); + int ret; + + ret = devm_scmi_process_msg(clk->dev, &msg); + if (ret < 0) + return ret; + + return scmi_to_linux_errno(out.status); +} + static const struct clk_ops scmi_clk_ops = { .enable = scmi_clk_enable, .disable = scmi_clk_disable, .get_rate = scmi_clk_get_rate, .set_rate = scmi_clk_set_rate, + .set_parent = scmi_clk_set_parent, }; U_BOOT_DRIVER(scmi_clock) = { |