Skip to content

Commit a0e0ec7

Browse files
konradybcioandersson
authored andcommitted
clk: qcom: rcg2: Make hw_clk_ctrl toggleable
Certain SoCs use the HW_CLK_CTRL feature on some of the clocks they host. This allows the clocks to be turned on automatically when a downstream branch tries to change rate or config. Make it togglable so that we can utilize this. Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/20230517-topic-waipio-gpucc-v1-2-4f40e282af1d@linaro.org
1 parent 6de1bd7 commit a0e0ec7

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/clk/qcom/clk-rcg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ extern const struct clk_ops clk_dyn_rcg_ops;
141141
* @clkr: regmap clock handle
142142
* @cfg_off: defines the cfg register offset from the CMD_RCGR + CFG_REG
143143
* @parked_cfg: cached value of the CFG register for parked RCGs
144+
* @hw_clk_ctrl: whether to enable hardware clock control
144145
*/
145146
struct clk_rcg2 {
146147
u32 cmd_rcgr;
@@ -152,6 +153,7 @@ struct clk_rcg2 {
152153
struct clk_regmap clkr;
153154
u8 cfg_off;
154155
u32 parked_cfg;
156+
bool hw_clk_ctrl;
155157
};
156158

157159
#define to_clk_rcg2(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg2, clkr)

drivers/clk/qcom/clk-rcg2.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ static int __clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f,
325325
cfg |= rcg->parent_map[index].cfg << CFG_SRC_SEL_SHIFT;
326326
if (rcg->mnd_width && f->n && (f->m != f->n))
327327
cfg |= CFG_MODE_DUAL_EDGE;
328+
if (rcg->hw_clk_ctrl)
329+
cfg |= CFG_HW_CLK_CTRL_MASK;
328330

329331
*_cfg &= ~mask;
330332
*_cfg |= cfg;

0 commit comments

Comments
 (0)