aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-tcc8k
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-17 22:08:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-17 22:08:06 -0400
commit411f5c7a502769ccc0377c5ba36cb0b283847ba8 (patch)
tree2c3a29671e3f923de48c55f94194849264a7bf53 /arch/arm/mach-tcc8k
parent6d7ed21d17e640b120b902a314143e5ef4917a70 (diff)
parent9ced9f03d12d7539e86b0bff5bc750153c976c34 (diff)
Merge branch 'devel-stable' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel-stable' of master.kernel.org:/home/rmk/linux-2.6-arm: (289 commits) davinci: DM644x EVM: register MUSB device earlier davinci: add spi devices on tnetv107x evm davinci: add ssp config for tnetv107x evm board davinci: add tnetv107x ssp platform device spi: add ti-ssp spi master driver mfd: add driver for sequencer serial port ARM: EXYNOS4: Implement Clock gating for System MMU ARM: EXYNOS4: Enhancement of System MMU driver ARM: EXYNOS4: Add support for gpio interrupts ARM: S5P: Add function to register gpio interrupt bank data ARM: S5P: Cleanup S5P gpio interrupt code ARM: EXYNOS4: Add missing GPYx banks ARM: S3C64XX: Fix section mismatch from cpufreq init ARM: EXYNOS4: Add keypad device to the SMDKV310 ARM: EXYNOS4: Update clocks for keypad ARM: EXYNOS4: Update keypad base address ARM: EXYNOS4: Add keypad device helpers ARM: EXYNOS4: Add support for SATA on ARMLEX4210 plat-nomadik: make GPIO interrupts work with cpuidle ApSleep mach-u300: define a dummy filter function for coh901318 ... Fix up various conflicts in - arch/arm/mach-exynos4/cpufreq.c - arch/arm/mach-mxs/gpio.c - drivers/net/Kconfig - drivers/tty/serial/Kconfig - drivers/tty/serial/Makefile - drivers/usb/gadget/fsl_mxc_udc.c - drivers/video/Kconfig
Diffstat (limited to 'arch/arm/mach-tcc8k')
-rw-r--r--arch/arm/mach-tcc8k/board-tcc8000-sdk.c19
-rw-r--r--arch/arm/mach-tcc8k/clock.c38
2 files changed, 45 insertions, 12 deletions
diff --git a/arch/arm/mach-tcc8k/board-tcc8000-sdk.c b/arch/arm/mach-tcc8k/board-tcc8000-sdk.c
index fb6426ddeb77..4cb3c2dd905c 100644
--- a/arch/arm/mach-tcc8k/board-tcc8000-sdk.c
+++ b/arch/arm/mach-tcc8k/board-tcc8000-sdk.c
@@ -6,6 +6,7 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8
9#include <linux/delay.h>
9#include <linux/init.h> 10#include <linux/init.h>
10#include <linux/kernel.h> 11#include <linux/kernel.h>
11#include <linux/platform_device.h> 12#include <linux/platform_device.h>
@@ -17,6 +18,8 @@
17#include <asm/mach/time.h> 18#include <asm/mach/time.h>
18 19
19#include <mach/clock.h> 20#include <mach/clock.h>
21#include <mach/tcc-nand.h>
22#include <mach/tcc8k-regs.h>
20 23
21#include "common.h" 24#include "common.h"
22 25
@@ -51,6 +54,22 @@ static struct sys_timer tcc8k_timer = {
51static void __init tcc8k_map_io(void) 54static void __init tcc8k_map_io(void)
52{ 55{
53 tcc8k_map_common_io(); 56 tcc8k_map_common_io();
57
58 /* set PLL0 clock to 96MHz, adapt UART0 divisor */
59 __raw_writel(0x00026003, CKC_BASE + PLL0CFG_OFFS);
60 __raw_writel(0x10000001, CKC_BASE + ACLKUART0_OFFS);
61
62 /* set PLL1 clock to 192MHz */
63 __raw_writel(0x00016003, CKC_BASE + PLL1CFG_OFFS);
64
65 /* set PLL2 clock to 48MHz */
66 __raw_writel(0x00036003, CKC_BASE + PLL2CFG_OFFS);
67
68 /* with CPU freq higher than 150 MHz, need extra DTCM wait */
69 __raw_writel(0x00000001, SCFG_BASE + DTCMWAIT_OFFS);
70
71 /* PLL locking time as specified */
72 udelay(300);
54} 73}
55 74
56MACHINE_START(TCC8000_SDK, "Telechips TCC8000-SDK Demo Board") 75MACHINE_START(TCC8000_SDK, "Telechips TCC8000-SDK Demo Board")
diff --git a/arch/arm/mach-tcc8k/clock.c b/arch/arm/mach-tcc8k/clock.c
index 3970a9cdce26..e7cdae5c77a4 100644
--- a/arch/arm/mach-tcc8k/clock.c
+++ b/arch/arm/mach-tcc8k/clock.c
@@ -45,11 +45,12 @@
45#define ACLKGSB1 (CKC_BASE + ACLKGSB1_OFFS) 45#define ACLKGSB1 (CKC_BASE + ACLKGSB1_OFFS)
46#define ACLKGSB2 (CKC_BASE + ACLKGSB2_OFFS) 46#define ACLKGSB2 (CKC_BASE + ACLKGSB2_OFFS)
47#define ACLKGSB3 (CKC_BASE + ACLKGSB3_OFFS) 47#define ACLKGSB3 (CKC_BASE + ACLKGSB3_OFFS)
48#define ACLKUSBH (CKC_BASE + ACLKUSBH_OFFS)
49#define ACLKTCT (CKC_BASE + ACLKTCT_OFFS) 48#define ACLKTCT (CKC_BASE + ACLKTCT_OFFS)
50#define ACLKTCX (CKC_BASE + ACLKTCX_OFFS) 49#define ACLKTCX (CKC_BASE + ACLKTCX_OFFS)
51#define ACLKTCZ (CKC_BASE + ACLKTCZ_OFFS) 50#define ACLKTCZ (CKC_BASE + ACLKTCZ_OFFS)
52 51
52#define ACLK_MAX_DIV (0xfff + 1)
53
53/* Crystal frequencies */ 54/* Crystal frequencies */
54static unsigned long xi_rate, xti_rate; 55static unsigned long xi_rate, xti_rate;
55 56
@@ -106,9 +107,9 @@ static int root_clk_enable(enum root_clks src)
106 return 0; 107 return 0;
107} 108}
108 109
109static int root_clk_disable(enum root_clks root_src) 110static int root_clk_disable(enum root_clks src)
110{ 111{
111 switch (root_src) { 112 switch (src) {
112 case CLK_SRC_PLL0: return pll_enable(0, 0); 113 case CLK_SRC_PLL0: return pll_enable(0, 0);
113 case CLK_SRC_PLL1: return pll_enable(1, 0); 114 case CLK_SRC_PLL1: return pll_enable(1, 0);
114 case CLK_SRC_PLL2: return pll_enable(2, 0); 115 case CLK_SRC_PLL2: return pll_enable(2, 0);
@@ -197,7 +198,7 @@ static unsigned long get_rate_pll_div(int pll)
197 addr = CKC_BASE + CLKDIVC1_OFFS; 198 addr = CKC_BASE + CLKDIVC1_OFFS;
198 reg = __raw_readl(addr); 199 reg = __raw_readl(addr);
199 if (reg & CLKDIVC1_P2E) 200 if (reg & CLKDIVC1_P2E)
200 div = __raw_readl(addr) & 0x3f; 201 div = reg & 0x3f;
201 break; 202 break;
202 } 203 }
203 return get_rate_pll(pll) / (div + 1); 204 return get_rate_pll(pll) / (div + 1);
@@ -258,14 +259,19 @@ static unsigned long aclk_best_div(struct clk *clk, unsigned long rate)
258{ 259{
259 unsigned long div, src, freq, r1, r2; 260 unsigned long div, src, freq, r1, r2;
260 261
262 if (!rate)
263 return ACLK_MAX_DIV;
264
261 src = __raw_readl(clk->aclkreg) >> ACLK_SEL_SHIFT; 265 src = __raw_readl(clk->aclkreg) >> ACLK_SEL_SHIFT;
262 src &= CLK_SRC_MASK; 266 src &= CLK_SRC_MASK;
263 freq = root_clk_get_rate(src); 267 freq = root_clk_get_rate(src);
264 div = freq / rate + 1; 268 div = freq / rate;
269 if (!div)
270 return 1;
271 if (div >= ACLK_MAX_DIV)
272 return ACLK_MAX_DIV;
265 r1 = freq / div; 273 r1 = freq / div;
266 r2 = freq / (div + 1); 274 r2 = freq / (div + 1);
267 if (r2 >= rate)
268 return div + 1;
269 if ((rate - r2) < (r1 - rate)) 275 if ((rate - r2) < (r1 - rate))
270 return div + 1; 276 return div + 1;
271 277
@@ -287,7 +293,8 @@ static int aclk_set_rate(struct clk *clk, unsigned long rate)
287 u32 reg; 293 u32 reg;
288 294
289 reg = __raw_readl(clk->aclkreg) & ~ACLK_DIV_MASK; 295 reg = __raw_readl(clk->aclkreg) & ~ACLK_DIV_MASK;
290 reg |= aclk_best_div(clk, rate); 296 reg |= aclk_best_div(clk, rate) - 1;
297 __raw_writel(reg, clk->aclkreg);
291 return 0; 298 return 0;
292} 299}
293 300
@@ -296,15 +303,22 @@ static unsigned long get_rate_sys(struct clk *clk)
296 unsigned int src; 303 unsigned int src;
297 304
298 src = __raw_readl(CKC_BASE + CLKCTRL_OFFS) & CLK_SRC_MASK; 305 src = __raw_readl(CKC_BASE + CLKCTRL_OFFS) & CLK_SRC_MASK;
299 return root_clk_get_rate(src); 306 return root_clk_get_rate(src);
300} 307}
301 308
302static unsigned long get_rate_bus(struct clk *clk) 309static unsigned long get_rate_bus(struct clk *clk)
303{ 310{
304 unsigned int div; 311 unsigned int reg, sdiv, bdiv, rate;
305 312
306 div = (__raw_readl(CKC_BASE + CLKCTRL_OFFS) >> 4) & 0xff; 313 reg = __raw_readl(CKC_BASE + CLKCTRL_OFFS);
307 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;
308} 322}
309 323
310static unsigned long get_rate_cpu(struct clk *clk) 324static unsigned long get_rate_cpu(struct clk *clk)