clock.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include <asm/clkdev.h>
  2. struct clkops {
  3. void (*enable)(struct clk *);
  4. void (*disable)(struct clk *);
  5. unsigned long (*getrate)(struct clk *);
  6. };
  7. struct clk {
  8. const struct clkops *ops;
  9. unsigned long rate;
  10. unsigned int cken;
  11. unsigned int delay;
  12. unsigned int enabled;
  13. };
  14. void clk_dummy_enable(struct clk *);
  15. void clk_dummy_disable(struct clk *);
  16. extern const struct clkops clk_dummy_ops;
  17. extern struct clk clk_dummy;
  18. #define INIT_CLKREG(_clk,_devname,_conname) \
  19. { \
  20. .clk = _clk, \
  21. .dev_id = _devname, \
  22. .con_id = _conname, \
  23. }
  24. #define DEFINE_CK(_name, _cken, _ops) \
  25. struct clk clk_##_name = { \
  26. .ops = _ops, \
  27. .cken = CKEN_##_cken, \
  28. }
  29. #define DEFINE_CLK(_name, _ops, _rate, _delay) \
  30. struct clk clk_##_name = { \
  31. .ops = _ops, \
  32. .rate = _rate, \
  33. .delay = _delay, \
  34. }
  35. #define DEFINE_PXA2_CKEN(_name, _cken, _rate, _delay) \
  36. struct clk clk_##_name = { \
  37. .ops = &clk_pxa2xx_cken_ops, \
  38. .rate = _rate, \
  39. .cken = CKEN_##_cken, \
  40. .delay = _delay, \
  41. }
  42. extern const struct clkops clk_pxa2xx_cken_ops;
  43. void clk_pxa2xx_cken_enable(struct clk *clk);
  44. void clk_pxa2xx_cken_disable(struct clk *clk);
  45. #ifdef CONFIG_PXA3xx
  46. #define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \
  47. struct clk clk_##_name = { \
  48. .ops = &clk_pxa3xx_cken_ops, \
  49. .rate = _rate, \
  50. .cken = CKEN_##_cken, \
  51. .delay = _delay, \
  52. }
  53. extern const struct clkops clk_pxa3xx_cken_ops;
  54. extern const struct clkops clk_pxa3xx_hsio_ops;
  55. extern const struct clkops clk_pxa3xx_ac97_ops;
  56. extern const struct clkops clk_pxa3xx_pout_ops;
  57. extern void clk_pxa3xx_cken_enable(struct clk *);
  58. extern void clk_pxa3xx_cken_disable(struct clk *);
  59. #endif