Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aeccbbdc authored by Junjie Wu's avatar Junjie Wu
Browse files

clock-local2: Enhance gate_clk to handle delay and rates



Some gate clocks require delay after writing to enable bit. Add
delay_us to account for the delay. Gate clocks should also handle
clk_round_rate and clk_get_rate by passing the request to its parent.

Change-Id: I84622f3675566e5c19d1422123d643ce391a1b63
Signed-off-by: default avatarJunjie Wu <junjiew@codeaurora.org>
parent bc45092a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1128,6 +1128,8 @@ static int gate_clk_enable(struct clk *c)
	regval |= g->en_mask;
	writel_relaxed(regval, GATE_EN_REG(g));
	spin_unlock_irqrestore(&local_clock_reg_lock, flags);
	if (g->delay_us)
		udelay(g->delay_us);

	return 0;
}
@@ -1143,6 +1145,8 @@ static void gate_clk_disable(struct clk *c)
	regval &= ~(g->en_mask);
	writel_relaxed(regval, GATE_EN_REG(g));
	spin_unlock_irqrestore(&local_clock_reg_lock, flags);
	if (g->delay_us)
		udelay(g->delay_us);
}

static void __iomem *gate_clk_list_registers(struct clk *c, int n,
@@ -1467,6 +1471,8 @@ struct clk_ops clk_ops_vote = {
struct clk_ops clk_ops_gate = {
	.enable = gate_clk_enable,
	.disable = gate_clk_disable,
	.get_rate = parent_get_rate,
	.round_rate = parent_round_rate,
	.handoff = gate_clk_handoff,
	.list_registers = gate_clk_list_registers,
};
+1 −0
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ struct gate_clk {
	struct clk c;
	const u32 en_mask;
	const u32 en_reg;
	const unsigned int delay_us;
	void *const __iomem *base;
};