Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: qcom: branch: Add a helper for setting the enable bit

We hardcode some clocks to be always-on, as they're essential to the
functioning of the SoC / some peripherals. Add a helper to do so
to make the writes less magic.

Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20240212-topic-clk_branch_en-v7-1-5b79eb7278b2@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Konrad Dybcio and committed by
Bjorn Andersson
a58009dc 42972649

+6
+6
drivers/clk/qcom/clk-branch.h
··· 64 64 #define CBCR_FORCE_MEM_PERIPH_OFF BIT(12) 65 65 #define CBCR_WAKEUP GENMASK(11, 8) 66 66 #define CBCR_SLEEP GENMASK(7, 4) 67 + #define CBCR_CLOCK_ENABLE BIT(0) 67 68 68 69 static inline void qcom_branch_set_force_mem_core(struct regmap *regmap, 69 70 struct clk_branch clk, bool on) ··· 97 96 { 98 97 regmap_update_bits(regmap, clk.halt_reg, CBCR_SLEEP, 99 98 FIELD_PREP(CBCR_SLEEP, val)); 99 + } 100 + 101 + static inline void qcom_branch_set_clk_en(struct regmap *regmap, u32 cbcr) 102 + { 103 + regmap_update_bits(regmap, cbcr, CBCR_CLOCK_ENABLE, CBCR_CLOCK_ENABLE); 100 104 } 101 105 102 106 extern const struct clk_ops clk_branch_ops;