blob: 3a607521dc218b61998734cc39e11237dcb8c3ce [file] [log] [blame]
Eric Miaof113fe42010-11-23 17:00:03 +08001#include <linux/sysdev.h>
Russell King8c3abc72008-11-08 20:25:21 +00002#include <asm/clkdev.h>
Russell Kinga6dba202007-08-20 10:18:02 +01003
4struct clkops {
5 void (*enable)(struct clk *);
6 void (*disable)(struct clk *);
7 unsigned long (*getrate)(struct clk *);
8};
9
10struct clk {
Russell Kinga6dba202007-08-20 10:18:02 +010011 const struct clkops *ops;
12 unsigned long rate;
13 unsigned int cken;
14 unsigned int delay;
15 unsigned int enabled;
16};
17
Eric Miao40298132010-11-22 10:49:55 +080018void clk_dummy_enable(struct clk *);
19void clk_dummy_disable(struct clk *);
20
21extern const struct clkops clk_dummy_ops;
22extern struct clk clk_dummy;
23
Russell King8c3abc72008-11-08 20:25:21 +000024#define INIT_CLKREG(_clk,_devname,_conname) \
Russell Kinga6dba202007-08-20 10:18:02 +010025 { \
Russell King8c3abc72008-11-08 20:25:21 +000026 .clk = _clk, \
27 .dev_id = _devname, \
28 .con_id = _conname, \
29 }
30
Russell King8c3abc72008-11-08 20:25:21 +000031#define DEFINE_CK(_name, _cken, _ops) \
32struct clk clk_##_name = { \
Russell Kinga6dba202007-08-20 10:18:02 +010033 .ops = _ops, \
34 .cken = CKEN_##_cken, \
35 }
36
Russell King8c3abc72008-11-08 20:25:21 +000037#define DEFINE_CLK(_name, _ops, _rate, _delay) \
38struct clk clk_##_name = { \
39 .ops = _ops, \
40 .rate = _rate, \
Ian Moltoned847782008-07-08 10:32:08 +010041 .delay = _delay, \
42 }
43
Eric Miao40298132010-11-22 10:49:55 +080044#define DEFINE_PXA2_CKEN(_name, _cken, _rate, _delay) \
Eric Miao2e8581e2010-11-22 09:41:39 +080045struct clk clk_##_name = { \
Eric Miao40298132010-11-22 10:49:55 +080046 .ops = &clk_pxa2xx_cken_ops, \
Eric Miao2e8581e2010-11-22 09:41:39 +080047 .rate = _rate, \
48 .cken = CKEN_##_cken, \
49 .delay = _delay, \
50 }
51
Eric Miao40298132010-11-22 10:49:55 +080052extern const struct clkops clk_pxa2xx_cken_ops;
Russell Kinga6dba202007-08-20 10:18:02 +010053
Eric Miao40298132010-11-22 10:49:55 +080054void clk_pxa2xx_cken_enable(struct clk *clk);
55void clk_pxa2xx_cken_disable(struct clk *clk);
Russell Kinga6dba202007-08-20 10:18:02 +010056
Eric Miaof113fe42010-11-23 17:00:03 +080057extern struct sysdev_class pxa2xx_clock_sysclass;
58
Haojian Zhuanga4553352010-11-24 11:54:19 +080059#if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x)
Russell King8c3abc72008-11-08 20:25:21 +000060#define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \
61struct clk clk_##_name = { \
eric miao7a2c5cb2008-02-19 11:13:31 +080062 .ops = &clk_pxa3xx_cken_ops, \
63 .rate = _rate, \
64 .cken = CKEN_##_cken, \
65 .delay = _delay, \
66 }
67
eric miao7a2c5cb2008-02-19 11:13:31 +080068extern const struct clkops clk_pxa3xx_cken_ops;
Eric Miao40298132010-11-22 10:49:55 +080069extern const struct clkops clk_pxa3xx_hsio_ops;
70extern const struct clkops clk_pxa3xx_ac97_ops;
71extern const struct clkops clk_pxa3xx_pout_ops;
72
eric miao7a2c5cb2008-02-19 11:13:31 +080073extern void clk_pxa3xx_cken_enable(struct clk *);
74extern void clk_pxa3xx_cken_disable(struct clk *);
Eric Miaoaae82242010-11-23 17:07:48 +080075
76extern struct sysdev_class pxa3xx_clock_sysclass;
eric miao7a2c5cb2008-02-19 11:13:31 +080077#endif