1 #include <asm/clkdev.h> 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 { 10 const struct clkops *ops; 11 unsigned long rate; 12 unsigned int cken; 13 unsigned int delay; 14 unsigned int enabled; 15 struct clk *other; 16 }; 17 18 #define INIT_CLKREG(_clk,_devname,_conname) \ 19 { \ 20 .clk = _clk, \ 21 .dev_id = _devname, \ 22 .con_id = _conname, \ 23 } 24 25 #define DEFINE_CKEN(_name, _cken, _rate, _delay) \ 26 struct clk clk_##_name = { \ 27 .ops = &clk_cken_ops, \ 28 .rate = _rate, \ 29 .cken = CKEN_##_cken, \ 30 .delay = _delay, \ 31 } 32 33 #define DEFINE_CK(_name, _cken, _ops) \ 34 struct clk clk_##_name = { \ 35 .ops = _ops, \ 36 .cken = CKEN_##_cken, \ 37 } 38 39 #define DEFINE_CLK(_name, _ops, _rate, _delay) \ 40 struct clk clk_##_name = { \ 41 .ops = _ops, \ 42 .rate = _rate, \ 43 .delay = _delay, \ 44 } 45 46 extern const struct clkops clk_cken_ops; 47 48 void clk_cken_enable(struct clk *clk); 49 void clk_cken_disable(struct clk *clk); 50 51 #ifdef CONFIG_PXA3xx 52 #define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \ 53 struct clk clk_##_name = { \ 54 .ops = &clk_pxa3xx_cken_ops, \ 55 .rate = _rate, \ 56 .cken = CKEN_##_cken, \ 57 .delay = _delay, \ 58 } 59 60 #define DEFINE_PXA3_CK(_name, _cken, _ops) \ 61 struct clk clk_##_name = { \ 62 .ops = _ops, \ 63 .cken = CKEN_##_cken, \ 64 } 65 66 extern const struct clkops clk_pxa3xx_cken_ops; 67 extern void clk_pxa3xx_cken_enable(struct clk *); 68 extern void clk_pxa3xx_cken_disable(struct clk *); 69 #endif 70 71 void clks_register(struct clk_lookup *clks, size_t num); 72 int clk_add_alias(char *alias, struct device *alias_dev, char *id, 73 struct device *dev); 74 75