diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2013-02-28 07:21:58 -0500 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2013-04-01 21:58:23 -0400 |
commit | 7653c318b73d8553d4c13bb7e371878ddc19f80d (patch) | |
tree | ec18d819e483d491e19c4f10bd4e6aa57a46de8b /arch/arm/mach-shmobile/clock-sh73a0.c | |
parent | d313d068d4b5801ea9c0c66bed66f37c64ad6807 (diff) |
ARM: shmobile: sh73a0: wait for completion when kicking the clock
To reconfigure clocks, controlled by FRQCRA and FRQCRB, a kick bit has to
be set and to make sure the setting has taken effect, it has to be read
back repeatedly until it is cleared by the hardware. This patch adds the
waiting part, that was missing until now.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Magnus Damm <damm@opensource.se
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile/clock-sh73a0.c')
-rw-r--r-- | arch/arm/mach-shmobile/clock-sh73a0.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index 71843dd39e16..34b5c5ae4cbd 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | #include <linux/sh_clk.h> | 22 | #include <linux/sh_clk.h> |
23 | #include <linux/clkdev.h> | 23 | #include <linux/clkdev.h> |
24 | #include <asm/processor.h> | ||
24 | #include <mach/common.h> | 25 | #include <mach/common.h> |
25 | 26 | ||
26 | #define FRQCRA IOMEM(0xe6150000) | 27 | #define FRQCRA IOMEM(0xe6150000) |
@@ -234,14 +235,24 @@ static struct clk *main_clks[] = { | |||
234 | &sh73a0_extalr_clk, | 235 | &sh73a0_extalr_clk, |
235 | }; | 236 | }; |
236 | 237 | ||
237 | static void div4_kick(struct clk *clk) | 238 | static int frqcr_kick(void) |
238 | { | 239 | { |
239 | unsigned long value; | 240 | int i; |
241 | |||
242 | /* set KICK bit in FRQCRB to update hardware setting, check success */ | ||
243 | __raw_writel(__raw_readl(FRQCRB) | (1 << 31), FRQCRB); | ||
244 | for (i = 1000; i; i--) | ||
245 | if (__raw_readl(FRQCRB) & (1 << 31)) | ||
246 | cpu_relax(); | ||
247 | else | ||
248 | return i; | ||
249 | |||
250 | return -ETIMEDOUT; | ||
251 | } | ||
240 | 252 | ||
241 | /* set KICK bit in FRQCRB to update hardware setting */ | 253 | static void div4_kick(struct clk *clk) |
242 | value = __raw_readl(FRQCRB); | 254 | { |
243 | value |= (1 << 31); | 255 | frqcr_kick(); |
244 | __raw_writel(value, FRQCRB); | ||
245 | } | 256 | } |
246 | 257 | ||
247 | static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18, | 258 | static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18, |