18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __MACH_IMX_CLK_H
38c2ecf20Sopenharmony_ci#define __MACH_IMX_CLK_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/bits.h>
68c2ecf20Sopenharmony_ci#include <linux/spinlock.h>
78c2ecf20Sopenharmony_ci#include <linux/clk-provider.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define IMX_CLK_GATE2_SINGLE_BIT	1
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciextern spinlock_t imx_ccm_lock;
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_civoid imx_check_clocks(struct clk *clks[], unsigned int count);
148c2ecf20Sopenharmony_civoid imx_check_clk_hws(struct clk_hw *clks[], unsigned int count);
158c2ecf20Sopenharmony_ci#ifndef MODULE
168c2ecf20Sopenharmony_civoid imx_register_uart_clocks(unsigned int clk_count);
178c2ecf20Sopenharmony_ci#else
188c2ecf20Sopenharmony_cistatic inline void imx_register_uart_clocks(unsigned int clk_count)
198c2ecf20Sopenharmony_ci{
208c2ecf20Sopenharmony_ci}
218c2ecf20Sopenharmony_ci#endif
228c2ecf20Sopenharmony_civoid imx_mmdc_mask_handshake(void __iomem *ccm_base, unsigned int chn);
238c2ecf20Sopenharmony_civoid imx_unregister_clocks(struct clk *clks[], unsigned int count);
248c2ecf20Sopenharmony_civoid imx_unregister_hw_clocks(struct clk_hw *hws[], unsigned int count);
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciextern void imx_cscmr1_fixup(u32 *val);
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cienum imx_pllv1_type {
298c2ecf20Sopenharmony_ci	IMX_PLLV1_IMX1,
308c2ecf20Sopenharmony_ci	IMX_PLLV1_IMX21,
318c2ecf20Sopenharmony_ci	IMX_PLLV1_IMX25,
328c2ecf20Sopenharmony_ci	IMX_PLLV1_IMX27,
338c2ecf20Sopenharmony_ci	IMX_PLLV1_IMX31,
348c2ecf20Sopenharmony_ci	IMX_PLLV1_IMX35,
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cienum imx_sscg_pll_type {
388c2ecf20Sopenharmony_ci	SCCG_PLL1,
398c2ecf20Sopenharmony_ci	SCCG_PLL2,
408c2ecf20Sopenharmony_ci};
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cienum imx_pll14xx_type {
438c2ecf20Sopenharmony_ci	PLL_1416X,
448c2ecf20Sopenharmony_ci	PLL_1443X,
458c2ecf20Sopenharmony_ci};
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* NOTE: Rate table should be kept sorted in descending order. */
488c2ecf20Sopenharmony_cistruct imx_pll14xx_rate_table {
498c2ecf20Sopenharmony_ci	unsigned int rate;
508c2ecf20Sopenharmony_ci	unsigned int pdiv;
518c2ecf20Sopenharmony_ci	unsigned int mdiv;
528c2ecf20Sopenharmony_ci	unsigned int sdiv;
538c2ecf20Sopenharmony_ci	unsigned int kdiv;
548c2ecf20Sopenharmony_ci};
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cistruct imx_pll14xx_clk {
578c2ecf20Sopenharmony_ci	enum imx_pll14xx_type type;
588c2ecf20Sopenharmony_ci	const struct imx_pll14xx_rate_table *rate_table;
598c2ecf20Sopenharmony_ci	int rate_count;
608c2ecf20Sopenharmony_ci	int flags;
618c2ecf20Sopenharmony_ci};
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ciextern struct imx_pll14xx_clk imx_1416x_pll;
648c2ecf20Sopenharmony_ciextern struct imx_pll14xx_clk imx_1443x_pll;
658c2ecf20Sopenharmony_ciextern struct imx_pll14xx_clk imx_1443x_dram_pll;
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define imx_clk_cpu(name, parent_name, div, mux, pll, step) \
688c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_cpu(name, parent_name, div, mux, pll, step))
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#define clk_register_gate2(dev, name, parent_name, flags, reg, bit_idx, \
718c2ecf20Sopenharmony_ci				cgr_val, clk_gate_flags, lock, share_count) \
728c2ecf20Sopenharmony_ci	to_clk(clk_hw_register_gate2(dev, name, parent_name, flags, reg, bit_idx, \
738c2ecf20Sopenharmony_ci				cgr_val, clk_gate_flags, lock, share_count))
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#define imx_clk_pllv3(type, name, parent_name, base, div_mask) \
768c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_pllv3(type, name, parent_name, base, div_mask))
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#define imx_clk_pfd(name, parent_name, reg, idx) \
798c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_pfd(name, parent_name, reg, idx))
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#define imx_clk_gate_exclusive(name, parent, reg, shift, exclusive_mask) \
828c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_gate_exclusive(name, parent, reg, shift, exclusive_mask))
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#define imx_clk_fixed(name, rate) \
858c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_fixed(name, rate))
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#define imx_clk_fixed_factor(name, parent, mult, div) \
888c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_fixed_factor(name, parent, mult, div))
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#define imx_clk_divider(name, parent, reg, shift, width) \
918c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_divider(name, parent, reg, shift, width))
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#define imx_clk_divider2(name, parent, reg, shift, width) \
948c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_divider2(name, parent, reg, shift, width))
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci#define imx_clk_divider_flags(name, parent, reg, shift, width, flags) \
978c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_divider_flags(name, parent, reg, shift, width, flags))
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci#define imx_clk_gate(name, parent, reg, shift) \
1008c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_gate(name, parent, reg, shift))
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci#define imx_clk_gate_dis(name, parent, reg, shift) \
1038c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_gate_dis(name, parent, reg, shift))
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci#define imx_clk_gate2(name, parent, reg, shift) \
1068c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_gate2(name, parent, reg, shift))
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci#define imx_clk_gate2_flags(name, parent, reg, shift, flags) \
1098c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_gate2_flags(name, parent, reg, shift, flags))
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci#define imx_clk_gate2_shared2(name, parent, reg, shift, share_count) \
1128c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_gate2_shared2(name, parent, reg, shift, share_count))
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci#define imx_clk_gate3(name, parent, reg, shift) \
1158c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_gate3(name, parent, reg, shift))
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci#define imx_clk_gate4(name, parent, reg, shift) \
1188c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_gate4(name, parent, reg, shift))
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci#define imx_clk_mux(name, reg, shift, width, parents, num_parents) \
1218c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_mux(name, reg, shift, width, parents, num_parents))
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci#define imx_clk_pllv1(type, name, parent, base) \
1248c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_pllv1(type, name, parent, base))
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci#define imx_clk_pllv2(name, parent, base) \
1278c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_pllv2(name, parent, base))
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci#define imx_clk_frac_pll(name, parent_name, base) \
1308c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_frac_pll(name, parent_name, base))
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci#define imx_clk_sscg_pll(name, parent_names, num_parents, parent,\
1338c2ecf20Sopenharmony_ci				bypass1, bypass2, base, flags) \
1348c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_sscg_pll(name, parent_names, num_parents, parent,\
1358c2ecf20Sopenharmony_ci				bypass1, bypass2, base, flags))
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_cistruct clk *imx_clk_pll14xx(const char *name, const char *parent_name,
1388c2ecf20Sopenharmony_ci		 void __iomem *base, const struct imx_pll14xx_clk *pll_clk);
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci#define imx_clk_pll14xx(name, parent_name, base, pll_clk) \
1418c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_pll14xx(name, parent_name, base, pll_clk))
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_cistruct clk_hw *imx_dev_clk_hw_pll14xx(struct device *dev, const char *name,
1448c2ecf20Sopenharmony_ci				const char *parent_name, void __iomem *base,
1458c2ecf20Sopenharmony_ci				const struct imx_pll14xx_clk *pll_clk);
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_pllv1(enum imx_pllv1_type type, const char *name,
1488c2ecf20Sopenharmony_ci		const char *parent, void __iomem *base);
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_pllv2(const char *name, const char *parent,
1518c2ecf20Sopenharmony_ci		void __iomem *base);
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_frac_pll(const char *name, const char *parent_name,
1548c2ecf20Sopenharmony_ci			     void __iomem *base);
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_sscg_pll(const char *name,
1578c2ecf20Sopenharmony_ci				const char * const *parent_names,
1588c2ecf20Sopenharmony_ci				u8 num_parents,
1598c2ecf20Sopenharmony_ci				u8 parent, u8 bypass1, u8 bypass2,
1608c2ecf20Sopenharmony_ci				void __iomem *base,
1618c2ecf20Sopenharmony_ci				unsigned long flags);
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_cienum imx_pllv3_type {
1648c2ecf20Sopenharmony_ci	IMX_PLLV3_GENERIC,
1658c2ecf20Sopenharmony_ci	IMX_PLLV3_SYS,
1668c2ecf20Sopenharmony_ci	IMX_PLLV3_USB,
1678c2ecf20Sopenharmony_ci	IMX_PLLV3_USB_VF610,
1688c2ecf20Sopenharmony_ci	IMX_PLLV3_AV,
1698c2ecf20Sopenharmony_ci	IMX_PLLV3_ENET,
1708c2ecf20Sopenharmony_ci	IMX_PLLV3_ENET_IMX7,
1718c2ecf20Sopenharmony_ci	IMX_PLLV3_SYS_VF610,
1728c2ecf20Sopenharmony_ci	IMX_PLLV3_DDR_IMX7,
1738c2ecf20Sopenharmony_ci	IMX_PLLV3_AV_IMX7,
1748c2ecf20Sopenharmony_ci};
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_pllv3(enum imx_pllv3_type type, const char *name,
1778c2ecf20Sopenharmony_ci		const char *parent_name, void __iomem *base, u32 div_mask);
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci#define PLL_1416X_RATE(_rate, _m, _p, _s)		\
1808c2ecf20Sopenharmony_ci	{						\
1818c2ecf20Sopenharmony_ci		.rate	=	(_rate),		\
1828c2ecf20Sopenharmony_ci		.mdiv	=	(_m),			\
1838c2ecf20Sopenharmony_ci		.pdiv	=	(_p),			\
1848c2ecf20Sopenharmony_ci		.sdiv	=	(_s),			\
1858c2ecf20Sopenharmony_ci	}
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci#define PLL_1443X_RATE(_rate, _m, _p, _s, _k)		\
1888c2ecf20Sopenharmony_ci	{						\
1898c2ecf20Sopenharmony_ci		.rate	=	(_rate),		\
1908c2ecf20Sopenharmony_ci		.mdiv	=	(_m),			\
1918c2ecf20Sopenharmony_ci		.pdiv	=	(_p),			\
1928c2ecf20Sopenharmony_ci		.sdiv	=	(_s),			\
1938c2ecf20Sopenharmony_ci		.kdiv	=	(_k),			\
1948c2ecf20Sopenharmony_ci	}
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_pllv4(const char *name, const char *parent_name,
1978c2ecf20Sopenharmony_ci			     void __iomem *base);
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_cistruct clk_hw *clk_hw_register_gate2(struct device *dev, const char *name,
2008c2ecf20Sopenharmony_ci		const char *parent_name, unsigned long flags,
2018c2ecf20Sopenharmony_ci		void __iomem *reg, u8 bit_idx, u8 cgr_val,
2028c2ecf20Sopenharmony_ci		u8 clk_gate_flags, spinlock_t *lock,
2038c2ecf20Sopenharmony_ci		unsigned int *share_count);
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_cistruct clk * imx_obtain_fixed_clock(
2068c2ecf20Sopenharmony_ci			const char *name, unsigned long rate);
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_cistruct clk_hw *imx_obtain_fixed_clock_hw(
2098c2ecf20Sopenharmony_ci			const char *name, unsigned long rate);
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_cistruct clk_hw *imx_obtain_fixed_clk_hw(struct device_node *np,
2128c2ecf20Sopenharmony_ci				       const char *name);
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_gate_exclusive(const char *name, const char *parent,
2158c2ecf20Sopenharmony_ci	 void __iomem *reg, u8 shift, u32 exclusive_mask);
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_pfd(const char *name, const char *parent_name,
2188c2ecf20Sopenharmony_ci		void __iomem *reg, u8 idx);
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_pfdv2(const char *name, const char *parent_name,
2218c2ecf20Sopenharmony_ci			     void __iomem *reg, u8 idx);
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_busy_divider(const char *name, const char *parent_name,
2248c2ecf20Sopenharmony_ci				 void __iomem *reg, u8 shift, u8 width,
2258c2ecf20Sopenharmony_ci				 void __iomem *busy_reg, u8 busy_shift);
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_busy_mux(const char *name, void __iomem *reg, u8 shift,
2288c2ecf20Sopenharmony_ci			     u8 width, void __iomem *busy_reg, u8 busy_shift,
2298c2ecf20Sopenharmony_ci			     const char * const *parent_names, int num_parents);
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_cistruct clk_hw *imx7ulp_clk_hw_composite(const char *name,
2328c2ecf20Sopenharmony_ci				     const char * const *parent_names,
2338c2ecf20Sopenharmony_ci				     int num_parents, bool mux_present,
2348c2ecf20Sopenharmony_ci				     bool rate_present, bool gate_present,
2358c2ecf20Sopenharmony_ci				     void __iomem *reg);
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_fixup_divider(const char *name, const char *parent,
2388c2ecf20Sopenharmony_ci				  void __iomem *reg, u8 shift, u8 width,
2398c2ecf20Sopenharmony_ci				  void (*fixup)(u32 *val));
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_fixup_mux(const char *name, void __iomem *reg,
2428c2ecf20Sopenharmony_ci			      u8 shift, u8 width, const char * const *parents,
2438c2ecf20Sopenharmony_ci			      int num_parents, void (*fixup)(u32 *val));
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_cistatic inline struct clk *to_clk(struct clk_hw *hw)
2468c2ecf20Sopenharmony_ci{
2478c2ecf20Sopenharmony_ci	if (IS_ERR_OR_NULL(hw))
2488c2ecf20Sopenharmony_ci		return ERR_CAST(hw);
2498c2ecf20Sopenharmony_ci	return hw->clk;
2508c2ecf20Sopenharmony_ci}
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_pll14xx(const char *name, const char *parent_name,
2538c2ecf20Sopenharmony_ci				  void __iomem *base,
2548c2ecf20Sopenharmony_ci				  const struct imx_pll14xx_clk *pll_clk)
2558c2ecf20Sopenharmony_ci{
2568c2ecf20Sopenharmony_ci	return imx_dev_clk_hw_pll14xx(NULL, name, parent_name, base, pll_clk);
2578c2ecf20Sopenharmony_ci}
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_fixed(const char *name, int rate)
2608c2ecf20Sopenharmony_ci{
2618c2ecf20Sopenharmony_ci	return clk_hw_register_fixed_rate(NULL, name, NULL, 0, rate);
2628c2ecf20Sopenharmony_ci}
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_mux_ldb(const char *name, void __iomem *reg,
2658c2ecf20Sopenharmony_ci			u8 shift, u8 width, const char * const *parents,
2668c2ecf20Sopenharmony_ci			int num_parents)
2678c2ecf20Sopenharmony_ci{
2688c2ecf20Sopenharmony_ci	return clk_hw_register_mux(NULL, name, parents, num_parents,
2698c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT, reg,
2708c2ecf20Sopenharmony_ci			shift, width, CLK_MUX_READ_ONLY, &imx_ccm_lock);
2718c2ecf20Sopenharmony_ci}
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_fixed_factor(const char *name,
2748c2ecf20Sopenharmony_ci		const char *parent, unsigned int mult, unsigned int div)
2758c2ecf20Sopenharmony_ci{
2768c2ecf20Sopenharmony_ci	return clk_hw_register_fixed_factor(NULL, name, parent,
2778c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT, mult, div);
2788c2ecf20Sopenharmony_ci}
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_divider(const char *name,
2818c2ecf20Sopenharmony_ci						const char *parent,
2828c2ecf20Sopenharmony_ci						void __iomem *reg, u8 shift,
2838c2ecf20Sopenharmony_ci						u8 width)
2848c2ecf20Sopenharmony_ci{
2858c2ecf20Sopenharmony_ci	return clk_hw_register_divider(NULL, name, parent, CLK_SET_RATE_PARENT,
2868c2ecf20Sopenharmony_ci				       reg, shift, width, 0, &imx_ccm_lock);
2878c2ecf20Sopenharmony_ci}
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_divider_flags(const char *name,
2908c2ecf20Sopenharmony_ci						   const char *parent,
2918c2ecf20Sopenharmony_ci						   void __iomem *reg, u8 shift,
2928c2ecf20Sopenharmony_ci						   u8 width, unsigned long flags)
2938c2ecf20Sopenharmony_ci{
2948c2ecf20Sopenharmony_ci	return clk_hw_register_divider(NULL, name, parent, flags,
2958c2ecf20Sopenharmony_ci				       reg, shift, width, 0, &imx_ccm_lock);
2968c2ecf20Sopenharmony_ci}
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_divider2(const char *name, const char *parent,
2998c2ecf20Sopenharmony_ci		void __iomem *reg, u8 shift, u8 width)
3008c2ecf20Sopenharmony_ci{
3018c2ecf20Sopenharmony_ci	return clk_hw_register_divider(NULL, name, parent,
3028c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
3038c2ecf20Sopenharmony_ci			reg, shift, width, 0, &imx_ccm_lock);
3048c2ecf20Sopenharmony_ci}
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_cistatic inline struct clk *imx_clk_divider2_flags(const char *name,
3078c2ecf20Sopenharmony_ci		const char *parent, void __iomem *reg, u8 shift, u8 width,
3088c2ecf20Sopenharmony_ci		unsigned long flags)
3098c2ecf20Sopenharmony_ci{
3108c2ecf20Sopenharmony_ci	return clk_register_divider(NULL, name, parent,
3118c2ecf20Sopenharmony_ci			flags | CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
3128c2ecf20Sopenharmony_ci			reg, shift, width, 0, &imx_ccm_lock);
3138c2ecf20Sopenharmony_ci}
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_gate_flags(const char *name, const char *parent,
3168c2ecf20Sopenharmony_ci		void __iomem *reg, u8 shift, unsigned long flags)
3178c2ecf20Sopenharmony_ci{
3188c2ecf20Sopenharmony_ci	return clk_hw_register_gate(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg,
3198c2ecf20Sopenharmony_ci			shift, 0, &imx_ccm_lock);
3208c2ecf20Sopenharmony_ci}
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_gate(const char *name, const char *parent,
3238c2ecf20Sopenharmony_ci					     void __iomem *reg, u8 shift)
3248c2ecf20Sopenharmony_ci{
3258c2ecf20Sopenharmony_ci	return clk_hw_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
3268c2ecf20Sopenharmony_ci				    shift, 0, &imx_ccm_lock);
3278c2ecf20Sopenharmony_ci}
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_dev_clk_hw_gate(struct device *dev, const char *name,
3308c2ecf20Sopenharmony_ci						const char *parent, void __iomem *reg, u8 shift)
3318c2ecf20Sopenharmony_ci{
3328c2ecf20Sopenharmony_ci	return clk_hw_register_gate(dev, name, parent, CLK_SET_RATE_PARENT, reg,
3338c2ecf20Sopenharmony_ci				    shift, 0, &imx_ccm_lock);
3348c2ecf20Sopenharmony_ci}
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_gate_dis(const char *name, const char *parent,
3378c2ecf20Sopenharmony_ci		void __iomem *reg, u8 shift)
3388c2ecf20Sopenharmony_ci{
3398c2ecf20Sopenharmony_ci	return clk_hw_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
3408c2ecf20Sopenharmony_ci			shift, CLK_GATE_SET_TO_DISABLE, &imx_ccm_lock);
3418c2ecf20Sopenharmony_ci}
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_gate_dis_flags(const char *name, const char *parent,
3448c2ecf20Sopenharmony_ci		void __iomem *reg, u8 shift, unsigned long flags)
3458c2ecf20Sopenharmony_ci{
3468c2ecf20Sopenharmony_ci	return clk_hw_register_gate(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg,
3478c2ecf20Sopenharmony_ci			shift, CLK_GATE_SET_TO_DISABLE, &imx_ccm_lock);
3488c2ecf20Sopenharmony_ci}
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_gate2(const char *name, const char *parent,
3518c2ecf20Sopenharmony_ci		void __iomem *reg, u8 shift)
3528c2ecf20Sopenharmony_ci{
3538c2ecf20Sopenharmony_ci	return clk_hw_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
3548c2ecf20Sopenharmony_ci			shift, 0x3, 0, &imx_ccm_lock, NULL);
3558c2ecf20Sopenharmony_ci}
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_gate2_flags(const char *name, const char *parent,
3588c2ecf20Sopenharmony_ci		void __iomem *reg, u8 shift, unsigned long flags)
3598c2ecf20Sopenharmony_ci{
3608c2ecf20Sopenharmony_ci	return clk_hw_register_gate2(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg,
3618c2ecf20Sopenharmony_ci			shift, 0x3, 0, &imx_ccm_lock, NULL);
3628c2ecf20Sopenharmony_ci}
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_gate2_shared(const char *name,
3658c2ecf20Sopenharmony_ci		const char *parent, void __iomem *reg, u8 shift,
3668c2ecf20Sopenharmony_ci		unsigned int *share_count)
3678c2ecf20Sopenharmony_ci{
3688c2ecf20Sopenharmony_ci	return clk_hw_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
3698c2ecf20Sopenharmony_ci			shift, 0x3, 0, &imx_ccm_lock, share_count);
3708c2ecf20Sopenharmony_ci}
3718c2ecf20Sopenharmony_ci
3728c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_gate2_shared2(const char *name,
3738c2ecf20Sopenharmony_ci		const char *parent, void __iomem *reg, u8 shift,
3748c2ecf20Sopenharmony_ci		unsigned int *share_count)
3758c2ecf20Sopenharmony_ci{
3768c2ecf20Sopenharmony_ci	return clk_hw_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT |
3778c2ecf20Sopenharmony_ci				  CLK_OPS_PARENT_ENABLE, reg, shift, 0x3, 0,
3788c2ecf20Sopenharmony_ci				  &imx_ccm_lock, share_count);
3798c2ecf20Sopenharmony_ci}
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_dev_clk_hw_gate_shared(struct device *dev,
3828c2ecf20Sopenharmony_ci				const char *name, const char *parent,
3838c2ecf20Sopenharmony_ci				void __iomem *reg, u8 shift,
3848c2ecf20Sopenharmony_ci				unsigned int *share_count)
3858c2ecf20Sopenharmony_ci{
3868c2ecf20Sopenharmony_ci	return clk_hw_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT |
3878c2ecf20Sopenharmony_ci					CLK_OPS_PARENT_ENABLE, reg, shift, 0x3,
3888c2ecf20Sopenharmony_ci					IMX_CLK_GATE2_SINGLE_BIT,
3898c2ecf20Sopenharmony_ci					&imx_ccm_lock, share_count);
3908c2ecf20Sopenharmony_ci}
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_cistatic inline struct clk *imx_clk_gate2_cgr(const char *name,
3938c2ecf20Sopenharmony_ci		const char *parent, void __iomem *reg, u8 shift, u8 cgr_val)
3948c2ecf20Sopenharmony_ci{
3958c2ecf20Sopenharmony_ci	return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
3968c2ecf20Sopenharmony_ci			shift, cgr_val, 0, &imx_ccm_lock, NULL);
3978c2ecf20Sopenharmony_ci}
3988c2ecf20Sopenharmony_ci
3998c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_gate3(const char *name, const char *parent,
4008c2ecf20Sopenharmony_ci		void __iomem *reg, u8 shift)
4018c2ecf20Sopenharmony_ci{
4028c2ecf20Sopenharmony_ci	return clk_hw_register_gate(NULL, name, parent,
4038c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
4048c2ecf20Sopenharmony_ci			reg, shift, 0, &imx_ccm_lock);
4058c2ecf20Sopenharmony_ci}
4068c2ecf20Sopenharmony_ci
4078c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_gate3_flags(const char *name,
4088c2ecf20Sopenharmony_ci		const char *parent, void __iomem *reg, u8 shift,
4098c2ecf20Sopenharmony_ci		unsigned long flags)
4108c2ecf20Sopenharmony_ci{
4118c2ecf20Sopenharmony_ci	return clk_hw_register_gate(NULL, name, parent,
4128c2ecf20Sopenharmony_ci			flags | CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
4138c2ecf20Sopenharmony_ci			reg, shift, 0, &imx_ccm_lock);
4148c2ecf20Sopenharmony_ci}
4158c2ecf20Sopenharmony_ci
4168c2ecf20Sopenharmony_ci#define imx_clk_gate3_flags(name, parent, reg, shift, flags) \
4178c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_gate3_flags(name, parent, reg, shift, flags))
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_gate4(const char *name, const char *parent,
4208c2ecf20Sopenharmony_ci		void __iomem *reg, u8 shift)
4218c2ecf20Sopenharmony_ci{
4228c2ecf20Sopenharmony_ci	return clk_hw_register_gate2(NULL, name, parent,
4238c2ecf20Sopenharmony_ci			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
4248c2ecf20Sopenharmony_ci			reg, shift, 0x3, 0, &imx_ccm_lock, NULL);
4258c2ecf20Sopenharmony_ci}
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_gate4_flags(const char *name,
4288c2ecf20Sopenharmony_ci		const char *parent, void __iomem *reg, u8 shift,
4298c2ecf20Sopenharmony_ci		unsigned long flags)
4308c2ecf20Sopenharmony_ci{
4318c2ecf20Sopenharmony_ci	return clk_hw_register_gate2(NULL, name, parent,
4328c2ecf20Sopenharmony_ci			flags | CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
4338c2ecf20Sopenharmony_ci			reg, shift, 0x3, 0, &imx_ccm_lock, NULL);
4348c2ecf20Sopenharmony_ci}
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci#define imx_clk_gate4_flags(name, parent, reg, shift, flags) \
4378c2ecf20Sopenharmony_ci	to_clk(imx_clk_hw_gate4_flags(name, parent, reg, shift, flags))
4388c2ecf20Sopenharmony_ci
4398c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_mux(const char *name, void __iomem *reg,
4408c2ecf20Sopenharmony_ci			u8 shift, u8 width, const char * const *parents,
4418c2ecf20Sopenharmony_ci			int num_parents)
4428c2ecf20Sopenharmony_ci{
4438c2ecf20Sopenharmony_ci	return clk_hw_register_mux(NULL, name, parents, num_parents,
4448c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT, reg, shift,
4458c2ecf20Sopenharmony_ci			width, 0, &imx_ccm_lock);
4468c2ecf20Sopenharmony_ci}
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_dev_clk_hw_mux(struct device *dev,
4498c2ecf20Sopenharmony_ci			const char *name, void __iomem *reg, u8 shift,
4508c2ecf20Sopenharmony_ci			u8 width, const char * const *parents, int num_parents)
4518c2ecf20Sopenharmony_ci{
4528c2ecf20Sopenharmony_ci	return clk_hw_register_mux(dev, name, parents, num_parents,
4538c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT | CLK_SET_PARENT_GATE,
4548c2ecf20Sopenharmony_ci			reg, shift, width, 0, &imx_ccm_lock);
4558c2ecf20Sopenharmony_ci}
4568c2ecf20Sopenharmony_ci
4578c2ecf20Sopenharmony_cistatic inline struct clk *imx_clk_mux2(const char *name, void __iomem *reg,
4588c2ecf20Sopenharmony_ci			u8 shift, u8 width, const char * const *parents,
4598c2ecf20Sopenharmony_ci			int num_parents)
4608c2ecf20Sopenharmony_ci{
4618c2ecf20Sopenharmony_ci	return clk_register_mux(NULL, name, parents, num_parents,
4628c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE,
4638c2ecf20Sopenharmony_ci			reg, shift, width, 0, &imx_ccm_lock);
4648c2ecf20Sopenharmony_ci}
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_mux2(const char *name, void __iomem *reg,
4678c2ecf20Sopenharmony_ci					     u8 shift, u8 width,
4688c2ecf20Sopenharmony_ci					     const char * const *parents,
4698c2ecf20Sopenharmony_ci					     int num_parents)
4708c2ecf20Sopenharmony_ci{
4718c2ecf20Sopenharmony_ci	return clk_hw_register_mux(NULL, name, parents, num_parents,
4728c2ecf20Sopenharmony_ci				   CLK_SET_RATE_NO_REPARENT |
4738c2ecf20Sopenharmony_ci				   CLK_OPS_PARENT_ENABLE,
4748c2ecf20Sopenharmony_ci				   reg, shift, width, 0, &imx_ccm_lock);
4758c2ecf20Sopenharmony_ci}
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_cistatic inline struct clk *imx_clk_mux_flags(const char *name,
4788c2ecf20Sopenharmony_ci			void __iomem *reg, u8 shift, u8 width,
4798c2ecf20Sopenharmony_ci			const char * const *parents, int num_parents,
4808c2ecf20Sopenharmony_ci			unsigned long flags)
4818c2ecf20Sopenharmony_ci{
4828c2ecf20Sopenharmony_ci	return clk_register_mux(NULL, name, parents, num_parents,
4838c2ecf20Sopenharmony_ci			flags | CLK_SET_RATE_NO_REPARENT, reg, shift, width, 0,
4848c2ecf20Sopenharmony_ci			&imx_ccm_lock);
4858c2ecf20Sopenharmony_ci}
4868c2ecf20Sopenharmony_ci
4878c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_mux2_flags(const char *name,
4888c2ecf20Sopenharmony_ci		void __iomem *reg, u8 shift, u8 width,
4898c2ecf20Sopenharmony_ci		const char * const *parents,
4908c2ecf20Sopenharmony_ci		int num_parents, unsigned long flags)
4918c2ecf20Sopenharmony_ci{
4928c2ecf20Sopenharmony_ci	return clk_hw_register_mux(NULL, name, parents, num_parents,
4938c2ecf20Sopenharmony_ci			flags | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE,
4948c2ecf20Sopenharmony_ci			reg, shift, width, 0, &imx_ccm_lock);
4958c2ecf20Sopenharmony_ci}
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_cistatic inline struct clk *imx_clk_mux2_flags(const char *name,
4988c2ecf20Sopenharmony_ci		void __iomem *reg, u8 shift, u8 width,
4998c2ecf20Sopenharmony_ci		const char * const *parents,
5008c2ecf20Sopenharmony_ci		int num_parents, unsigned long flags)
5018c2ecf20Sopenharmony_ci{
5028c2ecf20Sopenharmony_ci	return clk_register_mux(NULL, name, parents, num_parents,
5038c2ecf20Sopenharmony_ci			flags | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE,
5048c2ecf20Sopenharmony_ci			reg, shift, width, 0, &imx_ccm_lock);
5058c2ecf20Sopenharmony_ci}
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_clk_hw_mux_flags(const char *name,
5088c2ecf20Sopenharmony_ci						  void __iomem *reg, u8 shift,
5098c2ecf20Sopenharmony_ci						  u8 width,
5108c2ecf20Sopenharmony_ci						  const char * const *parents,
5118c2ecf20Sopenharmony_ci						  int num_parents,
5128c2ecf20Sopenharmony_ci						  unsigned long flags)
5138c2ecf20Sopenharmony_ci{
5148c2ecf20Sopenharmony_ci	return clk_hw_register_mux(NULL, name, parents, num_parents,
5158c2ecf20Sopenharmony_ci				   flags | CLK_SET_RATE_NO_REPARENT,
5168c2ecf20Sopenharmony_ci				   reg, shift, width, 0, &imx_ccm_lock);
5178c2ecf20Sopenharmony_ci}
5188c2ecf20Sopenharmony_ci
5198c2ecf20Sopenharmony_cistatic inline struct clk_hw *imx_dev_clk_hw_mux_flags(struct device *dev,
5208c2ecf20Sopenharmony_ci						  const char *name,
5218c2ecf20Sopenharmony_ci						  void __iomem *reg, u8 shift,
5228c2ecf20Sopenharmony_ci						  u8 width,
5238c2ecf20Sopenharmony_ci						  const char * const *parents,
5248c2ecf20Sopenharmony_ci						  int num_parents,
5258c2ecf20Sopenharmony_ci						  unsigned long flags)
5268c2ecf20Sopenharmony_ci{
5278c2ecf20Sopenharmony_ci	return clk_hw_register_mux(dev, name, parents, num_parents,
5288c2ecf20Sopenharmony_ci				   flags | CLK_SET_RATE_NO_REPARENT,
5298c2ecf20Sopenharmony_ci				   reg, shift, width, 0, &imx_ccm_lock);
5308c2ecf20Sopenharmony_ci}
5318c2ecf20Sopenharmony_ci
5328c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_cpu(const char *name, const char *parent_name,
5338c2ecf20Sopenharmony_ci		struct clk *div, struct clk *mux, struct clk *pll,
5348c2ecf20Sopenharmony_ci		struct clk *step);
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_ci#define IMX_COMPOSITE_CORE		BIT(0)
5378c2ecf20Sopenharmony_ci#define IMX_COMPOSITE_BUS		BIT(1)
5388c2ecf20Sopenharmony_ci#define IMX_COMPOSITE_FW_MANAGED	BIT(2)
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_cistruct clk_hw *imx8m_clk_hw_composite_flags(const char *name,
5418c2ecf20Sopenharmony_ci					    const char * const *parent_names,
5428c2ecf20Sopenharmony_ci					    int num_parents,
5438c2ecf20Sopenharmony_ci					    void __iomem *reg,
5448c2ecf20Sopenharmony_ci					    u32 composite_flags,
5458c2ecf20Sopenharmony_ci					    unsigned long flags);
5468c2ecf20Sopenharmony_ci
5478c2ecf20Sopenharmony_ci#define imx8m_clk_hw_composite_bus(name, parent_names, reg)	\
5488c2ecf20Sopenharmony_ci	imx8m_clk_hw_composite_flags(name, parent_names, \
5498c2ecf20Sopenharmony_ci			ARRAY_SIZE(parent_names), reg, \
5508c2ecf20Sopenharmony_ci			IMX_COMPOSITE_BUS, \
5518c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE)
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_ci#define imx8m_clk_hw_composite_bus_critical(name, parent_names, reg)	\
5548c2ecf20Sopenharmony_ci	imx8m_clk_hw_composite_flags(name, parent_names, ARRAY_SIZE(parent_names), reg, \
5558c2ecf20Sopenharmony_ci			IMX_COMPOSITE_BUS, \
5568c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE | CLK_IS_CRITICAL)
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ci#define imx8m_clk_hw_composite_core(name, parent_names, reg)	\
5598c2ecf20Sopenharmony_ci	imx8m_clk_hw_composite_flags(name, parent_names, \
5608c2ecf20Sopenharmony_ci			ARRAY_SIZE(parent_names), reg, \
5618c2ecf20Sopenharmony_ci			IMX_COMPOSITE_CORE, \
5628c2ecf20Sopenharmony_ci			CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE)
5638c2ecf20Sopenharmony_ci
5648c2ecf20Sopenharmony_ci#define imx8m_clk_composite_flags(name, parent_names, num_parents, reg, \
5658c2ecf20Sopenharmony_ci				  flags) \
5668c2ecf20Sopenharmony_ci	to_clk(imx8m_clk_hw_composite_flags(name, parent_names, \
5678c2ecf20Sopenharmony_ci				num_parents, reg, 0, flags))
5688c2ecf20Sopenharmony_ci
5698c2ecf20Sopenharmony_ci#define __imx8m_clk_hw_composite(name, parent_names, reg, flags) \
5708c2ecf20Sopenharmony_ci	imx8m_clk_hw_composite_flags(name, parent_names, \
5718c2ecf20Sopenharmony_ci		ARRAY_SIZE(parent_names), reg, 0, \
5728c2ecf20Sopenharmony_ci		flags | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE)
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_ci#define __imx8m_clk_hw_fw_managed_composite(name, parent_names, reg, flags) \
5758c2ecf20Sopenharmony_ci	imx8m_clk_hw_composite_flags(name, parent_names, \
5768c2ecf20Sopenharmony_ci		ARRAY_SIZE(parent_names), reg, IMX_COMPOSITE_FW_MANAGED, \
5778c2ecf20Sopenharmony_ci		flags | CLK_GET_RATE_NOCACHE | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE)
5788c2ecf20Sopenharmony_ci
5798c2ecf20Sopenharmony_ci#define imx8m_clk_hw_fw_managed_composite(name, parent_names, reg) \
5808c2ecf20Sopenharmony_ci	__imx8m_clk_hw_fw_managed_composite(name, parent_names, reg, 0)
5818c2ecf20Sopenharmony_ci
5828c2ecf20Sopenharmony_ci#define imx8m_clk_hw_fw_managed_composite_critical(name, parent_names, reg) \
5838c2ecf20Sopenharmony_ci	__imx8m_clk_hw_fw_managed_composite(name, parent_names, reg, CLK_IS_CRITICAL)
5848c2ecf20Sopenharmony_ci
5858c2ecf20Sopenharmony_ci#define __imx8m_clk_composite(name, parent_names, reg, flags) \
5868c2ecf20Sopenharmony_ci	to_clk(__imx8m_clk_hw_composite(name, parent_names, reg, flags))
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ci#define imx8m_clk_hw_composite(name, parent_names, reg) \
5898c2ecf20Sopenharmony_ci	__imx8m_clk_hw_composite(name, parent_names, reg, 0)
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci#define imx8m_clk_composite(name, parent_names, reg) \
5928c2ecf20Sopenharmony_ci	__imx8m_clk_composite(name, parent_names, reg, 0)
5938c2ecf20Sopenharmony_ci
5948c2ecf20Sopenharmony_ci#define imx8m_clk_hw_composite_critical(name, parent_names, reg) \
5958c2ecf20Sopenharmony_ci	__imx8m_clk_hw_composite(name, parent_names, reg, CLK_IS_CRITICAL)
5968c2ecf20Sopenharmony_ci
5978c2ecf20Sopenharmony_ci#define imx8m_clk_composite_critical(name, parent_names, reg) \
5988c2ecf20Sopenharmony_ci	__imx8m_clk_composite(name, parent_names, reg, CLK_IS_CRITICAL)
5998c2ecf20Sopenharmony_ci
6008c2ecf20Sopenharmony_cistruct clk_hw *imx_clk_hw_divider_gate(const char *name, const char *parent_name,
6018c2ecf20Sopenharmony_ci		unsigned long flags, void __iomem *reg, u8 shift, u8 width,
6028c2ecf20Sopenharmony_ci		u8 clk_divider_flags, const struct clk_div_table *table,
6038c2ecf20Sopenharmony_ci		spinlock_t *lock);
6048c2ecf20Sopenharmony_ci#endif
605