diff options
author | wanzongshun <mcuos.com@gmail.com> | 2009-07-30 21:30:32 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-08-01 11:23:57 -0400 |
commit | ae45b1c618d9e645a5e1decff31b710f739745fa (patch) | |
tree | de581101750f9b1a040fbb131740424649995281 /arch/arm/mach-w90x900/w90p910.c | |
parent | 897bd6a363770ced6b78f6ae8882325c7590ed8b (diff) |
ARM: 5634/1: Add static setting cpu frequence for w90p910 platform
Add static setting cpu frequence for w90p910 platform.
Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-w90x900/w90p910.c')
-rw-r--r-- | arch/arm/mach-w90x900/w90p910.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/arch/arm/mach-w90x900/w90p910.c b/arch/arm/mach-w90x900/w90p910.c index 6ebf5cfc78da..8444eababaab 100644 --- a/arch/arm/mach-w90x900/w90p910.c +++ b/arch/arm/mach-w90x900/w90p910.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/serial_8250.h> | 26 | #include <linux/serial_8250.h> |
27 | #include <linux/delay.h> | ||
27 | 28 | ||
28 | #include <asm/mach/arch.h> | 29 | #include <asm/mach/arch.h> |
29 | #include <asm/mach/map.h> | 30 | #include <asm/mach/map.h> |
@@ -32,6 +33,8 @@ | |||
32 | 33 | ||
33 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
34 | #include <mach/regs-serial.h> | 35 | #include <mach/regs-serial.h> |
36 | #include <mach/regs-clock.h> | ||
37 | #include <mach/regs-ebi.h> | ||
35 | 38 | ||
36 | #include "cpu.h" | 39 | #include "cpu.h" |
37 | #include "clock.h" | 40 | #include "clock.h" |
@@ -123,6 +126,83 @@ void __init w90p910_map_io(struct map_desc *mach_desc, int mach_size) | |||
123 | printk(KERN_ERR "CPU type 0x%08lx is not W90P910\n", idcode); | 126 | printk(KERN_ERR "CPU type 0x%08lx is not W90P910\n", idcode); |
124 | } | 127 | } |
125 | 128 | ||
129 | /*Set W90P910 cpu frequence*/ | ||
130 | static int __init w90p910_set_clkval(unsigned int cpufreq) | ||
131 | { | ||
132 | unsigned int pllclk, ahbclk, apbclk, val; | ||
133 | |||
134 | pllclk = 0; | ||
135 | ahbclk = 0; | ||
136 | apbclk = 0; | ||
137 | |||
138 | switch (cpufreq) { | ||
139 | case 66: | ||
140 | pllclk = PLL_66MHZ; | ||
141 | ahbclk = AHB_CPUCLK_1_1; | ||
142 | apbclk = APB_AHB_1_2; | ||
143 | break; | ||
144 | |||
145 | case 100: | ||
146 | pllclk = PLL_100MHZ; | ||
147 | ahbclk = AHB_CPUCLK_1_1; | ||
148 | apbclk = APB_AHB_1_2; | ||
149 | break; | ||
150 | |||
151 | case 120: | ||
152 | pllclk = PLL_120MHZ; | ||
153 | ahbclk = AHB_CPUCLK_1_2; | ||
154 | apbclk = APB_AHB_1_2; | ||
155 | break; | ||
156 | |||
157 | case 166: | ||
158 | pllclk = PLL_166MHZ; | ||
159 | ahbclk = AHB_CPUCLK_1_2; | ||
160 | apbclk = APB_AHB_1_2; | ||
161 | break; | ||
162 | |||
163 | case 200: | ||
164 | pllclk = PLL_200MHZ; | ||
165 | ahbclk = AHB_CPUCLK_1_2; | ||
166 | apbclk = APB_AHB_1_2; | ||
167 | break; | ||
168 | } | ||
169 | |||
170 | __raw_writel(pllclk, REG_PLLCON0); | ||
171 | |||
172 | val = __raw_readl(REG_CLKDIV); | ||
173 | val &= ~(0x03 << 24 | 0x03 << 26); | ||
174 | val |= (ahbclk << 24 | apbclk << 26); | ||
175 | __raw_writel(val, REG_CLKDIV); | ||
176 | |||
177 | return 0; | ||
178 | } | ||
179 | static int __init w90p910_set_cpufreq(char *str) | ||
180 | { | ||
181 | unsigned long cpufreq, val; | ||
182 | |||
183 | if (!*str) | ||
184 | return 0; | ||
185 | |||
186 | strict_strtoul(str, 0, &cpufreq); | ||
187 | |||
188 | w90p910_clock_source(NULL, "ext"); | ||
189 | |||
190 | w90p910_set_clkval(cpufreq); | ||
191 | |||
192 | mdelay(1); | ||
193 | |||
194 | val = __raw_readl(REG_CKSKEW); | ||
195 | val &= ~0xff; | ||
196 | val |= DEFAULTSKEW; | ||
197 | __raw_writel(val, REG_CKSKEW); | ||
198 | |||
199 | w90p910_clock_source(NULL, "pll0"); | ||
200 | |||
201 | return 1; | ||
202 | } | ||
203 | |||
204 | __setup("cpufreq=", w90p910_set_cpufreq); | ||
205 | |||
126 | /*Init W90P910 clock*/ | 206 | /*Init W90P910 clock*/ |
127 | 207 | ||
128 | void __init w90p910_init_clocks(void) | 208 | void __init w90p910_init_clocks(void) |