clock.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. };
  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 list_head children;
  25. struct list_head sibling; /* node for children */
  26. int usecount;
  27. unsigned long rate;
  28. unsigned long flags;
  29. unsigned long arch_flags;
  30. void *priv;
  31. };
  32. struct clk_lookup {
  33. struct list_head node;
  34. const char *dev_id;
  35. const char *con_id;
  36. struct clk *clk;
  37. };
  38. #define CLK_ENABLE_ON_INIT (1 << 0)
  39. /* Should be defined by processor-specific code */
  40. void __deprecated arch_init_clk_ops(struct clk_ops **, int type);
  41. int __init arch_clk_init(void);
  42. /* arch/sh/kernel/cpu/clock.c */
  43. int clk_init(void);
  44. unsigned long followparent_recalc(struct clk *);
  45. void recalculate_root_clocks(void);
  46. void propagate_rate(struct clk *);
  47. int clk_reparent(struct clk *child, struct clk *parent);
  48. int clk_register(struct clk *);
  49. void clk_unregister(struct clk *);
  50. /* arch/sh/kernel/cpu/clock-cpg.c */
  51. int __init __deprecated cpg_clk_init(void);
  52. /* the exported API, in addition to clk_set_rate */
  53. /**
  54. * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
  55. * @clk: clock source
  56. * @rate: desired clock rate in Hz
  57. * @algo_id: algorithm id to be passed down to ops->set_rate
  58. *
  59. * Returns success (0) or negative errno.
  60. */
  61. int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
  62. enum clk_sh_algo_id {
  63. NO_CHANGE = 0,
  64. IUS_N1_N1,
  65. IUS_322,
  66. IUS_522,
  67. IUS_N11,
  68. SB_N1,
  69. SB3_N1,
  70. SB3_32,
  71. SB3_43,
  72. SB3_54,
  73. BP_N1,
  74. IP_N1,
  75. };
  76. #endif /* __ASM_SH_CLOCK_H */