diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-11-04 09:02:46 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-02-02 09:52:18 -0500 |
commit | 548d849574847b788fe846fe21a41386063be161 (patch) | |
tree | 6c2ac7379c376793368affab03e5202abd0f1efa /arch/arm/mach-omap1/clock.c | |
parent | db8ac47cfccaafd3fa4c5c15320809d44f4fcef9 (diff) |
[ARM] omap: introduce clock operations structure
Collect up all the common enable/disable clock operation functions
into a separate operations structure.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap1/clock.c')
-rw-r--r-- | arch/arm/mach-omap1/clock.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c index 5fba20731710..25ef04da6b06 100644 --- a/arch/arm/mach-omap1/clock.c +++ b/arch/arm/mach-omap1/clock.c | |||
@@ -26,8 +26,17 @@ | |||
26 | #include <mach/clock.h> | 26 | #include <mach/clock.h> |
27 | #include <mach/sram.h> | 27 | #include <mach/sram.h> |
28 | 28 | ||
29 | static const struct clkops clkops_generic; | ||
30 | static const struct clkops clkops_uart; | ||
31 | static const struct clkops clkops_dspck; | ||
32 | |||
29 | #include "clock.h" | 33 | #include "clock.h" |
30 | 34 | ||
35 | static int omap1_clk_enable_generic(struct clk * clk); | ||
36 | static int omap1_clk_enable(struct clk *clk); | ||
37 | static void omap1_clk_disable_generic(struct clk * clk); | ||
38 | static void omap1_clk_disable(struct clk *clk); | ||
39 | |||
31 | __u32 arm_idlect1_mask; | 40 | __u32 arm_idlect1_mask; |
32 | 41 | ||
33 | /*------------------------------------------------------------------------- | 42 | /*------------------------------------------------------------------------- |
@@ -78,6 +87,11 @@ static void omap1_clk_disable_dsp_domain(struct clk *clk) | |||
78 | } | 87 | } |
79 | } | 88 | } |
80 | 89 | ||
90 | static const struct clkops clkops_dspck = { | ||
91 | .enable = &omap1_clk_enable_dsp_domain, | ||
92 | .disable = &omap1_clk_disable_dsp_domain, | ||
93 | }; | ||
94 | |||
81 | static int omap1_clk_enable_uart_functional(struct clk *clk) | 95 | static int omap1_clk_enable_uart_functional(struct clk *clk) |
82 | { | 96 | { |
83 | int ret; | 97 | int ret; |
@@ -105,6 +119,11 @@ static void omap1_clk_disable_uart_functional(struct clk *clk) | |||
105 | omap1_clk_disable_generic(clk); | 119 | omap1_clk_disable_generic(clk); |
106 | } | 120 | } |
107 | 121 | ||
122 | static const struct clkops clkops_uart = { | ||
123 | .enable = &omap1_clk_enable_uart_functional, | ||
124 | .disable = &omap1_clk_disable_uart_functional, | ||
125 | }; | ||
126 | |||
108 | static void omap1_clk_allow_idle(struct clk *clk) | 127 | static void omap1_clk_allow_idle(struct clk *clk) |
109 | { | 128 | { |
110 | struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk; | 129 | struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk; |
@@ -468,7 +487,7 @@ static int omap1_clk_enable(struct clk *clk) | |||
468 | omap1_clk_deny_idle(clk->parent); | 487 | omap1_clk_deny_idle(clk->parent); |
469 | } | 488 | } |
470 | 489 | ||
471 | ret = clk->enable(clk); | 490 | ret = clk->ops->enable(clk); |
472 | 491 | ||
473 | if (unlikely(ret != 0) && clk->parent) { | 492 | if (unlikely(ret != 0) && clk->parent) { |
474 | omap1_clk_disable(clk->parent); | 493 | omap1_clk_disable(clk->parent); |
@@ -482,7 +501,7 @@ static int omap1_clk_enable(struct clk *clk) | |||
482 | static void omap1_clk_disable(struct clk *clk) | 501 | static void omap1_clk_disable(struct clk *clk) |
483 | { | 502 | { |
484 | if (clk->usecount > 0 && !(--clk->usecount)) { | 503 | if (clk->usecount > 0 && !(--clk->usecount)) { |
485 | clk->disable(clk); | 504 | clk->ops->disable(clk); |
486 | if (likely(clk->parent)) { | 505 | if (likely(clk->parent)) { |
487 | omap1_clk_disable(clk->parent); | 506 | omap1_clk_disable(clk->parent); |
488 | if (clk->flags & CLOCK_NO_IDLE_PARENT) | 507 | if (clk->flags & CLOCK_NO_IDLE_PARENT) |
@@ -561,6 +580,11 @@ static void omap1_clk_disable_generic(struct clk *clk) | |||
561 | } | 580 | } |
562 | } | 581 | } |
563 | 582 | ||
583 | static const struct clkops clkops_generic = { | ||
584 | .enable = &omap1_clk_enable_generic, | ||
585 | .disable = &omap1_clk_disable_generic, | ||
586 | }; | ||
587 | |||
564 | static long omap1_clk_round_rate(struct clk *clk, unsigned long rate) | 588 | static long omap1_clk_round_rate(struct clk *clk, unsigned long rate) |
565 | { | 589 | { |
566 | int dsor_exp; | 590 | int dsor_exp; |
@@ -659,7 +683,7 @@ static void __init omap1_clk_disable_unused(struct clk *clk) | |||
659 | } | 683 | } |
660 | 684 | ||
661 | printk(KERN_INFO "Disabling unused clock \"%s\"... ", clk->name); | 685 | printk(KERN_INFO "Disabling unused clock \"%s\"... ", clk->name); |
662 | clk->disable(clk); | 686 | clk->ops->disable(clk); |
663 | printk(" done\n"); | 687 | printk(" done\n"); |
664 | } | 688 | } |
665 | 689 | ||