clock.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef __ASM_SH_CLOCK_H
  2. #define __ASM_SH_CLOCK_H
  3. #include <linux/kref.h>
  4. #include <linux/list.h>
  5. #include <linux/seq_file.h>
  6. #include <linux/clk.h>
  7. struct clk;
  8. struct clk_ops {
  9. void (*init)(struct clk *clk);
  10. void (*enable)(struct clk *clk);
  11. void (*disable)(struct clk *clk);
  12. void (*recalc)(struct clk *clk);
  13. int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);
  14. long (*round_rate)(struct clk *clk, unsigned long rate);
  15. };
  16. struct clk {
  17. struct list_head node;
  18. const char *name;
  19. int id;
  20. struct module *owner;
  21. struct clk *parent;
  22. struct clk_ops *ops;
  23. struct kref kref;
  24. unsigned long rate;
  25. unsigned long flags;
  26. };
  27. #define CLK_ALWAYS_ENABLED (1 << 0)
  28. #define CLK_RATE_PROPAGATES (1 << 1)
  29. /* Should be defined by processor-specific code */
  30. void arch_init_clk_ops(struct clk_ops **, int type);
  31. /* arch/sh/kernel/cpu/clock.c */
  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. enum clk_sh_algo_id {
  49. NO_CHANGE = 0,
  50. IUS_N1_N1,
  51. IUS_322,
  52. IUS_522,
  53. IUS_N11,
  54. SB_N1,
  55. SB3_N1,
  56. SB3_32,
  57. SB3_43,
  58. SB3_54,
  59. BP_N1,
  60. IP_N1,
  61. };
  62. #endif /* __ASM_SH_CLOCK_H */