diff options
author | Paul Walmsley <paul@pwsan.com> | 2008-08-19 04:08:45 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-08-19 04:08:45 -0400 |
commit | 333943ba9e1716a3751af82f2dcc7620b83091ed (patch) | |
tree | 8646e99605d9d1519ac2f93f9399d78b89490c68 /arch/arm/mach-omap2/clock.c | |
parent | d1b03f615ae7ede957551dd26bf8929bdc2bb786 (diff) |
ARM: OMAP2: Clockdomain: Integrate OMAP3 clocks with clockdomain code
This patch integrates the OMAP3 clock tree with the clockdomain code.
This patch:
- marks OMAP34xx clocks with their corresponding clockdomain.
- adds code to convert the clockdomain name to a clockdomain pointer in the
struct clk during clk_register().
- modifies OMAP2 clock usecounting to call into the clockdomain code
when clocks are enabled or disabled.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/clock.c')
-rw-r--r-- | arch/arm/mach-omap2/clock.c | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 1d891e4a6933..aa9b37370d44 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/io.h> | 26 | #include <asm/io.h> |
27 | 27 | ||
28 | #include <mach/clock.h> | 28 | #include <mach/clock.h> |
29 | #include <mach/clockdomain.h> | ||
29 | #include <mach/sram.h> | 30 | #include <mach/sram.h> |
30 | #include <mach/cpu.h> | 31 | #include <mach/cpu.h> |
31 | #include <asm/div64.h> | 32 | #include <asm/div64.h> |
@@ -62,10 +63,36 @@ | |||
62 | u8 cpu_mask; | 63 | u8 cpu_mask; |
63 | 64 | ||
64 | /*------------------------------------------------------------------------- | 65 | /*------------------------------------------------------------------------- |
65 | * Omap2 specific clock functions | 66 | * OMAP2/3 specific clock functions |
66 | *-------------------------------------------------------------------------*/ | 67 | *-------------------------------------------------------------------------*/ |
67 | 68 | ||
68 | /** | 69 | /** |
70 | * omap2_init_clk_clkdm - look up a clockdomain name, store pointer in clk | ||
71 | * @clk: OMAP clock struct ptr to use | ||
72 | * | ||
73 | * Convert a clockdomain name stored in a struct clk 'clk' into a | ||
74 | * clockdomain pointer, and save it into the struct clk. Intended to be | ||
75 | * called during clk_register(). No return value. | ||
76 | */ | ||
77 | void omap2_init_clk_clkdm(struct clk *clk) | ||
78 | { | ||
79 | struct clockdomain *clkdm; | ||
80 | |||
81 | if (!clk->clkdm_name) | ||
82 | return; | ||
83 | |||
84 | clkdm = clkdm_lookup(clk->clkdm_name); | ||
85 | if (clkdm) { | ||
86 | pr_debug("clock: associated clk %s to clkdm %s\n", | ||
87 | clk->name, clk->clkdm_name); | ||
88 | clk->clkdm = clkdm; | ||
89 | } else { | ||
90 | pr_debug("clock: could not associate clk %s to " | ||
91 | "clkdm %s\n", clk->name, clk->clkdm_name); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | /** | ||
69 | * omap2_init_clksel_parent - set a clksel clk's parent field from the hardware | 96 | * omap2_init_clksel_parent - set a clksel clk's parent field from the hardware |
70 | * @clk: OMAP clock struct ptr to use | 97 | * @clk: OMAP clock struct ptr to use |
71 | * | 98 | * |
@@ -308,6 +335,9 @@ void omap2_clk_disable(struct clk *clk) | |||
308 | _omap2_clk_disable(clk); | 335 | _omap2_clk_disable(clk); |
309 | if (likely((u32)clk->parent)) | 336 | if (likely((u32)clk->parent)) |
310 | omap2_clk_disable(clk->parent); | 337 | omap2_clk_disable(clk->parent); |
338 | if (clk->clkdm) | ||
339 | omap2_clkdm_clk_disable(clk->clkdm, clk); | ||
340 | |||
311 | } | 341 | } |
312 | } | 342 | } |
313 | 343 | ||
@@ -324,11 +354,19 @@ int omap2_clk_enable(struct clk *clk) | |||
324 | return ret; | 354 | return ret; |
325 | } | 355 | } |
326 | 356 | ||
357 | if (clk->clkdm) | ||
358 | omap2_clkdm_clk_enable(clk->clkdm, clk); | ||
359 | |||
327 | ret = _omap2_clk_enable(clk); | 360 | ret = _omap2_clk_enable(clk); |
328 | 361 | ||
329 | if (unlikely(ret != 0) && clk->parent) { | 362 | if (unlikely(ret != 0)) { |
330 | omap2_clk_disable(clk->parent); | 363 | if (clk->clkdm) |
331 | clk->usecount--; | 364 | omap2_clkdm_clk_disable(clk->clkdm, clk); |
365 | |||
366 | if (clk->parent) { | ||
367 | omap2_clk_disable(clk->parent); | ||
368 | clk->usecount--; | ||
369 | } | ||
332 | } | 370 | } |
333 | } | 371 | } |
334 | 372 | ||