--- zzzz-none-000/linux-4.4.60/drivers/clk/qcom/clk-rcg.h 2017-04-08 07:53:53.000000000 +0000 +++ scorpion-1750e-727/linux-4.4.60/drivers/clk/qcom/clk-rcg.h 2021-02-04 17:41:59.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -20,7 +20,7 @@ struct freq_tbl { unsigned long freq; u8 src; - u8 pre_div; + u16 pre_div; u16 m; u16 n; }; @@ -68,6 +68,18 @@ }; /** + * struct c_div - custom-divider used with Different Offsets + * @c_div_offset: offset of the CDIV in the ADDRESS Space + * @c_div_shift: lowest bit of pre divider field + * @c_div_width: number of bits in pre divider + */ +struct c_div { + u32 offset; + u8 shift; + u32 mask; +}; + +/** * 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 @@ -152,8 +164,10 @@ * struct clk_rcg2 - root clock generator * * @cmd_rcgr: corresponds to *_CMD_RCGR + * @cfg_offset: offset of *_CFG_RCGR from *_CMD_RCGR minus 4 * @mnd_width: number of bits in m/n/d values * @hid_width: number of bits in half integer divider + * @flags: RCG2 specific clock flags * @parent_map: map from software's parent index to hardware's src_sel field * @freq_tbl: frequency table * @current_freq: last cached frequency when using branches with shared RCGs @@ -162,8 +176,12 @@ */ struct clk_rcg2 { u32 cmd_rcgr; + u8 cfg_offset; u8 mnd_width; u8 hid_width; + +#define CLK_RCG2_HW_CONTROLLED BIT(0) + u8 flags; const struct parent_map *parent_map; const struct freq_tbl *freq_tbl; unsigned long current_freq; @@ -172,11 +190,66 @@ #define to_clk_rcg2(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg2, clkr) +/** + * struct clk_cdiv_rcg2 - cdiv with root clock generator + * + * @cmd_rcgr: corresponds to *_CMD_RCGR + * @cfg_offset: offset of *_CFG_RCGR from *_CMD_RCGR minus 4 + * @mnd_width: number of bits in m/n/d values + * @hid_width: number of bits in half integer divider + * @parent_map: map from software's parent index to hardware's src_sel field + * @freq_tbl: frequency table + * @clkr: regmap clock handle + * @lock: register lock + * + */ +struct clk_cdiv_rcg2 { + u32 cmd_rcgr; + u8 cfg_offset; + u8 mnd_width; + u8 hid_width; + struct c_div cdiv; + const struct parent_map *parent_map; + const struct freq_tbl *freq_tbl; + struct clk_regmap clkr; +}; + +#define to_clk_cdiv_rcg2(_hw) container_of(to_clk_regmap(_hw), \ + struct clk_cdiv_rcg2, clkr) + + +/** + * struct clk_muxr_misc - mux and misc register + * + * @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 + * @parent_map: map from software's parent index to hardware's src_sel field + * @freq_tbl: frequency table + * @clkr: regmap clock handle + * @lock: register lock + * + */ +struct clk_muxr_misc { + struct c_div muxr; + struct c_div misc; + const struct parent_map *parent_map; + const struct freq_tbl *freq_tbl; + struct clk_regmap clkr; +}; + +#define to_clk_muxr_misc(_hw) container_of(to_clk_regmap(_hw), \ + struct clk_muxr_misc, clkr) + extern const struct clk_ops clk_rcg2_ops; extern const struct clk_ops clk_rcg2_shared_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_cdiv_rcg2_ops; +extern const struct clk_ops clk_muxr_misc_ops; +extern void clk_dyn_configure_bank(struct clk_dyn_rcg *rcg, + const struct freq_tbl *f); #endif