18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2013, The Linux Foundation. All rights reserved. 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#ifndef __QCOM_CLK_PLL_H__ 78c2ecf20Sopenharmony_ci#define __QCOM_CLK_PLL_H__ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/clk-provider.h> 108c2ecf20Sopenharmony_ci#include "clk-regmap.h" 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci/** 138c2ecf20Sopenharmony_ci * struct pll_freq_tbl - PLL frequency table 148c2ecf20Sopenharmony_ci * @l: L value 158c2ecf20Sopenharmony_ci * @m: M value 168c2ecf20Sopenharmony_ci * @n: N value 178c2ecf20Sopenharmony_ci * @ibits: internal values 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_cistruct pll_freq_tbl { 208c2ecf20Sopenharmony_ci unsigned long freq; 218c2ecf20Sopenharmony_ci u16 l; 228c2ecf20Sopenharmony_ci u16 m; 238c2ecf20Sopenharmony_ci u16 n; 248c2ecf20Sopenharmony_ci u32 ibits; 258c2ecf20Sopenharmony_ci}; 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/** 288c2ecf20Sopenharmony_ci * struct clk_pll - phase locked loop (PLL) 298c2ecf20Sopenharmony_ci * @l_reg: L register 308c2ecf20Sopenharmony_ci * @m_reg: M register 318c2ecf20Sopenharmony_ci * @n_reg: N register 328c2ecf20Sopenharmony_ci * @config_reg: config register 338c2ecf20Sopenharmony_ci * @mode_reg: mode register 348c2ecf20Sopenharmony_ci * @status_reg: status register 358c2ecf20Sopenharmony_ci * @status_bit: ANDed with @status_reg to determine if PLL is enabled 368c2ecf20Sopenharmony_ci * @freq_tbl: PLL frequency table 378c2ecf20Sopenharmony_ci * @hw: handle between common and hardware-specific interfaces 388c2ecf20Sopenharmony_ci */ 398c2ecf20Sopenharmony_cistruct clk_pll { 408c2ecf20Sopenharmony_ci u32 l_reg; 418c2ecf20Sopenharmony_ci u32 m_reg; 428c2ecf20Sopenharmony_ci u32 n_reg; 438c2ecf20Sopenharmony_ci u32 config_reg; 448c2ecf20Sopenharmony_ci u32 mode_reg; 458c2ecf20Sopenharmony_ci u32 status_reg; 468c2ecf20Sopenharmony_ci u8 status_bit; 478c2ecf20Sopenharmony_ci u8 post_div_width; 488c2ecf20Sopenharmony_ci u8 post_div_shift; 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci const struct pll_freq_tbl *freq_tbl; 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci struct clk_regmap clkr; 538c2ecf20Sopenharmony_ci}; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ciextern const struct clk_ops clk_pll_ops; 568c2ecf20Sopenharmony_ciextern const struct clk_ops clk_pll_vote_ops; 578c2ecf20Sopenharmony_ciextern const struct clk_ops clk_pll_sr2_ops; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#define to_clk_pll(_hw) container_of(to_clk_regmap(_hw), struct clk_pll, clkr) 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cistruct pll_config { 628c2ecf20Sopenharmony_ci u16 l; 638c2ecf20Sopenharmony_ci u32 m; 648c2ecf20Sopenharmony_ci u32 n; 658c2ecf20Sopenharmony_ci u32 vco_val; 668c2ecf20Sopenharmony_ci u32 vco_mask; 678c2ecf20Sopenharmony_ci u32 pre_div_val; 688c2ecf20Sopenharmony_ci u32 pre_div_mask; 698c2ecf20Sopenharmony_ci u32 post_div_val; 708c2ecf20Sopenharmony_ci u32 post_div_mask; 718c2ecf20Sopenharmony_ci u32 mn_ena_mask; 728c2ecf20Sopenharmony_ci u32 main_output_mask; 738c2ecf20Sopenharmony_ci u32 aux_output_mask; 748c2ecf20Sopenharmony_ci}; 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_civoid clk_pll_configure_sr(struct clk_pll *pll, struct regmap *regmap, 778c2ecf20Sopenharmony_ci const struct pll_config *config, bool fsm_mode); 788c2ecf20Sopenharmony_civoid clk_pll_configure_sr_hpm_lp(struct clk_pll *pll, struct regmap *regmap, 798c2ecf20Sopenharmony_ci const struct pll_config *config, bool fsm_mode); 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#endif 82