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 extern void imx_cscmr1_fixup(u32
*val
);
11 struct clk
*imx_clk_pllv1(const char *name
, const char *parent
,
14 struct clk
*imx_clk_pllv2(const char *name
, const char *parent
,
25 struct clk
*imx_clk_pllv3(enum imx_pllv3_type type
, const char *name
,
26 const char *parent_name
, void __iomem
*base
, u32 div_mask
);
28 struct clk
*clk_register_gate2(struct device
*dev
, const char *name
,
29 const char *parent_name
, unsigned long flags
,
30 void __iomem
*reg
, u8 bit_idx
,
31 u8 clk_gate_flags
, spinlock_t
*lock
);
33 struct clk
* imx_obtain_fixed_clock(
34 const char *name
, unsigned long rate
);
36 static inline struct clk
*imx_clk_gate2(const char *name
, const char *parent
,
37 void __iomem
*reg
, u8 shift
)
39 return clk_register_gate2(NULL
, name
, parent
, CLK_SET_RATE_PARENT
, reg
,
40 shift
, 0, &imx_ccm_lock
);
43 struct clk
*imx_clk_pfd(const char *name
, const char *parent_name
,
44 void __iomem
*reg
, u8 idx
);
46 struct clk
*imx_clk_busy_divider(const char *name
, const char *parent_name
,
47 void __iomem
*reg
, u8 shift
, u8 width
,
48 void __iomem
*busy_reg
, u8 busy_shift
);
50 struct clk
*imx_clk_busy_mux(const char *name
, void __iomem
*reg
, u8 shift
,
51 u8 width
, void __iomem
*busy_reg
, u8 busy_shift
,
52 const char **parent_names
, int num_parents
);
54 struct clk
*imx_clk_fixup_divider(const char *name
, const char *parent
,
55 void __iomem
*reg
, u8 shift
, u8 width
,
56 void (*fixup
)(u32
*val
));
58 struct clk
*imx_clk_fixup_mux(const char *name
, void __iomem
*reg
,
59 u8 shift
, u8 width
, const char **parents
,
60 int num_parents
, void (*fixup
)(u32
*val
));
62 static inline struct clk
*imx_clk_fixed(const char *name
, int rate
)
64 return clk_register_fixed_rate(NULL
, name
, NULL
, CLK_IS_ROOT
, rate
);
67 static inline struct clk
*imx_clk_divider(const char *name
, const char *parent
,
68 void __iomem
*reg
, u8 shift
, u8 width
)
70 return clk_register_divider(NULL
, name
, parent
, CLK_SET_RATE_PARENT
,
71 reg
, shift
, width
, 0, &imx_ccm_lock
);
74 static inline struct clk
*imx_clk_divider_flags(const char *name
,
75 const char *parent
, void __iomem
*reg
, u8 shift
, u8 width
,
78 return clk_register_divider(NULL
, name
, parent
, flags
,
79 reg
, shift
, width
, 0, &imx_ccm_lock
);
82 static inline struct clk
*imx_clk_gate(const char *name
, const char *parent
,
83 void __iomem
*reg
, u8 shift
)
85 return clk_register_gate(NULL
, name
, parent
, CLK_SET_RATE_PARENT
, reg
,
86 shift
, 0, &imx_ccm_lock
);
89 static inline struct clk
*imx_clk_mux(const char *name
, void __iomem
*reg
,
90 u8 shift
, u8 width
, const char **parents
, int num_parents
)
92 return clk_register_mux(NULL
, name
, parents
, num_parents
,
93 CLK_SET_RATE_NO_REPARENT
, reg
, shift
,
94 width
, 0, &imx_ccm_lock
);
97 static inline struct clk
*imx_clk_mux_flags(const char *name
,
98 void __iomem
*reg
, u8 shift
, u8 width
, const char **parents
,
99 int num_parents
, unsigned long flags
)
101 return clk_register_mux(NULL
, name
, parents
, num_parents
,
102 flags
| CLK_SET_RATE_NO_REPARENT
, reg
, shift
, width
, 0,
106 static inline struct clk
*imx_clk_fixed_factor(const char *name
,
107 const char *parent
, unsigned int mult
, unsigned int div
)
109 return clk_register_fixed_factor(NULL
, name
, parent
,
110 CLK_SET_RATE_PARENT
, mult
, div
);