From a74cf75f084e62888f57f7718f614bcd6e5eb50f Mon Sep 17 00:00:00 2001 From: Ghennadi Procopciuc Date: Mon, 13 Jan 2025 12:00:50 +0200 Subject: [PATCH] feat(nxp-clk): add get_rate for partition objects The partition-related objects do not participate in clock rate calculation, except the s32cc_part_block_link_t, whose call is forwarded to the parent object. Change-Id: Id9e7fa49c3c1fb5b30b4c1b97fc8441bc967578a Signed-off-by: Ghennadi Procopciuc --- drivers/nxp/clk/s32cc/s32cc_clk_drv.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/nxp/clk/s32cc/s32cc_clk_drv.c b/drivers/nxp/clk/s32cc/s32cc_clk_drv.c index 5d0a304c3..17def0108 100644 --- a/drivers/nxp/clk/s32cc/s32cc_clk_drv.c +++ b/drivers/nxp/clk/s32cc/s32cc_clk_drv.c @@ -958,6 +958,22 @@ get_part_block_link_parent(const struct s32cc_clk_obj *module) return link->parent; } +static int get_part_block_link_freq(const struct s32cc_clk_obj *module, + const struct s32cc_clk_drv *drv, + unsigned long *rate, unsigned int depth) +{ + const struct s32cc_part_block_link *block = s32cc_obj2partblocklink(module); + unsigned int ldepth = depth; + int ret; + + ret = update_stack_depth(&ldepth); + if (ret != 0) { + return ret; + } + + return get_module_rate(block->parent, drv, rate, ldepth); +} + static int no_enable(struct s32cc_clk_obj *module, const struct s32cc_clk_drv *drv, unsigned int depth) @@ -1667,6 +1683,15 @@ static int get_module_rate(const struct s32cc_clk_obj *module, case s32cc_shared_clkmux_t: ret = get_mux_freq(module, drv, rate, ldepth); break; + case s32cc_part_t: + ERROR("s32cc_part_t cannot be used to get rate\n"); + break; + case s32cc_part_block_t: + ERROR("s32cc_part_block_t cannot be used to get rate\n"); + break; + case s32cc_part_block_link_t: + ret = get_part_block_link_freq(module, drv, rate, ldepth); + break; default: ret = -EINVAL; break;