clock.h 780 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef CLOCK_H
  2. #define CLOCK_H
  3. unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk);
  4. extern struct sh_clk_ops shmobile_fixed_ratio_clk_ops;
  5. /* clock ratio */
  6. struct clk_ratio {
  7. int mul;
  8. int div;
  9. };
  10. #define SH_CLK_RATIO(name, m, d) \
  11. static struct clk_ratio name ##_ratio = { \
  12. .mul = m, \
  13. .div = d, \
  14. }
  15. #define SH_FIXED_RATIO_CLKg(name, p, r) \
  16. struct clk name = { \
  17. .parent = &p, \
  18. .ops = &shmobile_fixed_ratio_clk_ops,\
  19. .priv = &r ## _ratio, \
  20. }
  21. #define SH_FIXED_RATIO_CLK(name, p, r) \
  22. static SH_FIXED_RATIO_CLKg(name, p, r)
  23. #define SH_FIXED_RATIO_CLK_SET(name, p, m, d) \
  24. SH_CLK_RATIO(name, m, d); \
  25. SH_FIXED_RATIO_CLK(name, p, name)
  26. #define SH_CLK_SET_RATIO(p, m, d) \
  27. do { \
  28. (p)->mul = m; \
  29. (p)->div = d; \
  30. } while (0)
  31. #endif