[RFC V2 5/8] ARM i.MX: clk: add generic support of gate2b
Mike Turquette
mturquette at linaro.org
Fri Dec 16 18:25:53 EST 2011
On Wed, Dec 14, 2011 at 1:23 AM, Richard Zhao <richard.zhao at linaro.org> wrote:
> +static int clk_gate2b_enable(struct clk *clk)
> +{
> + struct clk_gate2b *gate2b = to_clk_gate2b(clk);
> + unsigned long flags;
> + u32 reg;
> +
> + if (gate2b->lock)
> + spin_lock_irqsave(gate2b->lock, flags);
Are their bits in this register used by other clocks which aren't
protected by the enable_lock spinlock?
> +int clk_gate2b_set_val(struct clk *clk, int en, int dis)
> +{
> + struct clk_gate2b *gate2b = to_clk_gate2b(clk);
> + unsigned long flags;
> + u32 reg, val;
> +
> + en &= 0x3;
> + dis &= 0x3;
> +
> + if (gate2b->lock)
> + spin_lock_irqsave(gate2b->lock, flags);
> +
> + reg = __raw_readl(gate2b->reg);
> + val = (reg >> gate2b->shift) & 0x3;
> + reg &= ~(0x3 << gate2b->shift);
> + if (val == gate2b->val_en && val != en)
> + reg |= en << gate2b->shift;
> + else if (val == gate2b->val_dis && val != dis)
> + reg |= dis << gate2b->shift;
> + __raw_writel(reg, gate2b->reg);
> + gate2b->val_en = en;
> + gate2b->val_dis = dis;
> +
> + if (gate2b->lock)
> + spin_unlock_irqrestore(gate2b->lock, flags);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(clk_gate2b_set_val);
Who calls clk_gate2b_set_val, and why?
Regards,
Mike
More information about the linux-arm-kernel
mailing list