clk-alpha-pll.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (c) 2015, The Linux Foundation. All rights reserved.
  3. *
  4. * This software is licensed under the terms of the GNU General Public
  5. * License version 2, as published by the Free Software Foundation, and
  6. * may be copied, distributed, and modified under those terms.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef __QCOM_CLK_ALPHA_PLL_H__
  14. #define __QCOM_CLK_ALPHA_PLL_H__
  15. #include <linux/clk-provider.h>
  16. #include "clk-regmap.h"
  17. struct pll_vco {
  18. unsigned long min_freq;
  19. unsigned long max_freq;
  20. u32 val;
  21. };
  22. /**
  23. * struct clk_alpha_pll - phase locked loop (PLL)
  24. * @offset: base address of registers
  25. * @vco_table: array of VCO settings
  26. * @clkr: regmap clock handle
  27. */
  28. struct clk_alpha_pll {
  29. u32 offset;
  30. const struct pll_vco *vco_table;
  31. size_t num_vco;
  32. #define SUPPORTS_OFFLINE_REQ BIT(0)
  33. #define SUPPORTS_16BIT_ALPHA BIT(1)
  34. #define SUPPORTS_FSM_MODE BIT(2)
  35. u8 flags;
  36. struct clk_regmap clkr;
  37. };
  38. /**
  39. * struct clk_alpha_pll_postdiv - phase locked loop (PLL) post-divider
  40. * @offset: base address of registers
  41. * @width: width of post-divider
  42. * @clkr: regmap clock handle
  43. */
  44. struct clk_alpha_pll_postdiv {
  45. u32 offset;
  46. u8 width;
  47. struct clk_regmap clkr;
  48. };
  49. struct alpha_pll_config {
  50. u32 l;
  51. u32 alpha;
  52. u32 config_ctl_val;
  53. u32 config_ctl_hi_val;
  54. u32 main_output_mask;
  55. u32 aux_output_mask;
  56. u32 aux2_output_mask;
  57. u32 early_output_mask;
  58. u32 pre_div_val;
  59. u32 pre_div_mask;
  60. u32 post_div_val;
  61. u32 post_div_mask;
  62. u32 vco_val;
  63. u32 vco_mask;
  64. };
  65. extern const struct clk_ops clk_alpha_pll_ops;
  66. extern const struct clk_ops clk_alpha_pll_hwfsm_ops;
  67. extern const struct clk_ops clk_alpha_pll_postdiv_ops;
  68. void clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
  69. const struct alpha_pll_config *config);
  70. #endif