]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
OMAP2/3 clock: don't use a barrier after clk_disable()
authorPaul Walmsley <paul@pwsan.com>
Wed, 7 Jan 2009 15:23:21 +0000 (17:23 +0200)
committerTony Lindgren <tony@atomide.com>
Wed, 7 Jan 2009 15:23:21 +0000 (17:23 +0200)
clk_disable() previously used an ARM barrier, wmb(), to try to ensure
that the hardware write completed before continuing.  There are some
problems with this approach.

The first problem is that wmb() only ensures that the write leaves the
ARM -- not that it actually reaches the endpoint device.  In this
case, the endpoint device - either the PRM, CM, or SCM - is three
interconnects away from the ARM, and the final interconnect is
low-speed.  And the OCP interconnects will post the write, who knows
how long that will take to complete.  So the wmb() is not really what
we want.

Worse, the wmb() is indiscriminate; it will cause the ARM to flush any
other unrelated buffered writes and wait for the local interconnect to
acknowledge them - potentially very expensive.

This first problem could be fixed by doing a readback of the same PRM/CM/SCM
register.  Since these devices use a single OCP thread, this will cause the
MPU to wait for the write to complete.

But the primary problem is a conceptual one: clk_disable() should not
need any kind of barrier.  clk_enable() needs one since device driver
code must not access a device until its clocks are known to be
enabled.  But clk_disable() has no such restriction.

Since blocking the MPU on a PRM/CM/SCM write can be a very
high-latency operation - several hundred MPU cycles - it's worth
avoiding this barrier if possible.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/clock.c

index 8599b34305b5d19e66eac227da7023678790cc7a..d0caeef5aa72ad9b9c41bde454252a9cd839a4ff 100644 (file)
@@ -450,7 +450,7 @@ static void _omap2_clk_disable(struct clk *clk)
        else
                v &= ~(1 << clk->enable_bit);
        _omap2_clk_write_reg(v, clk->enable_reg, clk);
-       wmb();
+       /* No OCP barrier needed here since it is a disable operation */
 }
 
 void omap2_clk_disable(struct clk *clk)