aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-tcc8k
diff options
context:
space:
mode:
authorOskar Schirmer <oskar@linutronix.de>2011-02-17 10:43:02 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-03-11 04:06:06 -0500
commitf91f9cd505f92e4227ffda7e5799a33d4f34bf36 (patch)
tree94df64adc3e9c439a1b63725a0f34d88a1a30086 /arch/arm/mach-tcc8k
parentcfeeb2f99867c075f3a1a6ac59c0a42e1cd741b0 (diff)
arm: tcc8k: Fix bus clock calculation
There are two dividers used to derive bus clock from system clock: system clock is divided by SCKDIV+1, then by BCKDIV+1. SCKDIV divider has been ignored up to now, which is no problem as long as it is 0. Take SCKDIV into account for bus clock calculation. Signed-off-by: Oskar Schirmer <oskar@linutronix.de> Cc: bigeasy@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/arm/mach-tcc8k')
-rw-r--r--arch/arm/mach-tcc8k/clock.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/arm/mach-tcc8k/clock.c b/arch/arm/mach-tcc8k/clock.c
index 8d8c99f8955..e7cdae5c77a 100644
--- a/arch/arm/mach-tcc8k/clock.c
+++ b/arch/arm/mach-tcc8k/clock.c
@@ -308,10 +308,17 @@ static unsigned long get_rate_sys(struct clk *clk)
308 308
309static unsigned long get_rate_bus(struct clk *clk) 309static unsigned long get_rate_bus(struct clk *clk)
310{ 310{
311 unsigned int div; 311 unsigned int reg, sdiv, bdiv, rate;
312 312
313 div = (__raw_readl(CKC_BASE + CLKCTRL_OFFS) >> 4) & 0xff; 313 reg = __raw_readl(CKC_BASE + CLKCTRL_OFFS);
314 return get_rate_sys(clk) / (div + 1); 314 rate = get_rate_sys(clk);
315 sdiv = (reg >> 20) & 3;
316 if (sdiv)
317 rate /= sdiv + 1;
318 bdiv = (reg >> 4) & 0xff;
319 if (bdiv)
320 rate /= bdiv + 1;
321 return rate;
315} 322}
316 323
317static unsigned long get_rate_cpu(struct clk *clk) 324static unsigned long get_rate_cpu(struct clk *clk)