clk-pllfh.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2022 MediaTek Inc.
  4. * Author: Edward-JW Yang <edward-jw.yang@mediatek.com>
  5. */
  6. #ifndef __CLK_PLLFH_H
  7. #define __CLK_PLLFH_H
  8. #include "clk-pll.h"
  9. struct fh_pll_state {
  10. void __iomem *base;
  11. u32 fh_enable;
  12. u32 ssc_rate;
  13. };
  14. struct fh_pll_data {
  15. int pll_id;
  16. int fh_id;
  17. int fh_ver;
  18. u32 fhx_offset;
  19. u32 dds_mask;
  20. u32 slope0_value;
  21. u32 slope1_value;
  22. u32 sfstrx_en;
  23. u32 frddsx_en;
  24. u32 fhctlx_en;
  25. u32 tgl_org;
  26. u32 dvfs_tri;
  27. u32 pcwchg;
  28. u32 dt_val;
  29. u32 df_val;
  30. u32 updnlmt_shft;
  31. u32 msk_frddsx_dys;
  32. u32 msk_frddsx_dts;
  33. };
  34. struct mtk_pllfh_data {
  35. struct fh_pll_state state;
  36. const struct fh_pll_data data;
  37. };
  38. struct fh_pll_regs {
  39. void __iomem *reg_hp_en;
  40. void __iomem *reg_clk_con;
  41. void __iomem *reg_rst_con;
  42. void __iomem *reg_slope0;
  43. void __iomem *reg_slope1;
  44. void __iomem *reg_cfg;
  45. void __iomem *reg_updnlmt;
  46. void __iomem *reg_dds;
  47. void __iomem *reg_dvfs;
  48. void __iomem *reg_mon;
  49. };
  50. struct mtk_fh {
  51. struct mtk_clk_pll clk_pll;
  52. struct fh_pll_regs regs;
  53. struct mtk_pllfh_data *pllfh_data;
  54. const struct fh_operation *ops;
  55. spinlock_t *lock;
  56. };
  57. struct fh_operation {
  58. int (*hopping)(struct mtk_fh *fh, unsigned int new_dds,
  59. unsigned int postdiv);
  60. int (*ssc_enable)(struct mtk_fh *fh, u32 rate);
  61. };
  62. int mtk_clk_register_pllfhs(struct device_node *node,
  63. const struct mtk_pll_data *plls, int num_plls,
  64. struct mtk_pllfh_data *pllfhs, int num_pllfhs,
  65. struct clk_hw_onecell_data *clk_data);
  66. void mtk_clk_unregister_pllfhs(const struct mtk_pll_data *plls, int num_plls,
  67. struct mtk_pllfh_data *pllfhs, int num_fhs,
  68. struct clk_hw_onecell_data *clk_data);
  69. void fhctl_parse_dt(const u8 *compatible_node, struct mtk_pllfh_data *pllfhs,
  70. int num_pllfhs);
  71. #endif /* __CLK_PLLFH_H */