2019-05-29 14:17:56 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2014-01-15 18:47:24 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __QCOM_CLK_PLL_H__
|
|
|
|
#define __QCOM_CLK_PLL_H__
|
|
|
|
|
|
|
|
#include <linux/clk-provider.h>
|
|
|
|
#include "clk-regmap.h"
|
|
|
|
|
2014-04-28 22:58:11 +00:00
|
|
|
/**
|
|
|
|
* struct pll_freq_tbl - PLL frequency table
|
|
|
|
* @l: L value
|
|
|
|
* @m: M value
|
|
|
|
* @n: N value
|
|
|
|
* @ibits: internal values
|
|
|
|
*/
|
|
|
|
struct pll_freq_tbl {
|
|
|
|
unsigned long freq;
|
|
|
|
u16 l;
|
|
|
|
u16 m;
|
|
|
|
u16 n;
|
|
|
|
u32 ibits;
|
|
|
|
};
|
|
|
|
|
2014-01-15 18:47:24 +00:00
|
|
|
/**
|
|
|
|
* struct clk_pll - phase locked loop (PLL)
|
|
|
|
* @l_reg: L register
|
|
|
|
* @m_reg: M register
|
|
|
|
* @n_reg: N register
|
|
|
|
* @config_reg: config register
|
|
|
|
* @mode_reg: mode register
|
|
|
|
* @status_reg: status register
|
|
|
|
* @status_bit: ANDed with @status_reg to determine if PLL is enabled
|
2014-04-28 22:58:11 +00:00
|
|
|
* @freq_tbl: PLL frequency table
|
2014-01-15 18:47:24 +00:00
|
|
|
* @hw: handle between common and hardware-specific interfaces
|
|
|
|
*/
|
|
|
|
struct clk_pll {
|
|
|
|
u32 l_reg;
|
|
|
|
u32 m_reg;
|
|
|
|
u32 n_reg;
|
|
|
|
u32 config_reg;
|
|
|
|
u32 mode_reg;
|
|
|
|
u32 status_reg;
|
|
|
|
u8 status_bit;
|
2014-04-28 22:58:11 +00:00
|
|
|
u8 post_div_width;
|
|
|
|
u8 post_div_shift;
|
|
|
|
|
|
|
|
const struct pll_freq_tbl *freq_tbl;
|
2014-01-15 18:47:24 +00:00
|
|
|
|
|
|
|
struct clk_regmap clkr;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct clk_ops clk_pll_ops;
|
|
|
|
extern const struct clk_ops clk_pll_vote_ops;
|
2015-06-12 08:41:55 +00:00
|
|
|
extern const struct clk_ops clk_pll_sr2_ops;
|
2014-01-15 18:47:24 +00:00
|
|
|
|
|
|
|
#define to_clk_pll(_hw) container_of(to_clk_regmap(_hw), struct clk_pll, clkr)
|
|
|
|
|
|
|
|
struct pll_config {
|
|
|
|
u16 l;
|
|
|
|
u32 m;
|
|
|
|
u32 n;
|
|
|
|
u32 vco_val;
|
|
|
|
u32 vco_mask;
|
|
|
|
u32 pre_div_val;
|
|
|
|
u32 pre_div_mask;
|
|
|
|
u32 post_div_val;
|
|
|
|
u32 post_div_mask;
|
|
|
|
u32 mn_ena_mask;
|
|
|
|
u32 main_output_mask;
|
|
|
|
u32 aux_output_mask;
|
|
|
|
};
|
|
|
|
|
2014-07-15 21:48:41 +00:00
|
|
|
void clk_pll_configure_sr(struct clk_pll *pll, struct regmap *regmap,
|
|
|
|
const struct pll_config *config, bool fsm_mode);
|
2014-01-15 18:47:24 +00:00
|
|
|
void clk_pll_configure_sr_hpm_lp(struct clk_pll *pll, struct regmap *regmap,
|
|
|
|
const struct pll_config *config, bool fsm_mode);
|
|
|
|
|
|
|
|
#endif
|