diff options
author | Rajendra Nayak <rnayak@ti.com> | 2011-02-25 17:49:01 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2011-02-25 18:10:17 -0500 |
commit | 97f678989afe5dd1584a0877dfd8b0d2e124b73a (patch) | |
tree | 39f2b45b0e62b8c62a5e0e6277343a0474c04b2a /arch/arm/mach-omap2/dpll44xx.c | |
parent | b80b956dc56c6a3cb77b97e2abff48fb7ebc2119 (diff) |
OMAP4: DPLL: Add dpll api to control GATE_CTRL
On OMAP4, the dpll post divider outputs (MX outputs)
along with clockout_x2 output provide a way to allow/deny
hardware level autogating.
Allowing autoidle would mean that the hw would autogate
this clock when there is no dependency for it.
Denying idle would mean that this clock output will be
forced to stay enabled.
Add dpll api's to read/allow/deny idle control
for these dpll mx postdividers.
NOTE: The gatectrl bit set to 0 allows gatectrl,
and the bit set to 1 denies gatectrl.
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
[paul@pwsan.com: moved OMAP4-specific DPLL control code to
mach-omap2/dpll44xx.c; added some documentation for CLOCK_CLKOUTX2]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/dpll44xx.c')
-rw-r--r-- | arch/arm/mach-omap2/dpll44xx.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c new file mode 100644 index 000000000000..94a3592cd54c --- /dev/null +++ b/arch/arm/mach-omap2/dpll44xx.c | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * OMAP4-specific DPLL control functions | ||
3 | * | ||
4 | * Copyright (C) 2011 Texas Instruments, Inc. | ||
5 | * Rajendra Nayak | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <linux/clk.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/bitops.h> | ||
17 | |||
18 | #include <plat/cpu.h> | ||
19 | #include <plat/clock.h> | ||
20 | |||
21 | #include "clock.h" | ||
22 | #include "cm-regbits-44xx.h" | ||
23 | |||
24 | /* Supported only on OMAP4 */ | ||
25 | int omap4_dpllmx_gatectrl_read(struct clk *clk) | ||
26 | { | ||
27 | u32 v; | ||
28 | u32 mask; | ||
29 | |||
30 | if (!clk || !clk->clksel_reg || !cpu_is_omap44xx()) | ||
31 | return -EINVAL; | ||
32 | |||
33 | mask = clk->flags & CLOCK_CLKOUTX2 ? | ||
34 | OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK : | ||
35 | OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK; | ||
36 | |||
37 | v = __raw_readl(clk->clksel_reg); | ||
38 | v &= mask; | ||
39 | v >>= __ffs(mask); | ||
40 | |||
41 | return v; | ||
42 | } | ||
43 | |||
44 | void omap4_dpllmx_allow_gatectrl(struct clk *clk) | ||
45 | { | ||
46 | u32 v; | ||
47 | u32 mask; | ||
48 | |||
49 | if (!clk || !clk->clksel_reg || !cpu_is_omap44xx()) | ||
50 | return; | ||
51 | |||
52 | mask = clk->flags & CLOCK_CLKOUTX2 ? | ||
53 | OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK : | ||
54 | OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK; | ||
55 | |||
56 | v = __raw_readl(clk->clksel_reg); | ||
57 | /* Clear the bit to allow gatectrl */ | ||
58 | v &= ~mask; | ||
59 | __raw_writel(v, clk->clksel_reg); | ||
60 | } | ||
61 | |||
62 | void omap4_dpllmx_deny_gatectrl(struct clk *clk) | ||
63 | { | ||
64 | u32 v; | ||
65 | u32 mask; | ||
66 | |||
67 | if (!clk || !clk->clksel_reg || !cpu_is_omap44xx()) | ||
68 | return; | ||
69 | |||
70 | mask = clk->flags & CLOCK_CLKOUTX2 ? | ||
71 | OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK : | ||
72 | OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK; | ||
73 | |||
74 | v = __raw_readl(clk->clksel_reg); | ||
75 | /* Set the bit to deny gatectrl */ | ||
76 | v |= mask; | ||
77 | __raw_writel(v, clk->clksel_reg); | ||
78 | } | ||