1*9c92ab61SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 29e263131SStephen Boyd /* 39e263131SStephen Boyd * Copyright (c) 2013, The Linux Foundation. All rights reserved. 49e263131SStephen Boyd */ 59e263131SStephen Boyd 69e263131SStephen Boyd #ifndef __QCOM_CLK_PLL_H__ 79e263131SStephen Boyd #define __QCOM_CLK_PLL_H__ 89e263131SStephen Boyd 99e263131SStephen Boyd #include <linux/clk-provider.h> 109e263131SStephen Boyd #include "clk-regmap.h" 119e263131SStephen Boyd 129e263131SStephen Boyd /** 13ae3669acSStephen Boyd * struct pll_freq_tbl - PLL frequency table 14ae3669acSStephen Boyd * @l: L value 15ae3669acSStephen Boyd * @m: M value 16ae3669acSStephen Boyd * @n: N value 17ae3669acSStephen Boyd * @ibits: internal values 18ae3669acSStephen Boyd */ 19ae3669acSStephen Boyd struct pll_freq_tbl { 20ae3669acSStephen Boyd unsigned long freq; 21ae3669acSStephen Boyd u16 l; 22ae3669acSStephen Boyd u16 m; 23ae3669acSStephen Boyd u16 n; 24ae3669acSStephen Boyd u32 ibits; 25ae3669acSStephen Boyd }; 26ae3669acSStephen Boyd 27ae3669acSStephen Boyd /** 289e263131SStephen Boyd * struct clk_pll - phase locked loop (PLL) 299e263131SStephen Boyd * @l_reg: L register 309e263131SStephen Boyd * @m_reg: M register 319e263131SStephen Boyd * @n_reg: N register 329e263131SStephen Boyd * @config_reg: config register 339e263131SStephen Boyd * @mode_reg: mode register 349e263131SStephen Boyd * @status_reg: status register 359e263131SStephen Boyd * @status_bit: ANDed with @status_reg to determine if PLL is enabled 36ae3669acSStephen Boyd * @freq_tbl: PLL frequency table 379e263131SStephen Boyd * @hw: handle between common and hardware-specific interfaces 389e263131SStephen Boyd */ 399e263131SStephen Boyd struct clk_pll { 409e263131SStephen Boyd u32 l_reg; 419e263131SStephen Boyd u32 m_reg; 429e263131SStephen Boyd u32 n_reg; 439e263131SStephen Boyd u32 config_reg; 449e263131SStephen Boyd u32 mode_reg; 459e263131SStephen Boyd u32 status_reg; 469e263131SStephen Boyd u8 status_bit; 47ae3669acSStephen Boyd u8 post_div_width; 48ae3669acSStephen Boyd u8 post_div_shift; 49ae3669acSStephen Boyd 50ae3669acSStephen Boyd const struct pll_freq_tbl *freq_tbl; 519e263131SStephen Boyd 529e263131SStephen Boyd struct clk_regmap clkr; 539e263131SStephen Boyd }; 549e263131SStephen Boyd 559e263131SStephen Boyd extern const struct clk_ops clk_pll_ops; 569e263131SStephen Boyd extern const struct clk_ops clk_pll_vote_ops; 57d4f76de3SGeorgi Djakov extern const struct clk_ops clk_pll_sr2_ops; 589e263131SStephen Boyd 599e263131SStephen Boyd #define to_clk_pll(_hw) container_of(to_clk_regmap(_hw), struct clk_pll, clkr) 609e263131SStephen Boyd 619e263131SStephen Boyd struct pll_config { 629e263131SStephen Boyd u16 l; 639e263131SStephen Boyd u32 m; 649e263131SStephen Boyd u32 n; 659e263131SStephen Boyd u32 vco_val; 669e263131SStephen Boyd u32 vco_mask; 679e263131SStephen Boyd u32 pre_div_val; 689e263131SStephen Boyd u32 pre_div_mask; 699e263131SStephen Boyd u32 post_div_val; 709e263131SStephen Boyd u32 post_div_mask; 719e263131SStephen Boyd u32 mn_ena_mask; 729e263131SStephen Boyd u32 main_output_mask; 739e263131SStephen Boyd u32 aux_output_mask; 749e263131SStephen Boyd }; 759e263131SStephen Boyd 76d8c25d3aSStephen Boyd void clk_pll_configure_sr(struct clk_pll *pll, struct regmap *regmap, 77d8c25d3aSStephen Boyd const struct pll_config *config, bool fsm_mode); 789e263131SStephen Boyd void clk_pll_configure_sr_hpm_lp(struct clk_pll *pll, struct regmap *regmap, 799e263131SStephen Boyd const struct pll_config *config, bool fsm_mode); 809e263131SStephen Boyd 819e263131SStephen Boyd #endif 82