From 8501b1fc60e3f6d01a38a3055dc0f274ecb039c6 Mon Sep 17 00:00:00 2001 From: Ghennadi Procopciuc Date: Tue, 28 Jan 2025 11:52:11 +0200 Subject: [PATCH] feat(nxp-clk): set the rate for partition objects Only the partition block link can set the frequency, while the other two should not be able to because none of them participate in the clock generation. In the first case, the request will be propagated to the parent object of the partition link. Change-Id: Ic237972008eb51c62e92f03f657698a8a1ca4b0e Signed-off-by: Ghennadi Procopciuc --- drivers/nxp/clk/s32cc/s32cc_clk_drv.c | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/nxp/clk/s32cc/s32cc_clk_drv.c b/drivers/nxp/clk/s32cc/s32cc_clk_drv.c index cfbf2fb24..871c8e657 100644 --- a/drivers/nxp/clk/s32cc/s32cc_clk_drv.c +++ b/drivers/nxp/clk/s32cc/s32cc_clk_drv.c @@ -1708,6 +1708,28 @@ static int get_dfs_div_freq(const struct s32cc_clk_obj *module, return 0; } +static int set_part_block_link_freq(const struct s32cc_clk_obj *module, + unsigned long rate, unsigned long *orate, + const unsigned int *depth) +{ + const struct s32cc_part_block_link *link = s32cc_obj2partblocklink(module); + const struct s32cc_clk_obj *parent = link->parent; + unsigned int ldepth = *depth; + int ret; + + ret = update_stack_depth(&ldepth); + if (ret != 0) { + return ret; + } + + if (parent == NULL) { + ERROR("Partition block link with no parent\n"); + return -EINVAL; + } + + return set_module_rate(parent, rate, orate, &ldepth); +} + static int set_module_rate(const struct s32cc_clk_obj *module, unsigned long rate, unsigned long *orate, unsigned int *depth) @@ -1749,6 +1771,15 @@ static int set_module_rate(const struct s32cc_clk_obj *module, case s32cc_dfs_div_t: ret = set_dfs_div_freq(module, rate, orate, depth); break; + case s32cc_part_block_link_t: + ret = set_part_block_link_freq(module, rate, orate, depth); + break; + case s32cc_part_t: + ERROR("It's not allowed to set the frequency of a partition !"); + break; + case s32cc_part_block_t: + ERROR("It's not allowed to set the frequency of a partition block !"); + break; default: break; }