clock.h 827 B

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