diff options
author | Beniamino Galvani <b.galvani@gmail.com> | 2014-04-27 11:30:40 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-04-29 08:15:24 +0200 |
commit | 298ecc586006c9e256b00b03a69bb62d6d662132 (patch) | |
tree | abd6ad1b0eff35a3c0a912af7f0f9004252bb9e7 /drivers | |
parent | b80f5d58009130254bd660df36f0543e73dc959f (diff) | |
download | barebox-298ecc586006c9e256b00b03a69bb62d6d662132.tar.gz barebox-298ecc586006c9e256b00b03a69bb62d6d662132.tar.xz |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/clk/clk-gate.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index 54489c4214..85eba3d23a 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -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); } |