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