feat(nxp-clk): add clock objects for CGM dividers
The CGM dividers are controllable dividers attached to a CGM mux. Its
divison factor can be controlled through the MC_CGM's registers.
Change-Id: Id2786a46c5a1d389ca32a4839c7158949aec3b0a
Signed-off-by: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
diff --git a/include/drivers/nxp/clk/s32cc/s32cc-clk-modules.h b/include/drivers/nxp/clk/s32cc/s32cc-clk-modules.h
index 50e7a0c..285aeb3 100644
--- a/include/drivers/nxp/clk/s32cc/s32cc-clk-modules.h
+++ b/include/drivers/nxp/clk/s32cc/s32cc-clk-modules.h
@@ -19,6 +19,7 @@
s32cc_pll_out_div_t,
s32cc_dfs_t,
s32cc_dfs_div_t,
+ s32cc_cgm_div_t,
s32cc_clkmux_t,
s32cc_shared_clkmux_t,
s32cc_fixed_div_t,
@@ -288,6 +289,22 @@
.block = (BLOCK), \
}
+struct s32cc_cgm_div {
+ struct s32cc_clk_obj desc;
+ struct s32cc_clk_obj *parent;
+ unsigned long freq;
+ uint32_t index;
+};
+
+#define S32CC_CGM_DIV_INIT(PARENT, INDEX) \
+{ \
+ .desc = { \
+ .type = s32cc_cgm_div_t, \
+ }, \
+ .parent = &(PARENT).desc, \
+ .index = (INDEX), \
+}
+
static inline struct s32cc_osc *s32cc_obj2osc(const struct s32cc_clk_obj *mod)
{
uintptr_t osc_addr;
@@ -400,4 +417,12 @@
return (struct s32cc_part_block_link *)blk_link;
}
+static inline struct s32cc_cgm_div *s32cc_obj2cgmdiv(const struct s32cc_clk_obj *mod)
+{
+ uintptr_t cgm_div_addr;
+
+ cgm_div_addr = ((uintptr_t)mod) - offsetof(struct s32cc_cgm_div, desc);
+ return (struct s32cc_cgm_div *)cgm_div_addr;
+}
+
#endif /* S32CC_CLK_MODULES_H */