blob: 7f5da75f30b3b812511786e6168cc6db3cf3717c [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
Sascha Hauer6c7b068502012-03-07 21:01:28 +010014static inline struct clk *imx_clk_fixed(const char *name, int rate)
15{
16 return clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT, rate);
17}
18
19static inline struct clk *imx_clk_divider(const char *name, const char *parent,
20 void __iomem *reg, u8 shift, u8 width)
21{
22 return clk_register_divider(NULL, name, parent, CLK_SET_RATE_PARENT,
23 reg, shift, width, 0, &imx_ccm_lock);
24}
25
26static inline struct clk *imx_clk_gate(const char *name, const char *parent,
27 void __iomem *reg, u8 shift)
28{
29 return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
30 shift, 0, &imx_ccm_lock);
31}
32
33static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg,
34 u8 shift, u8 width, const char **parents, int num_parents)
35{
36 return clk_register_mux(NULL, name, parents, num_parents, 0, reg, shift,
37 width, 0, &imx_ccm_lock);
38}
39
40static inline struct clk *imx_clk_fixed_factor(const char *name,
41 const char *parent, unsigned int mult, unsigned int div)
42{
43 return clk_register_fixed_factor(NULL, name, parent,
44 CLK_SET_RATE_PARENT, mult, div);
45}
46
47#endif