Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7653c318 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Simon Horman
Browse files

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: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: default avatarMagnus Damm <damm@opensource.se>
Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
parent d313d068
Loading
Loading
Loading
Loading
+17 −6
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@
#include <linux/io.h>
#include <linux/io.h>
#include <linux/sh_clk.h>
#include <linux/sh_clk.h>
#include <linux/clkdev.h>
#include <linux/clkdev.h>
#include <asm/processor.h>
#include <mach/common.h>
#include <mach/common.h>


#define FRQCRA		IOMEM(0xe6150000)
#define FRQCRA		IOMEM(0xe6150000)
@@ -234,14 +235,24 @@ static struct clk *main_clks[] = {
	&sh73a0_extalr_clk,
	&sh73a0_extalr_clk,
};
};


static void div4_kick(struct clk *clk)
static int frqcr_kick(void)
{
{
	unsigned long value;
	int i;

	/* set KICK bit in FRQCRB to update hardware setting, check success */
	__raw_writel(__raw_readl(FRQCRB) | (1 << 31), FRQCRB);
	for (i = 1000; i; i--)
		if (__raw_readl(FRQCRB) & (1 << 31))
			cpu_relax();
		else
			return i;


	/* set KICK bit in FRQCRB to update hardware setting */
	return -ETIMEDOUT;
	value = __raw_readl(FRQCRB);
}
	value |= (1 << 31);

	__raw_writel(value, FRQCRB);
static void div4_kick(struct clk *clk)
{
	frqcr_kick();
}
}


static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18,
static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18,