clock.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef __ASM_SH_CLOCK_H
  2. #define __ASM_SH_CLOCK_H
  3. #include <linux/list.h>
  4. #include <linux/seq_file.h>
  5. #include <linux/clk.h>
  6. #include <linux/err.h>
  7. struct clk;
  8. struct clk_ops {
  9. void (*init)(struct clk *clk);
  10. int (*enable)(struct clk *clk);
  11. void (*disable)(struct clk *clk);
  12. unsigned long (*recalc)(struct clk *clk);
  13. int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);
  14. int (*set_parent)(struct clk *clk, struct clk *parent);
  15. long (*round_rate)(struct clk *clk, unsigned long rate);
  16. void (*build_rate_table)(struct clk *clk);
  17. };
  18. struct clk {
  19. struct list_head node;
  20. const char *name;
  21. int id;
  22. struct module *owner;
  23. struct clk *parent;
  24. struct clk_ops *ops;
  25. struct list_head children;
  26. struct list_head sibling; /* node for children */
  27. int usecount;
  28. unsigned long rate;
  29. unsigned long flags;
  30. unsigned long arch_flags;
  31. void *priv;
  32. };
  33. struct clk_lookup {
  34. struct list_head node;
  35. const char *dev_id;
  36. const char *con_id;
  37. struct clk *clk;
  38. };
  39. #define CLK_ENABLE_ON_INIT (1 << 0)
  40. /* Should be defined by processor-specific code */
  41. void __deprecated arch_init_clk_ops(struct clk_ops **, int type);
  42. int __init arch_clk_init(void);
  43. /* arch/sh/kernel/cpu/clock.c */
  44. int clk_init(void);
  45. unsigned long followparent_recalc(struct clk *);
  46. void recalculate_root_clocks(void);
  47. void propagate_rate(struct clk *);
  48. int clk_reparent(struct clk *child, struct clk *parent);
  49. int clk_register(struct clk *);
  50. void clk_unregister(struct clk *);
  51. /* arch/sh/kernel/cpu/clock-cpg.c */
  52. int __init __deprecated cpg_clk_init(void);
  53. /* the exported API, in addition to clk_set_rate */
  54. /**
  55. * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
  56. * @clk: clock source
  57. * @rate: desired clock rate in Hz
  58. * @algo_id: algorithm id to be passed down to ops->set_rate
  59. *
  60. * Returns success (0) or negative errno.
  61. */
  62. int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
  63. enum clk_sh_algo_id {
  64. NO_CHANGE = 0,
  65. IUS_N1_N1,
  66. IUS_322,
  67. IUS_522,
  68. IUS_N11,
  69. SB_N1,
  70. SB3_N1,
  71. SB3_32,
  72. SB3_43,
  73. SB3_54,
  74. BP_N1,
  75. IP_N1,
  76. };
  77. #endif /* __ASM_SH_CLOCK_H */