clk: gate: add CLK_GATE_HIWORD_MASK flag
Clock gates having the CLK_GATE_HIWORD_MASK flag set use the upper 16 bits of the register as a "write enable" mask for the value in the lower 16 bits. Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
b80f5d5800
commit
298ecc5860
|
@ -37,12 +37,19 @@ static void clk_gate_endisable(struct clk *clk, int enable)
|
|||
u32 val;
|
||||
|
||||
set ^= enable;
|
||||
val = readl(gate->reg);
|
||||
|
||||
if (set)
|
||||
val |= BIT(gate->shift);
|
||||
else
|
||||
val &= ~BIT(gate->shift);
|
||||
if (gate->flags & CLK_GATE_HIWORD_MASK) {
|
||||
val = BIT(gate->shift + 16);
|
||||
if (set)
|
||||
val |= BIT(gate->shift);
|
||||
} else {
|
||||
val = readl(gate->reg);
|
||||
|
||||
if (set)
|
||||
val |= BIT(gate->shift);
|
||||
else
|
||||
val &= ~BIT(gate->shift);
|
||||
}
|
||||
|
||||
writel(val, gate->reg);
|
||||
}
|
||||
|
|
|
@ -200,6 +200,7 @@ static inline int clk_set_rate(struct clk *clk, unsigned long rate)
|
|||
#define CLK_SET_RATE_PARENT (1 << 0) /* propagate rate change up one level */
|
||||
|
||||
#define CLK_GATE_INVERTED (1 << 0)
|
||||
#define CLK_GATE_HIWORD_MASK (1 << 1)
|
||||
|
||||
struct clk_ops {
|
||||
int (*enable)(struct clk *clk);
|
||||
|
|
Loading…
Reference in New Issue