clock.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef CLOCK_H
  2. #define CLOCK_H
  3. #ifdef CONFIG_COMMON_CLK
  4. /* temporary clock configuration helper for platform devices */
  5. struct clk_name {
  6. const char *clk;
  7. const char *con_id;
  8. const char *dev_id;
  9. };
  10. void shmobile_clk_workaround(const struct clk_name *clks, int nr_clks,
  11. bool enable);
  12. #else /* CONFIG_COMMON_CLK */
  13. /* legacy clock implementation */
  14. struct clk;
  15. unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk);
  16. extern struct sh_clk_ops shmobile_fixed_ratio_clk_ops;
  17. /* clock ratio */
  18. struct clk_ratio {
  19. int mul;
  20. int div;
  21. };
  22. #define SH_CLK_RATIO(name, m, d) \
  23. static struct clk_ratio name ##_ratio = { \
  24. .mul = m, \
  25. .div = d, \
  26. }
  27. #define SH_FIXED_RATIO_CLKg(name, p, r) \
  28. struct clk name = { \
  29. .parent = &p, \
  30. .ops = &shmobile_fixed_ratio_clk_ops,\
  31. .priv = &r ## _ratio, \
  32. }
  33. #define SH_FIXED_RATIO_CLK(name, p, r) \
  34. static SH_FIXED_RATIO_CLKg(name, p, r)
  35. #define SH_FIXED_RATIO_CLK_SET(name, p, m, d) \
  36. SH_CLK_RATIO(name, m, d); \
  37. SH_FIXED_RATIO_CLK(name, p, name)
  38. #define SH_CLK_SET_RATIO(p, m, d) \
  39. do { \
  40. (p)->mul = m; \
  41. (p)->div = d; \
  42. } while (0)
  43. #endif /* CONFIG_COMMON_CLK */
  44. #endif