blob: d8488742b8075179fd4d66026d79730e00505a21 [file] [log] [blame]
Russell King8c3abc72008-11-08 20:25:21 +00001#include <asm/clkdev.h>
Russell Kinga6dba202007-08-20 10:18:02 +01002
3struct clkops {
4 void (*enable)(struct clk *);
5 void (*disable)(struct clk *);
6 unsigned long (*getrate)(struct clk *);
7};
8
9struct clk {
Russell Kinga6dba202007-08-20 10:18:02 +010010 const struct clkops *ops;
11 unsigned long rate;
12 unsigned int cken;
13 unsigned int delay;
14 unsigned int enabled;
15};
16
Russell King8c3abc72008-11-08 20:25:21 +000017#define INIT_CLKREG(_clk,_devname,_conname) \
Russell Kinga6dba202007-08-20 10:18:02 +010018 { \
Russell King8c3abc72008-11-08 20:25:21 +000019 .clk = _clk, \
20 .dev_id = _devname, \
21 .con_id = _conname, \
22 }
23
24#define DEFINE_CKEN(_name, _cken, _rate, _delay) \
25struct clk clk_##_name = { \
Russell Kinga6dba202007-08-20 10:18:02 +010026 .ops = &clk_cken_ops, \
27 .rate = _rate, \
28 .cken = CKEN_##_cken, \
29 .delay = _delay, \
30 }
31
Russell King8c3abc72008-11-08 20:25:21 +000032#define DEFINE_CK(_name, _cken, _ops) \
33struct clk clk_##_name = { \
Russell Kinga6dba202007-08-20 10:18:02 +010034 .ops = _ops, \
35 .cken = CKEN_##_cken, \
36 }
37
Russell King8c3abc72008-11-08 20:25:21 +000038#define DEFINE_CLK(_name, _ops, _rate, _delay) \
39struct clk clk_##_name = { \
40 .ops = _ops, \
41 .rate = _rate, \
Ian Moltoned847782008-07-08 10:32:08 +010042 .delay = _delay, \
43 }
44
Russell Kinga6dba202007-08-20 10:18:02 +010045extern const struct clkops clk_cken_ops;
46
47void clk_cken_enable(struct clk *clk);
48void clk_cken_disable(struct clk *clk);
49
eric miao7a2c5cb2008-02-19 11:13:31 +080050#ifdef CONFIG_PXA3xx
Russell King8c3abc72008-11-08 20:25:21 +000051#define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \
52struct clk clk_##_name = { \
eric miao7a2c5cb2008-02-19 11:13:31 +080053 .ops = &clk_pxa3xx_cken_ops, \
54 .rate = _rate, \
55 .cken = CKEN_##_cken, \
56 .delay = _delay, \
57 }
58
Russell King8c3abc72008-11-08 20:25:21 +000059#define DEFINE_PXA3_CK(_name, _cken, _ops) \
60struct clk clk_##_name = { \
eric miao7a2c5cb2008-02-19 11:13:31 +080061 .ops = _ops, \
62 .cken = CKEN_##_cken, \
63 }
64
65extern const struct clkops clk_pxa3xx_cken_ops;
66extern void clk_pxa3xx_cken_enable(struct clk *);
67extern void clk_pxa3xx_cken_disable(struct clk *);
68#endif
69