1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2013, 2018, The Linux Foundation. All rights reserved. */
4 #ifndef __QCOM_CLK_RCG_H__
5 #define __QCOM_CLK_RCG_H__
7 #include <linux/clk-provider.h>
8 #include "clk-regmap.h"
19 * struct mn - M/N:D counter
20 * @mnctr_en_bit: bit to enable mn counter
21 * @mnctr_reset_bit: bit to assert mn counter reset
22 * @mnctr_mode_shift: lowest bit of mn counter mode field
23 * @n_val_shift: lowest bit of n value field
24 * @m_val_shift: lowest bit of m value field
25 * @width: number of bits in m/n/d values
26 * @reset_in_cc: true if the mnctr_reset_bit is in the CC register
32 #define MNCTR_MODE_DUAL 0x2
33 #define MNCTR_MODE_MASK 0x3
41 * struct pre_div - pre-divider
42 * @pre_div_shift: lowest bit of pre divider field
43 * @pre_div_width: number of bits in predivider
51 * struct src_sel - source selector
52 * @src_sel_shift: lowest bit of source selection field
53 * @parent_map: map from software's parent index to hardware's src_sel field
57 #define SRC_SEL_MASK 0x7
58 const struct parent_map
*parent_map
;
62 * struct clk_rcg - root clock generator
64 * @ns_reg: NS register
65 * @md_reg: MD register
69 * @freq_tbl: frequency table
70 * @clkr: regmap clock handle
71 * @lock: register lock
82 const struct freq_tbl
*freq_tbl
;
84 struct clk_regmap clkr
;
87 extern const struct clk_ops clk_rcg_ops
;
88 extern const struct clk_ops clk_rcg_bypass_ops
;
89 extern const struct clk_ops clk_rcg_bypass2_ops
;
90 extern const struct clk_ops clk_rcg_pixel_ops
;
91 extern const struct clk_ops clk_rcg_esc_ops
;
92 extern const struct clk_ops clk_rcg_lcc_ops
;
94 #define to_clk_rcg(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg, clkr)
97 * struct clk_dyn_rcg - root clock generator with glitch free mux
99 * @mux_sel_bit: bit to switch glitch free mux
100 * @ns_reg: NS0 and NS1 register
101 * @md_reg: MD0 and MD1 register
102 * @bank_reg: register to XOR @mux_sel_bit into to switch glitch free mux
103 * @mn: mn counter (banked)
104 * @s: source selector (banked)
105 * @freq_tbl: frequency table
106 * @clkr: regmap clock handle
107 * @lock: register lock
121 const struct freq_tbl
*freq_tbl
;
123 struct clk_regmap clkr
;
126 extern const struct clk_ops clk_dyn_rcg_ops
;
128 #define to_clk_dyn_rcg(_hw) \
129 container_of(to_clk_regmap(_hw), struct clk_dyn_rcg, clkr)
132 * struct clk_rcg2 - root clock generator
134 * @cmd_rcgr: corresponds to *_CMD_RCGR
135 * @mnd_width: number of bits in m/n/d values
136 * @hid_width: number of bits in half integer divider
137 * @safe_src_index: safe src index value
138 * @parent_map: map from software's parent index to hardware's src_sel field
139 * @freq_tbl: frequency table
140 * @clkr: regmap clock handle
148 const struct parent_map
*parent_map
;
149 const struct freq_tbl
*freq_tbl
;
150 struct clk_regmap clkr
;
153 #define to_clk_rcg2(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg2, clkr)
155 extern const struct clk_ops clk_rcg2_ops
;
156 extern const struct clk_ops clk_rcg2_floor_ops
;
157 extern const struct clk_ops clk_edp_pixel_ops
;
158 extern const struct clk_ops clk_byte_ops
;
159 extern const struct clk_ops clk_byte2_ops
;
160 extern const struct clk_ops clk_pixel_ops
;
161 extern const struct clk_ops clk_gfx3d_ops
;
162 extern const struct clk_ops clk_rcg2_shared_ops
;