/* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2013, 2018, The Linux Foundation. All rights reserved. */ #ifndef __QCOM_CLK_RCG_H__ #define __QCOM_CLK_RCG_H__ #include <linux/clk-provider.h> #include "clk-regmap.h" #define F(f, s, h, m, n) … struct freq_tbl { … }; #define C(s, h, m, n) … #define FM(f, confs) … #define FMS(f, s, h, m, n) … struct freq_conf { … }; struct freq_multi_tbl { … }; /** * struct mn - M/N:D counter * @mnctr_en_bit: bit to enable mn counter * @mnctr_reset_bit: bit to assert mn counter reset * @mnctr_mode_shift: lowest bit of mn counter mode field * @n_val_shift: lowest bit of n value field * @m_val_shift: lowest bit of m value field * @width: number of bits in m/n/d values * @reset_in_cc: true if the mnctr_reset_bit is in the CC register */ struct mn { … }; /** * struct pre_div - pre-divider * @pre_div_shift: lowest bit of pre divider field * @pre_div_width: number of bits in predivider */ struct pre_div { … }; /** * struct src_sel - source selector * @src_sel_shift: lowest bit of source selection field * @parent_map: map from software's parent index to hardware's src_sel field */ struct src_sel { … }; /** * struct clk_rcg - root clock generator * * @ns_reg: NS register * @md_reg: MD register * @mn: mn counter * @p: pre divider * @s: source selector * @freq_tbl: frequency table * @clkr: regmap clock handle * @lock: register lock */ struct clk_rcg { … }; extern const struct clk_ops clk_rcg_ops; extern const struct clk_ops clk_rcg_floor_ops; extern const struct clk_ops clk_rcg_bypass_ops; extern const struct clk_ops clk_rcg_bypass2_ops; extern const struct clk_ops clk_rcg_pixel_ops; extern const struct clk_ops clk_rcg_esc_ops; extern const struct clk_ops clk_rcg_lcc_ops; #define to_clk_rcg(_hw) … /** * struct clk_dyn_rcg - root clock generator with glitch free mux * * @mux_sel_bit: bit to switch glitch free mux * @ns_reg: NS0 and NS1 register * @md_reg: MD0 and MD1 register * @bank_reg: register to XOR @mux_sel_bit into to switch glitch free mux * @mn: mn counter (banked) * @s: source selector (banked) * @freq_tbl: frequency table * @clkr: regmap clock handle * @lock: register lock */ struct clk_dyn_rcg { … }; extern const struct clk_ops clk_dyn_rcg_ops; #define to_clk_dyn_rcg(_hw) … /** * struct clk_rcg2 - root clock generator * * @cmd_rcgr: corresponds to *_CMD_RCGR * @mnd_width: number of bits in m/n/d values * @hid_width: number of bits in half integer divider * @safe_src_index: safe src index value * @parent_map: map from software's parent index to hardware's src_sel field * @freq_tbl: frequency table * @freq_multi_tbl: frequency table for clocks reachable with multiple RCGs conf * @clkr: regmap clock handle * @cfg_off: defines the cfg register offset from the CMD_RCGR + CFG_REG * @parked_cfg: cached value of the CFG register for parked RCGs * @hw_clk_ctrl: whether to enable hardware clock control */ struct clk_rcg2 { … }; #define to_clk_rcg2(_hw) … struct clk_rcg2_gfx3d { … }; #define to_clk_rcg2_gfx3d(_hw) … extern const struct clk_ops clk_rcg2_ops; extern const struct clk_ops clk_rcg2_floor_ops; extern const struct clk_ops clk_rcg2_fm_ops; extern const struct clk_ops clk_rcg2_mux_closest_ops; extern const struct clk_ops clk_edp_pixel_ops; extern const struct clk_ops clk_byte_ops; extern const struct clk_ops clk_byte2_ops; extern const struct clk_ops clk_pixel_ops; extern const struct clk_ops clk_gfx3d_ops; extern const struct clk_ops clk_rcg2_shared_ops; extern const struct clk_ops clk_dp_ops; struct clk_rcg_dfs_data { … }; #define DEFINE_RCG_DFS(r) … extern int qcom_cc_register_rcg_dfs(struct regmap *regmap, const struct clk_rcg_dfs_data *rcgs, size_t len); #endif