diff options
author | Rajendra Nayak <rnayak@ti.com> | 2012-06-01 04:32:49 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2012-11-12 21:10:18 -0500 |
commit | 23fb8ba3a8f55f28a7a89b64b3711fcf72239d7f (patch) | |
tree | fcc04341ecf1d9c6a20261f3669a25a35506a246 /arch | |
parent | 7a2bd1cc3926327c0393deb52e8300af75b1c9e1 (diff) |
ARM: OMAP: clock: list all clk_hw_omap clks to enable/disable autoidle
Platforms can call omap2_init_clk_hw_omap_clocks() to register a clock
using clk_hw_omap. omap2_clk_enable_autoidle_all() and
omap2_clk_disable_autoidle_all() can then be used to run through
all the clocks which support autoidle to enable/disable them.
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mike Turquette <mturquette@ti.com>
[paul@pwsan.com: added kerneldoc on non-trivial new functions]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/clock.c | 59 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap2/io.c | 27 |
3 files changed, 89 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 72d7105b3c7d..c64203e55d19 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
@@ -66,6 +66,7 @@ static DEFINE_SPINLOCK(clockfw_lock); | |||
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #ifdef CONFIG_COMMON_CLK | 68 | #ifdef CONFIG_COMMON_CLK |
69 | static LIST_HEAD(clk_hw_omap_clocks); | ||
69 | 70 | ||
70 | /* | 71 | /* |
71 | * Used for clocks that have the same value as the parent clock, | 72 | * Used for clocks that have the same value as the parent clock, |
@@ -521,6 +522,64 @@ static int __init omap_clk_setup(char *str) | |||
521 | } | 522 | } |
522 | __setup("mpurate=", omap_clk_setup); | 523 | __setup("mpurate=", omap_clk_setup); |
523 | 524 | ||
525 | /** | ||
526 | * omap2_init_clk_hw_omap_clocks - initialize an OMAP clock | ||
527 | * @clk: struct clk * to initialize | ||
528 | * | ||
529 | * Add an OMAP clock @clk to the internal list of OMAP clocks. Used | ||
530 | * temporarily for autoidle handling, until this support can be | ||
531 | * integrated into the common clock framework code in some way. No | ||
532 | * return value. | ||
533 | */ | ||
534 | void omap2_init_clk_hw_omap_clocks(struct clk *clk) | ||
535 | { | ||
536 | struct clk_hw_omap *c; | ||
537 | |||
538 | if (__clk_get_flags(clk) & CLK_IS_BASIC) | ||
539 | return; | ||
540 | |||
541 | c = to_clk_hw_omap(__clk_get_hw(clk)); | ||
542 | list_add(&c->node, &clk_hw_omap_clocks); | ||
543 | } | ||
544 | |||
545 | /** | ||
546 | * omap2_clk_enable_autoidle_all - enable autoidle on all OMAP clocks that | ||
547 | * support it | ||
548 | * | ||
549 | * Enable clock autoidle on all OMAP clocks that have allow_idle | ||
550 | * function pointers associated with them. This function is intended | ||
551 | * to be temporary until support for this is added to the common clock | ||
552 | * code. Returns 0. | ||
553 | */ | ||
554 | int omap2_clk_enable_autoidle_all(void) | ||
555 | { | ||
556 | struct clk_hw_omap *c; | ||
557 | |||
558 | list_for_each_entry(c, &clk_hw_omap_clocks, node) | ||
559 | if (c->ops && c->ops->allow_idle) | ||
560 | c->ops->allow_idle(c); | ||
561 | return 0; | ||
562 | } | ||
563 | |||
564 | /** | ||
565 | * omap2_clk_disable_autoidle_all - disable autoidle on all OMAP clocks that | ||
566 | * support it | ||
567 | * | ||
568 | * Disable clock autoidle on all OMAP clocks that have allow_idle | ||
569 | * function pointers associated with them. This function is intended | ||
570 | * to be temporary until support for this is added to the common clock | ||
571 | * code. Returns 0. | ||
572 | */ | ||
573 | int omap2_clk_disable_autoidle_all(void) | ||
574 | { | ||
575 | struct clk_hw_omap *c; | ||
576 | |||
577 | list_for_each_entry(c, &clk_hw_omap_clocks, node) | ||
578 | if (c->ops && c->ops->deny_idle) | ||
579 | c->ops->deny_idle(c); | ||
580 | return 0; | ||
581 | } | ||
582 | |||
524 | const struct clk_hw_omap_ops clkhwops_wait = { | 583 | const struct clk_hw_omap_ops clkhwops_wait = { |
525 | .find_idlest = omap2_clk_dflt_find_idlest, | 584 | .find_idlest = omap2_clk_dflt_find_idlest, |
526 | .find_companion = omap2_clk_dflt_find_companion, | 585 | .find_companion = omap2_clk_dflt_find_companion, |
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 6800d5f82050..20a3be77cb8b 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h | |||
@@ -535,6 +535,9 @@ void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk, | |||
535 | void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk, | 535 | void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk, |
536 | void __iomem **idlest_reg, | 536 | void __iomem **idlest_reg, |
537 | u8 *idlest_bit, u8 *idlest_val); | 537 | u8 *idlest_bit, u8 *idlest_val); |
538 | void omap2_init_clk_hw_omap_clocks(struct clk *clk); | ||
539 | int omap2_clk_enable_autoidle_all(void); | ||
540 | int omap2_clk_disable_autoidle_all(void); | ||
538 | #else | 541 | #else |
539 | int omap2_dflt_clk_enable(struct clk *clk); | 542 | int omap2_dflt_clk_enable(struct clk *clk); |
540 | void omap2_dflt_clk_disable(struct clk *clk); | 543 | void omap2_dflt_clk_disable(struct clk *clk); |
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index c3472bd8e5a4..41c601311b3e 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
@@ -407,6 +407,9 @@ void __init omap2420_init_late(void) | |||
407 | omap_mux_late_init(); | 407 | omap_mux_late_init(); |
408 | omap2_common_pm_late_init(); | 408 | omap2_common_pm_late_init(); |
409 | omap2_pm_init(); | 409 | omap2_pm_init(); |
410 | #ifdef CONFIG_COMMON_CLK | ||
411 | omap2_clk_enable_autoidle_all(); | ||
412 | #endif | ||
410 | } | 413 | } |
411 | #endif | 414 | #endif |
412 | 415 | ||
@@ -436,6 +439,9 @@ void __init omap2430_init_late(void) | |||
436 | omap_mux_late_init(); | 439 | omap_mux_late_init(); |
437 | omap2_common_pm_late_init(); | 440 | omap2_common_pm_late_init(); |
438 | omap2_pm_init(); | 441 | omap2_pm_init(); |
442 | #ifdef CONFIG_COMMON_CLK | ||
443 | omap2_clk_enable_autoidle_all(); | ||
444 | #endif | ||
439 | } | 445 | } |
440 | #endif | 446 | #endif |
441 | 447 | ||
@@ -509,6 +515,9 @@ void __init omap3_init_late(void) | |||
509 | omap_mux_late_init(); | 515 | omap_mux_late_init(); |
510 | omap2_common_pm_late_init(); | 516 | omap2_common_pm_late_init(); |
511 | omap3_pm_init(); | 517 | omap3_pm_init(); |
518 | #ifdef CONFIG_COMMON_CLK | ||
519 | omap2_clk_enable_autoidle_all(); | ||
520 | #endif | ||
512 | } | 521 | } |
513 | 522 | ||
514 | void __init omap3430_init_late(void) | 523 | void __init omap3430_init_late(void) |
@@ -516,6 +525,9 @@ void __init omap3430_init_late(void) | |||
516 | omap_mux_late_init(); | 525 | omap_mux_late_init(); |
517 | omap2_common_pm_late_init(); | 526 | omap2_common_pm_late_init(); |
518 | omap3_pm_init(); | 527 | omap3_pm_init(); |
528 | #ifdef CONFIG_COMMON_CLK | ||
529 | omap2_clk_enable_autoidle_all(); | ||
530 | #endif | ||
519 | } | 531 | } |
520 | 532 | ||
521 | void __init omap35xx_init_late(void) | 533 | void __init omap35xx_init_late(void) |
@@ -523,6 +535,9 @@ void __init omap35xx_init_late(void) | |||
523 | omap_mux_late_init(); | 535 | omap_mux_late_init(); |
524 | omap2_common_pm_late_init(); | 536 | omap2_common_pm_late_init(); |
525 | omap3_pm_init(); | 537 | omap3_pm_init(); |
538 | #ifdef CONFIG_COMMON_CLK | ||
539 | omap2_clk_enable_autoidle_all(); | ||
540 | #endif | ||
526 | } | 541 | } |
527 | 542 | ||
528 | void __init omap3630_init_late(void) | 543 | void __init omap3630_init_late(void) |
@@ -530,6 +545,9 @@ void __init omap3630_init_late(void) | |||
530 | omap_mux_late_init(); | 545 | omap_mux_late_init(); |
531 | omap2_common_pm_late_init(); | 546 | omap2_common_pm_late_init(); |
532 | omap3_pm_init(); | 547 | omap3_pm_init(); |
548 | #ifdef CONFIG_COMMON_CLK | ||
549 | omap2_clk_enable_autoidle_all(); | ||
550 | #endif | ||
533 | } | 551 | } |
534 | 552 | ||
535 | void __init am35xx_init_late(void) | 553 | void __init am35xx_init_late(void) |
@@ -537,6 +555,9 @@ void __init am35xx_init_late(void) | |||
537 | omap_mux_late_init(); | 555 | omap_mux_late_init(); |
538 | omap2_common_pm_late_init(); | 556 | omap2_common_pm_late_init(); |
539 | omap3_pm_init(); | 557 | omap3_pm_init(); |
558 | #ifdef CONFIG_COMMON_CLK | ||
559 | omap2_clk_enable_autoidle_all(); | ||
560 | #endif | ||
540 | } | 561 | } |
541 | 562 | ||
542 | void __init ti81xx_init_late(void) | 563 | void __init ti81xx_init_late(void) |
@@ -544,6 +565,9 @@ void __init ti81xx_init_late(void) | |||
544 | omap_mux_late_init(); | 565 | omap_mux_late_init(); |
545 | omap2_common_pm_late_init(); | 566 | omap2_common_pm_late_init(); |
546 | omap3_pm_init(); | 567 | omap3_pm_init(); |
568 | #ifdef CONFIG_COMMON_CLK | ||
569 | omap2_clk_enable_autoidle_all(); | ||
570 | #endif | ||
547 | } | 571 | } |
548 | #endif | 572 | #endif |
549 | 573 | ||
@@ -597,6 +621,9 @@ void __init omap4430_init_late(void) | |||
597 | omap_mux_late_init(); | 621 | omap_mux_late_init(); |
598 | omap2_common_pm_late_init(); | 622 | omap2_common_pm_late_init(); |
599 | omap4_pm_init(); | 623 | omap4_pm_init(); |
624 | #ifdef CONFIG_COMMON_CLK | ||
625 | omap2_clk_enable_autoidle_all(); | ||
626 | #endif | ||
600 | } | 627 | } |
601 | #endif | 628 | #endif |
602 | 629 | ||