18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* Copyright (c) 2014, The Linux Foundation. All rights reserved. */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifndef __QCOM_CLK_COMMON_H__ 58c2ecf20Sopenharmony_ci#define __QCOM_CLK_COMMON_H__ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_cistruct platform_device; 88c2ecf20Sopenharmony_cistruct regmap_config; 98c2ecf20Sopenharmony_cistruct clk_regmap; 108c2ecf20Sopenharmony_cistruct qcom_reset_map; 118c2ecf20Sopenharmony_cistruct regmap; 128c2ecf20Sopenharmony_cistruct freq_tbl; 138c2ecf20Sopenharmony_cistruct clk_hw; 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define PLL_LOCK_COUNT_SHIFT 8 168c2ecf20Sopenharmony_ci#define PLL_LOCK_COUNT_MASK 0x3f 178c2ecf20Sopenharmony_ci#define PLL_BIAS_COUNT_SHIFT 14 188c2ecf20Sopenharmony_ci#define PLL_BIAS_COUNT_MASK 0x3f 198c2ecf20Sopenharmony_ci#define PLL_VOTE_FSM_ENA BIT(20) 208c2ecf20Sopenharmony_ci#define PLL_VOTE_FSM_RESET BIT(21) 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_cistruct qcom_cc_desc { 238c2ecf20Sopenharmony_ci const struct regmap_config *config; 248c2ecf20Sopenharmony_ci struct clk_regmap **clks; 258c2ecf20Sopenharmony_ci size_t num_clks; 268c2ecf20Sopenharmony_ci const struct qcom_reset_map *resets; 278c2ecf20Sopenharmony_ci size_t num_resets; 288c2ecf20Sopenharmony_ci struct gdsc **gdscs; 298c2ecf20Sopenharmony_ci size_t num_gdscs; 308c2ecf20Sopenharmony_ci struct clk_hw **clk_hws; 318c2ecf20Sopenharmony_ci size_t num_clk_hws; 328c2ecf20Sopenharmony_ci}; 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci/** 358c2ecf20Sopenharmony_ci * struct parent_map - map table for source select configuration values 368c2ecf20Sopenharmony_ci * @src: source 378c2ecf20Sopenharmony_ci * @cfg: configuration value 388c2ecf20Sopenharmony_ci */ 398c2ecf20Sopenharmony_cistruct parent_map { 408c2ecf20Sopenharmony_ci u8 src; 418c2ecf20Sopenharmony_ci u8 cfg; 428c2ecf20Sopenharmony_ci}; 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciextern const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, 458c2ecf20Sopenharmony_ci unsigned long rate); 468c2ecf20Sopenharmony_ciextern const struct freq_tbl *qcom_find_freq_floor(const struct freq_tbl *f, 478c2ecf20Sopenharmony_ci unsigned long rate); 488c2ecf20Sopenharmony_ciextern void 498c2ecf20Sopenharmony_ciqcom_pll_set_fsm_mode(struct regmap *m, u32 reg, u8 bias_count, u8 lock_count); 508c2ecf20Sopenharmony_ciextern int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, 518c2ecf20Sopenharmony_ci u8 src); 528c2ecf20Sopenharmony_ciextern int qcom_find_cfg_index(struct clk_hw *hw, const struct parent_map *map, 538c2ecf20Sopenharmony_ci u8 cfg); 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ciextern int qcom_cc_register_board_clk(struct device *dev, const char *path, 568c2ecf20Sopenharmony_ci const char *name, unsigned long rate); 578c2ecf20Sopenharmony_ciextern int qcom_cc_register_sleep_clk(struct device *dev); 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ciextern struct regmap *qcom_cc_map(struct platform_device *pdev, 608c2ecf20Sopenharmony_ci const struct qcom_cc_desc *desc); 618c2ecf20Sopenharmony_ciextern int qcom_cc_really_probe(struct platform_device *pdev, 628c2ecf20Sopenharmony_ci const struct qcom_cc_desc *desc, 638c2ecf20Sopenharmony_ci struct regmap *regmap); 648c2ecf20Sopenharmony_ciextern int qcom_cc_probe(struct platform_device *pdev, 658c2ecf20Sopenharmony_ci const struct qcom_cc_desc *desc); 668c2ecf20Sopenharmony_ciextern int qcom_cc_probe_by_index(struct platform_device *pdev, int index, 678c2ecf20Sopenharmony_ci const struct qcom_cc_desc *desc); 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#endif 70