clock.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. };
  15. struct clk {
  16. struct list_head node;
  17. const char *name;
  18. int id;
  19. struct module *owner;
  20. struct clk *parent;
  21. struct clk_ops *ops;
  22. struct kref kref;
  23. unsigned long rate;
  24. unsigned long flags;
  25. };
  26. #define CLK_ALWAYS_ENABLED (1 << 0)
  27. #define CLK_RATE_PROPAGATES (1 << 1)
  28. /* Should be defined by processor-specific code */
  29. void arch_init_clk_ops(struct clk_ops **, int type);
  30. /* arch/sh/kernel/cpu/clock.c */
  31. int clk_init(void);
  32. int __clk_enable(struct clk *);
  33. void __clk_disable(struct clk *);
  34. void clk_recalc_rate(struct clk *);
  35. int clk_register(struct clk *);
  36. void clk_unregister(struct clk *);
  37. /* the exported API, in addition to clk_set_rate */
  38. /**
  39. * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
  40. * @clk: clock source
  41. * @rate: desired clock rate in Hz
  42. * @algo_id: algorithm id to be passed down to ops->set_rate
  43. *
  44. * Returns success (0) or negative errno.
  45. */
  46. int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
  47. enum clk_sh_algo_id {
  48. NO_CHANGE = 0,
  49. IUS_N1_N1,
  50. IUS_322,
  51. IUS_522,
  52. IUS_N11,
  53. SB_N1,
  54. SB3_N1,
  55. SB3_32,
  56. SB3_43,
  57. SB3_54,
  58. BP_N1,
  59. IP_N1,
  60. };
  61. #endif /* __ASM_SH_CLOCK_H */