clock.h 1.9 KB

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