blob: 331316d6a4de63c8fbfd5e27704904224ddca1ef [file] [log] [blame]
Sascha Hauer6c7b068502012-03-07 21:01:28 +01001#ifndef __MACH_IMX_CLK_H
2#define __MACH_IMX_CLK_H
3
4#include <linux/spinlock.h>
5#include <linux/clk-provider.h>
6#include <mach/clock.h>
7
Sascha Hauer2af9e6d2012-03-09 09:11:55 +01008struct clk *imx_clk_pllv1(const char *name, const char *parent,
Sascha Hauer6c7b068502012-03-07 21:01:28 +01009 void __iomem *base);
10
Sascha Hauera547b812012-03-19 12:36:10 +010011struct clk *imx_clk_pllv2(const char *name, const char *parent,
12 void __iomem *base);
13
Shawn Guoa3f6b9d2012-04-04 16:02:28 +080014enum imx_pllv3_type {
15 IMX_PLLV3_GENERIC,
16 IMX_PLLV3_SYS,
17 IMX_PLLV3_USB,
18 IMX_PLLV3_AV,
19 IMX_PLLV3_ENET,
20 IMX_PLLV3_MLB,
21};
22
23struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
24 const char *parent_name, void __iomem *base, u32 gate_mask,
25 u32 div_mask);
26
Sascha Hauer6c7b068502012-03-07 21:01:28 +010027static inline struct clk *imx_clk_fixed(const char *name, int rate)
28{
29 return clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT, rate);
30}
31
32static inline struct clk *imx_clk_divider(const char *name, const char *parent,
33 void __iomem *reg, u8 shift, u8 width)
34{
35 return clk_register_divider(NULL, name, parent, CLK_SET_RATE_PARENT,
36 reg, shift, width, 0, &imx_ccm_lock);
37}
38
39static inline struct clk *imx_clk_gate(const char *name, const char *parent,
40 void __iomem *reg, u8 shift)
41{
42 return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
43 shift, 0, &imx_ccm_lock);
44}
45
46static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg,
47 u8 shift, u8 width, const char **parents, int num_parents)
48{
49 return clk_register_mux(NULL, name, parents, num_parents, 0, reg, shift,
50 width, 0, &imx_ccm_lock);
51}
52
53static inline struct clk *imx_clk_fixed_factor(const char *name,
54 const char *parent, unsigned int mult, unsigned int div)
55{
56 return clk_register_fixed_factor(NULL, name, parent,
57 CLK_SET_RATE_PARENT, mult, div);
58}
59
60#endif