clk-alpha-pll.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (c) 2015, 2018, The Linux Foundation. All rights reserved. */
  3. #ifndef __QCOM_CLK_ALPHA_PLL_H__
  4. #define __QCOM_CLK_ALPHA_PLL_H__
  5. #include <linux/clk-provider.h>
  6. #include "clk-regmap.h"
  7. /* Alpha PLL types */
  8. enum {
  9. CLK_ALPHA_PLL_TYPE_DEFAULT,
  10. CLK_ALPHA_PLL_TYPE_HUAYRA,
  11. CLK_ALPHA_PLL_TYPE_BRAMMO,
  12. CLK_ALPHA_PLL_TYPE_FABIA,
  13. CLK_ALPHA_PLL_TYPE_MAX,
  14. };
  15. enum {
  16. PLL_OFF_L_VAL,
  17. PLL_OFF_ALPHA_VAL,
  18. PLL_OFF_ALPHA_VAL_U,
  19. PLL_OFF_USER_CTL,
  20. PLL_OFF_USER_CTL_U,
  21. PLL_OFF_CONFIG_CTL,
  22. PLL_OFF_CONFIG_CTL_U,
  23. PLL_OFF_TEST_CTL,
  24. PLL_OFF_TEST_CTL_U,
  25. PLL_OFF_STATUS,
  26. PLL_OFF_OPMODE,
  27. PLL_OFF_FRAC,
  28. PLL_OFF_MAX_REGS
  29. };
  30. extern const u8 clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_MAX][PLL_OFF_MAX_REGS];
  31. struct pll_vco {
  32. unsigned long min_freq;
  33. unsigned long max_freq;
  34. u32 val;
  35. };
  36. /**
  37. * struct clk_alpha_pll - phase locked loop (PLL)
  38. * @offset: base address of registers
  39. * @vco_table: array of VCO settings
  40. * @regs: alpha pll register map (see @clk_alpha_pll_regs)
  41. * @clkr: regmap clock handle
  42. */
  43. struct clk_alpha_pll {
  44. u32 offset;
  45. const u8 *regs;
  46. const struct pll_vco *vco_table;
  47. size_t num_vco;
  48. #define SUPPORTS_OFFLINE_REQ BIT(0)
  49. #define SUPPORTS_FSM_MODE BIT(2)
  50. #define SUPPORTS_DYNAMIC_UPDATE BIT(3)
  51. u8 flags;
  52. struct clk_regmap clkr;
  53. };
  54. /**
  55. * struct clk_alpha_pll_postdiv - phase locked loop (PLL) post-divider
  56. * @offset: base address of registers
  57. * @regs: alpha pll register map (see @clk_alpha_pll_regs)
  58. * @width: width of post-divider
  59. * @post_div_shift: shift to differentiate between odd & even post-divider
  60. * @post_div_table: table with PLL odd and even post-divider settings
  61. * @num_post_div: Number of PLL post-divider settings
  62. *
  63. * @clkr: regmap clock handle
  64. */
  65. struct clk_alpha_pll_postdiv {
  66. u32 offset;
  67. u8 width;
  68. const u8 *regs;
  69. struct clk_regmap clkr;
  70. int post_div_shift;
  71. const struct clk_div_table *post_div_table;
  72. size_t num_post_div;
  73. };
  74. struct alpha_pll_config {
  75. u32 l;
  76. u32 alpha;
  77. u32 alpha_hi;
  78. u32 config_ctl_val;
  79. u32 config_ctl_hi_val;
  80. u32 main_output_mask;
  81. u32 aux_output_mask;
  82. u32 aux2_output_mask;
  83. u32 early_output_mask;
  84. u32 alpha_en_mask;
  85. u32 alpha_mode_mask;
  86. u32 pre_div_val;
  87. u32 pre_div_mask;
  88. u32 post_div_val;
  89. u32 post_div_mask;
  90. u32 vco_val;
  91. u32 vco_mask;
  92. };
  93. extern const struct clk_ops clk_alpha_pll_ops;
  94. extern const struct clk_ops clk_alpha_pll_hwfsm_ops;
  95. extern const struct clk_ops clk_alpha_pll_postdiv_ops;
  96. extern const struct clk_ops clk_alpha_pll_huayra_ops;
  97. extern const struct clk_ops clk_alpha_pll_postdiv_ro_ops;
  98. extern const struct clk_ops clk_alpha_pll_fabia_ops;
  99. extern const struct clk_ops clk_alpha_pll_fixed_fabia_ops;
  100. extern const struct clk_ops clk_alpha_pll_postdiv_fabia_ops;
  101. void clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
  102. const struct alpha_pll_config *config);
  103. void clk_fabia_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
  104. const struct alpha_pll_config *config);
  105. #endif