2 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef __QCOM_CLK_RCG_H__
15 #define __QCOM_CLK_RCG_H__
17 #include <linux/clk-provider.h>
18 #include "clk-regmap.h"
29 * struct mn - M/N:D counter
30 * @mnctr_en_bit: bit to enable mn counter
31 * @mnctr_reset_bit: bit to assert mn counter reset
32 * @mnctr_mode_shift: lowest bit of mn counter mode field
33 * @n_val_shift: lowest bit of n value field
34 * @m_val_shift: lowest bit of m value field
35 * @width: number of bits in m/n/d values
36 * @reset_in_cc: true if the mnctr_reset_bit is in the CC register
42 #define MNCTR_MODE_DUAL 0x2
43 #define MNCTR_MODE_MASK 0x3
51 * struct pre_div - pre-divider
52 * @pre_div_shift: lowest bit of pre divider field
53 * @pre_div_width: number of bits in predivider
61 * struct src_sel - source selector
62 * @src_sel_shift: lowest bit of source selection field
63 * @parent_map: map from software's parent index to hardware's src_sel field
67 #define SRC_SEL_MASK 0x7
68 const struct parent_map
*parent_map
;
72 * struct clk_rcg - root clock generator
74 * @ns_reg: NS register
75 * @md_reg: MD register
79 * @freq_tbl: frequency table
80 * @clkr: regmap clock handle
81 * @lock: register lock
92 const struct freq_tbl
*freq_tbl
;
94 struct clk_regmap clkr
;
97 extern const struct clk_ops clk_rcg_ops
;
98 extern const struct clk_ops clk_rcg_bypass_ops
;
99 extern const struct clk_ops clk_rcg_bypass2_ops
;
100 extern const struct clk_ops clk_rcg_pixel_ops
;
101 extern const struct clk_ops clk_rcg_esc_ops
;
102 extern const struct clk_ops clk_rcg_lcc_ops
;
104 #define to_clk_rcg(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg, clkr)
107 * struct clk_dyn_rcg - root clock generator with glitch free mux
109 * @mux_sel_bit: bit to switch glitch free mux
110 * @ns_reg: NS0 and NS1 register
111 * @md_reg: MD0 and MD1 register
112 * @bank_reg: register to XOR @mux_sel_bit into to switch glitch free mux
113 * @mn: mn counter (banked)
114 * @s: source selector (banked)
115 * @freq_tbl: frequency table
116 * @clkr: regmap clock handle
117 * @lock: register lock
131 const struct freq_tbl
*freq_tbl
;
133 struct clk_regmap clkr
;
136 extern const struct clk_ops clk_dyn_rcg_ops
;
138 #define to_clk_dyn_rcg(_hw) \
139 container_of(to_clk_regmap(_hw), struct clk_dyn_rcg, clkr)
142 * struct clk_rcg2 - root clock generator
144 * @cmd_rcgr: corresponds to *_CMD_RCGR
145 * @mnd_width: number of bits in m/n/d values
146 * @hid_width: number of bits in half integer divider
147 * @parent_map: map from software's parent index to hardware's src_sel field
148 * @freq_tbl: frequency table
149 * @clkr: regmap clock handle
156 const struct parent_map
*parent_map
;
157 const struct freq_tbl
*freq_tbl
;
158 struct clk_regmap clkr
;
161 #define to_clk_rcg2(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg2, clkr)
163 extern const struct clk_ops clk_rcg2_ops
;
164 extern const struct clk_ops clk_rcg2_floor_ops
;
165 extern const struct clk_ops clk_edp_pixel_ops
;
166 extern const struct clk_ops clk_byte_ops
;
167 extern const struct clk_ops clk_byte2_ops
;
168 extern const struct clk_ops clk_pixel_ops
;
169 extern const struct clk_ops clk_gfx3d_ops
;