Jean-Christop PLAGNIOL-VILLARD | 6d803ba | 2010-11-17 10:04:33 +0100 | [diff] [blame] | 1 | #include <linux/clkdev.h> |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 2 | #include <linux/syscore_ops.h> |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 3 | |
| 4 | struct clkops { |
| 5 | void (*enable)(struct clk *); |
| 6 | void (*disable)(struct clk *); |
| 7 | unsigned long (*getrate)(struct clk *); |
Haojian Zhuang | 52585cc | 2011-04-08 20:15:38 +0800 | [diff] [blame] | 8 | int (*setrate)(struct clk *, unsigned long); |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 9 | }; |
| 10 | |
| 11 | struct clk { |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 12 | const struct clkops *ops; |
| 13 | unsigned long rate; |
| 14 | unsigned int cken; |
| 15 | unsigned int delay; |
| 16 | unsigned int enabled; |
| 17 | }; |
| 18 | |
Eric Miao | 4029813 | 2010-11-22 10:49:55 +0800 | [diff] [blame] | 19 | void clk_dummy_enable(struct clk *); |
| 20 | void clk_dummy_disable(struct clk *); |
| 21 | |
| 22 | extern const struct clkops clk_dummy_ops; |
| 23 | extern struct clk clk_dummy; |
| 24 | |
Russell King | 8c3abc7 | 2008-11-08 20:25:21 +0000 | [diff] [blame] | 25 | #define INIT_CLKREG(_clk,_devname,_conname) \ |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 26 | { \ |
Russell King | 8c3abc7 | 2008-11-08 20:25:21 +0000 | [diff] [blame] | 27 | .clk = _clk, \ |
| 28 | .dev_id = _devname, \ |
| 29 | .con_id = _conname, \ |
| 30 | } |
| 31 | |
Russell King | 8c3abc7 | 2008-11-08 20:25:21 +0000 | [diff] [blame] | 32 | #define DEFINE_CK(_name, _cken, _ops) \ |
| 33 | struct clk clk_##_name = { \ |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 34 | .ops = _ops, \ |
| 35 | .cken = CKEN_##_cken, \ |
| 36 | } |
| 37 | |
Russell King | 8c3abc7 | 2008-11-08 20:25:21 +0000 | [diff] [blame] | 38 | #define DEFINE_CLK(_name, _ops, _rate, _delay) \ |
| 39 | struct clk clk_##_name = { \ |
| 40 | .ops = _ops, \ |
| 41 | .rate = _rate, \ |
Ian Molton | ed84778 | 2008-07-08 10:32:08 +0100 | [diff] [blame] | 42 | .delay = _delay, \ |
| 43 | } |
| 44 | |
Eric Miao | 4029813 | 2010-11-22 10:49:55 +0800 | [diff] [blame] | 45 | #define DEFINE_PXA2_CKEN(_name, _cken, _rate, _delay) \ |
Eric Miao | 2e8581e | 2010-11-22 09:41:39 +0800 | [diff] [blame] | 46 | struct clk clk_##_name = { \ |
Eric Miao | 4029813 | 2010-11-22 10:49:55 +0800 | [diff] [blame] | 47 | .ops = &clk_pxa2xx_cken_ops, \ |
Eric Miao | 2e8581e | 2010-11-22 09:41:39 +0800 | [diff] [blame] | 48 | .rate = _rate, \ |
| 49 | .cken = CKEN_##_cken, \ |
| 50 | .delay = _delay, \ |
| 51 | } |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 52 | |
Eric Miao | 4029813 | 2010-11-22 10:49:55 +0800 | [diff] [blame] | 53 | extern const struct clkops clk_pxa2xx_cken_ops; |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 54 | |
Eric Miao | 4029813 | 2010-11-22 10:49:55 +0800 | [diff] [blame] | 55 | void clk_pxa2xx_cken_enable(struct clk *clk); |
| 56 | void clk_pxa2xx_cken_disable(struct clk *clk); |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 57 | |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 58 | extern struct syscore_ops pxa2xx_clock_syscore_ops; |
Eric Miao | f113fe4 | 2010-11-23 17:00:03 +0800 | [diff] [blame] | 59 | |
Haojian Zhuang | a455335 | 2010-11-24 11:54:19 +0800 | [diff] [blame] | 60 | #if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x) |
Russell King | 8c3abc7 | 2008-11-08 20:25:21 +0000 | [diff] [blame] | 61 | #define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \ |
| 62 | struct clk clk_##_name = { \ |
eric miao | 7a2c5cb | 2008-02-19 11:13:31 +0800 | [diff] [blame] | 63 | .ops = &clk_pxa3xx_cken_ops, \ |
| 64 | .rate = _rate, \ |
| 65 | .cken = CKEN_##_cken, \ |
| 66 | .delay = _delay, \ |
| 67 | } |
| 68 | |
eric miao | 7a2c5cb | 2008-02-19 11:13:31 +0800 | [diff] [blame] | 69 | extern const struct clkops clk_pxa3xx_cken_ops; |
Eric Miao | 4029813 | 2010-11-22 10:49:55 +0800 | [diff] [blame] | 70 | extern const struct clkops clk_pxa3xx_hsio_ops; |
| 71 | extern const struct clkops clk_pxa3xx_ac97_ops; |
| 72 | extern const struct clkops clk_pxa3xx_pout_ops; |
Eric Miao | c085052 | 2010-11-29 22:56:00 +0800 | [diff] [blame] | 73 | extern const struct clkops clk_pxa3xx_smemc_ops; |
Eric Miao | 4029813 | 2010-11-22 10:49:55 +0800 | [diff] [blame] | 74 | |
eric miao | 7a2c5cb | 2008-02-19 11:13:31 +0800 | [diff] [blame] | 75 | extern void clk_pxa3xx_cken_enable(struct clk *); |
| 76 | extern void clk_pxa3xx_cken_disable(struct clk *); |
eric miao | 7a2c5cb | 2008-02-19 11:13:31 +0800 | [diff] [blame] | 77 | |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 78 | extern struct syscore_ops pxa3xx_clock_syscore_ops; |
| 79 | |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 80 | #endif |