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 parent_map - map table for PLL source select configuration values
31 * @cfg: configuration value
39 * struct mn - M/N:D counter
40 * @mnctr_en_bit: bit to enable mn counter
41 * @mnctr_reset_bit: bit to assert mn counter reset
42 * @mnctr_mode_shift: lowest bit of mn counter mode field
43 * @n_val_shift: lowest bit of n value field
44 * @m_val_shift: lowest bit of m value field
45 * @width: number of bits in m/n/d values
46 * @reset_in_cc: true if the mnctr_reset_bit is in the CC register
52 #define MNCTR_MODE_DUAL 0x2
53 #define MNCTR_MODE_MASK 0x3
61 * struct pre_div - pre-divider
62 * @pre_div_shift: lowest bit of pre divider field
63 * @pre_div_width: number of bits in predivider
71 * struct src_sel - source selector
72 * @src_sel_shift: lowest bit of source selection field
73 * @parent_map: map from software's parent index to hardware's src_sel field
77 #define SRC_SEL_MASK 0x7
78 const struct parent_map
*parent_map
;
82 * struct clk_rcg - root clock generator
84 * @ns_reg: NS register
85 * @md_reg: MD register
89 * @freq_tbl: frequency table
90 * @clkr: regmap clock handle
91 * @lock: register lock
102 const struct freq_tbl
*freq_tbl
;
104 struct clk_regmap clkr
;
107 extern const struct clk_ops clk_rcg_ops
;
108 extern const struct clk_ops clk_rcg_bypass_ops
;
109 extern const struct clk_ops clk_rcg_lcc_ops
;
111 #define to_clk_rcg(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg, clkr)
114 * struct clk_dyn_rcg - root clock generator with glitch free mux
116 * @mux_sel_bit: bit to switch glitch free mux
117 * @ns_reg: NS0 and NS1 register
118 * @md_reg: MD0 and MD1 register
119 * @bank_reg: register to XOR @mux_sel_bit into to switch glitch free mux
120 * @mn: mn counter (banked)
121 * @s: source selector (banked)
122 * @freq_tbl: frequency table
123 * @clkr: regmap clock handle
124 * @lock: register lock
138 const struct freq_tbl
*freq_tbl
;
140 struct clk_regmap clkr
;
143 extern const struct clk_ops clk_dyn_rcg_ops
;
145 #define to_clk_dyn_rcg(_hw) \
146 container_of(to_clk_regmap(_hw), struct clk_dyn_rcg, clkr)
149 * struct clk_rcg2 - root clock generator
151 * @cmd_rcgr: corresponds to *_CMD_RCGR
152 * @mnd_width: number of bits in m/n/d values
153 * @hid_width: number of bits in half integer divider
154 * @parent_map: map from software's parent index to hardware's src_sel field
155 * @freq_tbl: frequency table
156 * @clkr: regmap clock handle
157 * @lock: register lock
164 const struct parent_map
*parent_map
;
165 const struct freq_tbl
*freq_tbl
;
166 struct clk_regmap clkr
;
169 #define to_clk_rcg2(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg2, clkr)
171 extern const struct clk_ops clk_rcg2_ops
;
172 extern const struct clk_ops clk_edp_pixel_ops
;
173 extern const struct clk_ops clk_byte_ops
;
174 extern const struct clk_ops clk_pixel_ops
;