pll.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021 TOSHIBA CORPORATION
  4. * Copyright (c) 2021 Toshiba Electronic Devices & Storage Corporation
  5. *
  6. * Nobuhiro Iwamatsu <[email protected]>
  7. */
  8. #ifndef _VISCONTI_PLL_H_
  9. #define _VISCONTI_PLL_H_
  10. #include <linux/clk-provider.h>
  11. #include <linux/regmap.h>
  12. #include <linux/spinlock.h>
  13. struct visconti_pll_provider {
  14. void __iomem *reg_base;
  15. struct device_node *node;
  16. /* Must be last */
  17. struct clk_hw_onecell_data clk_data;
  18. };
  19. #define VISCONTI_PLL_RATE(_rate, _dacen, _dsmen, \
  20. _refdiv, _intin, _fracin, _postdiv1, _postdiv2) \
  21. { \
  22. .rate = _rate, \
  23. .dacen = _dacen, \
  24. .dsmen = _dsmen, \
  25. .refdiv = _refdiv, \
  26. .intin = _intin, \
  27. .fracin = _fracin, \
  28. .postdiv1 = _postdiv1, \
  29. .postdiv2 = _postdiv2 \
  30. }
  31. struct visconti_pll_rate_table {
  32. unsigned long rate;
  33. unsigned int dacen;
  34. unsigned int dsmen;
  35. unsigned int refdiv;
  36. unsigned long intin;
  37. unsigned long fracin;
  38. unsigned int postdiv1;
  39. unsigned int postdiv2;
  40. };
  41. struct visconti_pll_info {
  42. unsigned int id;
  43. const char *name;
  44. const char *parent;
  45. unsigned long base_reg;
  46. const struct visconti_pll_rate_table *rate_table;
  47. };
  48. struct visconti_pll_provider * __init visconti_init_pll(struct device_node *np,
  49. void __iomem *base,
  50. unsigned long nr_plls);
  51. void visconti_register_plls(struct visconti_pll_provider *ctx,
  52. const struct visconti_pll_info *list,
  53. unsigned int nr_plls, spinlock_t *lock);
  54. #endif /* _VISCONTI_PLL_H_ */