1f9419783STaniya Das /* SPDX-License-Identifier: GPL-2.0 */ 2f9419783STaniya Das /* Copyright (c) 2014, The Linux Foundation. All rights reserved. */ 3f9419783STaniya Das 449fc825fSStephen Boyd #ifndef __QCOM_CLK_COMMON_H__ 549fc825fSStephen Boyd #define __QCOM_CLK_COMMON_H__ 649fc825fSStephen Boyd 749fc825fSStephen Boyd struct platform_device; 849fc825fSStephen Boyd struct regmap_config; 949fc825fSStephen Boyd struct clk_regmap; 1049fc825fSStephen Boyd struct qcom_reset_map; 115b6b7490SStephen Boyd struct regmap; 1250c6a503SStephen Boyd struct freq_tbl; 13293d2e97SGeorgi Djakov struct clk_hw; 1449fc825fSStephen Boyd 15400d9fdaSRajendra Nayak #define PLL_LOCK_COUNT_SHIFT 8 16400d9fdaSRajendra Nayak #define PLL_LOCK_COUNT_MASK 0x3f 17400d9fdaSRajendra Nayak #define PLL_BIAS_COUNT_SHIFT 14 18400d9fdaSRajendra Nayak #define PLL_BIAS_COUNT_MASK 0x3f 19400d9fdaSRajendra Nayak #define PLL_VOTE_FSM_ENA BIT(20) 20400d9fdaSRajendra Nayak #define PLL_VOTE_FSM_RESET BIT(21) 21400d9fdaSRajendra Nayak 2249fc825fSStephen Boyd struct qcom_cc_desc { 2349fc825fSStephen Boyd const struct regmap_config *config; 2449fc825fSStephen Boyd struct clk_regmap **clks; 2549fc825fSStephen Boyd size_t num_clks; 2649fc825fSStephen Boyd const struct qcom_reset_map *resets; 2749fc825fSStephen Boyd size_t num_resets; 285e5cc241SRajendra Nayak struct gdsc **gdscs; 295e5cc241SRajendra Nayak size_t num_gdscs; 30760be658SJeffrey Hugo struct clk_hw **clk_hws; 31760be658SJeffrey Hugo size_t num_clk_hws; 3249fc825fSStephen Boyd }; 3349fc825fSStephen Boyd 34df964016SAbhishek Sahu /** 35df964016SAbhishek Sahu * struct parent_map - map table for source select configuration values 36df964016SAbhishek Sahu * @src: source 37df964016SAbhishek Sahu * @cfg: configuration value 38df964016SAbhishek Sahu */ 39df964016SAbhishek Sahu struct parent_map { 40df964016SAbhishek Sahu u8 src; 41df964016SAbhishek Sahu u8 cfg; 42df964016SAbhishek Sahu }; 43df964016SAbhishek Sahu 4450c6a503SStephen Boyd extern const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, 4550c6a503SStephen Boyd unsigned long rate); 46081ba802SRajendra Nayak extern const struct freq_tbl *qcom_find_freq_floor(const struct freq_tbl *f, 47081ba802SRajendra Nayak unsigned long rate); 48400d9fdaSRajendra Nayak extern void 49400d9fdaSRajendra Nayak qcom_pll_set_fsm_mode(struct regmap *m, u32 reg, u8 bias_count, u8 lock_count); 50293d2e97SGeorgi Djakov extern int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, 51293d2e97SGeorgi Djakov u8 src); 52*9a61f813SDmitry Baryshkov extern int qcom_find_cfg_index(struct clk_hw *hw, const struct parent_map *map, 53*9a61f813SDmitry Baryshkov u8 cfg); 5450c6a503SStephen Boyd 55ee15faffSStephen Boyd extern int qcom_cc_register_board_clk(struct device *dev, const char *path, 56ee15faffSStephen Boyd const char *name, unsigned long rate); 57ee15faffSStephen Boyd extern int qcom_cc_register_sleep_clk(struct device *dev); 58ee15faffSStephen Boyd 595b6b7490SStephen Boyd extern struct regmap *qcom_cc_map(struct platform_device *pdev, 605b6b7490SStephen Boyd const struct qcom_cc_desc *desc); 615b6b7490SStephen Boyd extern int qcom_cc_really_probe(struct platform_device *pdev, 625b6b7490SStephen Boyd const struct qcom_cc_desc *desc, 635b6b7490SStephen Boyd struct regmap *regmap); 6449fc825fSStephen Boyd extern int qcom_cc_probe(struct platform_device *pdev, 6549fc825fSStephen Boyd const struct qcom_cc_desc *desc); 6675e0a1e3SGovind Singh extern int qcom_cc_probe_by_index(struct platform_device *pdev, int index, 6775e0a1e3SGovind Singh const struct qcom_cc_desc *desc); 6849fc825fSStephen Boyd 6949fc825fSStephen Boyd #endif 70