1 #ifndef __MACH_IMX_CLK_H
2 #define __MACH_IMX_CLK_H
4 #include <linux/spinlock.h>
5 #include <linux/clk-provider.h>
7 extern spinlock_t imx_ccm_lock;
9 struct clk *imx_clk_pllv1(const char *name, const char *parent,
12 struct clk *imx_clk_pllv2(const char *name, const char *parent,
24 struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
25 const char *parent_name, void __iomem *base, u32 div_mask);
27 struct clk *clk_register_gate2(struct device *dev, const char *name,
28 const char *parent_name, unsigned long flags,
29 void __iomem *reg, u8 bit_idx,
30 u8 clk_gate_flags, spinlock_t *lock);
32 struct clk * imx_obtain_fixed_clock(
33 const char *name, unsigned long rate);
35 static inline struct clk *imx_clk_gate2(const char *name, const char *parent,
36 void __iomem *reg, u8 shift)
38 return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
39 shift, 0, &imx_ccm_lock);
42 struct clk *imx_clk_pfd(const char *name, const char *parent_name,
43 void __iomem *reg, u8 idx);
45 struct clk *imx_clk_busy_divider(const char *name, const char *parent_name,
46 void __iomem *reg, u8 shift, u8 width,
47 void __iomem *busy_reg, u8 busy_shift);
49 struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift,
50 u8 width, void __iomem *busy_reg, u8 busy_shift,
51 const char **parent_names, int num_parents);
53 static inline struct clk *imx_clk_fixed(const char *name, int rate)
55 return clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT, rate);
58 static inline struct clk *imx_clk_divider(const char *name, const char *parent,
59 void __iomem *reg, u8 shift, u8 width)
61 return clk_register_divider(NULL, name, parent, CLK_SET_RATE_PARENT,
62 reg, shift, width, 0, &imx_ccm_lock);
65 static inline struct clk *imx_clk_divider_flags(const char *name,
66 const char *parent, void __iomem *reg, u8 shift, u8 width,
69 return clk_register_divider(NULL, name, parent, flags,
70 reg, shift, width, 0, &imx_ccm_lock);
73 static inline struct clk *imx_clk_gate(const char *name, const char *parent,
74 void __iomem *reg, u8 shift)
76 return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
77 shift, 0, &imx_ccm_lock);
80 static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg,
81 u8 shift, u8 width, const char **parents, int num_parents)
83 return clk_register_mux(NULL, name, parents, num_parents, 0, reg, shift,
84 width, 0, &imx_ccm_lock);
87 static inline struct clk *imx_clk_mux_flags(const char *name,
88 void __iomem *reg, u8 shift, u8 width, const char **parents,
89 int num_parents, unsigned long flags)
91 return clk_register_mux(NULL, name, parents, num_parents,
92 flags, reg, shift, width, 0,
96 static inline struct clk *imx_clk_fixed_factor(const char *name,
97 const char *parent, unsigned int mult, unsigned int div)
99 return clk_register_fixed_factor(NULL, name, parent,
100 CLK_SET_RATE_PARENT, mult, div);