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 <ghennadi.procopciuc@nxp.com>
diff --git a/drivers/nxp/clk/s32cc/s32cc_clk_drv.c b/drivers/nxp/clk/s32cc/s32cc_clk_drv.c
index 5d0a304..17def01 100644
--- a/drivers/nxp/clk/s32cc/s32cc_clk_drv.c
+++ b/drivers/nxp/clk/s32cc/s32cc_clk_drv.c
@@ -958,6 +958,22 @@
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 @@
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;