clk-alpha-pll.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. /* Alpha PLL types */
  18. enum {
  19. CLK_ALPHA_PLL_TYPE_DEFAULT,
  20. CLK_ALPHA_PLL_TYPE_HUAYRA,
  21. CLK_ALPHA_PLL_TYPE_BRAMMO,
  22. CLK_ALPHA_PLL_TYPE_MAX,
  23. };
  24. enum {
  25. PLL_OFF_L_VAL,
  26. PLL_OFF_ALPHA_VAL,
  27. PLL_OFF_ALPHA_VAL_U,
  28. PLL_OFF_USER_CTL,
  29. PLL_OFF_USER_CTL_U,
  30. PLL_OFF_CONFIG_CTL,
  31. PLL_OFF_CONFIG_CTL_U,
  32. PLL_OFF_TEST_CTL,
  33. PLL_OFF_TEST_CTL_U,
  34. PLL_OFF_STATUS,
  35. PLL_OFF_MAX_REGS
  36. };
  37. extern const u8 clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_MAX][PLL_OFF_MAX_REGS];
  38. struct pll_vco {
  39. unsigned long min_freq;
  40. unsigned long max_freq;
  41. u32 val;
  42. };
  43. /**
  44. * struct clk_alpha_pll - phase locked loop (PLL)
  45. * @offset: base address of registers
  46. * @vco_table: array of VCO settings
  47. * @regs: alpha pll register map (see @clk_alpha_pll_regs)
  48. * @clkr: regmap clock handle
  49. */
  50. struct clk_alpha_pll {
  51. u32 offset;
  52. const u8 *regs;
  53. const struct pll_vco *vco_table;
  54. size_t num_vco;
  55. #define SUPPORTS_OFFLINE_REQ BIT(0)
  56. #define SUPPORTS_FSM_MODE BIT(2)
  57. #define SUPPORTS_DYNAMIC_UPDATE BIT(3)
  58. u8 flags;
  59. struct clk_regmap clkr;
  60. };
  61. /**
  62. * struct clk_alpha_pll_postdiv - phase locked loop (PLL) post-divider
  63. * @offset: base address of registers
  64. * @regs: alpha pll register map (see @clk_alpha_pll_regs)
  65. * @width: width of post-divider
  66. * @clkr: regmap clock handle
  67. */
  68. struct clk_alpha_pll_postdiv {
  69. u32 offset;
  70. u8 width;
  71. const u8 *regs;
  72. struct clk_regmap clkr;
  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. void clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
  99. const struct alpha_pll_config *config);
  100. #endif