clk-pll.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2013, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __QCOM_CLK_PLL_H__
  6. #define __QCOM_CLK_PLL_H__
  7. #include <linux/clk-provider.h>
  8. #include "clk-regmap.h"
  9. /**
  10. * struct pll_freq_tbl - PLL frequency table
  11. * @l: L value
  12. * @m: M value
  13. * @n: N value
  14. * @ibits: internal values
  15. */
  16. struct pll_freq_tbl {
  17. unsigned long freq;
  18. u16 l;
  19. u16 m;
  20. u16 n;
  21. u32 ibits;
  22. };
  23. /**
  24. * struct clk_pll - phase locked loop (PLL)
  25. * @l_reg: L register
  26. * @m_reg: M register
  27. * @n_reg: N register
  28. * @config_reg: config register
  29. * @mode_reg: mode register
  30. * @status_reg: status register
  31. * @status_bit: ANDed with @status_reg to determine if PLL is enabled
  32. * @freq_tbl: PLL frequency table
  33. * @hw: handle between common and hardware-specific interfaces
  34. */
  35. struct clk_pll {
  36. u32 l_reg;
  37. u32 m_reg;
  38. u32 n_reg;
  39. u32 config_reg;
  40. u32 mode_reg;
  41. u32 status_reg;
  42. u8 status_bit;
  43. u8 post_div_width;
  44. u8 post_div_shift;
  45. const struct pll_freq_tbl *freq_tbl;
  46. struct clk_regmap clkr;
  47. };
  48. extern const struct clk_ops clk_pll_ops;
  49. extern const struct clk_ops clk_pll_vote_ops;
  50. extern const struct clk_ops clk_pll_sr2_ops;
  51. #define to_clk_pll(_hw) container_of(to_clk_regmap(_hw), struct clk_pll, clkr)
  52. struct pll_config {
  53. u16 l;
  54. u32 m;
  55. u32 n;
  56. u32 vco_val;
  57. u32 vco_mask;
  58. u32 pre_div_val;
  59. u32 pre_div_mask;
  60. u32 post_div_val;
  61. u32 post_div_mask;
  62. u32 mn_ena_mask;
  63. u32 main_output_mask;
  64. u32 aux_output_mask;
  65. };
  66. void clk_pll_configure_sr(struct clk_pll *pll, struct regmap *regmap,
  67. const struct pll_config *config, bool fsm_mode);
  68. void clk_pll_configure_sr_hpm_lp(struct clk_pll *pll, struct regmap *regmap,
  69. const struct pll_config *config, bool fsm_mode);
  70. #endif