diff options
author | Paul Walmsley <paul@pwsan.com> | 2011-02-25 17:39:28 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2011-03-07 22:02:30 -0500 |
commit | 530e544fdadb934470c5c2b0e8d60c3d5386c161 (patch) | |
tree | ec06e217f38300674ee2171702034cf6dfe1d46a /arch/arm/mach-omap2 | |
parent | cc1d230cfbc1622be4bf16568f468054be8c5d2e (diff) |
OMAP2+: clock: add interface clock type code with autoidle support
Add interface clock type code with autoidle enable/disable support.
The clkops structures created in this file will be used for all
OMAP2/3 interface clocks with autoidle support. They will enable the
clock framework to control interface clock autoidle directly.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Rajendra Nayak <rnayak@ti.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/Makefile | 6 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clkt_iclk.c | 73 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock.h | 9 |
3 files changed, 85 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index ae44645551c2..c5b1be9b7328 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -110,19 +110,21 @@ obj-$(CONFIG_ARCH_OMAP3) += clockdomain.o \ | |||
110 | obj-$(CONFIG_ARCH_OMAP4) += clockdomain.o \ | 110 | obj-$(CONFIG_ARCH_OMAP4) += clockdomain.o \ |
111 | clockdomain44xx.o \ | 111 | clockdomain44xx.o \ |
112 | clockdomains44xx_data.o | 112 | clockdomains44xx_data.o |
113 | |||
113 | # Clock framework | 114 | # Clock framework |
114 | obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o \ | 115 | obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o \ |
115 | clkt2xxx_sys.o \ | 116 | clkt2xxx_sys.o \ |
116 | clkt2xxx_dpllcore.o \ | 117 | clkt2xxx_dpllcore.o \ |
117 | clkt2xxx_virt_prcm_set.o \ | 118 | clkt2xxx_virt_prcm_set.o \ |
118 | clkt2xxx_apll.o clkt2xxx_osc.o \ | 119 | clkt2xxx_apll.o clkt2xxx_osc.o \ |
119 | clkt2xxx_dpll.o | 120 | clkt2xxx_dpll.o clkt_iclk.o |
120 | obj-$(CONFIG_SOC_OMAP2420) += clock2420_data.o | 121 | obj-$(CONFIG_SOC_OMAP2420) += clock2420_data.o |
121 | obj-$(CONFIG_SOC_OMAP2430) += clock2430.o clock2430_data.o | 122 | obj-$(CONFIG_SOC_OMAP2430) += clock2430.o clock2430_data.o |
122 | obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o \ | 123 | obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o \ |
123 | clock34xx.o clkt34xx_dpll3m2.o \ | 124 | clock34xx.o clkt34xx_dpll3m2.o \ |
124 | clock3517.o clock36xx.o \ | 125 | clock3517.o clock36xx.o \ |
125 | dpll3xxx.o clock3xxx_data.o | 126 | dpll3xxx.o clock3xxx_data.o \ |
127 | clkt_iclk.o | ||
126 | obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) clock44xx_data.o \ | 128 | obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) clock44xx_data.o \ |
127 | dpll3xxx.o dpll44xx.o | 129 | dpll3xxx.o dpll44xx.o |
128 | 130 | ||
diff --git a/arch/arm/mach-omap2/clkt_iclk.c b/arch/arm/mach-omap2/clkt_iclk.c new file mode 100644 index 000000000000..dd8a6d3dc011 --- /dev/null +++ b/arch/arm/mach-omap2/clkt_iclk.c | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * OMAP2/3 interface clock control | ||
3 | * | ||
4 | * Copyright (C) 2011 Nokia Corporation | ||
5 | * Paul Walmsley | ||
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 | #undef DEBUG | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/clk.h> | ||
15 | #include <linux/io.h> | ||
16 | |||
17 | #include <plat/clock.h> | ||
18 | #include <plat/prcm.h> | ||
19 | |||
20 | #include "clock.h" | ||
21 | #include "clock2xxx.h" | ||
22 | #include "cm2xxx_3xxx.h" | ||
23 | #include "cm-regbits-24xx.h" | ||
24 | |||
25 | /* Private functions */ | ||
26 | |||
27 | /* XXX */ | ||
28 | void omap2_clkt_iclk_allow_idle(struct clk *clk) | ||
29 | { | ||
30 | u32 v, r; | ||
31 | |||
32 | r = ((__force u32)clk->enable_reg ^ (CM_AUTOIDLE ^ CM_ICLKEN)); | ||
33 | |||
34 | v = __raw_readl((__force void __iomem *)r); | ||
35 | v |= (1 << clk->enable_bit); | ||
36 | __raw_writel(v, (__force void __iomem *)r); | ||
37 | } | ||
38 | |||
39 | /* XXX */ | ||
40 | void omap2_clkt_iclk_deny_idle(struct clk *clk) | ||
41 | { | ||
42 | u32 v, r; | ||
43 | |||
44 | r = ((__force u32)clk->enable_reg ^ (CM_AUTOIDLE ^ CM_ICLKEN)); | ||
45 | |||
46 | v = __raw_readl((__force void __iomem *)r); | ||
47 | v &= ~(1 << clk->enable_bit); | ||
48 | __raw_writel(v, (__force void __iomem *)r); | ||
49 | } | ||
50 | |||
51 | /* Public data */ | ||
52 | |||
53 | const struct clkops clkops_omap2_iclk_dflt_wait = { | ||
54 | .enable = omap2_dflt_clk_enable, | ||
55 | .disable = omap2_dflt_clk_disable, | ||
56 | .find_companion = omap2_clk_dflt_find_companion, | ||
57 | .find_idlest = omap2_clk_dflt_find_idlest, | ||
58 | .allow_idle = omap2_clkt_iclk_allow_idle, | ||
59 | .deny_idle = omap2_clkt_iclk_deny_idle, | ||
60 | }; | ||
61 | |||
62 | const struct clkops clkops_omap2_iclk_dflt = { | ||
63 | .enable = omap2_dflt_clk_enable, | ||
64 | .disable = omap2_dflt_clk_disable, | ||
65 | .allow_idle = omap2_clkt_iclk_allow_idle, | ||
66 | .deny_idle = omap2_clkt_iclk_deny_idle, | ||
67 | }; | ||
68 | |||
69 | const struct clkops clkops_omap2_iclk_idle_only = { | ||
70 | .allow_idle = omap2_clkt_iclk_allow_idle, | ||
71 | .deny_idle = omap2_clkt_iclk_deny_idle, | ||
72 | }; | ||
73 | |||
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 9972d892a4af..5008f14448ef 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * linux/arch/arm/mach-omap2/clock.h | 2 | * linux/arch/arm/mach-omap2/clock.h |
3 | * | 3 | * |
4 | * Copyright (C) 2005-2009 Texas Instruments, Inc. | 4 | * Copyright (C) 2005-2009 Texas Instruments, Inc. |
5 | * Copyright (C) 2004-2009 Nokia Corporation | 5 | * Copyright (C) 2004-2011 Nokia Corporation |
6 | * | 6 | * |
7 | * Contacts: | 7 | * Contacts: |
8 | * Richard Woodruff <r-woodruff2@ti.com> | 8 | * Richard Woodruff <r-woodruff2@ti.com> |
@@ -86,6 +86,10 @@ long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); | |||
86 | int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); | 86 | int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); |
87 | int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent); | 87 | int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent); |
88 | 88 | ||
89 | /* clkt_iclk.c public functions */ | ||
90 | extern void omap2_clkt_iclk_allow_idle(struct clk *clk); | ||
91 | extern void omap2_clkt_iclk_deny_idle(struct clk *clk); | ||
92 | |||
89 | u32 omap2_get_dpll_rate(struct clk *clk); | 93 | u32 omap2_get_dpll_rate(struct clk *clk); |
90 | void omap2_init_dpll_parent(struct clk *clk); | 94 | void omap2_init_dpll_parent(struct clk *clk); |
91 | 95 | ||
@@ -148,6 +152,9 @@ extern void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table) | |||
148 | #define omap2_clk_exit_cpufreq_table 0 | 152 | #define omap2_clk_exit_cpufreq_table 0 |
149 | #endif | 153 | #endif |
150 | 154 | ||
155 | extern const struct clkops clkops_omap2_iclk_dflt_wait; | ||
156 | extern const struct clkops clkops_omap2_iclk_dflt; | ||
157 | extern const struct clkops clkops_omap2_iclk_idle_only; | ||
151 | extern const struct clkops clkops_omap2xxx_dpll_ops; | 158 | extern const struct clkops clkops_omap2xxx_dpll_ops; |
152 | extern const struct clkops clkops_omap3_noncore_dpll_ops; | 159 | extern const struct clkops clkops_omap3_noncore_dpll_ops; |
153 | extern const struct clkops clkops_omap3_core_dpll_ops; | 160 | extern const struct clkops clkops_omap3_core_dpll_ops; |