1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright (c) 2014, The Linux Foundation. All rights reserved. */ 3 4 #ifndef __QCOM_CLK_COMMON_H__ 5 #define __QCOM_CLK_COMMON_H__ 6 7 struct platform_device; 8 struct regmap_config; 9 struct clk_regmap; 10 struct qcom_reset_map; 11 struct regmap; 12 struct freq_tbl; 13 struct clk_hw; 14 15 #define PLL_LOCK_COUNT_SHIFT 8 16 #define PLL_LOCK_COUNT_MASK 0x3f 17 #define PLL_BIAS_COUNT_SHIFT 14 18 #define PLL_BIAS_COUNT_MASK 0x3f 19 #define PLL_VOTE_FSM_ENA BIT(20) 20 #define PLL_VOTE_FSM_RESET BIT(21) 21 22 struct qcom_icc_hws_data { 23 int master_id; 24 int slave_id; 25 int clk_id; 26 }; 27 28 struct qcom_cc_desc { 29 const struct regmap_config *config; 30 struct clk_regmap **clks; 31 size_t num_clks; 32 const struct qcom_reset_map *resets; 33 size_t num_resets; 34 struct gdsc **gdscs; 35 size_t num_gdscs; 36 struct clk_hw **clk_hws; 37 size_t num_clk_hws; 38 struct qcom_icc_hws_data *icc_hws; 39 size_t num_icc_hws; 40 unsigned int icc_first_node_id; 41 }; 42 43 /** 44 * struct parent_map - map table for source select configuration values 45 * @src: source 46 * @cfg: configuration value 47 */ 48 struct parent_map { 49 u8 src; 50 u8 cfg; 51 }; 52 53 extern const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, 54 unsigned long rate); 55 extern const struct freq_tbl *qcom_find_freq_floor(const struct freq_tbl *f, 56 unsigned long rate); 57 extern const struct freq_multi_tbl *qcom_find_freq_multi(const struct freq_multi_tbl *f, 58 unsigned long rate); 59 extern void 60 qcom_pll_set_fsm_mode(struct regmap *m, u32 reg, u8 bias_count, u8 lock_count); 61 extern int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, 62 u8 src); 63 extern int qcom_find_cfg_index(struct clk_hw *hw, const struct parent_map *map, 64 u8 cfg); 65 66 extern int qcom_cc_register_board_clk(struct device *dev, const char *path, 67 const char *name, unsigned long rate); 68 extern int qcom_cc_register_sleep_clk(struct device *dev); 69 70 extern struct regmap *qcom_cc_map(struct platform_device *pdev, 71 const struct qcom_cc_desc *desc); 72 extern int qcom_cc_really_probe(struct device *dev, 73 const struct qcom_cc_desc *desc, 74 struct regmap *regmap); 75 extern int qcom_cc_probe(struct platform_device *pdev, 76 const struct qcom_cc_desc *desc); 77 extern int qcom_cc_probe_by_index(struct platform_device *pdev, int index, 78 const struct qcom_cc_desc *desc); 79 80 #endif 81