clock.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #include <linux/clkdev.h>
  2. #include <linux/syscore_ops.h>
  3. struct clkops {
  4. void (*enable)(struct clk *);
  5. void (*disable)(struct clk *);
  6. unsigned long (*getrate)(struct clk *);
  7. int (*setrate)(struct clk *, unsigned long);
  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. };
  16. void clk_dummy_enable(struct clk *);
  17. void clk_dummy_disable(struct clk *);
  18. extern const struct clkops clk_dummy_ops;
  19. extern struct clk clk_dummy;
  20. #define INIT_CLKREG(_clk,_devname,_conname) \
  21. { \
  22. .clk = _clk, \
  23. .dev_id = _devname, \
  24. .con_id = _conname, \
  25. }
  26. #define DEFINE_CK(_name, _cken, _ops) \
  27. struct clk clk_##_name = { \
  28. .ops = _ops, \
  29. .cken = CKEN_##_cken, \
  30. }
  31. #define DEFINE_CLK(_name, _ops, _rate, _delay) \
  32. struct clk clk_##_name = { \
  33. .ops = _ops, \
  34. .rate = _rate, \
  35. .delay = _delay, \
  36. }
  37. #define DEFINE_PXA2_CKEN(_name, _cken, _rate, _delay) \
  38. struct clk clk_##_name = { \
  39. .ops = &clk_pxa2xx_cken_ops, \
  40. .rate = _rate, \
  41. .cken = CKEN_##_cken, \
  42. .delay = _delay, \
  43. }
  44. extern const struct clkops clk_pxa2xx_cken_ops;
  45. void clk_pxa2xx_cken_enable(struct clk *clk);
  46. void clk_pxa2xx_cken_disable(struct clk *clk);
  47. extern struct syscore_ops pxa2xx_clock_syscore_ops;
  48. #if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x)
  49. #define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \
  50. struct clk clk_##_name = { \
  51. .ops = &clk_pxa3xx_cken_ops, \
  52. .rate = _rate, \
  53. .cken = CKEN_##_cken, \
  54. .delay = _delay, \
  55. }
  56. extern const struct clkops clk_pxa3xx_cken_ops;
  57. extern const struct clkops clk_pxa3xx_hsio_ops;
  58. extern const struct clkops clk_pxa3xx_ac97_ops;
  59. extern const struct clkops clk_pxa3xx_pout_ops;
  60. extern const struct clkops clk_pxa3xx_smemc_ops;
  61. extern void clk_pxa3xx_cken_enable(struct clk *);
  62. extern void clk_pxa3xx_cken_disable(struct clk *);
  63. extern struct syscore_ops pxa3xx_clock_syscore_ops;
  64. #endif