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

Configure Feed

Select the types of activity you want to include in your feed.

clk: qcom: branch: Add helper functions for setting SLEEP/WAKE bits

HLOS-controlled branch clocks on non-ancient Qualcomm platforms
feature SLEEP and WAKE fields which can be written to to configure
how long the clock hardware should wait internally before being
(un)gated. Some very sensitive clocks need to have these values
programmed to prevent putting the hardware in a not-exactly-good
state. Add definitions of these fields and introduce helpers for
setting them inside clock drivers.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230208091340.124641-3-konrad.dybcio@linaro.org

authored by

Konrad Dybcio and committed by
Bjorn Andersson
0932e565 b594e6f6

+15
+15
drivers/clk/qcom/clk-branch.h
··· 4 4 #ifndef __QCOM_CLK_BRANCH_H__ 5 5 #define __QCOM_CLK_BRANCH_H__ 6 6 7 + #include <linux/bitfield.h> 7 8 #include <linux/clk-provider.h> 8 9 9 10 #include "clk-regmap.h" ··· 42 41 #define CBCR_FORCE_MEM_CORE_ON BIT(14) 43 42 #define CBCR_FORCE_MEM_PERIPH_ON BIT(13) 44 43 #define CBCR_FORCE_MEM_PERIPH_OFF BIT(12) 44 + #define CBCR_WAKEUP GENMASK(11, 8) 45 + #define CBCR_SLEEP GENMASK(7, 4) 45 46 46 47 static inline void qcom_branch_set_force_mem_core(struct regmap *regmap, 47 48 struct clk_branch clk, bool on) ··· 64 61 { 65 62 regmap_update_bits(regmap, clk.halt_reg, CBCR_FORCE_MEM_PERIPH_OFF, 66 63 on ? CBCR_FORCE_MEM_PERIPH_OFF : 0); 64 + } 65 + 66 + static inline void qcom_branch_set_wakeup(struct regmap *regmap, struct clk_branch clk, u32 val) 67 + { 68 + regmap_update_bits(regmap, clk.halt_reg, CBCR_WAKEUP, 69 + FIELD_PREP(CBCR_WAKEUP, val)); 70 + } 71 + 72 + static inline void qcom_branch_set_sleep(struct regmap *regmap, struct clk_branch clk, u32 val) 73 + { 74 + regmap_update_bits(regmap, clk.halt_reg, CBCR_SLEEP, 75 + FIELD_PREP(CBCR_SLEEP, val)); 67 76 } 68 77 69 78 extern const struct clk_ops clk_branch_ops;