Thread (46 messages) flat view 46 messages, 13 authors, 2011-07-11

[PATCH 4/4] clk: Add simple gated clock

From: arnd@arndb.de (Arnd Bergmann)
Date: 2011-05-20 11:37:13
Also in: linux-sh, lkml

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help