clock.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef __ASM_MIPS_CLOCK_H
  2. #define __ASM_MIPS_CLOCK_H
  3. #include <linux/kref.h>
  4. #include <linux/list.h>
  5. #include <linux/seq_file.h>
  6. #include <linux/clk.h>
  7. extern void (*cpu_wait) (void);
  8. struct clk;
  9. struct clk_ops {
  10. void (*init) (struct clk *clk);
  11. void (*enable) (struct clk *clk);
  12. void (*disable) (struct clk *clk);
  13. void (*recalc) (struct clk *clk);
  14. int (*set_rate) (struct clk *clk, unsigned long rate, int algo_id);
  15. long (*round_rate) (struct clk *clk, unsigned long rate);
  16. };
  17. struct clk {
  18. struct list_head node;
  19. const char *name;
  20. int id;
  21. struct module *owner;
  22. struct clk *parent;
  23. struct clk_ops *ops;
  24. struct kref kref;
  25. unsigned long rate;
  26. unsigned long flags;
  27. };
  28. #define CLK_ALWAYS_ENABLED (1 << 0)
  29. #define CLK_RATE_PROPAGATES (1 << 1)
  30. /* Should be defined by processor-specific code */
  31. void arch_init_clk_ops(struct clk_ops **, int type);
  32. int clk_init(void);
  33. int __clk_enable(struct clk *);
  34. void __clk_disable(struct clk *);
  35. void clk_recalc_rate(struct clk *);
  36. int clk_register(struct clk *);
  37. void clk_unregister(struct clk *);
  38. /* the exported API, in addition to clk_set_rate */
  39. /**
  40. * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
  41. * @clk: clock source
  42. * @rate: desired clock rate in Hz
  43. * @algo_id: algorithm id to be passed down to ops->set_rate
  44. *
  45. * Returns success (0) or negative errno.
  46. */
  47. int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
  48. #endif /* __ASM_MIPS_CLOCK_H */