Ian Molton | 5fedd0a | 2008-07-25 12:02:31 +0100 | [diff] [blame^] | 1 | #include <linux/list.h> |
| 2 | |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 3 | struct clk; |
| 4 | |
| 5 | struct clkops { |
| 6 | void (*enable)(struct clk *); |
| 7 | void (*disable)(struct clk *); |
| 8 | unsigned long (*getrate)(struct clk *); |
| 9 | }; |
| 10 | |
| 11 | struct clk { |
| 12 | struct list_head node; |
| 13 | const char *name; |
| 14 | struct device *dev; |
| 15 | const struct clkops *ops; |
| 16 | unsigned long rate; |
| 17 | unsigned int cken; |
| 18 | unsigned int delay; |
| 19 | unsigned int enabled; |
Russell King | bdb08cb | 2008-06-30 19:47:59 +0100 | [diff] [blame] | 20 | struct clk *other; |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 21 | }; |
| 22 | |
| 23 | #define INIT_CKEN(_name, _cken, _rate, _delay, _dev) \ |
| 24 | { \ |
| 25 | .name = _name, \ |
| 26 | .dev = _dev, \ |
| 27 | .ops = &clk_cken_ops, \ |
| 28 | .rate = _rate, \ |
| 29 | .cken = CKEN_##_cken, \ |
| 30 | .delay = _delay, \ |
| 31 | } |
| 32 | |
| 33 | #define INIT_CK(_name, _cken, _ops, _dev) \ |
| 34 | { \ |
| 35 | .name = _name, \ |
| 36 | .dev = _dev, \ |
| 37 | .ops = _ops, \ |
| 38 | .cken = CKEN_##_cken, \ |
| 39 | } |
| 40 | |
Russell King | bdb08cb | 2008-06-30 19:47:59 +0100 | [diff] [blame] | 41 | /* |
| 42 | * This is a placeholder to alias one clock device+name pair |
| 43 | * to another struct clk. |
| 44 | */ |
| 45 | #define INIT_CKOTHER(_name, _other, _dev) \ |
| 46 | { \ |
| 47 | .name = _name, \ |
| 48 | .dev = _dev, \ |
| 49 | .other = _other, \ |
| 50 | } |
| 51 | |
Ian Molton | ed84778 | 2008-07-08 10:32:08 +0100 | [diff] [blame] | 52 | #define INIT_CLK(_name, _ops, _rate, _delay, _dev) \ |
| 53 | { \ |
| 54 | .name = _name, \ |
| 55 | .dev = _dev, \ |
| 56 | .ops = _ops, \ |
| 57 | .rate = _rate, \ |
| 58 | .delay = _delay, \ |
| 59 | } |
| 60 | |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 61 | extern const struct clkops clk_cken_ops; |
| 62 | |
| 63 | void clk_cken_enable(struct clk *clk); |
| 64 | void clk_cken_disable(struct clk *clk); |
| 65 | |
eric miao | 7a2c5cb | 2008-02-19 11:13:31 +0800 | [diff] [blame] | 66 | #ifdef CONFIG_PXA3xx |
| 67 | #define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \ |
| 68 | { \ |
| 69 | .name = _name, \ |
| 70 | .dev = _dev, \ |
| 71 | .ops = &clk_pxa3xx_cken_ops, \ |
| 72 | .rate = _rate, \ |
| 73 | .cken = CKEN_##_cken, \ |
| 74 | .delay = _delay, \ |
| 75 | } |
| 76 | |
| 77 | #define PXA3xx_CK(_name, _cken, _ops, _dev) \ |
| 78 | { \ |
| 79 | .name = _name, \ |
| 80 | .dev = _dev, \ |
| 81 | .ops = _ops, \ |
| 82 | .cken = CKEN_##_cken, \ |
| 83 | } |
| 84 | |
| 85 | extern const struct clkops clk_pxa3xx_cken_ops; |
| 86 | extern void clk_pxa3xx_cken_enable(struct clk *); |
| 87 | extern void clk_pxa3xx_cken_disable(struct clk *); |
| 88 | #endif |
| 89 | |
Russell King | a6dba20 | 2007-08-20 10:18:02 +0100 | [diff] [blame] | 90 | void clks_register(struct clk *clks, size_t num); |
Ian Molton | 5fedd0a | 2008-07-25 12:02:31 +0100 | [diff] [blame^] | 91 | int clk_add_alias(char *alias, struct device *alias_dev, char *id, |
| 92 | struct device *dev); |
| 93 | |