diff options
author | Thomas Abraham <thomas.ab@samsung.com> | 2010-05-16 20:38:50 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2010-05-16 21:37:37 -0400 |
commit | f44cf78b6b475116a4d3c98576f8697dd4ca7e79 (patch) | |
tree | fc1cb821372cff55883d4e7a373d5b32e87ac662 /arch/arm/mach-s5pv210/clock.c | |
parent | 58772cd34479ca50e90eea25288d2021dd2e6ff6 (diff) |
ARM: S5PV210: Remove usage of clk_p66 and add clk_pclk_psys clock
The clk_p83 clock, which is the PCLK clock for PSYS domain, is of
type 'struct clk' whereas on S5PV210, this clock is suitable to be
of type clksrc_clk clock (since it has a clock divider). So this
patch replaces the 'struct clk' type clock to 'struct clksrc_clk'
type clock for the PCLK PSYS clock.
This patch modifies the following.
1. Removes definitions and usage of 'clk_p66' clock.
2. Adds 'clk_pclk_psys' clock which is of type 'struct clksrc_clk'.
3. Replaces all usage of clk_p66 with clk_pclk_psys clock.
4. Adds clk_pclk_psys into list of clocks to be registered.
5. Removes the sys_clks array since it is no longer required.
Also the registration of clocks in sys_clks is also removed.
6. Remove the 'GET_DIV' as it is no longer required.
Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/mach-s5pv210/clock.c')
-rw-r--r-- | arch/arm/mach-s5pv210/clock.c | 66 |
1 files changed, 30 insertions, 36 deletions
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c index b46d9ec69eb8..315955da0d06 100644 --- a/arch/arm/mach-s5pv210/clock.c +++ b/arch/arm/mach-s5pv210/clock.c | |||
@@ -144,6 +144,15 @@ static struct clksrc_clk clk_hclk_psys = { | |||
144 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 24, .size = 4 }, | 144 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 24, .size = 4 }, |
145 | }; | 145 | }; |
146 | 146 | ||
147 | static struct clksrc_clk clk_pclk_psys = { | ||
148 | .clk = { | ||
149 | .name = "pclk_psys", | ||
150 | .id = -1, | ||
151 | .parent = &clk_hclk_psys.clk, | ||
152 | }, | ||
153 | .reg_div = { .reg = S5P_CLK_DIV0, .shift = 28, .size = 3 }, | ||
154 | }; | ||
155 | |||
147 | static int s5pv210_clk_ip0_ctrl(struct clk *clk, int enable) | 156 | static int s5pv210_clk_ip0_ctrl(struct clk *clk, int enable) |
148 | { | 157 | { |
149 | return s5p_gatectrl(S5P_CLKGATE_IP0, clk, enable); | 158 | return s5p_gatectrl(S5P_CLKGATE_IP0, clk, enable); |
@@ -164,15 +173,6 @@ static int s5pv210_clk_ip3_ctrl(struct clk *clk, int enable) | |||
164 | return s5p_gatectrl(S5P_CLKGATE_IP3, clk, enable); | 173 | return s5p_gatectrl(S5P_CLKGATE_IP3, clk, enable); |
165 | } | 174 | } |
166 | 175 | ||
167 | static struct clk clk_p66 = { | ||
168 | .name = "pclk66", | ||
169 | .id = -1, | ||
170 | }; | ||
171 | |||
172 | static struct clk *sys_clks[] = { | ||
173 | &clk_p66 | ||
174 | }; | ||
175 | |||
176 | static unsigned long s5pv210_clk_imem_get_rate(struct clk *clk) | 176 | static unsigned long s5pv210_clk_imem_get_rate(struct clk *clk) |
177 | { | 177 | { |
178 | return clk_get_rate(clk->parent) / 2; | 178 | return clk_get_rate(clk->parent) / 2; |
@@ -240,73 +240,73 @@ static struct clk init_clocks_disable[] = { | |||
240 | }, { | 240 | }, { |
241 | .name = "systimer", | 241 | .name = "systimer", |
242 | .id = -1, | 242 | .id = -1, |
243 | .parent = &clk_p66, | 243 | .parent = &clk_pclk_psys.clk, |
244 | .enable = s5pv210_clk_ip3_ctrl, | 244 | .enable = s5pv210_clk_ip3_ctrl, |
245 | .ctrlbit = (1<<16), | 245 | .ctrlbit = (1<<16), |
246 | }, { | 246 | }, { |
247 | .name = "watchdog", | 247 | .name = "watchdog", |
248 | .id = -1, | 248 | .id = -1, |
249 | .parent = &clk_p66, | 249 | .parent = &clk_pclk_psys.clk, |
250 | .enable = s5pv210_clk_ip3_ctrl, | 250 | .enable = s5pv210_clk_ip3_ctrl, |
251 | .ctrlbit = (1<<22), | 251 | .ctrlbit = (1<<22), |
252 | }, { | 252 | }, { |
253 | .name = "rtc", | 253 | .name = "rtc", |
254 | .id = -1, | 254 | .id = -1, |
255 | .parent = &clk_p66, | 255 | .parent = &clk_pclk_psys.clk, |
256 | .enable = s5pv210_clk_ip3_ctrl, | 256 | .enable = s5pv210_clk_ip3_ctrl, |
257 | .ctrlbit = (1<<15), | 257 | .ctrlbit = (1<<15), |
258 | }, { | 258 | }, { |
259 | .name = "i2c", | 259 | .name = "i2c", |
260 | .id = 0, | 260 | .id = 0, |
261 | .parent = &clk_p66, | 261 | .parent = &clk_pclk_psys.clk, |
262 | .enable = s5pv210_clk_ip3_ctrl, | 262 | .enable = s5pv210_clk_ip3_ctrl, |
263 | .ctrlbit = (1<<7), | 263 | .ctrlbit = (1<<7), |
264 | }, { | 264 | }, { |
265 | .name = "i2c", | 265 | .name = "i2c", |
266 | .id = 1, | 266 | .id = 1, |
267 | .parent = &clk_p66, | 267 | .parent = &clk_pclk_psys.clk, |
268 | .enable = s5pv210_clk_ip3_ctrl, | 268 | .enable = s5pv210_clk_ip3_ctrl, |
269 | .ctrlbit = (1<<8), | 269 | .ctrlbit = (1<<8), |
270 | }, { | 270 | }, { |
271 | .name = "i2c", | 271 | .name = "i2c", |
272 | .id = 2, | 272 | .id = 2, |
273 | .parent = &clk_p66, | 273 | .parent = &clk_pclk_psys.clk, |
274 | .enable = s5pv210_clk_ip3_ctrl, | 274 | .enable = s5pv210_clk_ip3_ctrl, |
275 | .ctrlbit = (1<<9), | 275 | .ctrlbit = (1<<9), |
276 | }, { | 276 | }, { |
277 | .name = "spi", | 277 | .name = "spi", |
278 | .id = 0, | 278 | .id = 0, |
279 | .parent = &clk_p66, | 279 | .parent = &clk_pclk_psys.clk, |
280 | .enable = s5pv210_clk_ip3_ctrl, | 280 | .enable = s5pv210_clk_ip3_ctrl, |
281 | .ctrlbit = (1<<12), | 281 | .ctrlbit = (1<<12), |
282 | }, { | 282 | }, { |
283 | .name = "spi", | 283 | .name = "spi", |
284 | .id = 1, | 284 | .id = 1, |
285 | .parent = &clk_p66, | 285 | .parent = &clk_pclk_psys.clk, |
286 | .enable = s5pv210_clk_ip3_ctrl, | 286 | .enable = s5pv210_clk_ip3_ctrl, |
287 | .ctrlbit = (1<<13), | 287 | .ctrlbit = (1<<13), |
288 | }, { | 288 | }, { |
289 | .name = "spi", | 289 | .name = "spi", |
290 | .id = 2, | 290 | .id = 2, |
291 | .parent = &clk_p66, | 291 | .parent = &clk_pclk_psys.clk, |
292 | .enable = s5pv210_clk_ip3_ctrl, | 292 | .enable = s5pv210_clk_ip3_ctrl, |
293 | .ctrlbit = (1<<14), | 293 | .ctrlbit = (1<<14), |
294 | }, { | 294 | }, { |
295 | .name = "timers", | 295 | .name = "timers", |
296 | .id = -1, | 296 | .id = -1, |
297 | .parent = &clk_p66, | 297 | .parent = &clk_pclk_psys.clk, |
298 | .enable = s5pv210_clk_ip3_ctrl, | 298 | .enable = s5pv210_clk_ip3_ctrl, |
299 | .ctrlbit = (1<<23), | 299 | .ctrlbit = (1<<23), |
300 | }, { | 300 | }, { |
301 | .name = "adc", | 301 | .name = "adc", |
302 | .id = -1, | 302 | .id = -1, |
303 | .parent = &clk_p66, | 303 | .parent = &clk_pclk_psys.clk, |
304 | .enable = s5pv210_clk_ip3_ctrl, | 304 | .enable = s5pv210_clk_ip3_ctrl, |
305 | .ctrlbit = (1<<24), | 305 | .ctrlbit = (1<<24), |
306 | }, { | 306 | }, { |
307 | .name = "keypad", | 307 | .name = "keypad", |
308 | .id = -1, | 308 | .id = -1, |
309 | .parent = &clk_p66, | 309 | .parent = &clk_pclk_psys.clk, |
310 | .enable = s5pv210_clk_ip3_ctrl, | 310 | .enable = s5pv210_clk_ip3_ctrl, |
311 | .ctrlbit = (1<<21), | 311 | .ctrlbit = (1<<21), |
312 | }, { | 312 | }, { |
@@ -341,25 +341,25 @@ static struct clk init_clocks[] = { | |||
341 | }, { | 341 | }, { |
342 | .name = "uart", | 342 | .name = "uart", |
343 | .id = 0, | 343 | .id = 0, |
344 | .parent = &clk_p66, | 344 | .parent = &clk_pclk_psys.clk, |
345 | .enable = s5pv210_clk_ip3_ctrl, | 345 | .enable = s5pv210_clk_ip3_ctrl, |
346 | .ctrlbit = (1<<7), | 346 | .ctrlbit = (1<<7), |
347 | }, { | 347 | }, { |
348 | .name = "uart", | 348 | .name = "uart", |
349 | .id = 1, | 349 | .id = 1, |
350 | .parent = &clk_p66, | 350 | .parent = &clk_pclk_psys.clk, |
351 | .enable = s5pv210_clk_ip3_ctrl, | 351 | .enable = s5pv210_clk_ip3_ctrl, |
352 | .ctrlbit = (1<<8), | 352 | .ctrlbit = (1<<8), |
353 | }, { | 353 | }, { |
354 | .name = "uart", | 354 | .name = "uart", |
355 | .id = 2, | 355 | .id = 2, |
356 | .parent = &clk_p66, | 356 | .parent = &clk_pclk_psys.clk, |
357 | .enable = s5pv210_clk_ip3_ctrl, | 357 | .enable = s5pv210_clk_ip3_ctrl, |
358 | .ctrlbit = (1<<9), | 358 | .ctrlbit = (1<<9), |
359 | }, { | 359 | }, { |
360 | .name = "uart", | 360 | .name = "uart", |
361 | .id = 3, | 361 | .id = 3, |
362 | .parent = &clk_p66, | 362 | .parent = &clk_pclk_psys.clk, |
363 | .enable = s5pv210_clk_ip3_ctrl, | 363 | .enable = s5pv210_clk_ip3_ctrl, |
364 | .ctrlbit = (1<<10), | 364 | .ctrlbit = (1<<10), |
365 | }, | 365 | }, |
@@ -401,10 +401,9 @@ static struct clksrc_clk *sysclks[] = { | |||
401 | &clk_hclk_psys, | 401 | &clk_hclk_psys, |
402 | &clk_pclk_msys, | 402 | &clk_pclk_msys, |
403 | &clk_pclk_dsys, | 403 | &clk_pclk_dsys, |
404 | &clk_pclk_psys, | ||
404 | }; | 405 | }; |
405 | 406 | ||
406 | #define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) | ||
407 | |||
408 | void __init_or_cpufreq s5pv210_setup_clocks(void) | 407 | void __init_or_cpufreq s5pv210_setup_clocks(void) |
409 | { | 408 | { |
410 | struct clk *xtal_clk; | 409 | struct clk *xtal_clk; |
@@ -415,7 +414,7 @@ void __init_or_cpufreq s5pv210_setup_clocks(void) | |||
415 | unsigned long hclk_psys; | 414 | unsigned long hclk_psys; |
416 | unsigned long pclk_msys; | 415 | unsigned long pclk_msys; |
417 | unsigned long pclk_dsys; | 416 | unsigned long pclk_dsys; |
418 | unsigned long pclk66; | 417 | unsigned long pclk_psys; |
419 | unsigned long apll; | 418 | unsigned long apll; |
420 | unsigned long mpll; | 419 | unsigned long mpll; |
421 | unsigned long epll; | 420 | unsigned long epll; |
@@ -455,17 +454,16 @@ void __init_or_cpufreq s5pv210_setup_clocks(void) | |||
455 | hclk_psys = clk_get_rate(&clk_hclk_psys.clk); | 454 | hclk_psys = clk_get_rate(&clk_hclk_psys.clk); |
456 | pclk_msys = clk_get_rate(&clk_pclk_msys.clk); | 455 | pclk_msys = clk_get_rate(&clk_pclk_msys.clk); |
457 | pclk_dsys = clk_get_rate(&clk_pclk_dsys.clk); | 456 | pclk_dsys = clk_get_rate(&clk_pclk_dsys.clk); |
458 | pclk66 = hclk_psys / GET_DIV(clkdiv0, S5P_CLKDIV0_PCLK66); | 457 | pclk_psys = clk_get_rate(&clk_pclk_psys.clk); |
459 | 458 | ||
460 | printk(KERN_INFO "S5PV210: ARMCLK=%ld, HCLKM=%ld, HCLKD=%ld\n" | 459 | printk(KERN_INFO "S5PV210: ARMCLK=%ld, HCLKM=%ld, HCLKD=%ld\n" |
461 | "HCLKP=%ld, PCLKM=%ld, PCLKD=%ld, PCLKP=%ld\n", | 460 | "HCLKP=%ld, PCLKM=%ld, PCLKD=%ld, PCLKP=%ld\n", |
462 | armclk, hclk_msys, hclk_dsys, hclk_psys, | 461 | armclk, hclk_msys, hclk_dsys, hclk_psys, |
463 | pclk_msys, pclk_dsys, pclk66); | 462 | pclk_msys, pclk_dsys, pclk_psys); |
464 | 463 | ||
465 | clk_f.rate = armclk; | 464 | clk_f.rate = armclk; |
466 | clk_h.rate = hclk_psys; | 465 | clk_h.rate = hclk_psys; |
467 | clk_p.rate = pclk66; | 466 | clk_p.rate = pclk_psys; |
468 | clk_p66.rate = pclk66; | ||
469 | 467 | ||
470 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | 468 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) |
471 | s3c_set_clksrc(&clksrcs[ptr], true); | 469 | s3c_set_clksrc(&clksrcs[ptr], true); |
@@ -490,10 +488,6 @@ void __init s5pv210_register_clocks(void) | |||
490 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); | 488 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); |
491 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); | 489 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); |
492 | 490 | ||
493 | ret = s3c24xx_register_clocks(sys_clks, ARRAY_SIZE(sys_clks)); | ||
494 | if (ret > 0) | ||
495 | printk(KERN_ERR "Failed to register system clocks\n"); | ||
496 | |||
497 | clkp = init_clocks_disable; | 491 | clkp = init_clocks_disable; |
498 | for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { | 492 | for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { |
499 | ret = s3c24xx_register_clock(clkp); | 493 | ret = s3c24xx_register_clock(clkp); |