Taniya Das | f941978 | 2018-07-16 11:24:32 +0530 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* Copyright (c) 2014, The Linux Foundation. All rights reserved. */ |
| 3 | |
Stephen Boyd | 49fc825 | 2014-03-21 17:59:37 -0700 | [diff] [blame] | 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; |
Stephen Boyd | 5b6b749 | 2014-07-15 14:59:21 -0700 | [diff] [blame] | 11 | struct regmap; |
Stephen Boyd | 50c6a50 | 2014-09-04 13:21:50 -0700 | [diff] [blame] | 12 | struct freq_tbl; |
Georgi Djakov | 293d2e97 | 2015-03-20 18:30:26 +0200 | [diff] [blame] | 13 | struct clk_hw; |
Stephen Boyd | 49fc825 | 2014-03-21 17:59:37 -0700 | [diff] [blame] | 14 | |
Rajendra Nayak | 400d9fd | 2016-09-29 14:05:45 +0530 | [diff] [blame] | 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 | |
Stephen Boyd | 49fc825 | 2014-03-21 17:59:37 -0700 | [diff] [blame] | 22 | struct qcom_cc_desc { |
| 23 | const struct regmap_config *config; |
| 24 | struct clk_regmap **clks; |
| 25 | size_t num_clks; |
| 26 | const struct qcom_reset_map *resets; |
| 27 | size_t num_resets; |
Rajendra Nayak | 5e5cc24 | 2015-08-06 16:07:43 +0530 | [diff] [blame] | 28 | struct gdsc **gdscs; |
| 29 | size_t num_gdscs; |
Stephen Boyd | 49fc825 | 2014-03-21 17:59:37 -0700 | [diff] [blame] | 30 | }; |
| 31 | |
Abhishek Sahu | df96401 | 2017-12-13 19:55:33 +0530 | [diff] [blame] | 32 | /** |
| 33 | * struct parent_map - map table for source select configuration values |
| 34 | * @src: source |
| 35 | * @cfg: configuration value |
| 36 | */ |
| 37 | struct parent_map { |
| 38 | u8 src; |
| 39 | u8 cfg; |
| 40 | }; |
| 41 | |
Stephen Boyd | 50c6a50 | 2014-09-04 13:21:50 -0700 | [diff] [blame] | 42 | extern const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, |
| 43 | unsigned long rate); |
Rajendra Nayak | 081ba80 | 2016-11-21 12:07:11 +0530 | [diff] [blame] | 44 | extern const struct freq_tbl *qcom_find_freq_floor(const struct freq_tbl *f, |
| 45 | unsigned long rate); |
Rajendra Nayak | 400d9fd | 2016-09-29 14:05:45 +0530 | [diff] [blame] | 46 | extern void |
| 47 | qcom_pll_set_fsm_mode(struct regmap *m, u32 reg, u8 bias_count, u8 lock_count); |
Georgi Djakov | 293d2e97 | 2015-03-20 18:30:26 +0200 | [diff] [blame] | 48 | extern int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, |
| 49 | u8 src); |
Stephen Boyd | 50c6a50 | 2014-09-04 13:21:50 -0700 | [diff] [blame] | 50 | |
Stephen Boyd | ee15faf | 2015-10-26 17:11:32 -0700 | [diff] [blame] | 51 | extern int qcom_cc_register_board_clk(struct device *dev, const char *path, |
| 52 | const char *name, unsigned long rate); |
| 53 | extern int qcom_cc_register_sleep_clk(struct device *dev); |
| 54 | |
Stephen Boyd | 5b6b749 | 2014-07-15 14:59:21 -0700 | [diff] [blame] | 55 | extern struct regmap *qcom_cc_map(struct platform_device *pdev, |
| 56 | const struct qcom_cc_desc *desc); |
| 57 | extern int qcom_cc_really_probe(struct platform_device *pdev, |
| 58 | const struct qcom_cc_desc *desc, |
| 59 | struct regmap *regmap); |
Stephen Boyd | 49fc825 | 2014-03-21 17:59:37 -0700 | [diff] [blame] | 60 | extern int qcom_cc_probe(struct platform_device *pdev, |
| 61 | const struct qcom_cc_desc *desc); |
| 62 | |
Stephen Boyd | 49fc825 | 2014-03-21 17:59:37 -0700 | [diff] [blame] | 63 | #endif |