aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/clock-r8a73a4.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2013-05-22 05:12:33 -0400
committerSimon Horman <horms+renesas@verge.net.au>2013-07-17 01:25:35 -0400
commit8d27657286a1e9e6ee7adaf4d0638cefd708a6fa (patch)
treefdcbe23612a2be0ef7ef4c19cd48cda3a668724e /arch/arm/mach-shmobile/clock-r8a73a4.c
parent0b8eeba45143030e29ec39c43daa1383146581e6 (diff)
ARM: shmobile: r8a73a4: 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. Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile/clock-r8a73a4.c')
-rw-r--r--arch/arm/mach-shmobile/clock-r8a73a4.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c
index 5f7fe628b8a1..d5176d0861b5 100644
--- a/arch/arm/mach-shmobile/clock-r8a73a4.c
+++ b/arch/arm/mach-shmobile/clock-r8a73a4.c
@@ -184,6 +184,21 @@ PLL_CLOCK(pll2h_clk, &main_div2_clk, pll_parent_main_extal, 3, 5, PLL2HCR, 5);
184 184
185SH_FIXED_RATIO_CLK(pll1_div2_clk, pll1_clk, div2); 185SH_FIXED_RATIO_CLK(pll1_div2_clk, pll1_clk, div2);
186 186
187static int frqcr_kick_do(struct clk *clk)
188{
189 int i;
190
191 /* set KICK bit in FRQCRB to update hardware setting, check success */
192 iowrite32(ioread32(CPG_MAP(FRQCRB)) | BIT(31), CPG_MAP(FRQCRB));
193 for (i = 1000; i; i--)
194 if (ioread32(CPG_MAP(FRQCRB)) & BIT(31))
195 cpu_relax();
196 else
197 return 0;
198
199 return -ETIMEDOUT;
200}
201
187static struct clk *main_clks[] = { 202static struct clk *main_clks[] = {
188 &extalr_clk, 203 &extalr_clk,
189 &extal1_clk, 204 &extal1_clk,
@@ -205,12 +220,7 @@ static struct clk *main_clks[] = {
205/* DIV4 */ 220/* DIV4 */
206static void div4_kick(struct clk *clk) 221static void div4_kick(struct clk *clk)
207{ 222{
208 unsigned long value; 223 frqcr_kick_do(clk);
209
210 /* set KICK bit in FRQCRB to update hardware setting */
211 value = ioread32(CPG_MAP(FRQCRB));
212 value |= (1 << 31);
213 iowrite32(value, CPG_MAP(FRQCRB));
214} 224}
215 225
216static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18, 24, 0, 36, 48, 10}; 226static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18, 24, 0, 36, 48, 10};