]> err.no Git - linux-2.6/blob - arch/arm/mach-pxa/clock.h
x86: work around MTRR mask setting, v2
[linux-2.6] / arch / arm / mach-pxa / clock.h
1 struct clk;
2
3 struct clkops {
4         void                    (*enable)(struct clk *);
5         void                    (*disable)(struct clk *);
6         unsigned long           (*getrate)(struct clk *);
7 };
8
9 struct clk {
10         struct list_head        node;
11         const char              *name;
12         struct device           *dev;
13         const struct clkops     *ops;
14         unsigned long           rate;
15         unsigned int            cken;
16         unsigned int            delay;
17         unsigned int            enabled;
18         struct clk              *other;
19 };
20
21 #define INIT_CKEN(_name, _cken, _rate, _delay, _dev)    \
22         {                                               \
23                 .name   = _name,                        \
24                 .dev    = _dev,                         \
25                 .ops    = &clk_cken_ops,                \
26                 .rate   = _rate,                        \
27                 .cken   = CKEN_##_cken,                 \
28                 .delay  = _delay,                       \
29         }
30
31 #define INIT_CK(_name, _cken, _ops, _dev)               \
32         {                                               \
33                 .name   = _name,                        \
34                 .dev    = _dev,                         \
35                 .ops    = _ops,                         \
36                 .cken   = CKEN_##_cken,                 \
37         }
38
39 /*
40  * This is a placeholder to alias one clock device+name pair
41  * to another struct clk.
42  */
43 #define INIT_CKOTHER(_name, _other, _dev)               \
44         {                                               \
45                 .name   = _name,                        \
46                 .dev    = _dev,                         \
47                 .other  = _other,                       \
48         }
49
50 #define INIT_CLK(_name, _ops, _rate, _delay, _dev)      \
51         {                                               \
52                 .name   = _name,                        \
53                 .dev    = _dev,                         \
54                 .ops    = _ops,                         \
55                 .rate   = _rate,                        \
56                 .delay  = _delay,                       \
57         }
58
59 extern const struct clkops clk_cken_ops;
60
61 void clk_cken_enable(struct clk *clk);
62 void clk_cken_disable(struct clk *clk);
63
64 #ifdef CONFIG_PXA3xx
65 #define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev)  \
66         {                                               \
67                 .name   = _name,                        \
68                 .dev    = _dev,                         \
69                 .ops    = &clk_pxa3xx_cken_ops,         \
70                 .rate   = _rate,                        \
71                 .cken   = CKEN_##_cken,                 \
72                 .delay  = _delay,                       \
73         }
74
75 #define PXA3xx_CK(_name, _cken, _ops, _dev)             \
76         {                                               \
77                 .name   = _name,                        \
78                 .dev    = _dev,                         \
79                 .ops    = _ops,                         \
80                 .cken   = CKEN_##_cken,                 \
81         }
82
83 extern const struct clkops clk_pxa3xx_cken_ops;
84 extern void clk_pxa3xx_cken_enable(struct clk *);
85 extern void clk_pxa3xx_cken_disable(struct clk *);
86 #endif
87
88 void clks_register(struct clk *clks, size_t num);