Russell King | 8c3abc7 | 2008-11-08 20:25:21 +0000 | [diff] [blame] | 1 | #include <asm/clkdev.h> |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 2 | |
| 3 | struct clkops { |
| 4 | void (*enable)(struct clk *); |
| 5 | void (*disable)(struct clk *); |
| 6 | unsigned long (*getrate)(struct clk *); |
| 7 | }; |
| 8 | |
| 9 | struct clk { |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 10 | const struct clkops *ops; |
| 11 | unsigned long rate; |
| 12 | unsigned int cken; |
| 13 | unsigned int delay; |
| 14 | unsigned int enabled; |
| 15 | }; |
| 16 | |
Russell King | 8c3abc7 | 2008-11-08 20:25:21 +0000 | [diff] [blame] | 17 | #define INIT_CLKREG(_clk,_devname,_conname) \ |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 18 | { \ |
Russell King | 8c3abc7 | 2008-11-08 20:25:21 +0000 | [diff] [blame] | 19 | .clk = _clk, \ |
| 20 | .dev_id = _devname, \ |
| 21 | .con_id = _conname, \ |
| 22 | } |
| 23 | |
| 24 | #define DEFINE_CKEN(_name, _cken, _rate, _delay) \ |
| 25 | struct clk clk_##_name = { \ |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 26 | .ops = &clk_cken_ops, \ |
| 27 | .rate = _rate, \ |
| 28 | .cken = CKEN_##_cken, \ |
| 29 | .delay = _delay, \ |
| 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 | |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 45 | extern const struct clkops clk_cken_ops; |
| 46 | |
| 47 | void clk_cken_enable(struct clk *clk); |
| 48 | void clk_cken_disable(struct clk *clk); |
| 49 | |
eric miao | 7a2c5cb | 2008-02-19 11:13:31 +0800 | [diff] [blame] | 50 | #ifdef CONFIG_PXA3xx |
Russell King | 8c3abc7 | 2008-11-08 20:25:21 +0000 | [diff] [blame] | 51 | #define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \ |
| 52 | struct clk clk_##_name = { \ |
eric miao | 7a2c5cb | 2008-02-19 11:13:31 +0800 | [diff] [blame] | 53 | .ops = &clk_pxa3xx_cken_ops, \ |
| 54 | .rate = _rate, \ |
| 55 | .cken = CKEN_##_cken, \ |
| 56 | .delay = _delay, \ |
| 57 | } |
| 58 | |
Russell King | 8c3abc7 | 2008-11-08 20:25:21 +0000 | [diff] [blame] | 59 | #define DEFINE_PXA3_CK(_name, _cken, _ops) \ |
| 60 | struct clk clk_##_name = { \ |
eric miao | 7a2c5cb | 2008-02-19 11:13:31 +0800 | [diff] [blame] | 61 | .ops = _ops, \ |
| 62 | .cken = CKEN_##_cken, \ |
| 63 | } |
| 64 | |
| 65 | extern const struct clkops clk_pxa3xx_cken_ops; |
| 66 | extern void clk_pxa3xx_cken_enable(struct clk *); |
| 67 | extern void clk_pxa3xx_cken_disable(struct clk *); |
| 68 | #endif |
| 69 | |