blob: 3a258b1bf1aa46f39d255cb81a2643b667394192 [file] [log] [blame]
Jean-Christop PLAGNIOL-VILLARD6d803ba2010-11-17 10:04:33 +01001#include <linux/clkdev.h>
Rafael J. Wysocki2eaa03b2011-04-22 22:03:11 +02002#include <linux/syscore_ops.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 *);
Haojian Zhuang52585cc2011-04-08 20:15:38 +08008 int (*setrate)(struct clk *, unsigned long);
Russell Kinga6dba202007-08-20 10:18:02 +01009};
10
11struct clk {
Russell Kinga6dba202007-08-20 10:18:02 +010012 const struct clkops *ops;
13 unsigned long rate;
14 unsigned int cken;
15 unsigned int delay;
16 unsigned int enabled;
17};
18
Eric Miao40298132010-11-22 10:49:55 +080019void clk_dummy_enable(struct clk *);
20void clk_dummy_disable(struct clk *);
21
22extern const struct clkops clk_dummy_ops;
23extern struct clk clk_dummy;
24
Russell King8c3abc72008-11-08 20:25:21 +000025#define INIT_CLKREG(_clk,_devname,_conname) \
Russell Kinga6dba202007-08-20 10:18:02 +010026 { \
Russell King8c3abc72008-11-08 20:25:21 +000027 .clk = _clk, \
28 .dev_id = _devname, \
29 .con_id = _conname, \
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
Eric Miao40298132010-11-22 10:49:55 +080045#define DEFINE_PXA2_CKEN(_name, _cken, _rate, _delay) \
Eric Miao2e8581e2010-11-22 09:41:39 +080046struct clk clk_##_name = { \
Eric Miao40298132010-11-22 10:49:55 +080047 .ops = &clk_pxa2xx_cken_ops, \
Eric Miao2e8581e2010-11-22 09:41:39 +080048 .rate = _rate, \
49 .cken = CKEN_##_cken, \
50 .delay = _delay, \
51 }
Russell Kinga6dba202007-08-20 10:18:02 +010052
Eric Miao40298132010-11-22 10:49:55 +080053extern const struct clkops clk_pxa2xx_cken_ops;
Russell Kinga6dba202007-08-20 10:18:02 +010054
Eric Miao40298132010-11-22 10:49:55 +080055void clk_pxa2xx_cken_enable(struct clk *clk);
56void clk_pxa2xx_cken_disable(struct clk *clk);
Russell Kinga6dba202007-08-20 10:18:02 +010057
Rafael J. Wysocki2eaa03b2011-04-22 22:03:11 +020058extern struct syscore_ops pxa2xx_clock_syscore_ops;
Eric Miaof113fe42010-11-23 17:00:03 +080059
Haojian Zhuanga4553352010-11-24 11:54:19 +080060#if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x)
Russell King8c3abc72008-11-08 20:25:21 +000061#define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \
62struct clk clk_##_name = { \
eric miao7a2c5cb2008-02-19 11:13:31 +080063 .ops = &clk_pxa3xx_cken_ops, \
64 .rate = _rate, \
65 .cken = CKEN_##_cken, \
66 .delay = _delay, \
67 }
68
eric miao7a2c5cb2008-02-19 11:13:31 +080069extern const struct clkops clk_pxa3xx_cken_ops;
Eric Miao40298132010-11-22 10:49:55 +080070extern const struct clkops clk_pxa3xx_hsio_ops;
71extern const struct clkops clk_pxa3xx_ac97_ops;
72extern const struct clkops clk_pxa3xx_pout_ops;
Eric Miaoc0850522010-11-29 22:56:00 +080073extern const struct clkops clk_pxa3xx_smemc_ops;
Eric Miao40298132010-11-22 10:49:55 +080074
eric miao7a2c5cb2008-02-19 11:13:31 +080075extern void clk_pxa3xx_cken_enable(struct clk *);
76extern void clk_pxa3xx_cken_disable(struct clk *);
eric miao7a2c5cb2008-02-19 11:13:31 +080077
Rafael J. Wysocki2eaa03b2011-04-22 22:03:11 +020078extern struct syscore_ops pxa3xx_clock_syscore_ops;
79
Russell Kinga6dba202007-08-20 10:18:02 +010080#endif