Re: [PATCH 4/4] clk: Add simple gated clock
From: Arnd Bergmann
Date: Fri May 20 2011 - 07:37:50 EST
On Friday 20 May 2011 09:27:49 Jeremy Kerr wrote:
> +static int clk_gate_enable(struct clk_hw *clk)
> +{
> + struct clk_gate *gate = to_clk_gate(clk);
> + u32 reg;
> +
> + reg = __raw_readl(gate->reg);
> + reg |= 1 << gate->bit_idx;
> + __raw_writel(reg, gate->reg);
> +
> + return 0;
> +}
__raw_readl/__raw_writel is a rather bad choice for a common driver,
it might not do what you need. Unfortunately, readl() also wouldn't
do the right thing on all architectures, because it might only
be available on PCI buses. Maybe iowrite32 would be best here?
Instead of the bit_idx, a mask value might be better to avoid
confusion with the different ways of counting bits from one or
the other end.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/