diff options
author | Ben Dooks <ben-linux@fluff.org> | 2010-01-05 11:21:38 -0500 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2010-01-15 03:10:11 -0500 |
commit | 1d9f13c49ed750260f40317629bdd66160a3ac16 (patch) | |
tree | 3804e6a3fd0f7bf3b9e2869a26de3f018bff596a | |
parent | fb6e76cd2309c76d2120e013ff34ff6ab27aad88 (diff) |
ARM: SAMSUNG: Add call to register array of clocks
Add s3c_register_clocks() to register an array of clocks, printing
an error message if there is a problem. Replace all points in the code
where this could be used.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
-rw-r--r-- | arch/arm/mach-s3c2443/clock.c | 9 | ||||
-rw-r--r-- | arch/arm/plat-s3c/pwm-clock.c | 18 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/clock.c | 10 | ||||
-rw-r--r-- | arch/arm/plat-s5pc1xx/clock.c | 12 | ||||
-rw-r--r-- | arch/arm/plat-samsung/clock.c | 22 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/clock.h | 2 |
6 files changed, 32 insertions, 41 deletions
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c index 91db4f54bb33..3eb8b935d64c 100644 --- a/arch/arm/mach-s3c2443/clock.c +++ b/arch/arm/mach-s3c2443/clock.c | |||
@@ -1104,14 +1104,7 @@ void __init s3c2443_init_clocks(int xtal) | |||
1104 | 1104 | ||
1105 | /* register clocks from clock array */ | 1105 | /* register clocks from clock array */ |
1106 | 1106 | ||
1107 | clkp = init_clocks; | 1107 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); |
1108 | for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) { | ||
1109 | ret = s3c24xx_register_clock(clkp); | ||
1110 | if (ret < 0) { | ||
1111 | printk(KERN_ERR "Failed to register clock %s (%d)\n", | ||
1112 | clkp->name, ret); | ||
1113 | } | ||
1114 | } | ||
1115 | 1108 | ||
1116 | /* We must be careful disabling the clocks we are not intending to | 1109 | /* We must be careful disabling the clocks we are not intending to |
1117 | * be using at boot time, as subsystems such as the LCD which do | 1110 | * be using at boot time, as subsystems such as the LCD which do |
diff --git a/arch/arm/plat-s3c/pwm-clock.c b/arch/arm/plat-s3c/pwm-clock.c index 1808fa88609a..46c9381e083b 100644 --- a/arch/arm/plat-s3c/pwm-clock.c +++ b/arch/arm/plat-s3c/pwm-clock.c | |||
@@ -430,25 +430,15 @@ __init void s3c_pwmclk_init(void) | |||
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | 432 | ||
433 | for (clk = 0; clk < ARRAY_SIZE(clk_timer_scaler); clk++) { | 433 | for (clk = 0; clk < ARRAY_SIZE(clk_timer_scaler); clk++) |
434 | clk_timer_scaler[clk].parent = clk_timers; | 434 | clk_timer_scaler[clk].parent = clk_timers; |
435 | ret = s3c24xx_register_clock(&clk_timer_scaler[clk]); | ||
436 | if (ret < 0) { | ||
437 | printk(KERN_ERR "error adding pwm scaler%d clock\n", clk); | ||
438 | return; | ||
439 | } | ||
440 | } | ||
441 | 435 | ||
442 | for (clk = 0; clk < ARRAY_SIZE(clk_timer_tclk); clk++) { | 436 | s3c_register_clocks(clk_timer_scaler, ARRAY_SIZE(clk_timer_scaler)); |
443 | ret = s3c24xx_register_clock(&clk_timer_tclk[clk]); | 437 | s3c_register_clocks(clk_timer_tclk, ARRAY_SIZE(clk_timer_tclk)); |
444 | if (ret < 0) { | ||
445 | printk(KERN_ERR "error adding pww tclk%d\n", clk); | ||
446 | return; | ||
447 | } | ||
448 | } | ||
449 | 438 | ||
450 | for (clk = 0; clk < ARRAY_SIZE(clk_timer_tdiv); clk++) { | 439 | for (clk = 0; clk < ARRAY_SIZE(clk_timer_tdiv); clk++) { |
451 | ret = clk_pwm_tdiv_register(clk); | 440 | ret = clk_pwm_tdiv_register(clk); |
441 | |||
452 | if (ret < 0) { | 442 | if (ret < 0) { |
453 | printk(KERN_ERR "error adding pwm%d tdiv clock\n", clk); | 443 | printk(KERN_ERR "error adding pwm%d tdiv clock\n", clk); |
454 | return; | 444 | return; |
diff --git a/arch/arm/plat-s3c64xx/clock.c b/arch/arm/plat-s3c64xx/clock.c index 7a36e899360d..ae5883c00e7a 100644 --- a/arch/arm/plat-s3c64xx/clock.c +++ b/arch/arm/plat-s3c64xx/clock.c | |||
@@ -274,15 +274,7 @@ void __init s3c64xx_register_clocks(void) | |||
274 | int ptr; | 274 | int ptr; |
275 | 275 | ||
276 | s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); | 276 | s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); |
277 | 277 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); | |
278 | clkp = init_clocks; | ||
279 | for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) { | ||
280 | ret = s3c24xx_register_clock(clkp); | ||
281 | if (ret < 0) { | ||
282 | printk(KERN_ERR "Failed to register clock %s (%d)\n", | ||
283 | clkp->name, ret); | ||
284 | } | ||
285 | } | ||
286 | 278 | ||
287 | clkp = init_clocks_disable; | 279 | clkp = init_clocks_disable; |
288 | for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { | 280 | for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { |
diff --git a/arch/arm/plat-s5pc1xx/clock.c b/arch/arm/plat-s5pc1xx/clock.c index 2f4d8d4c4e1c..0aff16d1cc2c 100644 --- a/arch/arm/plat-s5pc1xx/clock.c +++ b/arch/arm/plat-s5pc1xx/clock.c | |||
@@ -704,16 +704,8 @@ void __init s5pc1xx_register_clocks(void) | |||
704 | 704 | ||
705 | s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); | 705 | s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); |
706 | 706 | ||
707 | clkp = s5pc100_init_clocks; | 707 | s3c_register_clocks(s5pc100_init_clocks, |
708 | size = ARRAY_SIZE(s5pc100_init_clocks); | 708 | ARRAY_SIZE(s5pc100_init_clocks)); |
709 | |||
710 | for (ptr = 0; ptr < size; ptr++, clkp++) { | ||
711 | ret = s3c24xx_register_clock(clkp); | ||
712 | if (ret < 0) { | ||
713 | printk(KERN_ERR "Failed to register clock %s (%d)\n", | ||
714 | clkp->name, ret); | ||
715 | } | ||
716 | } | ||
717 | 709 | ||
718 | clkp = s5pc100_init_clocks_disable; | 710 | clkp = s5pc100_init_clocks_disable; |
719 | size = ARRAY_SIZE(s5pc100_init_clocks_disable); | 711 | size = ARRAY_SIZE(s5pc100_init_clocks_disable); |
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c index fa91125c7e0e..9194af91e4b7 100644 --- a/arch/arm/plat-samsung/clock.c +++ b/arch/arm/plat-samsung/clock.c | |||
@@ -336,6 +336,28 @@ int s3c24xx_register_clocks(struct clk **clks, int nr_clks) | |||
336 | return fails; | 336 | return fails; |
337 | } | 337 | } |
338 | 338 | ||
339 | /** | ||
340 | * s3c_register_clocks() - register an array of clocks | ||
341 | * @clkp: Pointer to the first clock in the array. | ||
342 | * @nr_clks: Number of clocks to register. | ||
343 | * | ||
344 | * Call s3c24xx_register_clock() on the @clkp array given, printing an | ||
345 | * error if it fails to register the clock (unlikely). | ||
346 | */ | ||
347 | void __initdata s3c_register_clocks(struct clk *clkp, int nr_clks) | ||
348 | { | ||
349 | int ret; | ||
350 | |||
351 | for (; nr_clks > 0; nr_clks--, clkp++) { | ||
352 | ret = s3c24xx_register_clock(clkp); | ||
353 | |||
354 | if (ret < 0) { | ||
355 | printk(KERN_ERR "Failed to register clock %s (%d)\n", | ||
356 | clkp->name, ret); | ||
357 | } | ||
358 | } | ||
359 | } | ||
360 | |||
339 | /* initalise all the clocks */ | 361 | /* initalise all the clocks */ |
340 | 362 | ||
341 | int __init s3c24xx_register_baseclocks(unsigned long xtal) | 363 | int __init s3c24xx_register_baseclocks(unsigned long xtal) |
diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h index 43324af24c6e..bd41f828d15d 100644 --- a/arch/arm/plat-samsung/include/plat/clock.h +++ b/arch/arm/plat-samsung/include/plat/clock.h | |||
@@ -87,6 +87,8 @@ extern int s3c2410_clkcon_enable(struct clk *clk, int enable); | |||
87 | extern int s3c24xx_register_clock(struct clk *clk); | 87 | extern int s3c24xx_register_clock(struct clk *clk); |
88 | extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks); | 88 | extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks); |
89 | 89 | ||
90 | extern void s3c_register_clocks(struct clk *clk, int nr_clks); | ||
91 | |||
90 | extern int s3c24xx_register_baseclocks(unsigned long xtal); | 92 | extern int s3c24xx_register_baseclocks(unsigned long xtal); |
91 | 93 | ||
92 | extern void s3c64xx_register_clocks(void); | 94 | extern void s3c64xx_register_clocks(void); |