clock.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. struct clk *other;
  14. };
  15. #define INIT_CLKREG(_clk,_devname,_conname) \
  16. { \
  17. .clk = _clk, \
  18. .dev_id = _devname, \
  19. .con_id = _conname, \
  20. }
  21. #define DEFINE_CKEN(_name, _cken, _rate, _delay) \
  22. struct clk clk_##_name = { \
  23. .ops = &clk_cken_ops, \
  24. .rate = _rate, \
  25. .cken = CKEN_##_cken, \
  26. .delay = _delay, \
  27. }
  28. #define DEFINE_CK(_name, _cken, _ops) \
  29. struct clk clk_##_name = { \
  30. .ops = _ops, \
  31. .cken = CKEN_##_cken, \
  32. }
  33. #define DEFINE_CLK(_name, _ops, _rate, _delay) \
  34. struct clk clk_##_name = { \
  35. .ops = _ops, \
  36. .rate = _rate, \
  37. .delay = _delay, \
  38. }
  39. extern const struct clkops clk_cken_ops;
  40. void clk_cken_enable(struct clk *clk);
  41. void clk_cken_disable(struct clk *clk);
  42. #ifdef CONFIG_PXA3xx
  43. #define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \
  44. struct clk clk_##_name = { \
  45. .ops = &clk_pxa3xx_cken_ops, \
  46. .rate = _rate, \
  47. .cken = CKEN_##_cken, \
  48. .delay = _delay, \
  49. }
  50. #define DEFINE_PXA3_CK(_name, _cken, _ops) \
  51. struct clk clk_##_name = { \
  52. .ops = _ops, \
  53. .cken = CKEN_##_cken, \
  54. }
  55. extern const struct clkops clk_pxa3xx_cken_ops;
  56. extern void clk_pxa3xx_cken_enable(struct clk *);
  57. extern void clk_pxa3xx_cken_disable(struct clk *);
  58. #endif
  59. void clks_register(struct clk_lookup *clks, size_t num);
  60. int clk_add_alias(const char *alias, const char *alias_name, char *id,
  61. struct device *dev);