Re: [PATCH V2 2/4] clk: qcom: branch: Add mem ops support for branch2 clocks

From: Imran Shaik
Date: Wed Oct 18 2023 - 06:57:51 EST




On 10/13/2023 1:54 AM, Stephen Boyd wrote:
Quoting Imran Shaik (2023-10-11 02:00:26)
diff --git a/drivers/clk/qcom/clk-branch.c b/drivers/clk/qcom/clk-branch.c
index fc4735f74f0f..9ac8d04b425a 100644
--- a/drivers/clk/qcom/clk-branch.c
+++ b/drivers/clk/qcom/clk-branch.c
@@ -134,6 +135,42 @@ static void clk_branch2_disable(struct clk_hw *hw)
clk_branch_toggle(hw, false, clk_branch2_check_halt);
}
+static int clk_branch2_mem_enable(struct clk_hw *hw)
+{
+ struct clk_mem_branch *mem_br = to_clk_mem_branch(hw);
+ const char *name = clk_hw_get_name(&mem_br->branch.clkr.hw);
+ u32 val;
+ int timeout = 200, ret;

const int timeout?


Will drop the timeout as per Konrad's review comment and pass the int literal.

+
+ regmap_update_bits(mem_br->branch.clkr.regmap, mem_br->mem_enable_reg,
+ mem_br->mem_enable_ack_bit, mem_br->mem_enable_ack_bit);
+
+ ret = regmap_read_poll_timeout(mem_br->branch.clkr.regmap, mem_br->mem_ack_reg,
+ val, val & mem_br->mem_enable_ack_bit, 0, timeout);

The 'mem_br->branch' is used a few times so please make another local
variable for that called 'branch'.

+ if (ret) {
+ WARN(1, "%s mem enable failed", name);

Needs a newline on the message string.


Sure, will update this in the next series.

+ return ret;
+ }
+
+ return clk_branch2_enable(hw);
+}
+
+static void clk_branch2_mem_disable(struct clk_hw *hw)
+{
+ struct clk_mem_branch *mem_br = to_clk_mem_branch(hw);
+
+ regmap_update_bits(mem_br->branch.clkr.regmap, mem_br->mem_enable_reg,
+ mem_br->mem_enable_ack_bit, 0);

Please add a newline here.


Sure.

Thanks,
Imran

+ return clk_branch2_disable(hw);
+}
+