lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 31 Jan 2023 11:05:25 +0200
From:   Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To:     Konrad Dybcio <konrad.dybcio@...aro.org>,
        linux-arm-msm@...r.kernel.org, andersson@...nel.org,
        agross@...nel.org, krzysztof.kozlowski@...aro.org
Cc:     marijn.suijten@...ainline.org,
        Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>, linux-clk@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 1/8] clk: qcom: branch: Add helper functions for
 setting retain bits

On 31/01/2023 01:59, Konrad Dybcio wrote:
> Most Qualcomm branch clocks come with a pretty usual set of bits that
> can enable memory retention by means of not turning off parts of the
> memory logic. Add them to the common header file and introduce helper
> functions for setting them instead of using magic writes.
> 
> Signed-off-by: Konrad Dybcio <konrad.dybcio@...aro.org>
> ---
>   drivers/clk/qcom/clk-branch.h | 23 +++++++++++++++++++++++
>   1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/clk/qcom/clk-branch.h b/drivers/clk/qcom/clk-branch.h
> index 17a58119165e..d8fc7b93ef6d 100644
> --- a/drivers/clk/qcom/clk-branch.h
> +++ b/drivers/clk/qcom/clk-branch.h
> @@ -37,6 +37,29 @@ struct clk_branch {
>   	struct clk_regmap clkr;
>   };
>   
> +/* Branch clock common bits for HLOS-owned clocks */
> +#define CBCR_FORCE_MEM_CORE_ON		BIT(14)
> +#define CBCR_FORCE_MEM_PERIPH_ON	BIT(13)
> +#define CBCR_FORCE_MEM_PERIPH_OFF	BIT(12)

It might be a slight bit of pain, but I'd suggest moving these 
definitions next to BRANCH_CLK_OFF since they are using the same reg. 
(And while you are at it also reworking BRANCH_NOC_FSM_STATUS into a 
proper mask and FIELD_* macros.)

> +
> +static inline void qcom_branch_set_force_mem_core(struct regmap *regmap, u32 reg, bool on)

These functions can be more descriptive if they receive struct 
clk_branch as an argument instead of just a register.

> +{
> +	regmap_update_bits(regmap, reg, CBCR_FORCE_MEM_CORE_ON,
> +			   on ? CBCR_FORCE_MEM_CORE_ON : 0);
> +}
> +
> +static inline void qcom_branch_set_force_periph_on(struct regmap *regmap, u32 reg, bool on)
> +{
> +	regmap_update_bits(regmap, reg, CBCR_FORCE_MEM_PERIPH_ON,
> +			   on ? CBCR_FORCE_MEM_PERIPH_ON : 0);
> +}
> +
> +static inline void qcom_branch_set_force_periph_off(struct regmap *regmap, u32 reg, bool on)
> +{
> +	regmap_update_bits(regmap, reg, CBCR_FORCE_MEM_PERIPH_OFF,
> +			   on ? CBCR_FORCE_MEM_PERIPH_OFF : 0);
> +}
> +
>   extern const struct clk_ops clk_branch_ops;
>   extern const struct clk_ops clk_branch2_ops;
>   extern const struct clk_ops clk_branch_simple_ops;

-- 
With best wishes
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ