aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2011-03-11 12:20:03 -0500
committerTony Lindgren <tony@atomide.com>2011-03-11 12:20:03 -0500
commita2358a7bc35e388978fc2f7f6b071a0fd27d78c1 (patch)
treefbdc2ddb066243a11aebc490c4d54e6a42be51e2 /arch/arm/mach-omap2
parent94a06b74e724caabcf0464c81527cfbcae0c8aff (diff)
parenta08572ae529b1e8de12393eeced661feae8fd44c (diff)
Merge branch 'integration-2.6.39-for-tony' of git://git.pwsan.com/linux-integration into omap-for-linus
Conflicts: arch/arm/mach-omap2/pm34xx.c
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/Makefile34
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_apll.c24
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpll.c63
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_osc.c14
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c91
-rw-r--r--arch/arm/mach-omap2/clkt_iclk.c82
-rw-r--r--arch/arm/mach-omap2/clock.c28
-rw-r--r--arch/arm/mach-omap2/clock.h21
-rw-r--r--arch/arm/mach-omap2/clock2420_data.c221
-rw-r--r--arch/arm/mach-omap2/clock2430_data.c232
-rw-r--r--arch/arm/mach-omap2/clock2xxx.h4
-rw-r--r--arch/arm/mach-omap2/clock34xx.c29
-rw-r--r--arch/arm/mach-omap2/clock34xx.h5
-rw-r--r--arch/arm/mach-omap2/clock3517.c4
-rw-r--r--arch/arm/mach-omap2/clock3xxx.c3
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c165
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c57
-rw-r--r--arch/arm/mach-omap2/clock_common_data.c6
-rw-r--r--arch/arm/mach-omap2/clockdomain.c439
-rw-r--r--arch/arm/mach-omap2/clockdomain.h70
-rw-r--r--arch/arm/mach-omap2/clockdomain2xxx_3xxx.c274
-rw-r--r--arch/arm/mach-omap2/clockdomain44xx.c137
-rw-r--r--arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c12
-rw-r--r--arch/arm/mach-omap2/clockdomains44xx_data.c396
-rw-r--r--arch/arm/mach-omap2/cm-regbits-24xx.h3
-rw-r--r--arch/arm/mach-omap2/cm2xxx_3xxx.c69
-rw-r--r--arch/arm/mach-omap2/cm2xxx_3xxx.h8
-rw-r--r--arch/arm/mach-omap2/cm44xx.h1
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c21
-rw-r--r--arch/arm/mach-omap2/cminst44xx.h6
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c4
-rw-r--r--arch/arm/mach-omap2/dpll44xx.c84
-rw-r--r--arch/arm/mach-omap2/io.c6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c157
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c11
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c12
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c47
-rw-r--r--arch/arm/mach-omap2/omap_opp_data.h24
-rw-r--r--arch/arm/mach-omap2/omap_twl.c2
-rw-r--r--arch/arm/mach-omap2/opp3xxx_data.c66
-rw-r--r--arch/arm/mach-omap2/opp4xxx_data.c43
-rw-r--r--arch/arm/mach-omap2/pm.c8
-rw-r--r--arch/arm/mach-omap2/pm24xx.c77
-rw-r--r--arch/arm/mach-omap2/pm34xx.c127
-rw-r--r--arch/arm/mach-omap2/powerdomain.c43
-rw-r--r--arch/arm/mach-omap2/powerdomain.h19
-rw-r--r--arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c9
-rw-r--r--arch/arm/mach-omap2/powerdomains2xxx_data.c18
-rw-r--r--arch/arm/mach-omap2/powerdomains3xxx_data.c38
-rw-r--r--arch/arm/mach-omap2/powerdomains44xx_data.c88
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.h4
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.c18
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.h5
-rw-r--r--arch/arm/mach-omap2/smartreflex-class3.c2
-rw-r--r--arch/arm/mach-omap2/smartreflex.c2
-rw-r--r--arch/arm/mach-omap2/smartreflex.h246
-rw-r--r--arch/arm/mach-omap2/sr_device.c4
-rw-r--r--arch/arm/mach-omap2/vc.h83
-rw-r--r--arch/arm/mach-omap2/vc3xxx_data.c63
-rw-r--r--arch/arm/mach-omap2/vc44xx_data.c75
-rw-r--r--arch/arm/mach-omap2/voltage.c1020
-rw-r--r--arch/arm/mach-omap2/voltage.h184
-rw-r--r--arch/arm/mach-omap2/voltagedomains3xxx_data.c95
-rw-r--r--arch/arm/mach-omap2/voltagedomains44xx_data.c102
-rw-r--r--arch/arm/mach-omap2/vp.h143
-rw-r--r--arch/arm/mach-omap2/vp3xxx_data.c82
-rw-r--r--arch/arm/mach-omap2/vp44xx_data.c100
67 files changed, 3769 insertions, 1861 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 8ef8711eac94..82b2a67f42b7 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -59,10 +59,10 @@ endif
59# Power Management 59# Power Management
60ifeq ($(CONFIG_PM),y) 60ifeq ($(CONFIG_PM),y)
61obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o 61obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o
62obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o pm_bus.o voltage.o 62obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o pm_bus.o
63obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o voltage.o \ 63obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o \
64 cpuidle34xx.o pm_bus.o 64 cpuidle34xx.o pm_bus.o
65obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o voltage.o pm_bus.o 65obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o pm_bus.o
66obj-$(CONFIG_PM_DEBUG) += pm-debug.o 66obj-$(CONFIG_PM_DEBUG) += pm-debug.o
67obj-$(CONFIG_OMAP_SMARTREFLEX) += sr_device.o smartreflex.o 67obj-$(CONFIG_OMAP_SMARTREFLEX) += sr_device.o smartreflex.o
68obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3) += smartreflex-class3.o 68obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3) += smartreflex-class3.o
@@ -78,13 +78,25 @@ endif
78 78
79# PRCM 79# PRCM
80obj-$(CONFIG_ARCH_OMAP2) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o 80obj-$(CONFIG_ARCH_OMAP2) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
81obj-$(CONFIG_ARCH_OMAP3) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o 81obj-$(CONFIG_ARCH_OMAP3) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o \
82 vc3xxx_data.o vp3xxx_data.o
82# XXX The presence of cm2xxx_3xxx.o on the line below is temporary and 83# XXX The presence of cm2xxx_3xxx.o on the line below is temporary and
83# will be removed once the OMAP4 part of the codebase is converted to 84# will be removed once the OMAP4 part of the codebase is converted to
84# use OMAP4-specific PRCM functions. 85# use OMAP4-specific PRCM functions.
85obj-$(CONFIG_ARCH_OMAP4) += prcm.o cm2xxx_3xxx.o cminst44xx.o \ 86obj-$(CONFIG_ARCH_OMAP4) += prcm.o cm2xxx_3xxx.o cminst44xx.o \
86 cm44xx.o prcm_mpu44xx.o \ 87 cm44xx.o prcm_mpu44xx.o \
87 prminst44xx.o 88 prminst44xx.o vc44xx_data.o \
89 vp44xx_data.o
90
91# OMAP voltage domains
92ifeq ($(CONFIG_PM),y)
93voltagedomain-common := voltage.o
94obj-$(CONFIG_ARCH_OMAP2) += $(voltagedomain-common)
95obj-$(CONFIG_ARCH_OMAP3) += $(voltagedomain-common) \
96 voltagedomains3xxx_data.o
97obj-$(CONFIG_ARCH_OMAP4) += $(voltagedomain-common) \
98 voltagedomains44xx_data.o
99endif
88 100
89# OMAP powerdomain framework 101# OMAP powerdomain framework
90powerdomain-common += powerdomain.o powerdomain-common.o 102powerdomain-common += powerdomain.o powerdomain-common.o
@@ -102,25 +114,31 @@ obj-$(CONFIG_ARCH_OMAP4) += $(powerdomain-common) \
102 114
103# PRCM clockdomain control 115# PRCM clockdomain control
104obj-$(CONFIG_ARCH_OMAP2) += clockdomain.o \ 116obj-$(CONFIG_ARCH_OMAP2) += clockdomain.o \
117 clockdomain2xxx_3xxx.o \
105 clockdomains2xxx_3xxx_data.o 118 clockdomains2xxx_3xxx_data.o
106obj-$(CONFIG_ARCH_OMAP3) += clockdomain.o \ 119obj-$(CONFIG_ARCH_OMAP3) += clockdomain.o \
120 clockdomain2xxx_3xxx.o \
107 clockdomains2xxx_3xxx_data.o 121 clockdomains2xxx_3xxx_data.o
108obj-$(CONFIG_ARCH_OMAP4) += clockdomain.o \ 122obj-$(CONFIG_ARCH_OMAP4) += clockdomain.o \
123 clockdomain44xx.o \
109 clockdomains44xx_data.o 124 clockdomains44xx_data.o
125
110# Clock framework 126# Clock framework
111obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o \ 127obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o \
112 clkt2xxx_sys.o \ 128 clkt2xxx_sys.o \
113 clkt2xxx_dpllcore.o \ 129 clkt2xxx_dpllcore.o \
114 clkt2xxx_virt_prcm_set.o \ 130 clkt2xxx_virt_prcm_set.o \
115 clkt2xxx_apll.o clkt2xxx_osc.o 131 clkt2xxx_apll.o clkt2xxx_osc.o \
132 clkt2xxx_dpll.o clkt_iclk.o
116obj-$(CONFIG_SOC_OMAP2420) += clock2420_data.o 133obj-$(CONFIG_SOC_OMAP2420) += clock2420_data.o
117obj-$(CONFIG_SOC_OMAP2430) += clock2430.o clock2430_data.o 134obj-$(CONFIG_SOC_OMAP2430) += clock2430.o clock2430_data.o
118obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o \ 135obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o \
119 clock34xx.o clkt34xx_dpll3m2.o \ 136 clock34xx.o clkt34xx_dpll3m2.o \
120 clock3517.o clock36xx.o \ 137 clock3517.o clock36xx.o \
121 dpll3xxx.o clock3xxx_data.o 138 dpll3xxx.o clock3xxx_data.o \
139 clkt_iclk.o
122obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) clock44xx_data.o \ 140obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) clock44xx_data.o \
123 dpll3xxx.o 141 dpll3xxx.o dpll44xx.o
124 142
125# OMAP2 clock rate set data (old "OPP" data) 143# OMAP2 clock rate set data (old "OPP" data)
126obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o 144obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o
diff --git a/arch/arm/mach-omap2/clkt2xxx_apll.c b/arch/arm/mach-omap2/clkt2xxx_apll.c
index f51cffd1fc53..b19a1f7234ae 100644
--- a/arch/arm/mach-omap2/clkt2xxx_apll.c
+++ b/arch/arm/mach-omap2/clkt2xxx_apll.c
@@ -78,6 +78,26 @@ static int omap2_clk_apll54_enable(struct clk *clk)
78 return omap2_clk_apll_enable(clk, OMAP24XX_ST_54M_APLL_MASK); 78 return omap2_clk_apll_enable(clk, OMAP24XX_ST_54M_APLL_MASK);
79} 79}
80 80
81static void _apll96_allow_idle(struct clk *clk)
82{
83 omap2xxx_cm_set_apll96_auto_low_power_stop();
84}
85
86static void _apll96_deny_idle(struct clk *clk)
87{
88 omap2xxx_cm_set_apll96_disable_autoidle();
89}
90
91static void _apll54_allow_idle(struct clk *clk)
92{
93 omap2xxx_cm_set_apll54_auto_low_power_stop();
94}
95
96static void _apll54_deny_idle(struct clk *clk)
97{
98 omap2xxx_cm_set_apll54_disable_autoidle();
99}
100
81/* Stop APLL */ 101/* Stop APLL */
82static void omap2_clk_apll_disable(struct clk *clk) 102static void omap2_clk_apll_disable(struct clk *clk)
83{ 103{
@@ -93,11 +113,15 @@ static void omap2_clk_apll_disable(struct clk *clk)
93const struct clkops clkops_apll96 = { 113const struct clkops clkops_apll96 = {
94 .enable = omap2_clk_apll96_enable, 114 .enable = omap2_clk_apll96_enable,
95 .disable = omap2_clk_apll_disable, 115 .disable = omap2_clk_apll_disable,
116 .allow_idle = _apll96_allow_idle,
117 .deny_idle = _apll96_deny_idle,
96}; 118};
97 119
98const struct clkops clkops_apll54 = { 120const struct clkops clkops_apll54 = {
99 .enable = omap2_clk_apll54_enable, 121 .enable = omap2_clk_apll54_enable,
100 .disable = omap2_clk_apll_disable, 122 .disable = omap2_clk_apll_disable,
123 .allow_idle = _apll54_allow_idle,
124 .deny_idle = _apll54_deny_idle,
101}; 125};
102 126
103/* Public functions */ 127/* Public functions */
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpll.c b/arch/arm/mach-omap2/clkt2xxx_dpll.c
new file mode 100644
index 000000000000..1502a7bc20bb
--- /dev/null
+++ b/arch/arm/mach-omap2/clkt2xxx_dpll.c
@@ -0,0 +1,63 @@
1/*
2 * OMAP2-specific DPLL control functions
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
12#include <linux/kernel.h>
13#include <linux/errno.h>
14#include <linux/clk.h>
15#include <linux/io.h>
16
17#include <plat/clock.h>
18
19#include "clock.h"
20#include "cm2xxx_3xxx.h"
21#include "cm-regbits-24xx.h"
22
23/* Private functions */
24
25/**
26 * _allow_idle - enable DPLL autoidle bits
27 * @clk: struct clk * of the DPLL to operate on
28 *
29 * Enable DPLL automatic idle control. The DPLL will enter low-power
30 * stop when its downstream clocks are gated. No return value.
31 * REVISIT: DPLL can optionally enter low-power bypass by writing 0x1
32 * instead. Add some mechanism to optionally enter this mode.
33 */
34static void _allow_idle(struct clk *clk)
35{
36 if (!clk || !clk->dpll_data)
37 return;
38
39 omap2xxx_cm_set_dpll_auto_low_power_stop();
40}
41
42/**
43 * _deny_idle - prevent DPLL from automatically idling
44 * @clk: struct clk * of the DPLL to operate on
45 *
46 * Disable DPLL automatic idle control. No return value.
47 */
48static void _deny_idle(struct clk *clk)
49{
50 if (!clk || !clk->dpll_data)
51 return;
52
53 omap2xxx_cm_set_dpll_disable_autoidle();
54}
55
56
57/* Public data */
58
59const struct clkops clkops_omap2xxx_dpll_ops = {
60 .allow_idle = _allow_idle,
61 .deny_idle = _deny_idle,
62};
63
diff --git a/arch/arm/mach-omap2/clkt2xxx_osc.c b/arch/arm/mach-omap2/clkt2xxx_osc.c
index df7b80506483..c3460928b5e0 100644
--- a/arch/arm/mach-omap2/clkt2xxx_osc.c
+++ b/arch/arm/mach-omap2/clkt2xxx_osc.c
@@ -30,6 +30,13 @@
30#include "prm2xxx_3xxx.h" 30#include "prm2xxx_3xxx.h"
31#include "prm-regbits-24xx.h" 31#include "prm-regbits-24xx.h"
32 32
33/*
34 * XXX This does not actually enable the osc_ck, since the osc_ck must
35 * be running for this function to be called. Instead, this function
36 * is used to disable an autoidle mode on the osc_ck. The existing
37 * clk_enable/clk_disable()-based usecounting for osc_ck should be
38 * replaced with autoidle-based usecounting.
39 */
33static int omap2_enable_osc_ck(struct clk *clk) 40static int omap2_enable_osc_ck(struct clk *clk)
34{ 41{
35 u32 pcc; 42 u32 pcc;
@@ -41,6 +48,13 @@ static int omap2_enable_osc_ck(struct clk *clk)
41 return 0; 48 return 0;
42} 49}
43 50
51/*
52 * XXX This does not actually disable the osc_ck, since doing so would
53 * immediately halt the system. Instead, this function is used to
54 * enable an autoidle mode on the osc_ck. The existing
55 * clk_enable/clk_disable()-based usecounting for osc_ck should be
56 * replaced with autoidle-based usecounting.
57 */
44static void omap2_disable_osc_ck(struct clk *clk) 58static void omap2_disable_osc_ck(struct clk *clk)
45{ 59{
46 u32 pcc; 60 u32 pcc;
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index acb7ae5b0a25..bcffee001bfa 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -178,12 +178,11 @@ void omap2_init_dpll_parent(struct clk *clk)
178 if (!dd) 178 if (!dd)
179 return; 179 return;
180 180
181 /* Return bypass rate if DPLL is bypassed */
182 v = __raw_readl(dd->control_reg); 181 v = __raw_readl(dd->control_reg);
183 v &= dd->enable_mask; 182 v &= dd->enable_mask;
184 v >>= __ffs(dd->enable_mask); 183 v >>= __ffs(dd->enable_mask);
185 184
186 /* Reparent in case the dpll is in bypass */ 185 /* Reparent the struct clk in case the dpll is in bypass */
187 if (cpu_is_omap24xx()) { 186 if (cpu_is_omap24xx()) {
188 if (v == OMAP2XXX_EN_DPLL_LPBYPASS || 187 if (v == OMAP2XXX_EN_DPLL_LPBYPASS ||
189 v == OMAP2XXX_EN_DPLL_FRBYPASS) 188 v == OMAP2XXX_EN_DPLL_FRBYPASS)
@@ -260,50 +259,22 @@ u32 omap2_get_dpll_rate(struct clk *clk)
260/* DPLL rate rounding code */ 259/* DPLL rate rounding code */
261 260
262/** 261/**
263 * omap2_dpll_set_rate_tolerance: set the error tolerance during rate rounding
264 * @clk: struct clk * of the DPLL
265 * @tolerance: maximum rate error tolerance
266 *
267 * Set the maximum DPLL rate error tolerance for the rate rounding
268 * algorithm. The rate tolerance is an attempt to balance DPLL power
269 * saving (the least divider value "n") vs. rate fidelity (the least
270 * difference between the desired DPLL target rate and the rounded
271 * rate out of the algorithm). So, increasing the tolerance is likely
272 * to decrease DPLL power consumption and increase DPLL rate error.
273 * Returns -EINVAL if provided a null clock ptr or a clk that is not a
274 * DPLL; or 0 upon success.
275 */
276int omap2_dpll_set_rate_tolerance(struct clk *clk, unsigned int tolerance)
277{
278 if (!clk || !clk->dpll_data)
279 return -EINVAL;
280
281 clk->dpll_data->rate_tolerance = tolerance;
282
283 return 0;
284}
285
286/**
287 * omap2_dpll_round_rate - round a target rate for an OMAP DPLL 262 * omap2_dpll_round_rate - round a target rate for an OMAP DPLL
288 * @clk: struct clk * for a DPLL 263 * @clk: struct clk * for a DPLL
289 * @target_rate: desired DPLL clock rate 264 * @target_rate: desired DPLL clock rate
290 * 265 *
291 * Given a DPLL, a desired target rate, and a rate tolerance, round 266 * Given a DPLL and a desired target rate, round the target rate to a
292 * the target rate to a possible, programmable rate for this DPLL. 267 * possible, programmable rate for this DPLL. Attempts to select the
293 * Rate tolerance is assumed to be set by the caller before this 268 * minimum possible n. Stores the computed (m, n) in the DPLL's
294 * function is called. Attempts to select the minimum possible n 269 * dpll_data structure so set_rate() will not need to call this
295 * within the tolerance to reduce power consumption. Stores the 270 * (expensive) function again. Returns ~0 if the target rate cannot
296 * computed (m, n) in the DPLL's dpll_data structure so set_rate() 271 * be rounded, or the rounded rate upon success.
297 * will not need to call this (expensive) function again. Returns ~0
298 * if the target rate cannot be rounded, either because the rate is
299 * too low or because the rate tolerance is set too tightly; or the
300 * rounded rate upon success.
301 */ 272 */
302long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate) 273long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
303{ 274{
304 int m, n, r, e, scaled_max_m; 275 int m, n, r, scaled_max_m;
305 unsigned long scaled_rt_rp, new_rate; 276 unsigned long scaled_rt_rp;
306 int min_e = -1, min_e_m = -1, min_e_n = -1; 277 unsigned long new_rate = 0;
307 struct dpll_data *dd; 278 struct dpll_data *dd;
308 279
309 if (!clk || !clk->dpll_data) 280 if (!clk || !clk->dpll_data)
@@ -311,8 +282,8 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
311 282
312 dd = clk->dpll_data; 283 dd = clk->dpll_data;
313 284
314 pr_debug("clock: starting DPLL round_rate for clock %s, target rate " 285 pr_debug("clock: %s: starting DPLL round_rate, target rate %ld\n",
315 "%ld\n", clk->name, target_rate); 286 clk->name, target_rate);
316 287
317 scaled_rt_rp = target_rate / (dd->clk_ref->rate / DPLL_SCALE_FACTOR); 288 scaled_rt_rp = target_rate / (dd->clk_ref->rate / DPLL_SCALE_FACTOR);
318 scaled_max_m = dd->max_multiplier * DPLL_SCALE_FACTOR; 289 scaled_max_m = dd->max_multiplier * DPLL_SCALE_FACTOR;
@@ -347,39 +318,23 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
347 if (r == DPLL_MULT_UNDERFLOW) 318 if (r == DPLL_MULT_UNDERFLOW)
348 continue; 319 continue;
349 320
350 e = target_rate - new_rate; 321 pr_debug("clock: %s: m = %d: n = %d: new_rate = %ld\n",
351 pr_debug("clock: n = %d: m = %d: rate error is %d " 322 clk->name, m, n, new_rate);
352 "(new_rate = %ld)\n", n, m, e, new_rate);
353
354 if (min_e == -1 ||
355 min_e >= (int)(abs(e) - dd->rate_tolerance)) {
356 min_e = e;
357 min_e_m = m;
358 min_e_n = n;
359
360 pr_debug("clock: found new least error %d\n", min_e);
361 323
362 /* We found good settings -- bail out now */ 324 if (target_rate == new_rate) {
363 if (min_e <= dd->rate_tolerance) 325 dd->last_rounded_m = m;
364 break; 326 dd->last_rounded_n = n;
327 dd->last_rounded_rate = target_rate;
328 break;
365 } 329 }
366 } 330 }
367 331
368 if (min_e < 0) { 332 if (target_rate != new_rate) {
369 pr_debug("clock: error: target rate or tolerance too low\n"); 333 pr_debug("clock: %s: cannot round to rate %ld\n", clk->name,
334 target_rate);
370 return ~0; 335 return ~0;
371 } 336 }
372 337
373 dd->last_rounded_m = min_e_m; 338 return target_rate;
374 dd->last_rounded_n = min_e_n;
375 dd->last_rounded_rate = _dpll_compute_new_rate(dd->clk_ref->rate,
376 min_e_m, min_e_n);
377
378 pr_debug("clock: final least error: e = %d, m = %d, n = %d\n",
379 min_e, min_e_m, min_e_n);
380 pr_debug("clock: final rate: %ld (target rate: %ld)\n",
381 dd->last_rounded_rate, target_rate);
382
383 return dd->last_rounded_rate;
384} 339}
385 340
diff --git a/arch/arm/mach-omap2/clkt_iclk.c b/arch/arm/mach-omap2/clkt_iclk.c
new file mode 100644
index 000000000000..3d43fba2542f
--- /dev/null
+++ b/arch/arm/mach-omap2/clkt_iclk.c
@@ -0,0 +1,82 @@
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 */
28void 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 */
40void 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
53const 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
62const 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
69const 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
74const struct clkops clkops_omap2_mdmclk_dflt_wait = {
75 .enable = omap2_dflt_clk_enable,
76 .disable = omap2_dflt_clk_disable,
77 .find_companion = omap2_clk_dflt_find_companion,
78 .find_idlest = omap2_clk_dflt_find_idlest,
79 .allow_idle = omap2_clkt_iclk_allow_idle,
80 .deny_idle = omap2_clkt_iclk_deny_idle,
81};
82
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 2a2f15213add..46d03ccc2806 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -261,10 +261,11 @@ void omap2_clk_disable(struct clk *clk)
261 261
262 pr_debug("clock: %s: disabling in hardware\n", clk->name); 262 pr_debug("clock: %s: disabling in hardware\n", clk->name);
263 263
264 clk->ops->disable(clk); 264 if (clk->ops && clk->ops->disable)
265 clk->ops->disable(clk);
265 266
266 if (clk->clkdm) 267 if (clk->clkdm)
267 omap2_clkdm_clk_disable(clk->clkdm, clk); 268 clkdm_clk_disable(clk->clkdm, clk);
268 269
269 if (clk->parent) 270 if (clk->parent)
270 omap2_clk_disable(clk->parent); 271 omap2_clk_disable(clk->parent);
@@ -304,7 +305,7 @@ int omap2_clk_enable(struct clk *clk)
304 } 305 }
305 306
306 if (clk->clkdm) { 307 if (clk->clkdm) {
307 ret = omap2_clkdm_clk_enable(clk->clkdm, clk); 308 ret = clkdm_clk_enable(clk->clkdm, clk);
308 if (ret) { 309 if (ret) {
309 WARN(1, "clock: %s: could not enable clockdomain %s: " 310 WARN(1, "clock: %s: could not enable clockdomain %s: "
310 "%d\n", clk->name, clk->clkdm->name, ret); 311 "%d\n", clk->name, clk->clkdm->name, ret);
@@ -312,17 +313,20 @@ int omap2_clk_enable(struct clk *clk)
312 } 313 }
313 } 314 }
314 315
315 ret = clk->ops->enable(clk); 316 if (clk->ops && clk->ops->enable) {
316 if (ret) { 317 ret = clk->ops->enable(clk);
317 WARN(1, "clock: %s: could not enable: %d\n", clk->name, ret); 318 if (ret) {
318 goto oce_err3; 319 WARN(1, "clock: %s: could not enable: %d\n",
320 clk->name, ret);
321 goto oce_err3;
322 }
319 } 323 }
320 324
321 return 0; 325 return 0;
322 326
323oce_err3: 327oce_err3:
324 if (clk->clkdm) 328 if (clk->clkdm)
325 omap2_clkdm_clk_disable(clk->clkdm, clk); 329 clkdm_clk_disable(clk->clkdm, clk);
326oce_err2: 330oce_err2:
327 if (clk->parent) 331 if (clk->parent)
328 omap2_clk_disable(clk->parent); 332 omap2_clk_disable(clk->parent);
@@ -373,10 +377,16 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
373const struct clkops clkops_omap3_noncore_dpll_ops = { 377const struct clkops clkops_omap3_noncore_dpll_ops = {
374 .enable = omap3_noncore_dpll_enable, 378 .enable = omap3_noncore_dpll_enable,
375 .disable = omap3_noncore_dpll_disable, 379 .disable = omap3_noncore_dpll_disable,
380 .allow_idle = omap3_dpll_allow_idle,
381 .deny_idle = omap3_dpll_deny_idle,
376}; 382};
377 383
378#endif 384const struct clkops clkops_omap3_core_dpll_ops = {
385 .allow_idle = omap3_dpll_allow_idle,
386 .deny_idle = omap3_dpll_deny_idle,
387};
379 388
389#endif
380 390
381/* 391/*
382 * OMAP2+ clock reset and init functions 392 * OMAP2+ clock reset and init functions
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 896584e3c4ab..e10ff2b54844 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>
@@ -18,9 +18,6 @@
18 18
19#include <plat/clock.h> 19#include <plat/clock.h>
20 20
21/* The maximum error between a target DPLL rate and the rounded rate in Hz */
22#define DEFAULT_DPLL_RATE_TOLERANCE 50000
23
24/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ 21/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */
25#define CORE_CLK_SRC_32K 0x0 22#define CORE_CLK_SRC_32K 0x0
26#define CORE_CLK_SRC_DPLL 0x1 23#define CORE_CLK_SRC_DPLL 0x1
@@ -55,7 +52,6 @@ void omap2_clk_disable(struct clk *clk);
55long omap2_clk_round_rate(struct clk *clk, unsigned long rate); 52long omap2_clk_round_rate(struct clk *clk, unsigned long rate);
56int omap2_clk_set_rate(struct clk *clk, unsigned long rate); 53int omap2_clk_set_rate(struct clk *clk, unsigned long rate);
57int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent); 54int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent);
58int omap2_dpll_set_rate_tolerance(struct clk *clk, unsigned int tolerance);
59long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate); 55long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate);
60unsigned long omap3_dpll_recalc(struct clk *clk); 56unsigned long omap3_dpll_recalc(struct clk *clk);
61unsigned long omap3_clkoutx2_recalc(struct clk *clk); 57unsigned long omap3_clkoutx2_recalc(struct clk *clk);
@@ -65,6 +61,9 @@ u32 omap3_dpll_autoidle_read(struct clk *clk);
65int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate); 61int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate);
66int omap3_noncore_dpll_enable(struct clk *clk); 62int omap3_noncore_dpll_enable(struct clk *clk);
67void omap3_noncore_dpll_disable(struct clk *clk); 63void omap3_noncore_dpll_disable(struct clk *clk);
64int omap4_dpllmx_gatectrl_read(struct clk *clk);
65void omap4_dpllmx_allow_gatectrl(struct clk *clk);
66void omap4_dpllmx_deny_gatectrl(struct clk *clk);
68 67
69#ifdef CONFIG_OMAP_RESET_CLOCKS 68#ifdef CONFIG_OMAP_RESET_CLOCKS
70void omap2_clk_disable_unused(struct clk *clk); 69void omap2_clk_disable_unused(struct clk *clk);
@@ -83,6 +82,10 @@ long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate);
83int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); 82int omap2_clksel_set_rate(struct clk *clk, unsigned long rate);
84int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent); 83int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent);
85 84
85/* clkt_iclk.c public functions */
86extern void omap2_clkt_iclk_allow_idle(struct clk *clk);
87extern void omap2_clkt_iclk_deny_idle(struct clk *clk);
88
86u32 omap2_get_dpll_rate(struct clk *clk); 89u32 omap2_get_dpll_rate(struct clk *clk);
87void omap2_init_dpll_parent(struct clk *clk); 90void omap2_init_dpll_parent(struct clk *clk);
88 91
@@ -136,6 +139,7 @@ extern struct clk *vclk, *sclk;
136extern const struct clksel_rate gpt_32k_rates[]; 139extern const struct clksel_rate gpt_32k_rates[];
137extern const struct clksel_rate gpt_sys_rates[]; 140extern const struct clksel_rate gpt_sys_rates[];
138extern const struct clksel_rate gfx_l3_rates[]; 141extern const struct clksel_rate gfx_l3_rates[];
142extern const struct clksel_rate dsp_ick_rates[];
139 143
140#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_CPU_FREQ) 144#if defined(CONFIG_ARCH_OMAP2) && defined(CONFIG_CPU_FREQ)
141extern void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table); 145extern void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
@@ -145,6 +149,13 @@ extern void omap2_clk_exit_cpufreq_table(struct cpufreq_frequency_table **table)
145#define omap2_clk_exit_cpufreq_table 0 149#define omap2_clk_exit_cpufreq_table 0
146#endif 150#endif
147 151
152extern const struct clkops clkops_omap2_iclk_dflt_wait;
153extern const struct clkops clkops_omap2_iclk_dflt;
154extern const struct clkops clkops_omap2_iclk_idle_only;
155extern const struct clkops clkops_omap2_mdmclk_dflt_wait;
156extern const struct clkops clkops_omap2xxx_dpll_ops;
148extern const struct clkops clkops_omap3_noncore_dpll_ops; 157extern const struct clkops clkops_omap3_noncore_dpll_ops;
158extern const struct clkops clkops_omap3_core_dpll_ops;
159extern const struct clkops clkops_omap4_dpllmx_ops;
149 160
150#endif 161#endif
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index 0a992bc8d0d8..b6f65d4ac97d 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -1,12 +1,12 @@
1/* 1/*
2 * linux/arch/arm/mach-omap2/clock2420_data.c 2 * OMAP2420 clock data
3 * 3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc. 4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2010 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>
9 * Paul Walmsley 9 * Paul Walmsley
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
@@ -34,18 +34,15 @@
34/* 34/*
35 * 2420 clock tree. 35 * 2420 clock tree.
36 * 36 *
37 * NOTE:In many cases here we are assigning a 'default' parent. In many 37 * NOTE:In many cases here we are assigning a 'default' parent. In
38 * cases the parent is selectable. The get/set parent calls will also 38 * many cases the parent is selectable. The set parent calls will
39 * switch sources. 39 * also switch sources.
40 *
41 * Many some clocks say always_enabled, but they can be auto idled for
42 * power savings. They will always be available upon clock request.
43 * 40 *
44 * Several sources are given initial rates which may be wrong, this will 41 * Several sources are given initial rates which may be wrong, this will
45 * be fixed up in the init func. 42 * be fixed up in the init func.
46 * 43 *
47 * Things are broadly separated below by clock domains. It is 44 * Things are broadly separated below by clock domains. It is
48 * noteworthy that most periferals have dependencies on multiple clock 45 * noteworthy that most peripherals have dependencies on multiple clock
49 * domains. Many get their interface clocks from the L4 domain, but get 46 * domains. Many get their interface clocks from the L4 domain, but get
50 * functional clocks from fixed sources or other core domain derived 47 * functional clocks from fixed sources or other core domain derived
51 * clocks. 48 * clocks.
@@ -55,7 +52,7 @@
55static struct clk func_32k_ck = { 52static struct clk func_32k_ck = {
56 .name = "func_32k_ck", 53 .name = "func_32k_ck",
57 .ops = &clkops_null, 54 .ops = &clkops_null,
58 .rate = 32000, 55 .rate = 32768,
59 .clkdm_name = "wkup_clkdm", 56 .clkdm_name = "wkup_clkdm",
60}; 57};
61 58
@@ -116,7 +113,6 @@ static struct dpll_data dpll_dd = {
116 .max_multiplier = 1023, 113 .max_multiplier = 1023,
117 .min_divider = 1, 114 .min_divider = 1,
118 .max_divider = 16, 115 .max_divider = 16,
119 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
120}; 116};
121 117
122/* 118/*
@@ -125,7 +121,7 @@ static struct dpll_data dpll_dd = {
125 */ 121 */
126static struct clk dpll_ck = { 122static struct clk dpll_ck = {
127 .name = "dpll_ck", 123 .name = "dpll_ck",
128 .ops = &clkops_null, 124 .ops = &clkops_omap2xxx_dpll_ops,
129 .parent = &sys_ck, /* Can be func_32k also */ 125 .parent = &sys_ck, /* Can be func_32k also */
130 .dpll_data = &dpll_dd, 126 .dpll_data = &dpll_dd,
131 .clkdm_name = "wkup_clkdm", 127 .clkdm_name = "wkup_clkdm",
@@ -455,36 +451,22 @@ static struct clk dsp_fck = {
455 .recalc = &omap2_clksel_recalc, 451 .recalc = &omap2_clksel_recalc,
456}; 452};
457 453
458/* DSP interface clock */ 454static const struct clksel dsp_ick_clksel[] = {
459static const struct clksel_rate dsp_irate_ick_rates[] = { 455 { .parent = &dsp_fck, .rates = dsp_ick_rates },
460 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
461 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
462 { .div = 0 },
463};
464
465static const struct clksel dsp_irate_ick_clksel[] = {
466 { .parent = &dsp_fck, .rates = dsp_irate_ick_rates },
467 { .parent = NULL } 456 { .parent = NULL }
468}; 457};
469 458
470/* This clock does not exist as such in the TRM. */
471static struct clk dsp_irate_ick = {
472 .name = "dsp_irate_ick",
473 .ops = &clkops_null,
474 .parent = &dsp_fck,
475 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
476 .clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK,
477 .clksel = dsp_irate_ick_clksel,
478 .recalc = &omap2_clksel_recalc,
479};
480
481/* 2420 only */
482static struct clk dsp_ick = { 459static struct clk dsp_ick = {
483 .name = "dsp_ick", /* apparently ipi and isp */ 460 .name = "dsp_ick", /* apparently ipi and isp */
484 .ops = &clkops_omap2_dflt_wait, 461 .ops = &clkops_omap2_iclk_dflt_wait,
485 .parent = &dsp_irate_ick, 462 .parent = &dsp_fck,
463 .clkdm_name = "dsp_clkdm",
486 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN), 464 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN),
487 .enable_bit = OMAP2420_EN_DSP_IPI_SHIFT, /* for ipi */ 465 .enable_bit = OMAP2420_EN_DSP_IPI_SHIFT, /* for ipi */
466 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
467 .clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK,
468 .clksel = dsp_ick_clksel,
469 .recalc = &omap2_clksel_recalc,
488}; 470};
489 471
490/* 472/*
@@ -579,7 +561,7 @@ static const struct clksel usb_l4_ick_clksel[] = {
579/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */ 561/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */
580static struct clk usb_l4_ick = { /* FS-USB interface clock */ 562static struct clk usb_l4_ick = { /* FS-USB interface clock */
581 .name = "usb_l4_ick", 563 .name = "usb_l4_ick",
582 .ops = &clkops_omap2_dflt_wait, 564 .ops = &clkops_omap2_iclk_dflt_wait,
583 .parent = &core_l3_ck, 565 .parent = &core_l3_ck,
584 .clkdm_name = "core_l4_clkdm", 566 .clkdm_name = "core_l4_clkdm",
585 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 567 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -661,7 +643,7 @@ static struct clk ssi_ssr_sst_fck = {
661 */ 643 */
662static struct clk ssi_l4_ick = { 644static struct clk ssi_l4_ick = {
663 .name = "ssi_l4_ick", 645 .name = "ssi_l4_ick",
664 .ops = &clkops_omap2_dflt_wait, 646 .ops = &clkops_omap2_iclk_dflt_wait,
665 .parent = &l4_ck, 647 .parent = &l4_ck,
666 .clkdm_name = "core_l4_clkdm", 648 .clkdm_name = "core_l4_clkdm",
667 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 649 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -716,6 +698,7 @@ static struct clk gfx_2d_fck = {
716 .recalc = &omap2_clksel_recalc, 698 .recalc = &omap2_clksel_recalc,
717}; 699};
718 700
701/* This interface clock does not have a CM_AUTOIDLE bit */
719static struct clk gfx_ick = { 702static struct clk gfx_ick = {
720 .name = "gfx_ick", /* From l3 */ 703 .name = "gfx_ick", /* From l3 */
721 .ops = &clkops_omap2_dflt_wait, 704 .ops = &clkops_omap2_dflt_wait,
@@ -763,7 +746,7 @@ static const struct clksel dss1_fck_clksel[] = {
763 746
764static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */ 747static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */
765 .name = "dss_ick", 748 .name = "dss_ick",
766 .ops = &clkops_omap2_dflt, 749 .ops = &clkops_omap2_iclk_dflt,
767 .parent = &l4_ck, /* really both l3 and l4 */ 750 .parent = &l4_ck, /* really both l3 and l4 */
768 .clkdm_name = "dss_clkdm", 751 .clkdm_name = "dss_clkdm",
769 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 752 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -825,6 +808,14 @@ static struct clk dss_54m_fck = { /* Alt clk used in power management */
825 .recalc = &followparent_recalc, 808 .recalc = &followparent_recalc,
826}; 809};
827 810
811static struct clk wu_l4_ick = {
812 .name = "wu_l4_ick",
813 .ops = &clkops_null,
814 .parent = &sys_ck,
815 .clkdm_name = "wkup_clkdm",
816 .recalc = &followparent_recalc,
817};
818
828/* 819/*
829 * CORE power domain ICLK & FCLK defines. 820 * CORE power domain ICLK & FCLK defines.
830 * Many of the these can have more than one possible parent. Entries 821 * Many of the these can have more than one possible parent. Entries
@@ -845,9 +836,9 @@ static const struct clksel omap24xx_gpt_clksel[] = {
845 836
846static struct clk gpt1_ick = { 837static struct clk gpt1_ick = {
847 .name = "gpt1_ick", 838 .name = "gpt1_ick",
848 .ops = &clkops_omap2_dflt_wait, 839 .ops = &clkops_omap2_iclk_dflt_wait,
849 .parent = &l4_ck, 840 .parent = &wu_l4_ick,
850 .clkdm_name = "core_l4_clkdm", 841 .clkdm_name = "wkup_clkdm",
851 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 842 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
852 .enable_bit = OMAP24XX_EN_GPT1_SHIFT, 843 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
853 .recalc = &followparent_recalc, 844 .recalc = &followparent_recalc,
@@ -871,7 +862,7 @@ static struct clk gpt1_fck = {
871 862
872static struct clk gpt2_ick = { 863static struct clk gpt2_ick = {
873 .name = "gpt2_ick", 864 .name = "gpt2_ick",
874 .ops = &clkops_omap2_dflt_wait, 865 .ops = &clkops_omap2_iclk_dflt_wait,
875 .parent = &l4_ck, 866 .parent = &l4_ck,
876 .clkdm_name = "core_l4_clkdm", 867 .clkdm_name = "core_l4_clkdm",
877 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 868 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -895,7 +886,7 @@ static struct clk gpt2_fck = {
895 886
896static struct clk gpt3_ick = { 887static struct clk gpt3_ick = {
897 .name = "gpt3_ick", 888 .name = "gpt3_ick",
898 .ops = &clkops_omap2_dflt_wait, 889 .ops = &clkops_omap2_iclk_dflt_wait,
899 .parent = &l4_ck, 890 .parent = &l4_ck,
900 .clkdm_name = "core_l4_clkdm", 891 .clkdm_name = "core_l4_clkdm",
901 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 892 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -919,7 +910,7 @@ static struct clk gpt3_fck = {
919 910
920static struct clk gpt4_ick = { 911static struct clk gpt4_ick = {
921 .name = "gpt4_ick", 912 .name = "gpt4_ick",
922 .ops = &clkops_omap2_dflt_wait, 913 .ops = &clkops_omap2_iclk_dflt_wait,
923 .parent = &l4_ck, 914 .parent = &l4_ck,
924 .clkdm_name = "core_l4_clkdm", 915 .clkdm_name = "core_l4_clkdm",
925 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 916 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -943,7 +934,7 @@ static struct clk gpt4_fck = {
943 934
944static struct clk gpt5_ick = { 935static struct clk gpt5_ick = {
945 .name = "gpt5_ick", 936 .name = "gpt5_ick",
946 .ops = &clkops_omap2_dflt_wait, 937 .ops = &clkops_omap2_iclk_dflt_wait,
947 .parent = &l4_ck, 938 .parent = &l4_ck,
948 .clkdm_name = "core_l4_clkdm", 939 .clkdm_name = "core_l4_clkdm",
949 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 940 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -967,7 +958,7 @@ static struct clk gpt5_fck = {
967 958
968static struct clk gpt6_ick = { 959static struct clk gpt6_ick = {
969 .name = "gpt6_ick", 960 .name = "gpt6_ick",
970 .ops = &clkops_omap2_dflt_wait, 961 .ops = &clkops_omap2_iclk_dflt_wait,
971 .parent = &l4_ck, 962 .parent = &l4_ck,
972 .clkdm_name = "core_l4_clkdm", 963 .clkdm_name = "core_l4_clkdm",
973 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 964 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -991,8 +982,9 @@ static struct clk gpt6_fck = {
991 982
992static struct clk gpt7_ick = { 983static struct clk gpt7_ick = {
993 .name = "gpt7_ick", 984 .name = "gpt7_ick",
994 .ops = &clkops_omap2_dflt_wait, 985 .ops = &clkops_omap2_iclk_dflt_wait,
995 .parent = &l4_ck, 986 .parent = &l4_ck,
987 .clkdm_name = "core_l4_clkdm",
996 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 988 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
997 .enable_bit = OMAP24XX_EN_GPT7_SHIFT, 989 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
998 .recalc = &followparent_recalc, 990 .recalc = &followparent_recalc,
@@ -1014,7 +1006,7 @@ static struct clk gpt7_fck = {
1014 1006
1015static struct clk gpt8_ick = { 1007static struct clk gpt8_ick = {
1016 .name = "gpt8_ick", 1008 .name = "gpt8_ick",
1017 .ops = &clkops_omap2_dflt_wait, 1009 .ops = &clkops_omap2_iclk_dflt_wait,
1018 .parent = &l4_ck, 1010 .parent = &l4_ck,
1019 .clkdm_name = "core_l4_clkdm", 1011 .clkdm_name = "core_l4_clkdm",
1020 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1012 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1038,7 +1030,7 @@ static struct clk gpt8_fck = {
1038 1030
1039static struct clk gpt9_ick = { 1031static struct clk gpt9_ick = {
1040 .name = "gpt9_ick", 1032 .name = "gpt9_ick",
1041 .ops = &clkops_omap2_dflt_wait, 1033 .ops = &clkops_omap2_iclk_dflt_wait,
1042 .parent = &l4_ck, 1034 .parent = &l4_ck,
1043 .clkdm_name = "core_l4_clkdm", 1035 .clkdm_name = "core_l4_clkdm",
1044 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1036 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1062,7 +1054,7 @@ static struct clk gpt9_fck = {
1062 1054
1063static struct clk gpt10_ick = { 1055static struct clk gpt10_ick = {
1064 .name = "gpt10_ick", 1056 .name = "gpt10_ick",
1065 .ops = &clkops_omap2_dflt_wait, 1057 .ops = &clkops_omap2_iclk_dflt_wait,
1066 .parent = &l4_ck, 1058 .parent = &l4_ck,
1067 .clkdm_name = "core_l4_clkdm", 1059 .clkdm_name = "core_l4_clkdm",
1068 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1060 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1086,7 +1078,7 @@ static struct clk gpt10_fck = {
1086 1078
1087static struct clk gpt11_ick = { 1079static struct clk gpt11_ick = {
1088 .name = "gpt11_ick", 1080 .name = "gpt11_ick",
1089 .ops = &clkops_omap2_dflt_wait, 1081 .ops = &clkops_omap2_iclk_dflt_wait,
1090 .parent = &l4_ck, 1082 .parent = &l4_ck,
1091 .clkdm_name = "core_l4_clkdm", 1083 .clkdm_name = "core_l4_clkdm",
1092 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1084 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1110,7 +1102,7 @@ static struct clk gpt11_fck = {
1110 1102
1111static struct clk gpt12_ick = { 1103static struct clk gpt12_ick = {
1112 .name = "gpt12_ick", 1104 .name = "gpt12_ick",
1113 .ops = &clkops_omap2_dflt_wait, 1105 .ops = &clkops_omap2_iclk_dflt_wait,
1114 .parent = &l4_ck, 1106 .parent = &l4_ck,
1115 .clkdm_name = "core_l4_clkdm", 1107 .clkdm_name = "core_l4_clkdm",
1116 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1108 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1134,7 +1126,7 @@ static struct clk gpt12_fck = {
1134 1126
1135static struct clk mcbsp1_ick = { 1127static struct clk mcbsp1_ick = {
1136 .name = "mcbsp1_ick", 1128 .name = "mcbsp1_ick",
1137 .ops = &clkops_omap2_dflt_wait, 1129 .ops = &clkops_omap2_iclk_dflt_wait,
1138 .parent = &l4_ck, 1130 .parent = &l4_ck,
1139 .clkdm_name = "core_l4_clkdm", 1131 .clkdm_name = "core_l4_clkdm",
1140 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1132 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1174,7 +1166,7 @@ static struct clk mcbsp1_fck = {
1174 1166
1175static struct clk mcbsp2_ick = { 1167static struct clk mcbsp2_ick = {
1176 .name = "mcbsp2_ick", 1168 .name = "mcbsp2_ick",
1177 .ops = &clkops_omap2_dflt_wait, 1169 .ops = &clkops_omap2_iclk_dflt_wait,
1178 .parent = &l4_ck, 1170 .parent = &l4_ck,
1179 .clkdm_name = "core_l4_clkdm", 1171 .clkdm_name = "core_l4_clkdm",
1180 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1172 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1198,7 +1190,7 @@ static struct clk mcbsp2_fck = {
1198 1190
1199static struct clk mcspi1_ick = { 1191static struct clk mcspi1_ick = {
1200 .name = "mcspi1_ick", 1192 .name = "mcspi1_ick",
1201 .ops = &clkops_omap2_dflt_wait, 1193 .ops = &clkops_omap2_iclk_dflt_wait,
1202 .parent = &l4_ck, 1194 .parent = &l4_ck,
1203 .clkdm_name = "core_l4_clkdm", 1195 .clkdm_name = "core_l4_clkdm",
1204 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1196 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1218,7 +1210,7 @@ static struct clk mcspi1_fck = {
1218 1210
1219static struct clk mcspi2_ick = { 1211static struct clk mcspi2_ick = {
1220 .name = "mcspi2_ick", 1212 .name = "mcspi2_ick",
1221 .ops = &clkops_omap2_dflt_wait, 1213 .ops = &clkops_omap2_iclk_dflt_wait,
1222 .parent = &l4_ck, 1214 .parent = &l4_ck,
1223 .clkdm_name = "core_l4_clkdm", 1215 .clkdm_name = "core_l4_clkdm",
1224 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1216 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1238,7 +1230,7 @@ static struct clk mcspi2_fck = {
1238 1230
1239static struct clk uart1_ick = { 1231static struct clk uart1_ick = {
1240 .name = "uart1_ick", 1232 .name = "uart1_ick",
1241 .ops = &clkops_omap2_dflt_wait, 1233 .ops = &clkops_omap2_iclk_dflt_wait,
1242 .parent = &l4_ck, 1234 .parent = &l4_ck,
1243 .clkdm_name = "core_l4_clkdm", 1235 .clkdm_name = "core_l4_clkdm",
1244 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1236 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1258,7 +1250,7 @@ static struct clk uart1_fck = {
1258 1250
1259static struct clk uart2_ick = { 1251static struct clk uart2_ick = {
1260 .name = "uart2_ick", 1252 .name = "uart2_ick",
1261 .ops = &clkops_omap2_dflt_wait, 1253 .ops = &clkops_omap2_iclk_dflt_wait,
1262 .parent = &l4_ck, 1254 .parent = &l4_ck,
1263 .clkdm_name = "core_l4_clkdm", 1255 .clkdm_name = "core_l4_clkdm",
1264 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1256 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1278,7 +1270,7 @@ static struct clk uart2_fck = {
1278 1270
1279static struct clk uart3_ick = { 1271static struct clk uart3_ick = {
1280 .name = "uart3_ick", 1272 .name = "uart3_ick",
1281 .ops = &clkops_omap2_dflt_wait, 1273 .ops = &clkops_omap2_iclk_dflt_wait,
1282 .parent = &l4_ck, 1274 .parent = &l4_ck,
1283 .clkdm_name = "core_l4_clkdm", 1275 .clkdm_name = "core_l4_clkdm",
1284 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1276 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1298,9 +1290,9 @@ static struct clk uart3_fck = {
1298 1290
1299static struct clk gpios_ick = { 1291static struct clk gpios_ick = {
1300 .name = "gpios_ick", 1292 .name = "gpios_ick",
1301 .ops = &clkops_omap2_dflt_wait, 1293 .ops = &clkops_omap2_iclk_dflt_wait,
1302 .parent = &l4_ck, 1294 .parent = &wu_l4_ick,
1303 .clkdm_name = "core_l4_clkdm", 1295 .clkdm_name = "wkup_clkdm",
1304 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1296 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1305 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT, 1297 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1306 .recalc = &followparent_recalc, 1298 .recalc = &followparent_recalc,
@@ -1318,9 +1310,9 @@ static struct clk gpios_fck = {
1318 1310
1319static struct clk mpu_wdt_ick = { 1311static struct clk mpu_wdt_ick = {
1320 .name = "mpu_wdt_ick", 1312 .name = "mpu_wdt_ick",
1321 .ops = &clkops_omap2_dflt_wait, 1313 .ops = &clkops_omap2_iclk_dflt_wait,
1322 .parent = &l4_ck, 1314 .parent = &wu_l4_ick,
1323 .clkdm_name = "core_l4_clkdm", 1315 .clkdm_name = "wkup_clkdm",
1324 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1316 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1325 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT, 1317 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1326 .recalc = &followparent_recalc, 1318 .recalc = &followparent_recalc,
@@ -1338,10 +1330,10 @@ static struct clk mpu_wdt_fck = {
1338 1330
1339static struct clk sync_32k_ick = { 1331static struct clk sync_32k_ick = {
1340 .name = "sync_32k_ick", 1332 .name = "sync_32k_ick",
1341 .ops = &clkops_omap2_dflt_wait, 1333 .ops = &clkops_omap2_iclk_dflt_wait,
1342 .parent = &l4_ck, 1334 .parent = &wu_l4_ick,
1335 .clkdm_name = "wkup_clkdm",
1343 .flags = ENABLE_ON_INIT, 1336 .flags = ENABLE_ON_INIT,
1344 .clkdm_name = "core_l4_clkdm",
1345 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1337 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1346 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT, 1338 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1347 .recalc = &followparent_recalc, 1339 .recalc = &followparent_recalc,
@@ -1349,9 +1341,9 @@ static struct clk sync_32k_ick = {
1349 1341
1350static struct clk wdt1_ick = { 1342static struct clk wdt1_ick = {
1351 .name = "wdt1_ick", 1343 .name = "wdt1_ick",
1352 .ops = &clkops_omap2_dflt_wait, 1344 .ops = &clkops_omap2_iclk_dflt_wait,
1353 .parent = &l4_ck, 1345 .parent = &wu_l4_ick,
1354 .clkdm_name = "core_l4_clkdm", 1346 .clkdm_name = "wkup_clkdm",
1355 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1347 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1356 .enable_bit = OMAP24XX_EN_WDT1_SHIFT, 1348 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1357 .recalc = &followparent_recalc, 1349 .recalc = &followparent_recalc,
@@ -1359,10 +1351,10 @@ static struct clk wdt1_ick = {
1359 1351
1360static struct clk omapctrl_ick = { 1352static struct clk omapctrl_ick = {
1361 .name = "omapctrl_ick", 1353 .name = "omapctrl_ick",
1362 .ops = &clkops_omap2_dflt_wait, 1354 .ops = &clkops_omap2_iclk_dflt_wait,
1363 .parent = &l4_ck, 1355 .parent = &wu_l4_ick,
1356 .clkdm_name = "wkup_clkdm",
1364 .flags = ENABLE_ON_INIT, 1357 .flags = ENABLE_ON_INIT,
1365 .clkdm_name = "core_l4_clkdm",
1366 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1358 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1367 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT, 1359 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1368 .recalc = &followparent_recalc, 1360 .recalc = &followparent_recalc,
@@ -1370,7 +1362,7 @@ static struct clk omapctrl_ick = {
1370 1362
1371static struct clk cam_ick = { 1363static struct clk cam_ick = {
1372 .name = "cam_ick", 1364 .name = "cam_ick",
1373 .ops = &clkops_omap2_dflt, 1365 .ops = &clkops_omap2_iclk_dflt,
1374 .parent = &l4_ck, 1366 .parent = &l4_ck,
1375 .clkdm_name = "core_l4_clkdm", 1367 .clkdm_name = "core_l4_clkdm",
1376 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1368 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1395,7 +1387,7 @@ static struct clk cam_fck = {
1395 1387
1396static struct clk mailboxes_ick = { 1388static struct clk mailboxes_ick = {
1397 .name = "mailboxes_ick", 1389 .name = "mailboxes_ick",
1398 .ops = &clkops_omap2_dflt_wait, 1390 .ops = &clkops_omap2_iclk_dflt_wait,
1399 .parent = &l4_ck, 1391 .parent = &l4_ck,
1400 .clkdm_name = "core_l4_clkdm", 1392 .clkdm_name = "core_l4_clkdm",
1401 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1393 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1405,7 +1397,7 @@ static struct clk mailboxes_ick = {
1405 1397
1406static struct clk wdt4_ick = { 1398static struct clk wdt4_ick = {
1407 .name = "wdt4_ick", 1399 .name = "wdt4_ick",
1408 .ops = &clkops_omap2_dflt_wait, 1400 .ops = &clkops_omap2_iclk_dflt_wait,
1409 .parent = &l4_ck, 1401 .parent = &l4_ck,
1410 .clkdm_name = "core_l4_clkdm", 1402 .clkdm_name = "core_l4_clkdm",
1411 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1403 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1425,7 +1417,7 @@ static struct clk wdt4_fck = {
1425 1417
1426static struct clk wdt3_ick = { 1418static struct clk wdt3_ick = {
1427 .name = "wdt3_ick", 1419 .name = "wdt3_ick",
1428 .ops = &clkops_omap2_dflt_wait, 1420 .ops = &clkops_omap2_iclk_dflt_wait,
1429 .parent = &l4_ck, 1421 .parent = &l4_ck,
1430 .clkdm_name = "core_l4_clkdm", 1422 .clkdm_name = "core_l4_clkdm",
1431 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1423 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1445,7 +1437,7 @@ static struct clk wdt3_fck = {
1445 1437
1446static struct clk mspro_ick = { 1438static struct clk mspro_ick = {
1447 .name = "mspro_ick", 1439 .name = "mspro_ick",
1448 .ops = &clkops_omap2_dflt_wait, 1440 .ops = &clkops_omap2_iclk_dflt_wait,
1449 .parent = &l4_ck, 1441 .parent = &l4_ck,
1450 .clkdm_name = "core_l4_clkdm", 1442 .clkdm_name = "core_l4_clkdm",
1451 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1443 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1465,7 +1457,7 @@ static struct clk mspro_fck = {
1465 1457
1466static struct clk mmc_ick = { 1458static struct clk mmc_ick = {
1467 .name = "mmc_ick", 1459 .name = "mmc_ick",
1468 .ops = &clkops_omap2_dflt_wait, 1460 .ops = &clkops_omap2_iclk_dflt_wait,
1469 .parent = &l4_ck, 1461 .parent = &l4_ck,
1470 .clkdm_name = "core_l4_clkdm", 1462 .clkdm_name = "core_l4_clkdm",
1471 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1463 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1485,7 +1477,7 @@ static struct clk mmc_fck = {
1485 1477
1486static struct clk fac_ick = { 1478static struct clk fac_ick = {
1487 .name = "fac_ick", 1479 .name = "fac_ick",
1488 .ops = &clkops_omap2_dflt_wait, 1480 .ops = &clkops_omap2_iclk_dflt_wait,
1489 .parent = &l4_ck, 1481 .parent = &l4_ck,
1490 .clkdm_name = "core_l4_clkdm", 1482 .clkdm_name = "core_l4_clkdm",
1491 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1483 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1505,7 +1497,7 @@ static struct clk fac_fck = {
1505 1497
1506static struct clk eac_ick = { 1498static struct clk eac_ick = {
1507 .name = "eac_ick", 1499 .name = "eac_ick",
1508 .ops = &clkops_omap2_dflt_wait, 1500 .ops = &clkops_omap2_iclk_dflt_wait,
1509 .parent = &l4_ck, 1501 .parent = &l4_ck,
1510 .clkdm_name = "core_l4_clkdm", 1502 .clkdm_name = "core_l4_clkdm",
1511 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1503 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1525,7 +1517,7 @@ static struct clk eac_fck = {
1525 1517
1526static struct clk hdq_ick = { 1518static struct clk hdq_ick = {
1527 .name = "hdq_ick", 1519 .name = "hdq_ick",
1528 .ops = &clkops_omap2_dflt_wait, 1520 .ops = &clkops_omap2_iclk_dflt_wait,
1529 .parent = &l4_ck, 1521 .parent = &l4_ck,
1530 .clkdm_name = "core_l4_clkdm", 1522 .clkdm_name = "core_l4_clkdm",
1531 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1523 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1545,7 +1537,7 @@ static struct clk hdq_fck = {
1545 1537
1546static struct clk i2c2_ick = { 1538static struct clk i2c2_ick = {
1547 .name = "i2c2_ick", 1539 .name = "i2c2_ick",
1548 .ops = &clkops_omap2_dflt_wait, 1540 .ops = &clkops_omap2_iclk_dflt_wait,
1549 .parent = &l4_ck, 1541 .parent = &l4_ck,
1550 .clkdm_name = "core_l4_clkdm", 1542 .clkdm_name = "core_l4_clkdm",
1551 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1543 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1565,7 +1557,7 @@ static struct clk i2c2_fck = {
1565 1557
1566static struct clk i2c1_ick = { 1558static struct clk i2c1_ick = {
1567 .name = "i2c1_ick", 1559 .name = "i2c1_ick",
1568 .ops = &clkops_omap2_dflt_wait, 1560 .ops = &clkops_omap2_iclk_dflt_wait,
1569 .parent = &l4_ck, 1561 .parent = &l4_ck,
1570 .clkdm_name = "core_l4_clkdm", 1562 .clkdm_name = "core_l4_clkdm",
1571 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1563 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1583,12 +1575,18 @@ static struct clk i2c1_fck = {
1583 .recalc = &followparent_recalc, 1575 .recalc = &followparent_recalc,
1584}; 1576};
1585 1577
1578/*
1579 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1580 * accesses derived from this data.
1581 */
1586static struct clk gpmc_fck = { 1582static struct clk gpmc_fck = {
1587 .name = "gpmc_fck", 1583 .name = "gpmc_fck",
1588 .ops = &clkops_null, /* RMK: missing? */ 1584 .ops = &clkops_omap2_iclk_idle_only,
1589 .parent = &core_l3_ck, 1585 .parent = &core_l3_ck,
1590 .flags = ENABLE_ON_INIT, 1586 .flags = ENABLE_ON_INIT,
1591 .clkdm_name = "core_l3_clkdm", 1587 .clkdm_name = "core_l3_clkdm",
1588 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1589 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
1592 .recalc = &followparent_recalc, 1590 .recalc = &followparent_recalc,
1593}; 1591};
1594 1592
@@ -1600,17 +1598,38 @@ static struct clk sdma_fck = {
1600 .recalc = &followparent_recalc, 1598 .recalc = &followparent_recalc,
1601}; 1599};
1602 1600
1601/*
1602 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1603 * accesses derived from this data.
1604 */
1603static struct clk sdma_ick = { 1605static struct clk sdma_ick = {
1604 .name = "sdma_ick", 1606 .name = "sdma_ick",
1605 .ops = &clkops_null, /* RMK: missing? */ 1607 .ops = &clkops_omap2_iclk_idle_only,
1606 .parent = &l4_ck, 1608 .parent = &core_l3_ck,
1609 .clkdm_name = "core_l3_clkdm",
1610 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1611 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1612 .recalc = &followparent_recalc,
1613};
1614
1615/*
1616 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1617 * accesses derived from this data.
1618 */
1619static struct clk sdrc_ick = {
1620 .name = "sdrc_ick",
1621 .ops = &clkops_omap2_iclk_idle_only,
1622 .parent = &core_l3_ck,
1623 .flags = ENABLE_ON_INIT,
1607 .clkdm_name = "core_l3_clkdm", 1624 .clkdm_name = "core_l3_clkdm",
1625 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1626 .enable_bit = OMAP24XX_AUTO_SDRC_SHIFT,
1608 .recalc = &followparent_recalc, 1627 .recalc = &followparent_recalc,
1609}; 1628};
1610 1629
1611static struct clk vlynq_ick = { 1630static struct clk vlynq_ick = {
1612 .name = "vlynq_ick", 1631 .name = "vlynq_ick",
1613 .ops = &clkops_omap2_dflt_wait, 1632 .ops = &clkops_omap2_iclk_dflt_wait,
1614 .parent = &core_l3_ck, 1633 .parent = &core_l3_ck,
1615 .clkdm_name = "core_l3_clkdm", 1634 .clkdm_name = "core_l3_clkdm",
1616 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1635 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1659,7 +1678,7 @@ static struct clk vlynq_fck = {
1659 1678
1660static struct clk des_ick = { 1679static struct clk des_ick = {
1661 .name = "des_ick", 1680 .name = "des_ick",
1662 .ops = &clkops_omap2_dflt_wait, 1681 .ops = &clkops_omap2_iclk_dflt_wait,
1663 .parent = &l4_ck, 1682 .parent = &l4_ck,
1664 .clkdm_name = "core_l4_clkdm", 1683 .clkdm_name = "core_l4_clkdm",
1665 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), 1684 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
@@ -1669,7 +1688,7 @@ static struct clk des_ick = {
1669 1688
1670static struct clk sha_ick = { 1689static struct clk sha_ick = {
1671 .name = "sha_ick", 1690 .name = "sha_ick",
1672 .ops = &clkops_omap2_dflt_wait, 1691 .ops = &clkops_omap2_iclk_dflt_wait,
1673 .parent = &l4_ck, 1692 .parent = &l4_ck,
1674 .clkdm_name = "core_l4_clkdm", 1693 .clkdm_name = "core_l4_clkdm",
1675 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), 1694 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
@@ -1679,7 +1698,7 @@ static struct clk sha_ick = {
1679 1698
1680static struct clk rng_ick = { 1699static struct clk rng_ick = {
1681 .name = "rng_ick", 1700 .name = "rng_ick",
1682 .ops = &clkops_omap2_dflt_wait, 1701 .ops = &clkops_omap2_iclk_dflt_wait,
1683 .parent = &l4_ck, 1702 .parent = &l4_ck,
1684 .clkdm_name = "core_l4_clkdm", 1703 .clkdm_name = "core_l4_clkdm",
1685 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), 1704 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
@@ -1689,7 +1708,7 @@ static struct clk rng_ick = {
1689 1708
1690static struct clk aes_ick = { 1709static struct clk aes_ick = {
1691 .name = "aes_ick", 1710 .name = "aes_ick",
1692 .ops = &clkops_omap2_dflt_wait, 1711 .ops = &clkops_omap2_iclk_dflt_wait,
1693 .parent = &l4_ck, 1712 .parent = &l4_ck,
1694 .clkdm_name = "core_l4_clkdm", 1713 .clkdm_name = "core_l4_clkdm",
1695 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), 1714 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
@@ -1699,7 +1718,7 @@ static struct clk aes_ick = {
1699 1718
1700static struct clk pka_ick = { 1719static struct clk pka_ick = {
1701 .name = "pka_ick", 1720 .name = "pka_ick",
1702 .ops = &clkops_omap2_dflt_wait, 1721 .ops = &clkops_omap2_iclk_dflt_wait,
1703 .parent = &l4_ck, 1722 .parent = &l4_ck,
1704 .clkdm_name = "core_l4_clkdm", 1723 .clkdm_name = "core_l4_clkdm",
1705 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), 1724 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
@@ -1777,7 +1796,6 @@ static struct omap_clk omap2420_clks[] = {
1777 CLK(NULL, "mpu_ck", &mpu_ck, CK_242X), 1796 CLK(NULL, "mpu_ck", &mpu_ck, CK_242X),
1778 /* dsp domain clocks */ 1797 /* dsp domain clocks */
1779 CLK(NULL, "dsp_fck", &dsp_fck, CK_242X), 1798 CLK(NULL, "dsp_fck", &dsp_fck, CK_242X),
1780 CLK(NULL, "dsp_irate_ick", &dsp_irate_ick, CK_242X),
1781 CLK(NULL, "dsp_ick", &dsp_ick, CK_242X), 1799 CLK(NULL, "dsp_ick", &dsp_ick, CK_242X),
1782 CLK(NULL, "iva1_ifck", &iva1_ifck, CK_242X), 1800 CLK(NULL, "iva1_ifck", &iva1_ifck, CK_242X),
1783 CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck, CK_242X), 1801 CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck, CK_242X),
@@ -1797,6 +1815,7 @@ static struct omap_clk omap2420_clks[] = {
1797 /* L4 domain clocks */ 1815 /* L4 domain clocks */
1798 CLK(NULL, "l4_ck", &l4_ck, CK_242X), 1816 CLK(NULL, "l4_ck", &l4_ck, CK_242X),
1799 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_242X), 1817 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_242X),
1818 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_242X),
1800 /* virtual meta-group clock */ 1819 /* virtual meta-group clock */
1801 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_242X), 1820 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_242X),
1802 /* general l4 interface ck, multi-parent functional clk */ 1821 /* general l4 interface ck, multi-parent functional clk */
@@ -1869,6 +1888,7 @@ static struct omap_clk omap2420_clks[] = {
1869 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_242X), 1888 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_242X),
1870 CLK(NULL, "sdma_fck", &sdma_fck, CK_242X), 1889 CLK(NULL, "sdma_fck", &sdma_fck, CK_242X),
1871 CLK(NULL, "sdma_ick", &sdma_ick, CK_242X), 1890 CLK(NULL, "sdma_ick", &sdma_ick, CK_242X),
1891 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_242X),
1872 CLK(NULL, "vlynq_ick", &vlynq_ick, CK_242X), 1892 CLK(NULL, "vlynq_ick", &vlynq_ick, CK_242X),
1873 CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X), 1893 CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X),
1874 CLK(NULL, "des_ick", &des_ick, CK_242X), 1894 CLK(NULL, "des_ick", &des_ick, CK_242X),
@@ -1913,6 +1933,9 @@ int __init omap2420_clk_init(void)
1913 omap2_init_clk_clkdm(c->lk.clk); 1933 omap2_init_clk_clkdm(c->lk.clk);
1914 } 1934 }
1915 1935
1936 /* Disable autoidle on all clocks; let the PM code enable it later */
1937 omap_clk_disable_autoidle_all();
1938
1916 /* Check the MPU rate set by bootloader */ 1939 /* Check the MPU rate set by bootloader */
1917 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck); 1940 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
1918 for (prcm = rate_table; prcm->mpu_speed; prcm++) { 1941 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
index 5c647ce05b04..bba018331a71 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -1,12 +1,12 @@
1/* 1/*
2 * linux/arch/arm/mach-omap2/clock2430_data.c 2 * OMAP2430 clock data
3 * 3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc. 4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2010 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>
9 * Paul Walmsley 9 * Paul Walmsley
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
@@ -34,18 +34,15 @@
34/* 34/*
35 * 2430 clock tree. 35 * 2430 clock tree.
36 * 36 *
37 * NOTE:In many cases here we are assigning a 'default' parent. In many 37 * NOTE:In many cases here we are assigning a 'default' parent. In
38 * cases the parent is selectable. The get/set parent calls will also 38 * many cases the parent is selectable. The set parent calls will
39 * switch sources. 39 * also switch sources.
40 *
41 * Many some clocks say always_enabled, but they can be auto idled for
42 * power savings. They will always be available upon clock request.
43 * 40 *
44 * Several sources are given initial rates which may be wrong, this will 41 * Several sources are given initial rates which may be wrong, this will
45 * be fixed up in the init func. 42 * be fixed up in the init func.
46 * 43 *
47 * Things are broadly separated below by clock domains. It is 44 * Things are broadly separated below by clock domains. It is
48 * noteworthy that most periferals have dependencies on multiple clock 45 * noteworthy that most peripherals have dependencies on multiple clock
49 * domains. Many get their interface clocks from the L4 domain, but get 46 * domains. Many get their interface clocks from the L4 domain, but get
50 * functional clocks from fixed sources or other core domain derived 47 * functional clocks from fixed sources or other core domain derived
51 * clocks. 48 * clocks.
@@ -55,7 +52,7 @@
55static struct clk func_32k_ck = { 52static struct clk func_32k_ck = {
56 .name = "func_32k_ck", 53 .name = "func_32k_ck",
57 .ops = &clkops_null, 54 .ops = &clkops_null,
58 .rate = 32000, 55 .rate = 32768,
59 .clkdm_name = "wkup_clkdm", 56 .clkdm_name = "wkup_clkdm",
60}; 57};
61 58
@@ -116,7 +113,6 @@ static struct dpll_data dpll_dd = {
116 .max_multiplier = 1023, 113 .max_multiplier = 1023,
117 .min_divider = 1, 114 .min_divider = 1,
118 .max_divider = 16, 115 .max_divider = 16,
119 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
120}; 116};
121 117
122/* 118/*
@@ -125,7 +121,7 @@ static struct dpll_data dpll_dd = {
125 */ 121 */
126static struct clk dpll_ck = { 122static struct clk dpll_ck = {
127 .name = "dpll_ck", 123 .name = "dpll_ck",
128 .ops = &clkops_null, 124 .ops = &clkops_omap2xxx_dpll_ops,
129 .parent = &sys_ck, /* Can be func_32k also */ 125 .parent = &sys_ck, /* Can be func_32k also */
130 .dpll_data = &dpll_dd, 126 .dpll_data = &dpll_dd,
131 .clkdm_name = "wkup_clkdm", 127 .clkdm_name = "wkup_clkdm",
@@ -434,37 +430,23 @@ static struct clk dsp_fck = {
434 .recalc = &omap2_clksel_recalc, 430 .recalc = &omap2_clksel_recalc,
435}; 431};
436 432
437/* DSP interface clock */ 433static const struct clksel dsp_ick_clksel[] = {
438static const struct clksel_rate dsp_irate_ick_rates[] = { 434 { .parent = &dsp_fck, .rates = dsp_ick_rates },
439 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
440 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
441 { .div = 3, .val = 3, .flags = RATE_IN_243X },
442 { .div = 0 },
443};
444
445static const struct clksel dsp_irate_ick_clksel[] = {
446 { .parent = &dsp_fck, .rates = dsp_irate_ick_rates },
447 { .parent = NULL } 435 { .parent = NULL }
448}; 436};
449 437
450/* This clock does not exist as such in the TRM. */
451static struct clk dsp_irate_ick = {
452 .name = "dsp_irate_ick",
453 .ops = &clkops_null,
454 .parent = &dsp_fck,
455 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
456 .clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK,
457 .clksel = dsp_irate_ick_clksel,
458 .recalc = &omap2_clksel_recalc,
459};
460
461/* 2430 only - EN_DSP controls both dsp fclk and iclk on 2430 */ 438/* 2430 only - EN_DSP controls both dsp fclk and iclk on 2430 */
462static struct clk iva2_1_ick = { 439static struct clk iva2_1_ick = {
463 .name = "iva2_1_ick", 440 .name = "iva2_1_ick",
464 .ops = &clkops_omap2_dflt_wait, 441 .ops = &clkops_omap2_dflt_wait,
465 .parent = &dsp_irate_ick, 442 .parent = &dsp_fck,
443 .clkdm_name = "dsp_clkdm",
466 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN), 444 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
467 .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, 445 .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
446 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
447 .clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK,
448 .clksel = dsp_ick_clksel,
449 .recalc = &omap2_clksel_recalc,
468}; 450};
469 451
470/* 452/*
@@ -525,7 +507,7 @@ static const struct clksel usb_l4_ick_clksel[] = {
525/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */ 507/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */
526static struct clk usb_l4_ick = { /* FS-USB interface clock */ 508static struct clk usb_l4_ick = { /* FS-USB interface clock */
527 .name = "usb_l4_ick", 509 .name = "usb_l4_ick",
528 .ops = &clkops_omap2_dflt_wait, 510 .ops = &clkops_omap2_iclk_dflt_wait,
529 .parent = &core_l3_ck, 511 .parent = &core_l3_ck,
530 .clkdm_name = "core_l4_clkdm", 512 .clkdm_name = "core_l4_clkdm",
531 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 513 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -606,7 +588,7 @@ static struct clk ssi_ssr_sst_fck = {
606 */ 588 */
607static struct clk ssi_l4_ick = { 589static struct clk ssi_l4_ick = {
608 .name = "ssi_l4_ick", 590 .name = "ssi_l4_ick",
609 .ops = &clkops_omap2_dflt_wait, 591 .ops = &clkops_omap2_iclk_dflt_wait,
610 .parent = &l4_ck, 592 .parent = &l4_ck,
611 .clkdm_name = "core_l4_clkdm", 593 .clkdm_name = "core_l4_clkdm",
612 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 594 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -661,6 +643,7 @@ static struct clk gfx_2d_fck = {
661 .recalc = &omap2_clksel_recalc, 643 .recalc = &omap2_clksel_recalc,
662}; 644};
663 645
646/* This interface clock does not have a CM_AUTOIDLE bit */
664static struct clk gfx_ick = { 647static struct clk gfx_ick = {
665 .name = "gfx_ick", /* From l3 */ 648 .name = "gfx_ick", /* From l3 */
666 .ops = &clkops_omap2_dflt_wait, 649 .ops = &clkops_omap2_dflt_wait,
@@ -693,7 +676,7 @@ static const struct clksel mdm_ick_clksel[] = {
693 676
694static struct clk mdm_ick = { /* used both as a ick and fck */ 677static struct clk mdm_ick = { /* used both as a ick and fck */
695 .name = "mdm_ick", 678 .name = "mdm_ick",
696 .ops = &clkops_omap2_dflt_wait, 679 .ops = &clkops_omap2_iclk_dflt_wait,
697 .parent = &core_ck, 680 .parent = &core_ck,
698 .clkdm_name = "mdm_clkdm", 681 .clkdm_name = "mdm_clkdm",
699 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_ICLKEN), 682 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_ICLKEN),
@@ -706,7 +689,7 @@ static struct clk mdm_ick = { /* used both as a ick and fck */
706 689
707static struct clk mdm_osc_ck = { 690static struct clk mdm_osc_ck = {
708 .name = "mdm_osc_ck", 691 .name = "mdm_osc_ck",
709 .ops = &clkops_omap2_dflt_wait, 692 .ops = &clkops_omap2_mdmclk_dflt_wait,
710 .parent = &osc_ck, 693 .parent = &osc_ck,
711 .clkdm_name = "mdm_clkdm", 694 .clkdm_name = "mdm_clkdm",
712 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN), 695 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN),
@@ -751,7 +734,7 @@ static const struct clksel dss1_fck_clksel[] = {
751 734
752static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */ 735static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */
753 .name = "dss_ick", 736 .name = "dss_ick",
754 .ops = &clkops_omap2_dflt, 737 .ops = &clkops_omap2_iclk_dflt,
755 .parent = &l4_ck, /* really both l3 and l4 */ 738 .parent = &l4_ck, /* really both l3 and l4 */
756 .clkdm_name = "dss_clkdm", 739 .clkdm_name = "dss_clkdm",
757 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 740 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -813,6 +796,14 @@ static struct clk dss_54m_fck = { /* Alt clk used in power management */
813 .recalc = &followparent_recalc, 796 .recalc = &followparent_recalc,
814}; 797};
815 798
799static struct clk wu_l4_ick = {
800 .name = "wu_l4_ick",
801 .ops = &clkops_null,
802 .parent = &sys_ck,
803 .clkdm_name = "wkup_clkdm",
804 .recalc = &followparent_recalc,
805};
806
816/* 807/*
817 * CORE power domain ICLK & FCLK defines. 808 * CORE power domain ICLK & FCLK defines.
818 * Many of the these can have more than one possible parent. Entries 809 * Many of the these can have more than one possible parent. Entries
@@ -833,9 +824,9 @@ static const struct clksel omap24xx_gpt_clksel[] = {
833 824
834static struct clk gpt1_ick = { 825static struct clk gpt1_ick = {
835 .name = "gpt1_ick", 826 .name = "gpt1_ick",
836 .ops = &clkops_omap2_dflt_wait, 827 .ops = &clkops_omap2_iclk_dflt_wait,
837 .parent = &l4_ck, 828 .parent = &wu_l4_ick,
838 .clkdm_name = "core_l4_clkdm", 829 .clkdm_name = "wkup_clkdm",
839 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 830 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
840 .enable_bit = OMAP24XX_EN_GPT1_SHIFT, 831 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
841 .recalc = &followparent_recalc, 832 .recalc = &followparent_recalc,
@@ -859,7 +850,7 @@ static struct clk gpt1_fck = {
859 850
860static struct clk gpt2_ick = { 851static struct clk gpt2_ick = {
861 .name = "gpt2_ick", 852 .name = "gpt2_ick",
862 .ops = &clkops_omap2_dflt_wait, 853 .ops = &clkops_omap2_iclk_dflt_wait,
863 .parent = &l4_ck, 854 .parent = &l4_ck,
864 .clkdm_name = "core_l4_clkdm", 855 .clkdm_name = "core_l4_clkdm",
865 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 856 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -883,7 +874,7 @@ static struct clk gpt2_fck = {
883 874
884static struct clk gpt3_ick = { 875static struct clk gpt3_ick = {
885 .name = "gpt3_ick", 876 .name = "gpt3_ick",
886 .ops = &clkops_omap2_dflt_wait, 877 .ops = &clkops_omap2_iclk_dflt_wait,
887 .parent = &l4_ck, 878 .parent = &l4_ck,
888 .clkdm_name = "core_l4_clkdm", 879 .clkdm_name = "core_l4_clkdm",
889 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 880 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -907,7 +898,7 @@ static struct clk gpt3_fck = {
907 898
908static struct clk gpt4_ick = { 899static struct clk gpt4_ick = {
909 .name = "gpt4_ick", 900 .name = "gpt4_ick",
910 .ops = &clkops_omap2_dflt_wait, 901 .ops = &clkops_omap2_iclk_dflt_wait,
911 .parent = &l4_ck, 902 .parent = &l4_ck,
912 .clkdm_name = "core_l4_clkdm", 903 .clkdm_name = "core_l4_clkdm",
913 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 904 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -931,7 +922,7 @@ static struct clk gpt4_fck = {
931 922
932static struct clk gpt5_ick = { 923static struct clk gpt5_ick = {
933 .name = "gpt5_ick", 924 .name = "gpt5_ick",
934 .ops = &clkops_omap2_dflt_wait, 925 .ops = &clkops_omap2_iclk_dflt_wait,
935 .parent = &l4_ck, 926 .parent = &l4_ck,
936 .clkdm_name = "core_l4_clkdm", 927 .clkdm_name = "core_l4_clkdm",
937 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 928 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -955,7 +946,7 @@ static struct clk gpt5_fck = {
955 946
956static struct clk gpt6_ick = { 947static struct clk gpt6_ick = {
957 .name = "gpt6_ick", 948 .name = "gpt6_ick",
958 .ops = &clkops_omap2_dflt_wait, 949 .ops = &clkops_omap2_iclk_dflt_wait,
959 .parent = &l4_ck, 950 .parent = &l4_ck,
960 .clkdm_name = "core_l4_clkdm", 951 .clkdm_name = "core_l4_clkdm",
961 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 952 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -979,8 +970,9 @@ static struct clk gpt6_fck = {
979 970
980static struct clk gpt7_ick = { 971static struct clk gpt7_ick = {
981 .name = "gpt7_ick", 972 .name = "gpt7_ick",
982 .ops = &clkops_omap2_dflt_wait, 973 .ops = &clkops_omap2_iclk_dflt_wait,
983 .parent = &l4_ck, 974 .parent = &l4_ck,
975 .clkdm_name = "core_l4_clkdm",
984 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 976 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
985 .enable_bit = OMAP24XX_EN_GPT7_SHIFT, 977 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
986 .recalc = &followparent_recalc, 978 .recalc = &followparent_recalc,
@@ -1002,7 +994,7 @@ static struct clk gpt7_fck = {
1002 994
1003static struct clk gpt8_ick = { 995static struct clk gpt8_ick = {
1004 .name = "gpt8_ick", 996 .name = "gpt8_ick",
1005 .ops = &clkops_omap2_dflt_wait, 997 .ops = &clkops_omap2_iclk_dflt_wait,
1006 .parent = &l4_ck, 998 .parent = &l4_ck,
1007 .clkdm_name = "core_l4_clkdm", 999 .clkdm_name = "core_l4_clkdm",
1008 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1000 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1026,7 +1018,7 @@ static struct clk gpt8_fck = {
1026 1018
1027static struct clk gpt9_ick = { 1019static struct clk gpt9_ick = {
1028 .name = "gpt9_ick", 1020 .name = "gpt9_ick",
1029 .ops = &clkops_omap2_dflt_wait, 1021 .ops = &clkops_omap2_iclk_dflt_wait,
1030 .parent = &l4_ck, 1022 .parent = &l4_ck,
1031 .clkdm_name = "core_l4_clkdm", 1023 .clkdm_name = "core_l4_clkdm",
1032 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1024 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1050,7 +1042,7 @@ static struct clk gpt9_fck = {
1050 1042
1051static struct clk gpt10_ick = { 1043static struct clk gpt10_ick = {
1052 .name = "gpt10_ick", 1044 .name = "gpt10_ick",
1053 .ops = &clkops_omap2_dflt_wait, 1045 .ops = &clkops_omap2_iclk_dflt_wait,
1054 .parent = &l4_ck, 1046 .parent = &l4_ck,
1055 .clkdm_name = "core_l4_clkdm", 1047 .clkdm_name = "core_l4_clkdm",
1056 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1048 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1074,7 +1066,7 @@ static struct clk gpt10_fck = {
1074 1066
1075static struct clk gpt11_ick = { 1067static struct clk gpt11_ick = {
1076 .name = "gpt11_ick", 1068 .name = "gpt11_ick",
1077 .ops = &clkops_omap2_dflt_wait, 1069 .ops = &clkops_omap2_iclk_dflt_wait,
1078 .parent = &l4_ck, 1070 .parent = &l4_ck,
1079 .clkdm_name = "core_l4_clkdm", 1071 .clkdm_name = "core_l4_clkdm",
1080 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1072 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1098,7 +1090,7 @@ static struct clk gpt11_fck = {
1098 1090
1099static struct clk gpt12_ick = { 1091static struct clk gpt12_ick = {
1100 .name = "gpt12_ick", 1092 .name = "gpt12_ick",
1101 .ops = &clkops_omap2_dflt_wait, 1093 .ops = &clkops_omap2_iclk_dflt_wait,
1102 .parent = &l4_ck, 1094 .parent = &l4_ck,
1103 .clkdm_name = "core_l4_clkdm", 1095 .clkdm_name = "core_l4_clkdm",
1104 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1096 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1122,7 +1114,7 @@ static struct clk gpt12_fck = {
1122 1114
1123static struct clk mcbsp1_ick = { 1115static struct clk mcbsp1_ick = {
1124 .name = "mcbsp1_ick", 1116 .name = "mcbsp1_ick",
1125 .ops = &clkops_omap2_dflt_wait, 1117 .ops = &clkops_omap2_iclk_dflt_wait,
1126 .parent = &l4_ck, 1118 .parent = &l4_ck,
1127 .clkdm_name = "core_l4_clkdm", 1119 .clkdm_name = "core_l4_clkdm",
1128 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1120 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1162,7 +1154,7 @@ static struct clk mcbsp1_fck = {
1162 1154
1163static struct clk mcbsp2_ick = { 1155static struct clk mcbsp2_ick = {
1164 .name = "mcbsp2_ick", 1156 .name = "mcbsp2_ick",
1165 .ops = &clkops_omap2_dflt_wait, 1157 .ops = &clkops_omap2_iclk_dflt_wait,
1166 .parent = &l4_ck, 1158 .parent = &l4_ck,
1167 .clkdm_name = "core_l4_clkdm", 1159 .clkdm_name = "core_l4_clkdm",
1168 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1160 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1186,7 +1178,7 @@ static struct clk mcbsp2_fck = {
1186 1178
1187static struct clk mcbsp3_ick = { 1179static struct clk mcbsp3_ick = {
1188 .name = "mcbsp3_ick", 1180 .name = "mcbsp3_ick",
1189 .ops = &clkops_omap2_dflt_wait, 1181 .ops = &clkops_omap2_iclk_dflt_wait,
1190 .parent = &l4_ck, 1182 .parent = &l4_ck,
1191 .clkdm_name = "core_l4_clkdm", 1183 .clkdm_name = "core_l4_clkdm",
1192 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1184 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1210,7 +1202,7 @@ static struct clk mcbsp3_fck = {
1210 1202
1211static struct clk mcbsp4_ick = { 1203static struct clk mcbsp4_ick = {
1212 .name = "mcbsp4_ick", 1204 .name = "mcbsp4_ick",
1213 .ops = &clkops_omap2_dflt_wait, 1205 .ops = &clkops_omap2_iclk_dflt_wait,
1214 .parent = &l4_ck, 1206 .parent = &l4_ck,
1215 .clkdm_name = "core_l4_clkdm", 1207 .clkdm_name = "core_l4_clkdm",
1216 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1208 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1234,7 +1226,7 @@ static struct clk mcbsp4_fck = {
1234 1226
1235static struct clk mcbsp5_ick = { 1227static struct clk mcbsp5_ick = {
1236 .name = "mcbsp5_ick", 1228 .name = "mcbsp5_ick",
1237 .ops = &clkops_omap2_dflt_wait, 1229 .ops = &clkops_omap2_iclk_dflt_wait,
1238 .parent = &l4_ck, 1230 .parent = &l4_ck,
1239 .clkdm_name = "core_l4_clkdm", 1231 .clkdm_name = "core_l4_clkdm",
1240 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1232 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1258,7 +1250,7 @@ static struct clk mcbsp5_fck = {
1258 1250
1259static struct clk mcspi1_ick = { 1251static struct clk mcspi1_ick = {
1260 .name = "mcspi1_ick", 1252 .name = "mcspi1_ick",
1261 .ops = &clkops_omap2_dflt_wait, 1253 .ops = &clkops_omap2_iclk_dflt_wait,
1262 .parent = &l4_ck, 1254 .parent = &l4_ck,
1263 .clkdm_name = "core_l4_clkdm", 1255 .clkdm_name = "core_l4_clkdm",
1264 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1256 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1278,7 +1270,7 @@ static struct clk mcspi1_fck = {
1278 1270
1279static struct clk mcspi2_ick = { 1271static struct clk mcspi2_ick = {
1280 .name = "mcspi2_ick", 1272 .name = "mcspi2_ick",
1281 .ops = &clkops_omap2_dflt_wait, 1273 .ops = &clkops_omap2_iclk_dflt_wait,
1282 .parent = &l4_ck, 1274 .parent = &l4_ck,
1283 .clkdm_name = "core_l4_clkdm", 1275 .clkdm_name = "core_l4_clkdm",
1284 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1276 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1298,7 +1290,7 @@ static struct clk mcspi2_fck = {
1298 1290
1299static struct clk mcspi3_ick = { 1291static struct clk mcspi3_ick = {
1300 .name = "mcspi3_ick", 1292 .name = "mcspi3_ick",
1301 .ops = &clkops_omap2_dflt_wait, 1293 .ops = &clkops_omap2_iclk_dflt_wait,
1302 .parent = &l4_ck, 1294 .parent = &l4_ck,
1303 .clkdm_name = "core_l4_clkdm", 1295 .clkdm_name = "core_l4_clkdm",
1304 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1296 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1318,7 +1310,7 @@ static struct clk mcspi3_fck = {
1318 1310
1319static struct clk uart1_ick = { 1311static struct clk uart1_ick = {
1320 .name = "uart1_ick", 1312 .name = "uart1_ick",
1321 .ops = &clkops_omap2_dflt_wait, 1313 .ops = &clkops_omap2_iclk_dflt_wait,
1322 .parent = &l4_ck, 1314 .parent = &l4_ck,
1323 .clkdm_name = "core_l4_clkdm", 1315 .clkdm_name = "core_l4_clkdm",
1324 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1316 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1338,7 +1330,7 @@ static struct clk uart1_fck = {
1338 1330
1339static struct clk uart2_ick = { 1331static struct clk uart2_ick = {
1340 .name = "uart2_ick", 1332 .name = "uart2_ick",
1341 .ops = &clkops_omap2_dflt_wait, 1333 .ops = &clkops_omap2_iclk_dflt_wait,
1342 .parent = &l4_ck, 1334 .parent = &l4_ck,
1343 .clkdm_name = "core_l4_clkdm", 1335 .clkdm_name = "core_l4_clkdm",
1344 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1336 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1358,7 +1350,7 @@ static struct clk uart2_fck = {
1358 1350
1359static struct clk uart3_ick = { 1351static struct clk uart3_ick = {
1360 .name = "uart3_ick", 1352 .name = "uart3_ick",
1361 .ops = &clkops_omap2_dflt_wait, 1353 .ops = &clkops_omap2_iclk_dflt_wait,
1362 .parent = &l4_ck, 1354 .parent = &l4_ck,
1363 .clkdm_name = "core_l4_clkdm", 1355 .clkdm_name = "core_l4_clkdm",
1364 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1356 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1378,9 +1370,9 @@ static struct clk uart3_fck = {
1378 1370
1379static struct clk gpios_ick = { 1371static struct clk gpios_ick = {
1380 .name = "gpios_ick", 1372 .name = "gpios_ick",
1381 .ops = &clkops_omap2_dflt_wait, 1373 .ops = &clkops_omap2_iclk_dflt_wait,
1382 .parent = &l4_ck, 1374 .parent = &wu_l4_ick,
1383 .clkdm_name = "core_l4_clkdm", 1375 .clkdm_name = "wkup_clkdm",
1384 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1376 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1385 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT, 1377 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1386 .recalc = &followparent_recalc, 1378 .recalc = &followparent_recalc,
@@ -1398,9 +1390,9 @@ static struct clk gpios_fck = {
1398 1390
1399static struct clk mpu_wdt_ick = { 1391static struct clk mpu_wdt_ick = {
1400 .name = "mpu_wdt_ick", 1392 .name = "mpu_wdt_ick",
1401 .ops = &clkops_omap2_dflt_wait, 1393 .ops = &clkops_omap2_iclk_dflt_wait,
1402 .parent = &l4_ck, 1394 .parent = &wu_l4_ick,
1403 .clkdm_name = "core_l4_clkdm", 1395 .clkdm_name = "wkup_clkdm",
1404 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1396 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1405 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT, 1397 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1406 .recalc = &followparent_recalc, 1398 .recalc = &followparent_recalc,
@@ -1418,10 +1410,10 @@ static struct clk mpu_wdt_fck = {
1418 1410
1419static struct clk sync_32k_ick = { 1411static struct clk sync_32k_ick = {
1420 .name = "sync_32k_ick", 1412 .name = "sync_32k_ick",
1421 .ops = &clkops_omap2_dflt_wait, 1413 .ops = &clkops_omap2_iclk_dflt_wait,
1422 .parent = &l4_ck,
1423 .flags = ENABLE_ON_INIT, 1414 .flags = ENABLE_ON_INIT,
1424 .clkdm_name = "core_l4_clkdm", 1415 .parent = &wu_l4_ick,
1416 .clkdm_name = "wkup_clkdm",
1425 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1417 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1426 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT, 1418 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1427 .recalc = &followparent_recalc, 1419 .recalc = &followparent_recalc,
@@ -1429,9 +1421,9 @@ static struct clk sync_32k_ick = {
1429 1421
1430static struct clk wdt1_ick = { 1422static struct clk wdt1_ick = {
1431 .name = "wdt1_ick", 1423 .name = "wdt1_ick",
1432 .ops = &clkops_omap2_dflt_wait, 1424 .ops = &clkops_omap2_iclk_dflt_wait,
1433 .parent = &l4_ck, 1425 .parent = &wu_l4_ick,
1434 .clkdm_name = "core_l4_clkdm", 1426 .clkdm_name = "wkup_clkdm",
1435 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1427 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1436 .enable_bit = OMAP24XX_EN_WDT1_SHIFT, 1428 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1437 .recalc = &followparent_recalc, 1429 .recalc = &followparent_recalc,
@@ -1439,10 +1431,10 @@ static struct clk wdt1_ick = {
1439 1431
1440static struct clk omapctrl_ick = { 1432static struct clk omapctrl_ick = {
1441 .name = "omapctrl_ick", 1433 .name = "omapctrl_ick",
1442 .ops = &clkops_omap2_dflt_wait, 1434 .ops = &clkops_omap2_iclk_dflt_wait,
1443 .parent = &l4_ck,
1444 .flags = ENABLE_ON_INIT, 1435 .flags = ENABLE_ON_INIT,
1445 .clkdm_name = "core_l4_clkdm", 1436 .parent = &wu_l4_ick,
1437 .clkdm_name = "wkup_clkdm",
1446 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1438 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1447 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT, 1439 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1448 .recalc = &followparent_recalc, 1440 .recalc = &followparent_recalc,
@@ -1450,9 +1442,9 @@ static struct clk omapctrl_ick = {
1450 1442
1451static struct clk icr_ick = { 1443static struct clk icr_ick = {
1452 .name = "icr_ick", 1444 .name = "icr_ick",
1453 .ops = &clkops_omap2_dflt_wait, 1445 .ops = &clkops_omap2_iclk_dflt_wait,
1454 .parent = &l4_ck, 1446 .parent = &wu_l4_ick,
1455 .clkdm_name = "core_l4_clkdm", 1447 .clkdm_name = "wkup_clkdm",
1456 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 1448 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1457 .enable_bit = OMAP2430_EN_ICR_SHIFT, 1449 .enable_bit = OMAP2430_EN_ICR_SHIFT,
1458 .recalc = &followparent_recalc, 1450 .recalc = &followparent_recalc,
@@ -1460,7 +1452,7 @@ static struct clk icr_ick = {
1460 1452
1461static struct clk cam_ick = { 1453static struct clk cam_ick = {
1462 .name = "cam_ick", 1454 .name = "cam_ick",
1463 .ops = &clkops_omap2_dflt, 1455 .ops = &clkops_omap2_iclk_dflt,
1464 .parent = &l4_ck, 1456 .parent = &l4_ck,
1465 .clkdm_name = "core_l4_clkdm", 1457 .clkdm_name = "core_l4_clkdm",
1466 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1458 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1485,7 +1477,7 @@ static struct clk cam_fck = {
1485 1477
1486static struct clk mailboxes_ick = { 1478static struct clk mailboxes_ick = {
1487 .name = "mailboxes_ick", 1479 .name = "mailboxes_ick",
1488 .ops = &clkops_omap2_dflt_wait, 1480 .ops = &clkops_omap2_iclk_dflt_wait,
1489 .parent = &l4_ck, 1481 .parent = &l4_ck,
1490 .clkdm_name = "core_l4_clkdm", 1482 .clkdm_name = "core_l4_clkdm",
1491 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1483 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1495,7 +1487,7 @@ static struct clk mailboxes_ick = {
1495 1487
1496static struct clk wdt4_ick = { 1488static struct clk wdt4_ick = {
1497 .name = "wdt4_ick", 1489 .name = "wdt4_ick",
1498 .ops = &clkops_omap2_dflt_wait, 1490 .ops = &clkops_omap2_iclk_dflt_wait,
1499 .parent = &l4_ck, 1491 .parent = &l4_ck,
1500 .clkdm_name = "core_l4_clkdm", 1492 .clkdm_name = "core_l4_clkdm",
1501 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1493 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1515,7 +1507,7 @@ static struct clk wdt4_fck = {
1515 1507
1516static struct clk mspro_ick = { 1508static struct clk mspro_ick = {
1517 .name = "mspro_ick", 1509 .name = "mspro_ick",
1518 .ops = &clkops_omap2_dflt_wait, 1510 .ops = &clkops_omap2_iclk_dflt_wait,
1519 .parent = &l4_ck, 1511 .parent = &l4_ck,
1520 .clkdm_name = "core_l4_clkdm", 1512 .clkdm_name = "core_l4_clkdm",
1521 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1513 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1535,7 +1527,7 @@ static struct clk mspro_fck = {
1535 1527
1536static struct clk fac_ick = { 1528static struct clk fac_ick = {
1537 .name = "fac_ick", 1529 .name = "fac_ick",
1538 .ops = &clkops_omap2_dflt_wait, 1530 .ops = &clkops_omap2_iclk_dflt_wait,
1539 .parent = &l4_ck, 1531 .parent = &l4_ck,
1540 .clkdm_name = "core_l4_clkdm", 1532 .clkdm_name = "core_l4_clkdm",
1541 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1533 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1555,7 +1547,7 @@ static struct clk fac_fck = {
1555 1547
1556static struct clk hdq_ick = { 1548static struct clk hdq_ick = {
1557 .name = "hdq_ick", 1549 .name = "hdq_ick",
1558 .ops = &clkops_omap2_dflt_wait, 1550 .ops = &clkops_omap2_iclk_dflt_wait,
1559 .parent = &l4_ck, 1551 .parent = &l4_ck,
1560 .clkdm_name = "core_l4_clkdm", 1552 .clkdm_name = "core_l4_clkdm",
1561 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1553 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1579,7 +1571,7 @@ static struct clk hdq_fck = {
1579 */ 1571 */
1580static struct clk i2c2_ick = { 1572static struct clk i2c2_ick = {
1581 .name = "i2c2_ick", 1573 .name = "i2c2_ick",
1582 .ops = &clkops_omap2_dflt_wait, 1574 .ops = &clkops_omap2_iclk_dflt_wait,
1583 .parent = &l4_ck, 1575 .parent = &l4_ck,
1584 .clkdm_name = "core_l4_clkdm", 1576 .clkdm_name = "core_l4_clkdm",
1585 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1577 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1603,7 +1595,7 @@ static struct clk i2chs2_fck = {
1603 */ 1595 */
1604static struct clk i2c1_ick = { 1596static struct clk i2c1_ick = {
1605 .name = "i2c1_ick", 1597 .name = "i2c1_ick",
1606 .ops = &clkops_omap2_dflt_wait, 1598 .ops = &clkops_omap2_iclk_dflt_wait,
1607 .parent = &l4_ck, 1599 .parent = &l4_ck,
1608 .clkdm_name = "core_l4_clkdm", 1600 .clkdm_name = "core_l4_clkdm",
1609 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1601 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -1621,12 +1613,18 @@ static struct clk i2chs1_fck = {
1621 .recalc = &followparent_recalc, 1613 .recalc = &followparent_recalc,
1622}; 1614};
1623 1615
1616/*
1617 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1618 * accesses derived from this data.
1619 */
1624static struct clk gpmc_fck = { 1620static struct clk gpmc_fck = {
1625 .name = "gpmc_fck", 1621 .name = "gpmc_fck",
1626 .ops = &clkops_null, /* RMK: missing? */ 1622 .ops = &clkops_omap2_iclk_idle_only,
1627 .parent = &core_l3_ck, 1623 .parent = &core_l3_ck,
1628 .flags = ENABLE_ON_INIT, 1624 .flags = ENABLE_ON_INIT,
1629 .clkdm_name = "core_l3_clkdm", 1625 .clkdm_name = "core_l3_clkdm",
1626 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1627 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
1630 .recalc = &followparent_recalc, 1628 .recalc = &followparent_recalc,
1631}; 1629};
1632 1630
@@ -1638,20 +1636,26 @@ static struct clk sdma_fck = {
1638 .recalc = &followparent_recalc, 1636 .recalc = &followparent_recalc,
1639}; 1637};
1640 1638
1639/*
1640 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1641 * accesses derived from this data.
1642 */
1641static struct clk sdma_ick = { 1643static struct clk sdma_ick = {
1642 .name = "sdma_ick", 1644 .name = "sdma_ick",
1643 .ops = &clkops_null, /* RMK: missing? */ 1645 .ops = &clkops_omap2_iclk_idle_only,
1644 .parent = &l4_ck, 1646 .parent = &core_l3_ck,
1645 .clkdm_name = "core_l3_clkdm", 1647 .clkdm_name = "core_l3_clkdm",
1648 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1649 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1646 .recalc = &followparent_recalc, 1650 .recalc = &followparent_recalc,
1647}; 1651};
1648 1652
1649static struct clk sdrc_ick = { 1653static struct clk sdrc_ick = {
1650 .name = "sdrc_ick", 1654 .name = "sdrc_ick",
1651 .ops = &clkops_omap2_dflt_wait, 1655 .ops = &clkops_omap2_iclk_idle_only,
1652 .parent = &l4_ck, 1656 .parent = &core_l3_ck,
1653 .flags = ENABLE_ON_INIT, 1657 .flags = ENABLE_ON_INIT,
1654 .clkdm_name = "core_l4_clkdm", 1658 .clkdm_name = "core_l3_clkdm",
1655 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3), 1659 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1656 .enable_bit = OMAP2430_EN_SDRC_SHIFT, 1660 .enable_bit = OMAP2430_EN_SDRC_SHIFT,
1657 .recalc = &followparent_recalc, 1661 .recalc = &followparent_recalc,
@@ -1659,7 +1663,7 @@ static struct clk sdrc_ick = {
1659 1663
1660static struct clk des_ick = { 1664static struct clk des_ick = {
1661 .name = "des_ick", 1665 .name = "des_ick",
1662 .ops = &clkops_omap2_dflt_wait, 1666 .ops = &clkops_omap2_iclk_dflt_wait,
1663 .parent = &l4_ck, 1667 .parent = &l4_ck,
1664 .clkdm_name = "core_l4_clkdm", 1668 .clkdm_name = "core_l4_clkdm",
1665 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), 1669 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
@@ -1669,7 +1673,7 @@ static struct clk des_ick = {
1669 1673
1670static struct clk sha_ick = { 1674static struct clk sha_ick = {
1671 .name = "sha_ick", 1675 .name = "sha_ick",
1672 .ops = &clkops_omap2_dflt_wait, 1676 .ops = &clkops_omap2_iclk_dflt_wait,
1673 .parent = &l4_ck, 1677 .parent = &l4_ck,
1674 .clkdm_name = "core_l4_clkdm", 1678 .clkdm_name = "core_l4_clkdm",
1675 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), 1679 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
@@ -1679,7 +1683,7 @@ static struct clk sha_ick = {
1679 1683
1680static struct clk rng_ick = { 1684static struct clk rng_ick = {
1681 .name = "rng_ick", 1685 .name = "rng_ick",
1682 .ops = &clkops_omap2_dflt_wait, 1686 .ops = &clkops_omap2_iclk_dflt_wait,
1683 .parent = &l4_ck, 1687 .parent = &l4_ck,
1684 .clkdm_name = "core_l4_clkdm", 1688 .clkdm_name = "core_l4_clkdm",
1685 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), 1689 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
@@ -1689,7 +1693,7 @@ static struct clk rng_ick = {
1689 1693
1690static struct clk aes_ick = { 1694static struct clk aes_ick = {
1691 .name = "aes_ick", 1695 .name = "aes_ick",
1692 .ops = &clkops_omap2_dflt_wait, 1696 .ops = &clkops_omap2_iclk_dflt_wait,
1693 .parent = &l4_ck, 1697 .parent = &l4_ck,
1694 .clkdm_name = "core_l4_clkdm", 1698 .clkdm_name = "core_l4_clkdm",
1695 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), 1699 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
@@ -1699,7 +1703,7 @@ static struct clk aes_ick = {
1699 1703
1700static struct clk pka_ick = { 1704static struct clk pka_ick = {
1701 .name = "pka_ick", 1705 .name = "pka_ick",
1702 .ops = &clkops_omap2_dflt_wait, 1706 .ops = &clkops_omap2_iclk_dflt_wait,
1703 .parent = &l4_ck, 1707 .parent = &l4_ck,
1704 .clkdm_name = "core_l4_clkdm", 1708 .clkdm_name = "core_l4_clkdm",
1705 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), 1709 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
@@ -1719,7 +1723,7 @@ static struct clk usb_fck = {
1719 1723
1720static struct clk usbhs_ick = { 1724static struct clk usbhs_ick = {
1721 .name = "usbhs_ick", 1725 .name = "usbhs_ick",
1722 .ops = &clkops_omap2_dflt_wait, 1726 .ops = &clkops_omap2_iclk_dflt_wait,
1723 .parent = &core_l3_ck, 1727 .parent = &core_l3_ck,
1724 .clkdm_name = "core_l3_clkdm", 1728 .clkdm_name = "core_l3_clkdm",
1725 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1729 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1729,7 +1733,7 @@ static struct clk usbhs_ick = {
1729 1733
1730static struct clk mmchs1_ick = { 1734static struct clk mmchs1_ick = {
1731 .name = "mmchs1_ick", 1735 .name = "mmchs1_ick",
1732 .ops = &clkops_omap2_dflt_wait, 1736 .ops = &clkops_omap2_iclk_dflt_wait,
1733 .parent = &l4_ck, 1737 .parent = &l4_ck,
1734 .clkdm_name = "core_l4_clkdm", 1738 .clkdm_name = "core_l4_clkdm",
1735 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1739 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1741,7 +1745,7 @@ static struct clk mmchs1_fck = {
1741 .name = "mmchs1_fck", 1745 .name = "mmchs1_fck",
1742 .ops = &clkops_omap2_dflt_wait, 1746 .ops = &clkops_omap2_dflt_wait,
1743 .parent = &func_96m_ck, 1747 .parent = &func_96m_ck,
1744 .clkdm_name = "core_l3_clkdm", 1748 .clkdm_name = "core_l4_clkdm",
1745 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), 1749 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1746 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT, 1750 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1747 .recalc = &followparent_recalc, 1751 .recalc = &followparent_recalc,
@@ -1749,7 +1753,7 @@ static struct clk mmchs1_fck = {
1749 1753
1750static struct clk mmchs2_ick = { 1754static struct clk mmchs2_ick = {
1751 .name = "mmchs2_ick", 1755 .name = "mmchs2_ick",
1752 .ops = &clkops_omap2_dflt_wait, 1756 .ops = &clkops_omap2_iclk_dflt_wait,
1753 .parent = &l4_ck, 1757 .parent = &l4_ck,
1754 .clkdm_name = "core_l4_clkdm", 1758 .clkdm_name = "core_l4_clkdm",
1755 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1759 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1761,6 +1765,7 @@ static struct clk mmchs2_fck = {
1761 .name = "mmchs2_fck", 1765 .name = "mmchs2_fck",
1762 .ops = &clkops_omap2_dflt_wait, 1766 .ops = &clkops_omap2_dflt_wait,
1763 .parent = &func_96m_ck, 1767 .parent = &func_96m_ck,
1768 .clkdm_name = "core_l4_clkdm",
1764 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), 1769 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1765 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT, 1770 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1766 .recalc = &followparent_recalc, 1771 .recalc = &followparent_recalc,
@@ -1768,7 +1773,7 @@ static struct clk mmchs2_fck = {
1768 1773
1769static struct clk gpio5_ick = { 1774static struct clk gpio5_ick = {
1770 .name = "gpio5_ick", 1775 .name = "gpio5_ick",
1771 .ops = &clkops_omap2_dflt_wait, 1776 .ops = &clkops_omap2_iclk_dflt_wait,
1772 .parent = &l4_ck, 1777 .parent = &l4_ck,
1773 .clkdm_name = "core_l4_clkdm", 1778 .clkdm_name = "core_l4_clkdm",
1774 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1779 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1788,7 +1793,7 @@ static struct clk gpio5_fck = {
1788 1793
1789static struct clk mdm_intc_ick = { 1794static struct clk mdm_intc_ick = {
1790 .name = "mdm_intc_ick", 1795 .name = "mdm_intc_ick",
1791 .ops = &clkops_omap2_dflt_wait, 1796 .ops = &clkops_omap2_iclk_dflt_wait,
1792 .parent = &l4_ck, 1797 .parent = &l4_ck,
1793 .clkdm_name = "core_l4_clkdm", 1798 .clkdm_name = "core_l4_clkdm",
1794 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1799 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
@@ -1880,7 +1885,6 @@ static struct omap_clk omap2430_clks[] = {
1880 CLK(NULL, "mpu_ck", &mpu_ck, CK_243X), 1885 CLK(NULL, "mpu_ck", &mpu_ck, CK_243X),
1881 /* dsp domain clocks */ 1886 /* dsp domain clocks */
1882 CLK(NULL, "dsp_fck", &dsp_fck, CK_243X), 1887 CLK(NULL, "dsp_fck", &dsp_fck, CK_243X),
1883 CLK(NULL, "dsp_irate_ick", &dsp_irate_ick, CK_243X),
1884 CLK(NULL, "iva2_1_ick", &iva2_1_ick, CK_243X), 1888 CLK(NULL, "iva2_1_ick", &iva2_1_ick, CK_243X),
1885 /* GFX domain clocks */ 1889 /* GFX domain clocks */
1886 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_243X), 1890 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_243X),
@@ -1901,6 +1905,7 @@ static struct omap_clk omap2430_clks[] = {
1901 /* L4 domain clocks */ 1905 /* L4 domain clocks */
1902 CLK(NULL, "l4_ck", &l4_ck, CK_243X), 1906 CLK(NULL, "l4_ck", &l4_ck, CK_243X),
1903 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_243X), 1907 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_243X),
1908 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_243X),
1904 /* virtual meta-group clock */ 1909 /* virtual meta-group clock */
1905 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_243X), 1910 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_243X),
1906 /* general l4 interface ck, multi-parent functional clk */ 1911 /* general l4 interface ck, multi-parent functional clk */
@@ -2028,6 +2033,9 @@ int __init omap2430_clk_init(void)
2028 omap2_init_clk_clkdm(c->lk.clk); 2033 omap2_init_clk_clkdm(c->lk.clk);
2029 } 2034 }
2030 2035
2036 /* Disable autoidle on all clocks; let the PM code enable it later */
2037 omap_clk_disable_autoidle_all();
2038
2031 /* Check the MPU rate set by bootloader */ 2039 /* Check the MPU rate set by bootloader */
2032 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck); 2040 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
2033 for (prcm = rate_table; prcm->mpu_speed; prcm++) { 2041 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
diff --git a/arch/arm/mach-omap2/clock2xxx.h b/arch/arm/mach-omap2/clock2xxx.h
index cc5c8d422c5b..cb6df8ca9e4a 100644
--- a/arch/arm/mach-omap2/clock2xxx.h
+++ b/arch/arm/mach-omap2/clock2xxx.h
@@ -23,13 +23,13 @@ void omap2xxx_clk_prepare_for_reboot(void);
23#ifdef CONFIG_SOC_OMAP2420 23#ifdef CONFIG_SOC_OMAP2420
24int omap2420_clk_init(void); 24int omap2420_clk_init(void);
25#else 25#else
26#define omap2420_clk_init() 0 26#define omap2420_clk_init() do { } while(0)
27#endif 27#endif
28 28
29#ifdef CONFIG_SOC_OMAP2430 29#ifdef CONFIG_SOC_OMAP2430
30int omap2430_clk_init(void); 30int omap2430_clk_init(void);
31#else 31#else
32#define omap2430_clk_init() 0 32#define omap2430_clk_init() do { } while(0)
33#endif 33#endif
34 34
35extern void __iomem *prcm_clksrc_ctrl, *cm_idlest_pll; 35extern void __iomem *prcm_clksrc_ctrl, *cm_idlest_pll;
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 287abc480924..1fc96b9ee330 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -2,7 +2,7 @@
2 * OMAP3-specific clock framework functions 2 * OMAP3-specific clock framework functions
3 * 3 *
4 * Copyright (C) 2007-2008 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
5 * Copyright (C) 2007-2010 Nokia Corporation 5 * Copyright (C) 2007-2011 Nokia Corporation
6 * 6 *
7 * Paul Walmsley 7 * Paul Walmsley
8 * Jouni Högander 8 * Jouni Högander
@@ -59,6 +59,15 @@ const struct clkops clkops_omap3430es2_ssi_wait = {
59 .find_companion = omap2_clk_dflt_find_companion, 59 .find_companion = omap2_clk_dflt_find_companion,
60}; 60};
61 61
62const struct clkops clkops_omap3430es2_iclk_ssi_wait = {
63 .enable = omap2_dflt_clk_enable,
64 .disable = omap2_dflt_clk_disable,
65 .find_idlest = omap3430es2_clk_ssi_find_idlest,
66 .find_companion = omap2_clk_dflt_find_companion,
67 .allow_idle = omap2_clkt_iclk_allow_idle,
68 .deny_idle = omap2_clkt_iclk_deny_idle,
69};
70
62/** 71/**
63 * omap3430es2_clk_dss_usbhost_find_idlest - CM_IDLEST info for DSS, USBHOST 72 * omap3430es2_clk_dss_usbhost_find_idlest - CM_IDLEST info for DSS, USBHOST
64 * @clk: struct clk * being enabled 73 * @clk: struct clk * being enabled
@@ -94,6 +103,15 @@ const struct clkops clkops_omap3430es2_dss_usbhost_wait = {
94 .find_companion = omap2_clk_dflt_find_companion, 103 .find_companion = omap2_clk_dflt_find_companion,
95}; 104};
96 105
106const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait = {
107 .enable = omap2_dflt_clk_enable,
108 .disable = omap2_dflt_clk_disable,
109 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
110 .find_companion = omap2_clk_dflt_find_companion,
111 .allow_idle = omap2_clkt_iclk_allow_idle,
112 .deny_idle = omap2_clkt_iclk_deny_idle,
113};
114
97/** 115/**
98 * omap3430es2_clk_hsotgusb_find_idlest - return CM_IDLEST info for HSOTGUSB 116 * omap3430es2_clk_hsotgusb_find_idlest - return CM_IDLEST info for HSOTGUSB
99 * @clk: struct clk * being enabled 117 * @clk: struct clk * being enabled
@@ -124,3 +142,12 @@ const struct clkops clkops_omap3430es2_hsotgusb_wait = {
124 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest, 142 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
125 .find_companion = omap2_clk_dflt_find_companion, 143 .find_companion = omap2_clk_dflt_find_companion,
126}; 144};
145
146const struct clkops clkops_omap3430es2_iclk_hsotgusb_wait = {
147 .enable = omap2_dflt_clk_enable,
148 .disable = omap2_dflt_clk_disable,
149 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
150 .find_companion = omap2_clk_dflt_find_companion,
151 .allow_idle = omap2_clkt_iclk_allow_idle,
152 .deny_idle = omap2_clkt_iclk_deny_idle,
153};
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h
index 628e8de57680..084ba71b2b31 100644
--- a/arch/arm/mach-omap2/clock34xx.h
+++ b/arch/arm/mach-omap2/clock34xx.h
@@ -2,14 +2,17 @@
2 * OMAP34xx clock function prototypes and macros 2 * OMAP34xx clock function prototypes and macros
3 * 3 *
4 * Copyright (C) 2007-2010 Texas Instruments, Inc. 4 * Copyright (C) 2007-2010 Texas Instruments, Inc.
5 * Copyright (C) 2007-2010 Nokia Corporation 5 * Copyright (C) 2007-2011 Nokia Corporation
6 */ 6 */
7 7
8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H 8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H
9#define __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H 9#define __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H
10 10
11extern const struct clkops clkops_omap3430es2_ssi_wait; 11extern const struct clkops clkops_omap3430es2_ssi_wait;
12extern const struct clkops clkops_omap3430es2_iclk_ssi_wait;
12extern const struct clkops clkops_omap3430es2_hsotgusb_wait; 13extern const struct clkops clkops_omap3430es2_hsotgusb_wait;
14extern const struct clkops clkops_omap3430es2_iclk_hsotgusb_wait;
13extern const struct clkops clkops_omap3430es2_dss_usbhost_wait; 15extern const struct clkops clkops_omap3430es2_dss_usbhost_wait;
16extern const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait;
14 17
15#endif 18#endif
diff --git a/arch/arm/mach-omap2/clock3517.c b/arch/arm/mach-omap2/clock3517.c
index 74116a3cf099..2e97d08f0e56 100644
--- a/arch/arm/mach-omap2/clock3517.c
+++ b/arch/arm/mach-omap2/clock3517.c
@@ -2,7 +2,7 @@
2 * OMAP3517/3505-specific clock framework functions 2 * OMAP3517/3505-specific clock framework functions
3 * 3 *
4 * Copyright (C) 2010 Texas Instruments, Inc. 4 * Copyright (C) 2010 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation 5 * Copyright (C) 2011 Nokia Corporation
6 * 6 *
7 * Ranjith Lohithakshan 7 * Ranjith Lohithakshan
8 * Paul Walmsley 8 * Paul Walmsley
@@ -119,6 +119,8 @@ const struct clkops clkops_am35xx_ipss_wait = {
119 .disable = omap2_dflt_clk_disable, 119 .disable = omap2_dflt_clk_disable,
120 .find_idlest = am35xx_clk_ipss_find_idlest, 120 .find_idlest = am35xx_clk_ipss_find_idlest,
121 .find_companion = omap2_clk_dflt_find_companion, 121 .find_companion = omap2_clk_dflt_find_companion,
122 .allow_idle = omap2_clkt_iclk_allow_idle,
123 .deny_idle = omap2_clkt_iclk_deny_idle,
122}; 124};
123 125
124 126
diff --git a/arch/arm/mach-omap2/clock3xxx.c b/arch/arm/mach-omap2/clock3xxx.c
index e9f66b6dec18..952c3e01c9eb 100644
--- a/arch/arm/mach-omap2/clock3xxx.c
+++ b/arch/arm/mach-omap2/clock3xxx.c
@@ -65,9 +65,6 @@ void __init omap3_clk_lock_dpll5(void)
65 clk_set_rate(dpll5_clk, DPLL5_FREQ_FOR_USBHOST); 65 clk_set_rate(dpll5_clk, DPLL5_FREQ_FOR_USBHOST);
66 clk_enable(dpll5_clk); 66 clk_enable(dpll5_clk);
67 67
68 /* Enable autoidle to allow it to enter low power bypass */
69 omap3_dpll_allow_idle(dpll5_clk);
70
71 /* Program dpll5_m2_clk divider for no division */ 68 /* Program dpll5_m2_clk divider for no division */
72 dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck"); 69 dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck");
73 clk_enable(dpll5_m2_clk); 70 clk_enable(dpll5_m2_clk);
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index 052ac329282f..d905ecc7989a 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -2,7 +2,7 @@
2 * OMAP3 clock data 2 * OMAP3 clock data
3 * 3 *
4 * Copyright (C) 2007-2010 Texas Instruments, Inc. 4 * Copyright (C) 2007-2010 Texas Instruments, Inc.
5 * Copyright (C) 2007-2010 Nokia Corporation 5 * Copyright (C) 2007-2011 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
8 * With many device clock fixes by Kevin Hilman and Jouni Högander 8 * With many device clock fixes by Kevin Hilman and Jouni Högander
@@ -291,12 +291,11 @@ static struct dpll_data dpll1_dd = {
291 .max_multiplier = OMAP3_MAX_DPLL_MULT, 291 .max_multiplier = OMAP3_MAX_DPLL_MULT,
292 .min_divider = 1, 292 .min_divider = 1,
293 .max_divider = OMAP3_MAX_DPLL_DIV, 293 .max_divider = OMAP3_MAX_DPLL_DIV,
294 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
295}; 294};
296 295
297static struct clk dpll1_ck = { 296static struct clk dpll1_ck = {
298 .name = "dpll1_ck", 297 .name = "dpll1_ck",
299 .ops = &clkops_null, 298 .ops = &clkops_omap3_noncore_dpll_ops,
300 .parent = &sys_ck, 299 .parent = &sys_ck,
301 .dpll_data = &dpll1_dd, 300 .dpll_data = &dpll1_dd,
302 .round_rate = &omap2_dpll_round_rate, 301 .round_rate = &omap2_dpll_round_rate,
@@ -364,7 +363,6 @@ static struct dpll_data dpll2_dd = {
364 .max_multiplier = OMAP3_MAX_DPLL_MULT, 363 .max_multiplier = OMAP3_MAX_DPLL_MULT,
365 .min_divider = 1, 364 .min_divider = 1,
366 .max_divider = OMAP3_MAX_DPLL_DIV, 365 .max_divider = OMAP3_MAX_DPLL_DIV,
367 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
368}; 366};
369 367
370static struct clk dpll2_ck = { 368static struct clk dpll2_ck = {
@@ -424,12 +422,11 @@ static struct dpll_data dpll3_dd = {
424 .max_multiplier = OMAP3_MAX_DPLL_MULT, 422 .max_multiplier = OMAP3_MAX_DPLL_MULT,
425 .min_divider = 1, 423 .min_divider = 1,
426 .max_divider = OMAP3_MAX_DPLL_DIV, 424 .max_divider = OMAP3_MAX_DPLL_DIV,
427 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
428}; 425};
429 426
430static struct clk dpll3_ck = { 427static struct clk dpll3_ck = {
431 .name = "dpll3_ck", 428 .name = "dpll3_ck",
432 .ops = &clkops_null, 429 .ops = &clkops_omap3_core_dpll_ops,
433 .parent = &sys_ck, 430 .parent = &sys_ck,
434 .dpll_data = &dpll3_dd, 431 .dpll_data = &dpll3_dd,
435 .round_rate = &omap2_dpll_round_rate, 432 .round_rate = &omap2_dpll_round_rate,
@@ -583,7 +580,6 @@ static struct dpll_data dpll4_dd_34xx __initdata = {
583 .max_multiplier = OMAP3_MAX_DPLL_MULT, 580 .max_multiplier = OMAP3_MAX_DPLL_MULT,
584 .min_divider = 1, 581 .min_divider = 1,
585 .max_divider = OMAP3_MAX_DPLL_DIV, 582 .max_divider = OMAP3_MAX_DPLL_DIV,
586 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
587}; 583};
588 584
589static struct dpll_data dpll4_dd_3630 __initdata = { 585static struct dpll_data dpll4_dd_3630 __initdata = {
@@ -607,7 +603,6 @@ static struct dpll_data dpll4_dd_3630 __initdata = {
607 .max_multiplier = OMAP3630_MAX_JTYPE_DPLL_MULT, 603 .max_multiplier = OMAP3630_MAX_JTYPE_DPLL_MULT,
608 .min_divider = 1, 604 .min_divider = 1,
609 .max_divider = OMAP3_MAX_DPLL_DIV, 605 .max_divider = OMAP3_MAX_DPLL_DIV,
610 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE,
611 .flags = DPLL_J_TYPE 606 .flags = DPLL_J_TYPE
612}; 607};
613 608
@@ -939,7 +934,6 @@ static struct dpll_data dpll5_dd = {
939 .max_multiplier = OMAP3_MAX_DPLL_MULT, 934 .max_multiplier = OMAP3_MAX_DPLL_MULT,
940 .min_divider = 1, 935 .min_divider = 1,
941 .max_divider = OMAP3_MAX_DPLL_DIV, 936 .max_divider = OMAP3_MAX_DPLL_DIV,
942 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
943}; 937};
944 938
945static struct clk dpll5_ck = { 939static struct clk dpll5_ck = {
@@ -1205,7 +1199,10 @@ static const struct clksel gfx_l3_clksel[] = {
1205 { .parent = NULL } 1199 { .parent = NULL }
1206}; 1200};
1207 1201
1208/* Virtual parent clock for gfx_l3_ick and gfx_l3_fck */ 1202/*
1203 * Virtual parent clock for gfx_l3_ick and gfx_l3_fck
1204 * This interface clock does not have a CM_AUTOIDLE bit
1205 */
1209static struct clk gfx_l3_ck = { 1206static struct clk gfx_l3_ck = {
1210 .name = "gfx_l3_ck", 1207 .name = "gfx_l3_ck",
1211 .ops = &clkops_omap2_dflt_wait, 1208 .ops = &clkops_omap2_dflt_wait,
@@ -1304,6 +1301,7 @@ static struct clk sgx_fck = {
1304 .round_rate = &omap2_clksel_round_rate 1301 .round_rate = &omap2_clksel_round_rate
1305}; 1302};
1306 1303
1304/* This interface clock does not have a CM_AUTOIDLE bit */
1307static struct clk sgx_ick = { 1305static struct clk sgx_ick = {
1308 .name = "sgx_ick", 1306 .name = "sgx_ick",
1309 .ops = &clkops_omap2_dflt_wait, 1307 .ops = &clkops_omap2_dflt_wait,
@@ -1328,7 +1326,7 @@ static struct clk d2d_26m_fck = {
1328 1326
1329static struct clk modem_fck = { 1327static struct clk modem_fck = {
1330 .name = "modem_fck", 1328 .name = "modem_fck",
1331 .ops = &clkops_omap2_dflt_wait, 1329 .ops = &clkops_omap2_mdmclk_dflt_wait,
1332 .parent = &sys_ck, 1330 .parent = &sys_ck,
1333 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1331 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1334 .enable_bit = OMAP3430_EN_MODEM_SHIFT, 1332 .enable_bit = OMAP3430_EN_MODEM_SHIFT,
@@ -1338,7 +1336,7 @@ static struct clk modem_fck = {
1338 1336
1339static struct clk sad2d_ick = { 1337static struct clk sad2d_ick = {
1340 .name = "sad2d_ick", 1338 .name = "sad2d_ick",
1341 .ops = &clkops_omap2_dflt_wait, 1339 .ops = &clkops_omap2_iclk_dflt_wait,
1342 .parent = &l3_ick, 1340 .parent = &l3_ick,
1343 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1341 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1344 .enable_bit = OMAP3430_EN_SAD2D_SHIFT, 1342 .enable_bit = OMAP3430_EN_SAD2D_SHIFT,
@@ -1348,7 +1346,7 @@ static struct clk sad2d_ick = {
1348 1346
1349static struct clk mad2d_ick = { 1347static struct clk mad2d_ick = {
1350 .name = "mad2d_ick", 1348 .name = "mad2d_ick",
1351 .ops = &clkops_omap2_dflt_wait, 1349 .ops = &clkops_omap2_iclk_dflt_wait,
1352 .parent = &l3_ick, 1350 .parent = &l3_ick,
1353 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3), 1351 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1354 .enable_bit = OMAP3430_EN_MAD2D_SHIFT, 1352 .enable_bit = OMAP3430_EN_MAD2D_SHIFT,
@@ -1718,7 +1716,7 @@ static struct clk core_l3_ick = {
1718 1716
1719static struct clk hsotgusb_ick_3430es1 = { 1717static struct clk hsotgusb_ick_3430es1 = {
1720 .name = "hsotgusb_ick", 1718 .name = "hsotgusb_ick",
1721 .ops = &clkops_omap2_dflt, 1719 .ops = &clkops_omap2_iclk_dflt,
1722 .parent = &core_l3_ick, 1720 .parent = &core_l3_ick,
1723 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1721 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1724 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT, 1722 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
@@ -1728,7 +1726,7 @@ static struct clk hsotgusb_ick_3430es1 = {
1728 1726
1729static struct clk hsotgusb_ick_3430es2 = { 1727static struct clk hsotgusb_ick_3430es2 = {
1730 .name = "hsotgusb_ick", 1728 .name = "hsotgusb_ick",
1731 .ops = &clkops_omap3430es2_hsotgusb_wait, 1729 .ops = &clkops_omap3430es2_iclk_hsotgusb_wait,
1732 .parent = &core_l3_ick, 1730 .parent = &core_l3_ick,
1733 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1731 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1734 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT, 1732 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
@@ -1736,6 +1734,7 @@ static struct clk hsotgusb_ick_3430es2 = {
1736 .recalc = &followparent_recalc, 1734 .recalc = &followparent_recalc,
1737}; 1735};
1738 1736
1737/* This interface clock does not have a CM_AUTOIDLE bit */
1739static struct clk sdrc_ick = { 1738static struct clk sdrc_ick = {
1740 .name = "sdrc_ick", 1739 .name = "sdrc_ick",
1741 .ops = &clkops_omap2_dflt_wait, 1740 .ops = &clkops_omap2_dflt_wait,
@@ -1767,7 +1766,7 @@ static struct clk security_l3_ick = {
1767 1766
1768static struct clk pka_ick = { 1767static struct clk pka_ick = {
1769 .name = "pka_ick", 1768 .name = "pka_ick",
1770 .ops = &clkops_omap2_dflt_wait, 1769 .ops = &clkops_omap2_iclk_dflt_wait,
1771 .parent = &security_l3_ick, 1770 .parent = &security_l3_ick,
1772 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 1771 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1773 .enable_bit = OMAP3430_EN_PKA_SHIFT, 1772 .enable_bit = OMAP3430_EN_PKA_SHIFT,
@@ -1786,7 +1785,7 @@ static struct clk core_l4_ick = {
1786 1785
1787static struct clk usbtll_ick = { 1786static struct clk usbtll_ick = {
1788 .name = "usbtll_ick", 1787 .name = "usbtll_ick",
1789 .ops = &clkops_omap2_dflt_wait, 1788 .ops = &clkops_omap2_iclk_dflt_wait,
1790 .parent = &core_l4_ick, 1789 .parent = &core_l4_ick,
1791 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3), 1790 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1792 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT, 1791 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
@@ -1796,7 +1795,7 @@ static struct clk usbtll_ick = {
1796 1795
1797static struct clk mmchs3_ick = { 1796static struct clk mmchs3_ick = {
1798 .name = "mmchs3_ick", 1797 .name = "mmchs3_ick",
1799 .ops = &clkops_omap2_dflt_wait, 1798 .ops = &clkops_omap2_iclk_dflt_wait,
1800 .parent = &core_l4_ick, 1799 .parent = &core_l4_ick,
1801 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1800 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1802 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT, 1801 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
@@ -1807,7 +1806,7 @@ static struct clk mmchs3_ick = {
1807/* Intersystem Communication Registers - chassis mode only */ 1806/* Intersystem Communication Registers - chassis mode only */
1808static struct clk icr_ick = { 1807static struct clk icr_ick = {
1809 .name = "icr_ick", 1808 .name = "icr_ick",
1810 .ops = &clkops_omap2_dflt_wait, 1809 .ops = &clkops_omap2_iclk_dflt_wait,
1811 .parent = &core_l4_ick, 1810 .parent = &core_l4_ick,
1812 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1811 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1813 .enable_bit = OMAP3430_EN_ICR_SHIFT, 1812 .enable_bit = OMAP3430_EN_ICR_SHIFT,
@@ -1817,7 +1816,7 @@ static struct clk icr_ick = {
1817 1816
1818static struct clk aes2_ick = { 1817static struct clk aes2_ick = {
1819 .name = "aes2_ick", 1818 .name = "aes2_ick",
1820 .ops = &clkops_omap2_dflt_wait, 1819 .ops = &clkops_omap2_iclk_dflt_wait,
1821 .parent = &core_l4_ick, 1820 .parent = &core_l4_ick,
1822 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1821 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1823 .enable_bit = OMAP3430_EN_AES2_SHIFT, 1822 .enable_bit = OMAP3430_EN_AES2_SHIFT,
@@ -1827,7 +1826,7 @@ static struct clk aes2_ick = {
1827 1826
1828static struct clk sha12_ick = { 1827static struct clk sha12_ick = {
1829 .name = "sha12_ick", 1828 .name = "sha12_ick",
1830 .ops = &clkops_omap2_dflt_wait, 1829 .ops = &clkops_omap2_iclk_dflt_wait,
1831 .parent = &core_l4_ick, 1830 .parent = &core_l4_ick,
1832 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1831 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1833 .enable_bit = OMAP3430_EN_SHA12_SHIFT, 1832 .enable_bit = OMAP3430_EN_SHA12_SHIFT,
@@ -1837,7 +1836,7 @@ static struct clk sha12_ick = {
1837 1836
1838static struct clk des2_ick = { 1837static struct clk des2_ick = {
1839 .name = "des2_ick", 1838 .name = "des2_ick",
1840 .ops = &clkops_omap2_dflt_wait, 1839 .ops = &clkops_omap2_iclk_dflt_wait,
1841 .parent = &core_l4_ick, 1840 .parent = &core_l4_ick,
1842 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1841 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1843 .enable_bit = OMAP3430_EN_DES2_SHIFT, 1842 .enable_bit = OMAP3430_EN_DES2_SHIFT,
@@ -1847,7 +1846,7 @@ static struct clk des2_ick = {
1847 1846
1848static struct clk mmchs2_ick = { 1847static struct clk mmchs2_ick = {
1849 .name = "mmchs2_ick", 1848 .name = "mmchs2_ick",
1850 .ops = &clkops_omap2_dflt_wait, 1849 .ops = &clkops_omap2_iclk_dflt_wait,
1851 .parent = &core_l4_ick, 1850 .parent = &core_l4_ick,
1852 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1851 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1853 .enable_bit = OMAP3430_EN_MMC2_SHIFT, 1852 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
@@ -1857,7 +1856,7 @@ static struct clk mmchs2_ick = {
1857 1856
1858static struct clk mmchs1_ick = { 1857static struct clk mmchs1_ick = {
1859 .name = "mmchs1_ick", 1858 .name = "mmchs1_ick",
1860 .ops = &clkops_omap2_dflt_wait, 1859 .ops = &clkops_omap2_iclk_dflt_wait,
1861 .parent = &core_l4_ick, 1860 .parent = &core_l4_ick,
1862 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1861 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1863 .enable_bit = OMAP3430_EN_MMC1_SHIFT, 1862 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
@@ -1867,7 +1866,7 @@ static struct clk mmchs1_ick = {
1867 1866
1868static struct clk mspro_ick = { 1867static struct clk mspro_ick = {
1869 .name = "mspro_ick", 1868 .name = "mspro_ick",
1870 .ops = &clkops_omap2_dflt_wait, 1869 .ops = &clkops_omap2_iclk_dflt_wait,
1871 .parent = &core_l4_ick, 1870 .parent = &core_l4_ick,
1872 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1871 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1873 .enable_bit = OMAP3430_EN_MSPRO_SHIFT, 1872 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
@@ -1877,7 +1876,7 @@ static struct clk mspro_ick = {
1877 1876
1878static struct clk hdq_ick = { 1877static struct clk hdq_ick = {
1879 .name = "hdq_ick", 1878 .name = "hdq_ick",
1880 .ops = &clkops_omap2_dflt_wait, 1879 .ops = &clkops_omap2_iclk_dflt_wait,
1881 .parent = &core_l4_ick, 1880 .parent = &core_l4_ick,
1882 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1881 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1883 .enable_bit = OMAP3430_EN_HDQ_SHIFT, 1882 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
@@ -1887,7 +1886,7 @@ static struct clk hdq_ick = {
1887 1886
1888static struct clk mcspi4_ick = { 1887static struct clk mcspi4_ick = {
1889 .name = "mcspi4_ick", 1888 .name = "mcspi4_ick",
1890 .ops = &clkops_omap2_dflt_wait, 1889 .ops = &clkops_omap2_iclk_dflt_wait,
1891 .parent = &core_l4_ick, 1890 .parent = &core_l4_ick,
1892 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1891 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1893 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT, 1892 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
@@ -1897,7 +1896,7 @@ static struct clk mcspi4_ick = {
1897 1896
1898static struct clk mcspi3_ick = { 1897static struct clk mcspi3_ick = {
1899 .name = "mcspi3_ick", 1898 .name = "mcspi3_ick",
1900 .ops = &clkops_omap2_dflt_wait, 1899 .ops = &clkops_omap2_iclk_dflt_wait,
1901 .parent = &core_l4_ick, 1900 .parent = &core_l4_ick,
1902 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1901 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1903 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT, 1902 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
@@ -1907,7 +1906,7 @@ static struct clk mcspi3_ick = {
1907 1906
1908static struct clk mcspi2_ick = { 1907static struct clk mcspi2_ick = {
1909 .name = "mcspi2_ick", 1908 .name = "mcspi2_ick",
1910 .ops = &clkops_omap2_dflt_wait, 1909 .ops = &clkops_omap2_iclk_dflt_wait,
1911 .parent = &core_l4_ick, 1910 .parent = &core_l4_ick,
1912 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1911 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1913 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT, 1912 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
@@ -1917,7 +1916,7 @@ static struct clk mcspi2_ick = {
1917 1916
1918static struct clk mcspi1_ick = { 1917static struct clk mcspi1_ick = {
1919 .name = "mcspi1_ick", 1918 .name = "mcspi1_ick",
1920 .ops = &clkops_omap2_dflt_wait, 1919 .ops = &clkops_omap2_iclk_dflt_wait,
1921 .parent = &core_l4_ick, 1920 .parent = &core_l4_ick,
1922 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1921 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1923 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT, 1922 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
@@ -1927,7 +1926,7 @@ static struct clk mcspi1_ick = {
1927 1926
1928static struct clk i2c3_ick = { 1927static struct clk i2c3_ick = {
1929 .name = "i2c3_ick", 1928 .name = "i2c3_ick",
1930 .ops = &clkops_omap2_dflt_wait, 1929 .ops = &clkops_omap2_iclk_dflt_wait,
1931 .parent = &core_l4_ick, 1930 .parent = &core_l4_ick,
1932 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1931 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1933 .enable_bit = OMAP3430_EN_I2C3_SHIFT, 1932 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
@@ -1937,7 +1936,7 @@ static struct clk i2c3_ick = {
1937 1936
1938static struct clk i2c2_ick = { 1937static struct clk i2c2_ick = {
1939 .name = "i2c2_ick", 1938 .name = "i2c2_ick",
1940 .ops = &clkops_omap2_dflt_wait, 1939 .ops = &clkops_omap2_iclk_dflt_wait,
1941 .parent = &core_l4_ick, 1940 .parent = &core_l4_ick,
1942 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1941 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1943 .enable_bit = OMAP3430_EN_I2C2_SHIFT, 1942 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
@@ -1947,7 +1946,7 @@ static struct clk i2c2_ick = {
1947 1946
1948static struct clk i2c1_ick = { 1947static struct clk i2c1_ick = {
1949 .name = "i2c1_ick", 1948 .name = "i2c1_ick",
1950 .ops = &clkops_omap2_dflt_wait, 1949 .ops = &clkops_omap2_iclk_dflt_wait,
1951 .parent = &core_l4_ick, 1950 .parent = &core_l4_ick,
1952 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1951 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1953 .enable_bit = OMAP3430_EN_I2C1_SHIFT, 1952 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
@@ -1957,7 +1956,7 @@ static struct clk i2c1_ick = {
1957 1956
1958static struct clk uart2_ick = { 1957static struct clk uart2_ick = {
1959 .name = "uart2_ick", 1958 .name = "uart2_ick",
1960 .ops = &clkops_omap2_dflt_wait, 1959 .ops = &clkops_omap2_iclk_dflt_wait,
1961 .parent = &core_l4_ick, 1960 .parent = &core_l4_ick,
1962 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1961 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1963 .enable_bit = OMAP3430_EN_UART2_SHIFT, 1962 .enable_bit = OMAP3430_EN_UART2_SHIFT,
@@ -1967,7 +1966,7 @@ static struct clk uart2_ick = {
1967 1966
1968static struct clk uart1_ick = { 1967static struct clk uart1_ick = {
1969 .name = "uart1_ick", 1968 .name = "uart1_ick",
1970 .ops = &clkops_omap2_dflt_wait, 1969 .ops = &clkops_omap2_iclk_dflt_wait,
1971 .parent = &core_l4_ick, 1970 .parent = &core_l4_ick,
1972 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1971 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1973 .enable_bit = OMAP3430_EN_UART1_SHIFT, 1972 .enable_bit = OMAP3430_EN_UART1_SHIFT,
@@ -1977,7 +1976,7 @@ static struct clk uart1_ick = {
1977 1976
1978static struct clk gpt11_ick = { 1977static struct clk gpt11_ick = {
1979 .name = "gpt11_ick", 1978 .name = "gpt11_ick",
1980 .ops = &clkops_omap2_dflt_wait, 1979 .ops = &clkops_omap2_iclk_dflt_wait,
1981 .parent = &core_l4_ick, 1980 .parent = &core_l4_ick,
1982 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1981 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1983 .enable_bit = OMAP3430_EN_GPT11_SHIFT, 1982 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
@@ -1987,7 +1986,7 @@ static struct clk gpt11_ick = {
1987 1986
1988static struct clk gpt10_ick = { 1987static struct clk gpt10_ick = {
1989 .name = "gpt10_ick", 1988 .name = "gpt10_ick",
1990 .ops = &clkops_omap2_dflt_wait, 1989 .ops = &clkops_omap2_iclk_dflt_wait,
1991 .parent = &core_l4_ick, 1990 .parent = &core_l4_ick,
1992 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 1991 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1993 .enable_bit = OMAP3430_EN_GPT10_SHIFT, 1992 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
@@ -1997,7 +1996,7 @@ static struct clk gpt10_ick = {
1997 1996
1998static struct clk mcbsp5_ick = { 1997static struct clk mcbsp5_ick = {
1999 .name = "mcbsp5_ick", 1998 .name = "mcbsp5_ick",
2000 .ops = &clkops_omap2_dflt_wait, 1999 .ops = &clkops_omap2_iclk_dflt_wait,
2001 .parent = &core_l4_ick, 2000 .parent = &core_l4_ick,
2002 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2001 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2003 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT, 2002 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
@@ -2007,7 +2006,7 @@ static struct clk mcbsp5_ick = {
2007 2006
2008static struct clk mcbsp1_ick = { 2007static struct clk mcbsp1_ick = {
2009 .name = "mcbsp1_ick", 2008 .name = "mcbsp1_ick",
2010 .ops = &clkops_omap2_dflt_wait, 2009 .ops = &clkops_omap2_iclk_dflt_wait,
2011 .parent = &core_l4_ick, 2010 .parent = &core_l4_ick,
2012 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2011 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2013 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT, 2012 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
@@ -2017,7 +2016,7 @@ static struct clk mcbsp1_ick = {
2017 2016
2018static struct clk fac_ick = { 2017static struct clk fac_ick = {
2019 .name = "fac_ick", 2018 .name = "fac_ick",
2020 .ops = &clkops_omap2_dflt_wait, 2019 .ops = &clkops_omap2_iclk_dflt_wait,
2021 .parent = &core_l4_ick, 2020 .parent = &core_l4_ick,
2022 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2021 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2023 .enable_bit = OMAP3430ES1_EN_FAC_SHIFT, 2022 .enable_bit = OMAP3430ES1_EN_FAC_SHIFT,
@@ -2027,7 +2026,7 @@ static struct clk fac_ick = {
2027 2026
2028static struct clk mailboxes_ick = { 2027static struct clk mailboxes_ick = {
2029 .name = "mailboxes_ick", 2028 .name = "mailboxes_ick",
2030 .ops = &clkops_omap2_dflt_wait, 2029 .ops = &clkops_omap2_iclk_dflt_wait,
2031 .parent = &core_l4_ick, 2030 .parent = &core_l4_ick,
2032 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2031 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2033 .enable_bit = OMAP3430_EN_MAILBOXES_SHIFT, 2032 .enable_bit = OMAP3430_EN_MAILBOXES_SHIFT,
@@ -2037,7 +2036,7 @@ static struct clk mailboxes_ick = {
2037 2036
2038static struct clk omapctrl_ick = { 2037static struct clk omapctrl_ick = {
2039 .name = "omapctrl_ick", 2038 .name = "omapctrl_ick",
2040 .ops = &clkops_omap2_dflt_wait, 2039 .ops = &clkops_omap2_iclk_dflt_wait,
2041 .parent = &core_l4_ick, 2040 .parent = &core_l4_ick,
2042 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2041 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2043 .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT, 2042 .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT,
@@ -2057,7 +2056,7 @@ static struct clk ssi_l4_ick = {
2057 2056
2058static struct clk ssi_ick_3430es1 = { 2057static struct clk ssi_ick_3430es1 = {
2059 .name = "ssi_ick", 2058 .name = "ssi_ick",
2060 .ops = &clkops_omap2_dflt, 2059 .ops = &clkops_omap2_iclk_dflt,
2061 .parent = &ssi_l4_ick, 2060 .parent = &ssi_l4_ick,
2062 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2061 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2063 .enable_bit = OMAP3430_EN_SSI_SHIFT, 2062 .enable_bit = OMAP3430_EN_SSI_SHIFT,
@@ -2067,7 +2066,7 @@ static struct clk ssi_ick_3430es1 = {
2067 2066
2068static struct clk ssi_ick_3430es2 = { 2067static struct clk ssi_ick_3430es2 = {
2069 .name = "ssi_ick", 2068 .name = "ssi_ick",
2070 .ops = &clkops_omap3430es2_ssi_wait, 2069 .ops = &clkops_omap3430es2_iclk_ssi_wait,
2071 .parent = &ssi_l4_ick, 2070 .parent = &ssi_l4_ick,
2072 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2071 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2073 .enable_bit = OMAP3430_EN_SSI_SHIFT, 2072 .enable_bit = OMAP3430_EN_SSI_SHIFT,
@@ -2085,7 +2084,7 @@ static const struct clksel usb_l4_clksel[] = {
2085 2084
2086static struct clk usb_l4_ick = { 2085static struct clk usb_l4_ick = {
2087 .name = "usb_l4_ick", 2086 .name = "usb_l4_ick",
2088 .ops = &clkops_omap2_dflt_wait, 2087 .ops = &clkops_omap2_iclk_dflt_wait,
2089 .parent = &l4_ick, 2088 .parent = &l4_ick,
2090 .init = &omap2_init_clksel_parent, 2089 .init = &omap2_init_clksel_parent,
2091 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2090 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
@@ -2107,7 +2106,7 @@ static struct clk security_l4_ick2 = {
2107 2106
2108static struct clk aes1_ick = { 2107static struct clk aes1_ick = {
2109 .name = "aes1_ick", 2108 .name = "aes1_ick",
2110 .ops = &clkops_omap2_dflt_wait, 2109 .ops = &clkops_omap2_iclk_dflt_wait,
2111 .parent = &security_l4_ick2, 2110 .parent = &security_l4_ick2,
2112 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 2111 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2113 .enable_bit = OMAP3430_EN_AES1_SHIFT, 2112 .enable_bit = OMAP3430_EN_AES1_SHIFT,
@@ -2116,7 +2115,7 @@ static struct clk aes1_ick = {
2116 2115
2117static struct clk rng_ick = { 2116static struct clk rng_ick = {
2118 .name = "rng_ick", 2117 .name = "rng_ick",
2119 .ops = &clkops_omap2_dflt_wait, 2118 .ops = &clkops_omap2_iclk_dflt_wait,
2120 .parent = &security_l4_ick2, 2119 .parent = &security_l4_ick2,
2121 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 2120 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2122 .enable_bit = OMAP3430_EN_RNG_SHIFT, 2121 .enable_bit = OMAP3430_EN_RNG_SHIFT,
@@ -2125,7 +2124,7 @@ static struct clk rng_ick = {
2125 2124
2126static struct clk sha11_ick = { 2125static struct clk sha11_ick = {
2127 .name = "sha11_ick", 2126 .name = "sha11_ick",
2128 .ops = &clkops_omap2_dflt_wait, 2127 .ops = &clkops_omap2_iclk_dflt_wait,
2129 .parent = &security_l4_ick2, 2128 .parent = &security_l4_ick2,
2130 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 2129 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2131 .enable_bit = OMAP3430_EN_SHA11_SHIFT, 2130 .enable_bit = OMAP3430_EN_SHA11_SHIFT,
@@ -2134,7 +2133,7 @@ static struct clk sha11_ick = {
2134 2133
2135static struct clk des1_ick = { 2134static struct clk des1_ick = {
2136 .name = "des1_ick", 2135 .name = "des1_ick",
2137 .ops = &clkops_omap2_dflt_wait, 2136 .ops = &clkops_omap2_iclk_dflt_wait,
2138 .parent = &security_l4_ick2, 2137 .parent = &security_l4_ick2,
2139 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), 2138 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2140 .enable_bit = OMAP3430_EN_DES1_SHIFT, 2139 .enable_bit = OMAP3430_EN_DES1_SHIFT,
@@ -2195,7 +2194,7 @@ static struct clk dss2_alwon_fck = {
2195static struct clk dss_ick_3430es1 = { 2194static struct clk dss_ick_3430es1 = {
2196 /* Handles both L3 and L4 clocks */ 2195 /* Handles both L3 and L4 clocks */
2197 .name = "dss_ick", 2196 .name = "dss_ick",
2198 .ops = &clkops_omap2_dflt, 2197 .ops = &clkops_omap2_iclk_dflt,
2199 .parent = &l4_ick, 2198 .parent = &l4_ick,
2200 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN), 2199 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
2201 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT, 2200 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
@@ -2206,7 +2205,7 @@ static struct clk dss_ick_3430es1 = {
2206static struct clk dss_ick_3430es2 = { 2205static struct clk dss_ick_3430es2 = {
2207 /* Handles both L3 and L4 clocks */ 2206 /* Handles both L3 and L4 clocks */
2208 .name = "dss_ick", 2207 .name = "dss_ick",
2209 .ops = &clkops_omap3430es2_dss_usbhost_wait, 2208 .ops = &clkops_omap3430es2_iclk_dss_usbhost_wait,
2210 .parent = &l4_ick, 2209 .parent = &l4_ick,
2211 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN), 2210 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
2212 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT, 2211 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
@@ -2229,7 +2228,7 @@ static struct clk cam_mclk = {
2229static struct clk cam_ick = { 2228static struct clk cam_ick = {
2230 /* Handles both L3 and L4 clocks */ 2229 /* Handles both L3 and L4 clocks */
2231 .name = "cam_ick", 2230 .name = "cam_ick",
2232 .ops = &clkops_omap2_dflt, 2231 .ops = &clkops_omap2_iclk_dflt,
2233 .parent = &l4_ick, 2232 .parent = &l4_ick,
2234 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN), 2233 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN),
2235 .enable_bit = OMAP3430_EN_CAM_SHIFT, 2234 .enable_bit = OMAP3430_EN_CAM_SHIFT,
@@ -2272,7 +2271,7 @@ static struct clk usbhost_48m_fck = {
2272static struct clk usbhost_ick = { 2271static struct clk usbhost_ick = {
2273 /* Handles both L3 and L4 clocks */ 2272 /* Handles both L3 and L4 clocks */
2274 .name = "usbhost_ick", 2273 .name = "usbhost_ick",
2275 .ops = &clkops_omap3430es2_dss_usbhost_wait, 2274 .ops = &clkops_omap3430es2_iclk_dss_usbhost_wait,
2276 .parent = &l4_ick, 2275 .parent = &l4_ick,
2277 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN), 2276 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN),
2278 .enable_bit = OMAP3430ES2_EN_USBHOST_SHIFT, 2277 .enable_bit = OMAP3430ES2_EN_USBHOST_SHIFT,
@@ -2372,7 +2371,7 @@ static struct clk wkup_l4_ick = {
2372/* Never specifically named in the TRM, so we have to infer a likely name */ 2371/* Never specifically named in the TRM, so we have to infer a likely name */
2373static struct clk usim_ick = { 2372static struct clk usim_ick = {
2374 .name = "usim_ick", 2373 .name = "usim_ick",
2375 .ops = &clkops_omap2_dflt_wait, 2374 .ops = &clkops_omap2_iclk_dflt_wait,
2376 .parent = &wkup_l4_ick, 2375 .parent = &wkup_l4_ick,
2377 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 2376 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2378 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT, 2377 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
@@ -2382,7 +2381,7 @@ static struct clk usim_ick = {
2382 2381
2383static struct clk wdt2_ick = { 2382static struct clk wdt2_ick = {
2384 .name = "wdt2_ick", 2383 .name = "wdt2_ick",
2385 .ops = &clkops_omap2_dflt_wait, 2384 .ops = &clkops_omap2_iclk_dflt_wait,
2386 .parent = &wkup_l4_ick, 2385 .parent = &wkup_l4_ick,
2387 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 2386 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2388 .enable_bit = OMAP3430_EN_WDT2_SHIFT, 2387 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
@@ -2392,7 +2391,7 @@ static struct clk wdt2_ick = {
2392 2391
2393static struct clk wdt1_ick = { 2392static struct clk wdt1_ick = {
2394 .name = "wdt1_ick", 2393 .name = "wdt1_ick",
2395 .ops = &clkops_omap2_dflt_wait, 2394 .ops = &clkops_omap2_iclk_dflt_wait,
2396 .parent = &wkup_l4_ick, 2395 .parent = &wkup_l4_ick,
2397 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 2396 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2398 .enable_bit = OMAP3430_EN_WDT1_SHIFT, 2397 .enable_bit = OMAP3430_EN_WDT1_SHIFT,
@@ -2402,7 +2401,7 @@ static struct clk wdt1_ick = {
2402 2401
2403static struct clk gpio1_ick = { 2402static struct clk gpio1_ick = {
2404 .name = "gpio1_ick", 2403 .name = "gpio1_ick",
2405 .ops = &clkops_omap2_dflt_wait, 2404 .ops = &clkops_omap2_iclk_dflt_wait,
2406 .parent = &wkup_l4_ick, 2405 .parent = &wkup_l4_ick,
2407 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 2406 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2408 .enable_bit = OMAP3430_EN_GPIO1_SHIFT, 2407 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
@@ -2412,7 +2411,7 @@ static struct clk gpio1_ick = {
2412 2411
2413static struct clk omap_32ksync_ick = { 2412static struct clk omap_32ksync_ick = {
2414 .name = "omap_32ksync_ick", 2413 .name = "omap_32ksync_ick",
2415 .ops = &clkops_omap2_dflt_wait, 2414 .ops = &clkops_omap2_iclk_dflt_wait,
2416 .parent = &wkup_l4_ick, 2415 .parent = &wkup_l4_ick,
2417 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 2416 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2418 .enable_bit = OMAP3430_EN_32KSYNC_SHIFT, 2417 .enable_bit = OMAP3430_EN_32KSYNC_SHIFT,
@@ -2423,7 +2422,7 @@ static struct clk omap_32ksync_ick = {
2423/* XXX This clock no longer exists in 3430 TRM rev F */ 2422/* XXX This clock no longer exists in 3430 TRM rev F */
2424static struct clk gpt12_ick = { 2423static struct clk gpt12_ick = {
2425 .name = "gpt12_ick", 2424 .name = "gpt12_ick",
2426 .ops = &clkops_omap2_dflt_wait, 2425 .ops = &clkops_omap2_iclk_dflt_wait,
2427 .parent = &wkup_l4_ick, 2426 .parent = &wkup_l4_ick,
2428 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 2427 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2429 .enable_bit = OMAP3430_EN_GPT12_SHIFT, 2428 .enable_bit = OMAP3430_EN_GPT12_SHIFT,
@@ -2433,7 +2432,7 @@ static struct clk gpt12_ick = {
2433 2432
2434static struct clk gpt1_ick = { 2433static struct clk gpt1_ick = {
2435 .name = "gpt1_ick", 2434 .name = "gpt1_ick",
2436 .ops = &clkops_omap2_dflt_wait, 2435 .ops = &clkops_omap2_iclk_dflt_wait,
2437 .parent = &wkup_l4_ick, 2436 .parent = &wkup_l4_ick,
2438 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), 2437 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2439 .enable_bit = OMAP3430_EN_GPT1_SHIFT, 2438 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
@@ -2663,7 +2662,7 @@ static struct clk per_l4_ick = {
2663 2662
2664static struct clk gpio6_ick = { 2663static struct clk gpio6_ick = {
2665 .name = "gpio6_ick", 2664 .name = "gpio6_ick",
2666 .ops = &clkops_omap2_dflt_wait, 2665 .ops = &clkops_omap2_iclk_dflt_wait,
2667 .parent = &per_l4_ick, 2666 .parent = &per_l4_ick,
2668 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2667 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2669 .enable_bit = OMAP3430_EN_GPIO6_SHIFT, 2668 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
@@ -2673,7 +2672,7 @@ static struct clk gpio6_ick = {
2673 2672
2674static struct clk gpio5_ick = { 2673static struct clk gpio5_ick = {
2675 .name = "gpio5_ick", 2674 .name = "gpio5_ick",
2676 .ops = &clkops_omap2_dflt_wait, 2675 .ops = &clkops_omap2_iclk_dflt_wait,
2677 .parent = &per_l4_ick, 2676 .parent = &per_l4_ick,
2678 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2677 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2679 .enable_bit = OMAP3430_EN_GPIO5_SHIFT, 2678 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
@@ -2683,7 +2682,7 @@ static struct clk gpio5_ick = {
2683 2682
2684static struct clk gpio4_ick = { 2683static struct clk gpio4_ick = {
2685 .name = "gpio4_ick", 2684 .name = "gpio4_ick",
2686 .ops = &clkops_omap2_dflt_wait, 2685 .ops = &clkops_omap2_iclk_dflt_wait,
2687 .parent = &per_l4_ick, 2686 .parent = &per_l4_ick,
2688 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2687 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2689 .enable_bit = OMAP3430_EN_GPIO4_SHIFT, 2688 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
@@ -2693,7 +2692,7 @@ static struct clk gpio4_ick = {
2693 2692
2694static struct clk gpio3_ick = { 2693static struct clk gpio3_ick = {
2695 .name = "gpio3_ick", 2694 .name = "gpio3_ick",
2696 .ops = &clkops_omap2_dflt_wait, 2695 .ops = &clkops_omap2_iclk_dflt_wait,
2697 .parent = &per_l4_ick, 2696 .parent = &per_l4_ick,
2698 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2697 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2699 .enable_bit = OMAP3430_EN_GPIO3_SHIFT, 2698 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
@@ -2703,7 +2702,7 @@ static struct clk gpio3_ick = {
2703 2702
2704static struct clk gpio2_ick = { 2703static struct clk gpio2_ick = {
2705 .name = "gpio2_ick", 2704 .name = "gpio2_ick",
2706 .ops = &clkops_omap2_dflt_wait, 2705 .ops = &clkops_omap2_iclk_dflt_wait,
2707 .parent = &per_l4_ick, 2706 .parent = &per_l4_ick,
2708 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2707 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2709 .enable_bit = OMAP3430_EN_GPIO2_SHIFT, 2708 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
@@ -2713,7 +2712,7 @@ static struct clk gpio2_ick = {
2713 2712
2714static struct clk wdt3_ick = { 2713static struct clk wdt3_ick = {
2715 .name = "wdt3_ick", 2714 .name = "wdt3_ick",
2716 .ops = &clkops_omap2_dflt_wait, 2715 .ops = &clkops_omap2_iclk_dflt_wait,
2717 .parent = &per_l4_ick, 2716 .parent = &per_l4_ick,
2718 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2717 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2719 .enable_bit = OMAP3430_EN_WDT3_SHIFT, 2718 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
@@ -2723,7 +2722,7 @@ static struct clk wdt3_ick = {
2723 2722
2724static struct clk uart3_ick = { 2723static struct clk uart3_ick = {
2725 .name = "uart3_ick", 2724 .name = "uart3_ick",
2726 .ops = &clkops_omap2_dflt_wait, 2725 .ops = &clkops_omap2_iclk_dflt_wait,
2727 .parent = &per_l4_ick, 2726 .parent = &per_l4_ick,
2728 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2727 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2729 .enable_bit = OMAP3430_EN_UART3_SHIFT, 2728 .enable_bit = OMAP3430_EN_UART3_SHIFT,
@@ -2733,7 +2732,7 @@ static struct clk uart3_ick = {
2733 2732
2734static struct clk uart4_ick = { 2733static struct clk uart4_ick = {
2735 .name = "uart4_ick", 2734 .name = "uart4_ick",
2736 .ops = &clkops_omap2_dflt_wait, 2735 .ops = &clkops_omap2_iclk_dflt_wait,
2737 .parent = &per_l4_ick, 2736 .parent = &per_l4_ick,
2738 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2737 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2739 .enable_bit = OMAP3630_EN_UART4_SHIFT, 2738 .enable_bit = OMAP3630_EN_UART4_SHIFT,
@@ -2743,7 +2742,7 @@ static struct clk uart4_ick = {
2743 2742
2744static struct clk gpt9_ick = { 2743static struct clk gpt9_ick = {
2745 .name = "gpt9_ick", 2744 .name = "gpt9_ick",
2746 .ops = &clkops_omap2_dflt_wait, 2745 .ops = &clkops_omap2_iclk_dflt_wait,
2747 .parent = &per_l4_ick, 2746 .parent = &per_l4_ick,
2748 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2747 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2749 .enable_bit = OMAP3430_EN_GPT9_SHIFT, 2748 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
@@ -2753,7 +2752,7 @@ static struct clk gpt9_ick = {
2753 2752
2754static struct clk gpt8_ick = { 2753static struct clk gpt8_ick = {
2755 .name = "gpt8_ick", 2754 .name = "gpt8_ick",
2756 .ops = &clkops_omap2_dflt_wait, 2755 .ops = &clkops_omap2_iclk_dflt_wait,
2757 .parent = &per_l4_ick, 2756 .parent = &per_l4_ick,
2758 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2757 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2759 .enable_bit = OMAP3430_EN_GPT8_SHIFT, 2758 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
@@ -2763,7 +2762,7 @@ static struct clk gpt8_ick = {
2763 2762
2764static struct clk gpt7_ick = { 2763static struct clk gpt7_ick = {
2765 .name = "gpt7_ick", 2764 .name = "gpt7_ick",
2766 .ops = &clkops_omap2_dflt_wait, 2765 .ops = &clkops_omap2_iclk_dflt_wait,
2767 .parent = &per_l4_ick, 2766 .parent = &per_l4_ick,
2768 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2767 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2769 .enable_bit = OMAP3430_EN_GPT7_SHIFT, 2768 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
@@ -2773,7 +2772,7 @@ static struct clk gpt7_ick = {
2773 2772
2774static struct clk gpt6_ick = { 2773static struct clk gpt6_ick = {
2775 .name = "gpt6_ick", 2774 .name = "gpt6_ick",
2776 .ops = &clkops_omap2_dflt_wait, 2775 .ops = &clkops_omap2_iclk_dflt_wait,
2777 .parent = &per_l4_ick, 2776 .parent = &per_l4_ick,
2778 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2777 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2779 .enable_bit = OMAP3430_EN_GPT6_SHIFT, 2778 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
@@ -2783,7 +2782,7 @@ static struct clk gpt6_ick = {
2783 2782
2784static struct clk gpt5_ick = { 2783static struct clk gpt5_ick = {
2785 .name = "gpt5_ick", 2784 .name = "gpt5_ick",
2786 .ops = &clkops_omap2_dflt_wait, 2785 .ops = &clkops_omap2_iclk_dflt_wait,
2787 .parent = &per_l4_ick, 2786 .parent = &per_l4_ick,
2788 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2787 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2789 .enable_bit = OMAP3430_EN_GPT5_SHIFT, 2788 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
@@ -2793,7 +2792,7 @@ static struct clk gpt5_ick = {
2793 2792
2794static struct clk gpt4_ick = { 2793static struct clk gpt4_ick = {
2795 .name = "gpt4_ick", 2794 .name = "gpt4_ick",
2796 .ops = &clkops_omap2_dflt_wait, 2795 .ops = &clkops_omap2_iclk_dflt_wait,
2797 .parent = &per_l4_ick, 2796 .parent = &per_l4_ick,
2798 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2797 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2799 .enable_bit = OMAP3430_EN_GPT4_SHIFT, 2798 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
@@ -2803,7 +2802,7 @@ static struct clk gpt4_ick = {
2803 2802
2804static struct clk gpt3_ick = { 2803static struct clk gpt3_ick = {
2805 .name = "gpt3_ick", 2804 .name = "gpt3_ick",
2806 .ops = &clkops_omap2_dflt_wait, 2805 .ops = &clkops_omap2_iclk_dflt_wait,
2807 .parent = &per_l4_ick, 2806 .parent = &per_l4_ick,
2808 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2807 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2809 .enable_bit = OMAP3430_EN_GPT3_SHIFT, 2808 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
@@ -2813,7 +2812,7 @@ static struct clk gpt3_ick = {
2813 2812
2814static struct clk gpt2_ick = { 2813static struct clk gpt2_ick = {
2815 .name = "gpt2_ick", 2814 .name = "gpt2_ick",
2816 .ops = &clkops_omap2_dflt_wait, 2815 .ops = &clkops_omap2_iclk_dflt_wait,
2817 .parent = &per_l4_ick, 2816 .parent = &per_l4_ick,
2818 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2817 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2819 .enable_bit = OMAP3430_EN_GPT2_SHIFT, 2818 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
@@ -2823,7 +2822,7 @@ static struct clk gpt2_ick = {
2823 2822
2824static struct clk mcbsp2_ick = { 2823static struct clk mcbsp2_ick = {
2825 .name = "mcbsp2_ick", 2824 .name = "mcbsp2_ick",
2826 .ops = &clkops_omap2_dflt_wait, 2825 .ops = &clkops_omap2_iclk_dflt_wait,
2827 .parent = &per_l4_ick, 2826 .parent = &per_l4_ick,
2828 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2827 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2829 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT, 2828 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
@@ -2833,7 +2832,7 @@ static struct clk mcbsp2_ick = {
2833 2832
2834static struct clk mcbsp3_ick = { 2833static struct clk mcbsp3_ick = {
2835 .name = "mcbsp3_ick", 2834 .name = "mcbsp3_ick",
2836 .ops = &clkops_omap2_dflt_wait, 2835 .ops = &clkops_omap2_iclk_dflt_wait,
2837 .parent = &per_l4_ick, 2836 .parent = &per_l4_ick,
2838 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2837 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2839 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT, 2838 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
@@ -2843,7 +2842,7 @@ static struct clk mcbsp3_ick = {
2843 2842
2844static struct clk mcbsp4_ick = { 2843static struct clk mcbsp4_ick = {
2845 .name = "mcbsp4_ick", 2844 .name = "mcbsp4_ick",
2846 .ops = &clkops_omap2_dflt_wait, 2845 .ops = &clkops_omap2_iclk_dflt_wait,
2847 .parent = &per_l4_ick, 2846 .parent = &per_l4_ick,
2848 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN), 2847 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2849 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT, 2848 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
@@ -3186,7 +3185,7 @@ static struct clk vpfe_fck = {
3186 */ 3185 */
3187static struct clk uart4_ick_am35xx = { 3186static struct clk uart4_ick_am35xx = {
3188 .name = "uart4_ick", 3187 .name = "uart4_ick",
3189 .ops = &clkops_omap2_dflt_wait, 3188 .ops = &clkops_omap2_iclk_dflt_wait,
3190 .parent = &core_l4_ick, 3189 .parent = &core_l4_ick,
3191 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 3190 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
3192 .enable_bit = AM35XX_EN_UART4_SHIFT, 3191 .enable_bit = AM35XX_EN_UART4_SHIFT,
@@ -3538,6 +3537,9 @@ int __init omap3xxx_clk_init(void)
3538 omap2_init_clk_clkdm(c->lk.clk); 3537 omap2_init_clk_clkdm(c->lk.clk);
3539 } 3538 }
3540 3539
3540 /* Disable autoidle on all clocks; let the PM code enable it later */
3541 omap_clk_disable_autoidle_all();
3542
3541 recalculate_root_clocks(); 3543 recalculate_root_clocks();
3542 3544
3543 pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n", 3545 pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n",
@@ -3551,7 +3553,8 @@ int __init omap3xxx_clk_init(void)
3551 clk_enable_init_clocks(); 3553 clk_enable_init_clocks();
3552 3554
3553 /* 3555 /*
3554 * Lock DPLL5 and put it in autoidle. 3556 * Lock DPLL5 -- here only until other device init code can
3557 * handle this
3555 */ 3558 */
3556 if (!cpu_is_ti816x() && (omap_rev() >= OMAP3430_REV_ES2_0)) 3559 if (!cpu_is_ti816x() && (omap_rev() >= OMAP3430_REV_ES2_0))
3557 omap3_clk_lock_dpll5(); 3560 omap3_clk_lock_dpll5();
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index fdbc0426b6f4..f1fedb71ae08 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -278,8 +278,10 @@ static struct clk dpll_abe_ck = {
278static struct clk dpll_abe_x2_ck = { 278static struct clk dpll_abe_x2_ck = {
279 .name = "dpll_abe_x2_ck", 279 .name = "dpll_abe_x2_ck",
280 .parent = &dpll_abe_ck, 280 .parent = &dpll_abe_ck,
281 .ops = &clkops_null, 281 .flags = CLOCK_CLKOUTX2,
282 .ops = &clkops_omap4_dpllmx_ops,
282 .recalc = &omap3_clkoutx2_recalc, 283 .recalc = &omap3_clkoutx2_recalc,
284 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
283}; 285};
284 286
285static const struct clksel_rate div31_1to31_rates[] = { 287static const struct clksel_rate div31_1to31_rates[] = {
@@ -328,7 +330,7 @@ static struct clk dpll_abe_m2x2_ck = {
328 .clksel = dpll_abe_m2x2_div, 330 .clksel = dpll_abe_m2x2_div,
329 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE, 331 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
330 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK, 332 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
331 .ops = &clkops_null, 333 .ops = &clkops_omap4_dpllmx_ops,
332 .recalc = &omap2_clksel_recalc, 334 .recalc = &omap2_clksel_recalc,
333 .round_rate = &omap2_clksel_round_rate, 335 .round_rate = &omap2_clksel_round_rate,
334 .set_rate = &omap2_clksel_set_rate, 336 .set_rate = &omap2_clksel_set_rate,
@@ -395,7 +397,7 @@ static struct clk dpll_abe_m3x2_ck = {
395 .clksel = dpll_abe_m2x2_div, 397 .clksel = dpll_abe_m2x2_div,
396 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_ABE, 398 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_ABE,
397 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK, 399 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
398 .ops = &clkops_null, 400 .ops = &clkops_omap4_dpllmx_ops,
399 .recalc = &omap2_clksel_recalc, 401 .recalc = &omap2_clksel_recalc,
400 .round_rate = &omap2_clksel_round_rate, 402 .round_rate = &omap2_clksel_round_rate,
401 .set_rate = &omap2_clksel_set_rate, 403 .set_rate = &omap2_clksel_set_rate,
@@ -443,13 +445,14 @@ static struct clk dpll_core_ck = {
443 .parent = &sys_clkin_ck, 445 .parent = &sys_clkin_ck,
444 .dpll_data = &dpll_core_dd, 446 .dpll_data = &dpll_core_dd,
445 .init = &omap2_init_dpll_parent, 447 .init = &omap2_init_dpll_parent,
446 .ops = &clkops_null, 448 .ops = &clkops_omap3_core_dpll_ops,
447 .recalc = &omap3_dpll_recalc, 449 .recalc = &omap3_dpll_recalc,
448}; 450};
449 451
450static struct clk dpll_core_x2_ck = { 452static struct clk dpll_core_x2_ck = {
451 .name = "dpll_core_x2_ck", 453 .name = "dpll_core_x2_ck",
452 .parent = &dpll_core_ck, 454 .parent = &dpll_core_ck,
455 .flags = CLOCK_CLKOUTX2,
453 .ops = &clkops_null, 456 .ops = &clkops_null,
454 .recalc = &omap3_clkoutx2_recalc, 457 .recalc = &omap3_clkoutx2_recalc,
455}; 458};
@@ -465,7 +468,7 @@ static struct clk dpll_core_m6x2_ck = {
465 .clksel = dpll_core_m6x2_div, 468 .clksel = dpll_core_m6x2_div,
466 .clksel_reg = OMAP4430_CM_DIV_M6_DPLL_CORE, 469 .clksel_reg = OMAP4430_CM_DIV_M6_DPLL_CORE,
467 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK, 470 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK,
468 .ops = &clkops_null, 471 .ops = &clkops_omap4_dpllmx_ops,
469 .recalc = &omap2_clksel_recalc, 472 .recalc = &omap2_clksel_recalc,
470 .round_rate = &omap2_clksel_round_rate, 473 .round_rate = &omap2_clksel_round_rate,
471 .set_rate = &omap2_clksel_set_rate, 474 .set_rate = &omap2_clksel_set_rate,
@@ -495,7 +498,7 @@ static struct clk dpll_core_m2_ck = {
495 .clksel = dpll_core_m2_div, 498 .clksel = dpll_core_m2_div,
496 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_CORE, 499 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_CORE,
497 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK, 500 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
498 .ops = &clkops_null, 501 .ops = &clkops_omap4_dpllmx_ops,
499 .recalc = &omap2_clksel_recalc, 502 .recalc = &omap2_clksel_recalc,
500 .round_rate = &omap2_clksel_round_rate, 503 .round_rate = &omap2_clksel_round_rate,
501 .set_rate = &omap2_clksel_set_rate, 504 .set_rate = &omap2_clksel_set_rate,
@@ -515,7 +518,7 @@ static struct clk dpll_core_m5x2_ck = {
515 .clksel = dpll_core_m6x2_div, 518 .clksel = dpll_core_m6x2_div,
516 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_CORE, 519 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_CORE,
517 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK, 520 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
518 .ops = &clkops_null, 521 .ops = &clkops_omap4_dpllmx_ops,
519 .recalc = &omap2_clksel_recalc, 522 .recalc = &omap2_clksel_recalc,
520 .round_rate = &omap2_clksel_round_rate, 523 .round_rate = &omap2_clksel_round_rate,
521 .set_rate = &omap2_clksel_set_rate, 524 .set_rate = &omap2_clksel_set_rate,
@@ -581,7 +584,7 @@ static struct clk dpll_core_m4x2_ck = {
581 .clksel = dpll_core_m6x2_div, 584 .clksel = dpll_core_m6x2_div,
582 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_CORE, 585 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_CORE,
583 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK, 586 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
584 .ops = &clkops_null, 587 .ops = &clkops_omap4_dpllmx_ops,
585 .recalc = &omap2_clksel_recalc, 588 .recalc = &omap2_clksel_recalc,
586 .round_rate = &omap2_clksel_round_rate, 589 .round_rate = &omap2_clksel_round_rate,
587 .set_rate = &omap2_clksel_set_rate, 590 .set_rate = &omap2_clksel_set_rate,
@@ -606,7 +609,7 @@ static struct clk dpll_abe_m2_ck = {
606 .clksel = dpll_abe_m2_div, 609 .clksel = dpll_abe_m2_div,
607 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE, 610 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
608 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK, 611 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
609 .ops = &clkops_null, 612 .ops = &clkops_omap4_dpllmx_ops,
610 .recalc = &omap2_clksel_recalc, 613 .recalc = &omap2_clksel_recalc,
611 .round_rate = &omap2_clksel_round_rate, 614 .round_rate = &omap2_clksel_round_rate,
612 .set_rate = &omap2_clksel_set_rate, 615 .set_rate = &omap2_clksel_set_rate,
@@ -632,7 +635,7 @@ static struct clk dpll_core_m7x2_ck = {
632 .clksel = dpll_core_m6x2_div, 635 .clksel = dpll_core_m6x2_div,
633 .clksel_reg = OMAP4430_CM_DIV_M7_DPLL_CORE, 636 .clksel_reg = OMAP4430_CM_DIV_M7_DPLL_CORE,
634 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK, 637 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK,
635 .ops = &clkops_null, 638 .ops = &clkops_omap4_dpllmx_ops,
636 .recalc = &omap2_clksel_recalc, 639 .recalc = &omap2_clksel_recalc,
637 .round_rate = &omap2_clksel_round_rate, 640 .round_rate = &omap2_clksel_round_rate,
638 .set_rate = &omap2_clksel_set_rate, 641 .set_rate = &omap2_clksel_set_rate,
@@ -689,6 +692,7 @@ static struct clk dpll_iva_ck = {
689static struct clk dpll_iva_x2_ck = { 692static struct clk dpll_iva_x2_ck = {
690 .name = "dpll_iva_x2_ck", 693 .name = "dpll_iva_x2_ck",
691 .parent = &dpll_iva_ck, 694 .parent = &dpll_iva_ck,
695 .flags = CLOCK_CLKOUTX2,
692 .ops = &clkops_null, 696 .ops = &clkops_null,
693 .recalc = &omap3_clkoutx2_recalc, 697 .recalc = &omap3_clkoutx2_recalc,
694}; 698};
@@ -704,7 +708,7 @@ static struct clk dpll_iva_m4x2_ck = {
704 .clksel = dpll_iva_m4x2_div, 708 .clksel = dpll_iva_m4x2_div,
705 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_IVA, 709 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_IVA,
706 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK, 710 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
707 .ops = &clkops_null, 711 .ops = &clkops_omap4_dpllmx_ops,
708 .recalc = &omap2_clksel_recalc, 712 .recalc = &omap2_clksel_recalc,
709 .round_rate = &omap2_clksel_round_rate, 713 .round_rate = &omap2_clksel_round_rate,
710 .set_rate = &omap2_clksel_set_rate, 714 .set_rate = &omap2_clksel_set_rate,
@@ -716,7 +720,7 @@ static struct clk dpll_iva_m5x2_ck = {
716 .clksel = dpll_iva_m4x2_div, 720 .clksel = dpll_iva_m4x2_div,
717 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_IVA, 721 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_IVA,
718 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK, 722 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
719 .ops = &clkops_null, 723 .ops = &clkops_omap4_dpllmx_ops,
720 .recalc = &omap2_clksel_recalc, 724 .recalc = &omap2_clksel_recalc,
721 .round_rate = &omap2_clksel_round_rate, 725 .round_rate = &omap2_clksel_round_rate,
722 .set_rate = &omap2_clksel_set_rate, 726 .set_rate = &omap2_clksel_set_rate,
@@ -764,7 +768,7 @@ static struct clk dpll_mpu_m2_ck = {
764 .clksel = dpll_mpu_m2_div, 768 .clksel = dpll_mpu_m2_div,
765 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_MPU, 769 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_MPU,
766 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK, 770 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
767 .ops = &clkops_null, 771 .ops = &clkops_omap4_dpllmx_ops,
768 .recalc = &omap2_clksel_recalc, 772 .recalc = &omap2_clksel_recalc,
769 .round_rate = &omap2_clksel_round_rate, 773 .round_rate = &omap2_clksel_round_rate,
770 .set_rate = &omap2_clksel_set_rate, 774 .set_rate = &omap2_clksel_set_rate,
@@ -837,7 +841,7 @@ static struct clk dpll_per_m2_ck = {
837 .clksel = dpll_per_m2_div, 841 .clksel = dpll_per_m2_div,
838 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER, 842 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
839 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK, 843 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
840 .ops = &clkops_null, 844 .ops = &clkops_omap4_dpllmx_ops,
841 .recalc = &omap2_clksel_recalc, 845 .recalc = &omap2_clksel_recalc,
842 .round_rate = &omap2_clksel_round_rate, 846 .round_rate = &omap2_clksel_round_rate,
843 .set_rate = &omap2_clksel_set_rate, 847 .set_rate = &omap2_clksel_set_rate,
@@ -846,8 +850,10 @@ static struct clk dpll_per_m2_ck = {
846static struct clk dpll_per_x2_ck = { 850static struct clk dpll_per_x2_ck = {
847 .name = "dpll_per_x2_ck", 851 .name = "dpll_per_x2_ck",
848 .parent = &dpll_per_ck, 852 .parent = &dpll_per_ck,
849 .ops = &clkops_null, 853 .flags = CLOCK_CLKOUTX2,
854 .ops = &clkops_omap4_dpllmx_ops,
850 .recalc = &omap3_clkoutx2_recalc, 855 .recalc = &omap3_clkoutx2_recalc,
856 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
851}; 857};
852 858
853static const struct clksel dpll_per_m2x2_div[] = { 859static const struct clksel dpll_per_m2x2_div[] = {
@@ -861,7 +867,7 @@ static struct clk dpll_per_m2x2_ck = {
861 .clksel = dpll_per_m2x2_div, 867 .clksel = dpll_per_m2x2_div,
862 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER, 868 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
863 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK, 869 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
864 .ops = &clkops_null, 870 .ops = &clkops_omap4_dpllmx_ops,
865 .recalc = &omap2_clksel_recalc, 871 .recalc = &omap2_clksel_recalc,
866 .round_rate = &omap2_clksel_round_rate, 872 .round_rate = &omap2_clksel_round_rate,
867 .set_rate = &omap2_clksel_set_rate, 873 .set_rate = &omap2_clksel_set_rate,
@@ -887,7 +893,7 @@ static struct clk dpll_per_m4x2_ck = {
887 .clksel = dpll_per_m2x2_div, 893 .clksel = dpll_per_m2x2_div,
888 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_PER, 894 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_PER,
889 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK, 895 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
890 .ops = &clkops_null, 896 .ops = &clkops_omap4_dpllmx_ops,
891 .recalc = &omap2_clksel_recalc, 897 .recalc = &omap2_clksel_recalc,
892 .round_rate = &omap2_clksel_round_rate, 898 .round_rate = &omap2_clksel_round_rate,
893 .set_rate = &omap2_clksel_set_rate, 899 .set_rate = &omap2_clksel_set_rate,
@@ -899,7 +905,7 @@ static struct clk dpll_per_m5x2_ck = {
899 .clksel = dpll_per_m2x2_div, 905 .clksel = dpll_per_m2x2_div,
900 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_PER, 906 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_PER,
901 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK, 907 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
902 .ops = &clkops_null, 908 .ops = &clkops_omap4_dpllmx_ops,
903 .recalc = &omap2_clksel_recalc, 909 .recalc = &omap2_clksel_recalc,
904 .round_rate = &omap2_clksel_round_rate, 910 .round_rate = &omap2_clksel_round_rate,
905 .set_rate = &omap2_clksel_set_rate, 911 .set_rate = &omap2_clksel_set_rate,
@@ -911,7 +917,7 @@ static struct clk dpll_per_m6x2_ck = {
911 .clksel = dpll_per_m2x2_div, 917 .clksel = dpll_per_m2x2_div,
912 .clksel_reg = OMAP4430_CM_DIV_M6_DPLL_PER, 918 .clksel_reg = OMAP4430_CM_DIV_M6_DPLL_PER,
913 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK, 919 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK,
914 .ops = &clkops_null, 920 .ops = &clkops_omap4_dpllmx_ops,
915 .recalc = &omap2_clksel_recalc, 921 .recalc = &omap2_clksel_recalc,
916 .round_rate = &omap2_clksel_round_rate, 922 .round_rate = &omap2_clksel_round_rate,
917 .set_rate = &omap2_clksel_set_rate, 923 .set_rate = &omap2_clksel_set_rate,
@@ -923,7 +929,7 @@ static struct clk dpll_per_m7x2_ck = {
923 .clksel = dpll_per_m2x2_div, 929 .clksel = dpll_per_m2x2_div,
924 .clksel_reg = OMAP4430_CM_DIV_M7_DPLL_PER, 930 .clksel_reg = OMAP4430_CM_DIV_M7_DPLL_PER,
925 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK, 931 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK,
926 .ops = &clkops_null, 932 .ops = &clkops_omap4_dpllmx_ops,
927 .recalc = &omap2_clksel_recalc, 933 .recalc = &omap2_clksel_recalc,
928 .round_rate = &omap2_clksel_round_rate, 934 .round_rate = &omap2_clksel_round_rate,
929 .set_rate = &omap2_clksel_set_rate, 935 .set_rate = &omap2_clksel_set_rate,
@@ -964,6 +970,7 @@ static struct clk dpll_unipro_ck = {
964static struct clk dpll_unipro_x2_ck = { 970static struct clk dpll_unipro_x2_ck = {
965 .name = "dpll_unipro_x2_ck", 971 .name = "dpll_unipro_x2_ck",
966 .parent = &dpll_unipro_ck, 972 .parent = &dpll_unipro_ck,
973 .flags = CLOCK_CLKOUTX2,
967 .ops = &clkops_null, 974 .ops = &clkops_null,
968 .recalc = &omap3_clkoutx2_recalc, 975 .recalc = &omap3_clkoutx2_recalc,
969}; 976};
@@ -979,7 +986,7 @@ static struct clk dpll_unipro_m2x2_ck = {
979 .clksel = dpll_unipro_m2x2_div, 986 .clksel = dpll_unipro_m2x2_div,
980 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_UNIPRO, 987 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_UNIPRO,
981 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK, 988 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
982 .ops = &clkops_null, 989 .ops = &clkops_omap4_dpllmx_ops,
983 .recalc = &omap2_clksel_recalc, 990 .recalc = &omap2_clksel_recalc,
984 .round_rate = &omap2_clksel_round_rate, 991 .round_rate = &omap2_clksel_round_rate,
985 .set_rate = &omap2_clksel_set_rate, 992 .set_rate = &omap2_clksel_set_rate,
@@ -1028,7 +1035,8 @@ static struct clk dpll_usb_ck = {
1028static struct clk dpll_usb_clkdcoldo_ck = { 1035static struct clk dpll_usb_clkdcoldo_ck = {
1029 .name = "dpll_usb_clkdcoldo_ck", 1036 .name = "dpll_usb_clkdcoldo_ck",
1030 .parent = &dpll_usb_ck, 1037 .parent = &dpll_usb_ck,
1031 .ops = &clkops_null, 1038 .ops = &clkops_omap4_dpllmx_ops,
1039 .clksel_reg = OMAP4430_CM_CLKDCOLDO_DPLL_USB,
1032 .recalc = &followparent_recalc, 1040 .recalc = &followparent_recalc,
1033}; 1041};
1034 1042
@@ -1043,7 +1051,7 @@ static struct clk dpll_usb_m2_ck = {
1043 .clksel = dpll_usb_m2_div, 1051 .clksel = dpll_usb_m2_div,
1044 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_USB, 1052 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_USB,
1045 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK, 1053 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK,
1046 .ops = &clkops_null, 1054 .ops = &clkops_omap4_dpllmx_ops,
1047 .recalc = &omap2_clksel_recalc, 1055 .recalc = &omap2_clksel_recalc,
1048 .round_rate = &omap2_clksel_round_rate, 1056 .round_rate = &omap2_clksel_round_rate,
1049 .set_rate = &omap2_clksel_set_rate, 1057 .set_rate = &omap2_clksel_set_rate,
@@ -3301,6 +3309,9 @@ int __init omap4xxx_clk_init(void)
3301 omap2_init_clk_clkdm(c->lk.clk); 3309 omap2_init_clk_clkdm(c->lk.clk);
3302 } 3310 }
3303 3311
3312 /* Disable autoidle on all clocks; let the PM code enable it later */
3313 omap_clk_disable_autoidle_all();
3314
3304 recalculate_root_clocks(); 3315 recalculate_root_clocks();
3305 3316
3306 /* 3317 /*
diff --git a/arch/arm/mach-omap2/clock_common_data.c b/arch/arm/mach-omap2/clock_common_data.c
index 1cf8131205fa..6424d46be14a 100644
--- a/arch/arm/mach-omap2/clock_common_data.c
+++ b/arch/arm/mach-omap2/clock_common_data.c
@@ -37,3 +37,9 @@ const struct clksel_rate gfx_l3_rates[] = {
37 { .div = 0 } 37 { .div = 0 }
38}; 38};
39 39
40const struct clksel_rate dsp_ick_rates[] = {
41 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
42 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
43 { .div = 3, .val = 3, .flags = RATE_IN_243X },
44 { .div = 0 },
45};
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 58e42f76603f..ab878545bd9b 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -26,17 +26,8 @@
26 26
27#include <linux/bitops.h> 27#include <linux/bitops.h>
28 28
29#include "prm2xxx_3xxx.h"
30#include "prm-regbits-24xx.h"
31#include "cm2xxx_3xxx.h"
32#include "cm-regbits-24xx.h"
33#include "cminst44xx.h"
34#include "prcm44xx.h"
35
36#include <plat/clock.h> 29#include <plat/clock.h>
37#include "powerdomain.h"
38#include "clockdomain.h" 30#include "clockdomain.h"
39#include <plat/prcm.h>
40 31
41/* clkdm_list contains all registered struct clockdomains */ 32/* clkdm_list contains all registered struct clockdomains */
42static LIST_HEAD(clkdm_list); 33static LIST_HEAD(clkdm_list);
@@ -44,6 +35,7 @@ static LIST_HEAD(clkdm_list);
44/* array of clockdomain deps to be added/removed when clkdm in hwsup mode */ 35/* array of clockdomain deps to be added/removed when clkdm in hwsup mode */
45static struct clkdm_autodep *autodeps; 36static struct clkdm_autodep *autodeps;
46 37
38static struct clkdm_ops *arch_clkdm;
47 39
48/* Private functions */ 40/* Private functions */
49 41
@@ -177,11 +169,11 @@ static void _autodep_lookup(struct clkdm_autodep *autodep)
177 * XXX autodeps are deprecated and should be removed at the earliest 169 * XXX autodeps are deprecated and should be removed at the earliest
178 * opportunity 170 * opportunity
179 */ 171 */
180static void _clkdm_add_autodeps(struct clockdomain *clkdm) 172void _clkdm_add_autodeps(struct clockdomain *clkdm)
181{ 173{
182 struct clkdm_autodep *autodep; 174 struct clkdm_autodep *autodep;
183 175
184 if (!autodeps) 176 if (!autodeps || clkdm->flags & CLKDM_NO_AUTODEPS)
185 return; 177 return;
186 178
187 for (autodep = autodeps; autodep->clkdm.ptr; autodep++) { 179 for (autodep = autodeps; autodep->clkdm.ptr; autodep++) {
@@ -211,11 +203,11 @@ static void _clkdm_add_autodeps(struct clockdomain *clkdm)
211 * XXX autodeps are deprecated and should be removed at the earliest 203 * XXX autodeps are deprecated and should be removed at the earliest
212 * opportunity 204 * opportunity
213 */ 205 */
214static void _clkdm_del_autodeps(struct clockdomain *clkdm) 206void _clkdm_del_autodeps(struct clockdomain *clkdm)
215{ 207{
216 struct clkdm_autodep *autodep; 208 struct clkdm_autodep *autodep;
217 209
218 if (!autodeps) 210 if (!autodeps || clkdm->flags & CLKDM_NO_AUTODEPS)
219 return; 211 return;
220 212
221 for (autodep = autodeps; autodep->clkdm.ptr; autodep++) { 213 for (autodep = autodeps; autodep->clkdm.ptr; autodep++) {
@@ -235,55 +227,29 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm)
235} 227}
236 228
237/** 229/**
238 * _enable_hwsup - place a clockdomain into hardware-supervised idle 230 * _resolve_clkdm_deps() - resolve clkdm_names in @clkdm_deps to clkdms
239 * @clkdm: struct clockdomain * 231 * @clkdm: clockdomain that we are resolving dependencies for
240 * 232 * @clkdm_deps: ptr to array of struct clkdm_deps to resolve
241 * Place the clockdomain into hardware-supervised idle mode. No return
242 * value.
243 * 233 *
244 * XXX Should this return an error if the clockdomain does not support 234 * Iterates through @clkdm_deps, looking up the struct clockdomain named by
245 * hardware-supervised idle mode? 235 * clkdm_name and storing the clockdomain pointer in the struct clkdm_dep.
246 */
247static void _enable_hwsup(struct clockdomain *clkdm)
248{
249 if (cpu_is_omap24xx())
250 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
251 clkdm->clktrctrl_mask);
252 else if (cpu_is_omap34xx())
253 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
254 clkdm->clktrctrl_mask);
255 else if (cpu_is_omap44xx())
256 return omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
257 clkdm->cm_inst,
258 clkdm->clkdm_offs);
259 else
260 BUG();
261}
262
263/**
264 * _disable_hwsup - place a clockdomain into software-supervised idle
265 * @clkdm: struct clockdomain *
266 *
267 * Place the clockdomain @clkdm into software-supervised idle mode.
268 * No return value. 236 * No return value.
269 *
270 * XXX Should this return an error if the clockdomain does not support
271 * software-supervised idle mode?
272 */ 237 */
273static void _disable_hwsup(struct clockdomain *clkdm) 238static void _resolve_clkdm_deps(struct clockdomain *clkdm,
239 struct clkdm_dep *clkdm_deps)
274{ 240{
275 if (cpu_is_omap24xx()) 241 struct clkdm_dep *cd;
276 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, 242
277 clkdm->clktrctrl_mask); 243 for (cd = clkdm_deps; cd && cd->clkdm_name; cd++) {
278 else if (cpu_is_omap34xx()) 244 if (!omap_chip_is(cd->omap_chip))
279 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, 245 continue;
280 clkdm->clktrctrl_mask); 246 if (cd->clkdm)
281 else if (cpu_is_omap44xx()) 247 continue;
282 return omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition, 248 cd->clkdm = _clkdm_lookup(cd->clkdm_name);
283 clkdm->cm_inst, 249
284 clkdm->clkdm_offs); 250 WARN(!cd->clkdm, "clockdomain: %s: could not find clkdm %s while resolving dependencies - should never happen",
285 else 251 clkdm->name, cd->clkdm_name);
286 BUG(); 252 }
287} 253}
288 254
289/* Public functions */ 255/* Public functions */
@@ -292,6 +258,7 @@ static void _disable_hwsup(struct clockdomain *clkdm)
292 * clkdm_init - set up the clockdomain layer 258 * clkdm_init - set up the clockdomain layer
293 * @clkdms: optional pointer to an array of clockdomains to register 259 * @clkdms: optional pointer to an array of clockdomains to register
294 * @init_autodeps: optional pointer to an array of autodeps to register 260 * @init_autodeps: optional pointer to an array of autodeps to register
261 * @custom_funcs: func pointers for arch specfic implementations
295 * 262 *
296 * Set up internal state. If a pointer to an array of clockdomains 263 * Set up internal state. If a pointer to an array of clockdomains
297 * @clkdms was supplied, loop through the list of clockdomains, 264 * @clkdms was supplied, loop through the list of clockdomains,
@@ -300,12 +267,18 @@ static void _disable_hwsup(struct clockdomain *clkdm)
300 * @init_autodeps was provided, register those. No return value. 267 * @init_autodeps was provided, register those. No return value.
301 */ 268 */
302void clkdm_init(struct clockdomain **clkdms, 269void clkdm_init(struct clockdomain **clkdms,
303 struct clkdm_autodep *init_autodeps) 270 struct clkdm_autodep *init_autodeps,
271 struct clkdm_ops *custom_funcs)
304{ 272{
305 struct clockdomain **c = NULL; 273 struct clockdomain **c = NULL;
306 struct clockdomain *clkdm; 274 struct clockdomain *clkdm;
307 struct clkdm_autodep *autodep = NULL; 275 struct clkdm_autodep *autodep = NULL;
308 276
277 if (!custom_funcs)
278 WARN(1, "No custom clkdm functions registered\n");
279 else
280 arch_clkdm = custom_funcs;
281
309 if (clkdms) 282 if (clkdms)
310 for (c = clkdms; *c; c++) 283 for (c = clkdms; *c; c++)
311 _clkdm_register(*c); 284 _clkdm_register(*c);
@@ -321,11 +294,14 @@ void clkdm_init(struct clockdomain **clkdms,
321 */ 294 */
322 list_for_each_entry(clkdm, &clkdm_list, node) { 295 list_for_each_entry(clkdm, &clkdm_list, node) {
323 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) 296 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
324 omap2_clkdm_wakeup(clkdm); 297 clkdm_wakeup(clkdm);
325 else if (clkdm->flags & CLKDM_CAN_DISABLE_AUTO) 298 else if (clkdm->flags & CLKDM_CAN_DISABLE_AUTO)
326 omap2_clkdm_deny_idle(clkdm); 299 clkdm_deny_idle(clkdm);
327 300
301 _resolve_clkdm_deps(clkdm, clkdm->wkdep_srcs);
328 clkdm_clear_all_wkdeps(clkdm); 302 clkdm_clear_all_wkdeps(clkdm);
303
304 _resolve_clkdm_deps(clkdm, clkdm->sleepdep_srcs);
329 clkdm_clear_all_sleepdeps(clkdm); 305 clkdm_clear_all_sleepdeps(clkdm);
330 } 306 }
331} 307}
@@ -422,32 +398,32 @@ struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm)
422int clkdm_add_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2) 398int clkdm_add_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
423{ 399{
424 struct clkdm_dep *cd; 400 struct clkdm_dep *cd;
425 401 int ret = 0;
426 if (!cpu_is_omap24xx() && !cpu_is_omap34xx()) {
427 pr_err("clockdomain: %s/%s: %s: not yet implemented\n",
428 clkdm1->name, clkdm2->name, __func__);
429 return -EINVAL;
430 }
431 402
432 if (!clkdm1 || !clkdm2) 403 if (!clkdm1 || !clkdm2)
433 return -EINVAL; 404 return -EINVAL;
434 405
435 cd = _clkdm_deps_lookup(clkdm2, clkdm1->wkdep_srcs); 406 cd = _clkdm_deps_lookup(clkdm2, clkdm1->wkdep_srcs);
436 if (IS_ERR(cd)) { 407 if (IS_ERR(cd))
408 ret = PTR_ERR(cd);
409
410 if (!arch_clkdm || !arch_clkdm->clkdm_add_wkdep)
411 ret = -EINVAL;
412
413 if (ret) {
437 pr_debug("clockdomain: hardware cannot set/clear wake up of " 414 pr_debug("clockdomain: hardware cannot set/clear wake up of "
438 "%s when %s wakes up\n", clkdm1->name, clkdm2->name); 415 "%s when %s wakes up\n", clkdm1->name, clkdm2->name);
439 return PTR_ERR(cd); 416 return ret;
440 } 417 }
441 418
442 if (atomic_inc_return(&cd->wkdep_usecount) == 1) { 419 if (atomic_inc_return(&cd->wkdep_usecount) == 1) {
443 pr_debug("clockdomain: hardware will wake up %s when %s wakes " 420 pr_debug("clockdomain: hardware will wake up %s when %s wakes "
444 "up\n", clkdm1->name, clkdm2->name); 421 "up\n", clkdm1->name, clkdm2->name);
445 422
446 omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit), 423 ret = arch_clkdm->clkdm_add_wkdep(clkdm1, clkdm2);
447 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
448 } 424 }
449 425
450 return 0; 426 return ret;
451} 427}
452 428
453/** 429/**
@@ -463,32 +439,32 @@ int clkdm_add_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
463int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2) 439int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
464{ 440{
465 struct clkdm_dep *cd; 441 struct clkdm_dep *cd;
466 442 int ret = 0;
467 if (!cpu_is_omap24xx() && !cpu_is_omap34xx()) {
468 pr_err("clockdomain: %s/%s: %s: not yet implemented\n",
469 clkdm1->name, clkdm2->name, __func__);
470 return -EINVAL;
471 }
472 443
473 if (!clkdm1 || !clkdm2) 444 if (!clkdm1 || !clkdm2)
474 return -EINVAL; 445 return -EINVAL;
475 446
476 cd = _clkdm_deps_lookup(clkdm2, clkdm1->wkdep_srcs); 447 cd = _clkdm_deps_lookup(clkdm2, clkdm1->wkdep_srcs);
477 if (IS_ERR(cd)) { 448 if (IS_ERR(cd))
449 ret = PTR_ERR(cd);
450
451 if (!arch_clkdm || !arch_clkdm->clkdm_del_wkdep)
452 ret = -EINVAL;
453
454 if (ret) {
478 pr_debug("clockdomain: hardware cannot set/clear wake up of " 455 pr_debug("clockdomain: hardware cannot set/clear wake up of "
479 "%s when %s wakes up\n", clkdm1->name, clkdm2->name); 456 "%s when %s wakes up\n", clkdm1->name, clkdm2->name);
480 return PTR_ERR(cd); 457 return ret;
481 } 458 }
482 459
483 if (atomic_dec_return(&cd->wkdep_usecount) == 0) { 460 if (atomic_dec_return(&cd->wkdep_usecount) == 0) {
484 pr_debug("clockdomain: hardware will no longer wake up %s " 461 pr_debug("clockdomain: hardware will no longer wake up %s "
485 "after %s wakes up\n", clkdm1->name, clkdm2->name); 462 "after %s wakes up\n", clkdm1->name, clkdm2->name);
486 463
487 omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit), 464 ret = arch_clkdm->clkdm_del_wkdep(clkdm1, clkdm2);
488 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
489 } 465 }
490 466
491 return 0; 467 return ret;
492} 468}
493 469
494/** 470/**
@@ -508,26 +484,26 @@ int clkdm_del_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
508int clkdm_read_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2) 484int clkdm_read_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
509{ 485{
510 struct clkdm_dep *cd; 486 struct clkdm_dep *cd;
487 int ret = 0;
511 488
512 if (!clkdm1 || !clkdm2) 489 if (!clkdm1 || !clkdm2)
513 return -EINVAL; 490 return -EINVAL;
514 491
515 if (!cpu_is_omap24xx() && !cpu_is_omap34xx()) {
516 pr_err("clockdomain: %s/%s: %s: not yet implemented\n",
517 clkdm1->name, clkdm2->name, __func__);
518 return -EINVAL;
519 }
520
521 cd = _clkdm_deps_lookup(clkdm2, clkdm1->wkdep_srcs); 492 cd = _clkdm_deps_lookup(clkdm2, clkdm1->wkdep_srcs);
522 if (IS_ERR(cd)) { 493 if (IS_ERR(cd))
494 ret = PTR_ERR(cd);
495
496 if (!arch_clkdm || !arch_clkdm->clkdm_read_wkdep)
497 ret = -EINVAL;
498
499 if (ret) {
523 pr_debug("clockdomain: hardware cannot set/clear wake up of " 500 pr_debug("clockdomain: hardware cannot set/clear wake up of "
524 "%s when %s wakes up\n", clkdm1->name, clkdm2->name); 501 "%s when %s wakes up\n", clkdm1->name, clkdm2->name);
525 return PTR_ERR(cd); 502 return ret;
526 } 503 }
527 504
528 /* XXX It's faster to return the atomic wkdep_usecount */ 505 /* XXX It's faster to return the atomic wkdep_usecount */
529 return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP, 506 return arch_clkdm->clkdm_read_wkdep(clkdm1, clkdm2);
530 (1 << clkdm2->dep_bit));
531} 507}
532 508
533/** 509/**
@@ -542,33 +518,13 @@ int clkdm_read_wkdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
542 */ 518 */
543int clkdm_clear_all_wkdeps(struct clockdomain *clkdm) 519int clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
544{ 520{
545 struct clkdm_dep *cd;
546 u32 mask = 0;
547
548 if (!cpu_is_omap24xx() && !cpu_is_omap34xx()) {
549 pr_err("clockdomain: %s: %s: not yet implemented\n",
550 clkdm->name, __func__);
551 return -EINVAL;
552 }
553
554 if (!clkdm) 521 if (!clkdm)
555 return -EINVAL; 522 return -EINVAL;
556 523
557 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) { 524 if (!arch_clkdm || !arch_clkdm->clkdm_clear_all_wkdeps)
558 if (!omap_chip_is(cd->omap_chip)) 525 return -EINVAL;
559 continue;
560
561 if (!cd->clkdm && cd->clkdm_name)
562 cd->clkdm = _clkdm_lookup(cd->clkdm_name);
563
564 /* PRM accesses are slow, so minimize them */
565 mask |= 1 << cd->clkdm->dep_bit;
566 atomic_set(&cd->wkdep_usecount, 0);
567 }
568
569 omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs, PM_WKDEP);
570 526
571 return 0; 527 return arch_clkdm->clkdm_clear_all_wkdeps(clkdm);
572} 528}
573 529
574/** 530/**
@@ -586,31 +542,33 @@ int clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
586int clkdm_add_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2) 542int clkdm_add_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
587{ 543{
588 struct clkdm_dep *cd; 544 struct clkdm_dep *cd;
589 545 int ret = 0;
590 if (!cpu_is_omap34xx())
591 return -EINVAL;
592 546
593 if (!clkdm1 || !clkdm2) 547 if (!clkdm1 || !clkdm2)
594 return -EINVAL; 548 return -EINVAL;
595 549
596 cd = _clkdm_deps_lookup(clkdm2, clkdm1->sleepdep_srcs); 550 cd = _clkdm_deps_lookup(clkdm2, clkdm1->sleepdep_srcs);
597 if (IS_ERR(cd)) { 551 if (IS_ERR(cd))
552 ret = PTR_ERR(cd);
553
554 if (!arch_clkdm || !arch_clkdm->clkdm_add_sleepdep)
555 ret = -EINVAL;
556
557 if (ret) {
598 pr_debug("clockdomain: hardware cannot set/clear sleep " 558 pr_debug("clockdomain: hardware cannot set/clear sleep "
599 "dependency affecting %s from %s\n", clkdm1->name, 559 "dependency affecting %s from %s\n", clkdm1->name,
600 clkdm2->name); 560 clkdm2->name);
601 return PTR_ERR(cd); 561 return ret;
602 } 562 }
603 563
604 if (atomic_inc_return(&cd->sleepdep_usecount) == 1) { 564 if (atomic_inc_return(&cd->sleepdep_usecount) == 1) {
605 pr_debug("clockdomain: will prevent %s from sleeping if %s " 565 pr_debug("clockdomain: will prevent %s from sleeping if %s "
606 "is active\n", clkdm1->name, clkdm2->name); 566 "is active\n", clkdm1->name, clkdm2->name);
607 567
608 omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit), 568 ret = arch_clkdm->clkdm_add_sleepdep(clkdm1, clkdm2);
609 clkdm1->pwrdm.ptr->prcm_offs,
610 OMAP3430_CM_SLEEPDEP);
611 } 569 }
612 570
613 return 0; 571 return ret;
614} 572}
615 573
616/** 574/**
@@ -628,19 +586,23 @@ int clkdm_add_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
628int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2) 586int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
629{ 587{
630 struct clkdm_dep *cd; 588 struct clkdm_dep *cd;
631 589 int ret = 0;
632 if (!cpu_is_omap34xx())
633 return -EINVAL;
634 590
635 if (!clkdm1 || !clkdm2) 591 if (!clkdm1 || !clkdm2)
636 return -EINVAL; 592 return -EINVAL;
637 593
638 cd = _clkdm_deps_lookup(clkdm2, clkdm1->sleepdep_srcs); 594 cd = _clkdm_deps_lookup(clkdm2, clkdm1->sleepdep_srcs);
639 if (IS_ERR(cd)) { 595 if (IS_ERR(cd))
596 ret = PTR_ERR(cd);
597
598 if (!arch_clkdm || !arch_clkdm->clkdm_del_sleepdep)
599 ret = -EINVAL;
600
601 if (ret) {
640 pr_debug("clockdomain: hardware cannot set/clear sleep " 602 pr_debug("clockdomain: hardware cannot set/clear sleep "
641 "dependency affecting %s from %s\n", clkdm1->name, 603 "dependency affecting %s from %s\n", clkdm1->name,
642 clkdm2->name); 604 clkdm2->name);
643 return PTR_ERR(cd); 605 return ret;
644 } 606 }
645 607
646 if (atomic_dec_return(&cd->sleepdep_usecount) == 0) { 608 if (atomic_dec_return(&cd->sleepdep_usecount) == 0) {
@@ -648,12 +610,10 @@ int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
648 "sleeping if %s is active\n", clkdm1->name, 610 "sleeping if %s is active\n", clkdm1->name,
649 clkdm2->name); 611 clkdm2->name);
650 612
651 omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit), 613 ret = arch_clkdm->clkdm_del_sleepdep(clkdm1, clkdm2);
652 clkdm1->pwrdm.ptr->prcm_offs,
653 OMAP3430_CM_SLEEPDEP);
654 } 614 }
655 615
656 return 0; 616 return ret;
657} 617}
658 618
659/** 619/**
@@ -675,25 +635,27 @@ int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
675int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2) 635int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
676{ 636{
677 struct clkdm_dep *cd; 637 struct clkdm_dep *cd;
678 638 int ret = 0;
679 if (!cpu_is_omap34xx())
680 return -EINVAL;
681 639
682 if (!clkdm1 || !clkdm2) 640 if (!clkdm1 || !clkdm2)
683 return -EINVAL; 641 return -EINVAL;
684 642
685 cd = _clkdm_deps_lookup(clkdm2, clkdm1->sleepdep_srcs); 643 cd = _clkdm_deps_lookup(clkdm2, clkdm1->sleepdep_srcs);
686 if (IS_ERR(cd)) { 644 if (IS_ERR(cd))
645 ret = PTR_ERR(cd);
646
647 if (!arch_clkdm || !arch_clkdm->clkdm_read_sleepdep)
648 ret = -EINVAL;
649
650 if (ret) {
687 pr_debug("clockdomain: hardware cannot set/clear sleep " 651 pr_debug("clockdomain: hardware cannot set/clear sleep "
688 "dependency affecting %s from %s\n", clkdm1->name, 652 "dependency affecting %s from %s\n", clkdm1->name,
689 clkdm2->name); 653 clkdm2->name);
690 return PTR_ERR(cd); 654 return ret;
691 } 655 }
692 656
693 /* XXX It's faster to return the atomic sleepdep_usecount */ 657 /* XXX It's faster to return the atomic sleepdep_usecount */
694 return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs, 658 return arch_clkdm->clkdm_read_sleepdep(clkdm1, clkdm2);
695 OMAP3430_CM_SLEEPDEP,
696 (1 << clkdm2->dep_bit));
697} 659}
698 660
699/** 661/**
@@ -708,35 +670,17 @@ int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2)
708 */ 670 */
709int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm) 671int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
710{ 672{
711 struct clkdm_dep *cd;
712 u32 mask = 0;
713
714 if (!cpu_is_omap34xx())
715 return -EINVAL;
716
717 if (!clkdm) 673 if (!clkdm)
718 return -EINVAL; 674 return -EINVAL;
719 675
720 for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) { 676 if (!arch_clkdm || !arch_clkdm->clkdm_clear_all_sleepdeps)
721 if (!omap_chip_is(cd->omap_chip)) 677 return -EINVAL;
722 continue;
723
724 if (!cd->clkdm && cd->clkdm_name)
725 cd->clkdm = _clkdm_lookup(cd->clkdm_name);
726
727 /* PRM accesses are slow, so minimize them */
728 mask |= 1 << cd->clkdm->dep_bit;
729 atomic_set(&cd->sleepdep_usecount, 0);
730 }
731
732 omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
733 OMAP3430_CM_SLEEPDEP);
734 678
735 return 0; 679 return arch_clkdm->clkdm_clear_all_sleepdeps(clkdm);
736} 680}
737 681
738/** 682/**
739 * omap2_clkdm_sleep - force clockdomain sleep transition 683 * clkdm_sleep - force clockdomain sleep transition
740 * @clkdm: struct clockdomain * 684 * @clkdm: struct clockdomain *
741 * 685 *
742 * Instruct the CM to force a sleep transition on the specified 686 * Instruct the CM to force a sleep transition on the specified
@@ -744,7 +688,7 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
744 * clockdomain does not support software-initiated sleep; 0 upon 688 * clockdomain does not support software-initiated sleep; 0 upon
745 * success. 689 * success.
746 */ 690 */
747int omap2_clkdm_sleep(struct clockdomain *clkdm) 691int clkdm_sleep(struct clockdomain *clkdm)
748{ 692{
749 if (!clkdm) 693 if (!clkdm)
750 return -EINVAL; 694 return -EINVAL;
@@ -755,33 +699,16 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
755 return -EINVAL; 699 return -EINVAL;
756 } 700 }
757 701
758 pr_debug("clockdomain: forcing sleep on %s\n", clkdm->name); 702 if (!arch_clkdm || !arch_clkdm->clkdm_sleep)
759 703 return -EINVAL;
760 if (cpu_is_omap24xx()) {
761
762 omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
763 clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);
764
765 } else if (cpu_is_omap34xx()) {
766
767 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
768 clkdm->clktrctrl_mask);
769
770 } else if (cpu_is_omap44xx()) {
771
772 omap4_cminst_clkdm_force_sleep(clkdm->prcm_partition,
773 clkdm->cm_inst,
774 clkdm->clkdm_offs);
775 704
776 } else { 705 pr_debug("clockdomain: forcing sleep on %s\n", clkdm->name);
777 BUG();
778 };
779 706
780 return 0; 707 return arch_clkdm->clkdm_sleep(clkdm);
781} 708}
782 709
783/** 710/**
784 * omap2_clkdm_wakeup - force clockdomain wakeup transition 711 * clkdm_wakeup - force clockdomain wakeup transition
785 * @clkdm: struct clockdomain * 712 * @clkdm: struct clockdomain *
786 * 713 *
787 * Instruct the CM to force a wakeup transition on the specified 714 * Instruct the CM to force a wakeup transition on the specified
@@ -789,7 +716,7 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
789 * clockdomain does not support software-controlled wakeup; 0 upon 716 * clockdomain does not support software-controlled wakeup; 0 upon
790 * success. 717 * success.
791 */ 718 */
792int omap2_clkdm_wakeup(struct clockdomain *clkdm) 719int clkdm_wakeup(struct clockdomain *clkdm)
793{ 720{
794 if (!clkdm) 721 if (!clkdm)
795 return -EINVAL; 722 return -EINVAL;
@@ -800,33 +727,16 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
800 return -EINVAL; 727 return -EINVAL;
801 } 728 }
802 729
803 pr_debug("clockdomain: forcing wakeup on %s\n", clkdm->name); 730 if (!arch_clkdm || !arch_clkdm->clkdm_wakeup)
804 731 return -EINVAL;
805 if (cpu_is_omap24xx()) {
806
807 omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
808 clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);
809
810 } else if (cpu_is_omap34xx()) {
811
812 omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
813 clkdm->clktrctrl_mask);
814
815 } else if (cpu_is_omap44xx()) {
816
817 omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
818 clkdm->cm_inst,
819 clkdm->clkdm_offs);
820 732
821 } else { 733 pr_debug("clockdomain: forcing wakeup on %s\n", clkdm->name);
822 BUG();
823 };
824 734
825 return 0; 735 return arch_clkdm->clkdm_wakeup(clkdm);
826} 736}
827 737
828/** 738/**
829 * omap2_clkdm_allow_idle - enable hwsup idle transitions for clkdm 739 * clkdm_allow_idle - enable hwsup idle transitions for clkdm
830 * @clkdm: struct clockdomain * 740 * @clkdm: struct clockdomain *
831 * 741 *
832 * Allow the hardware to automatically switch the clockdomain @clkdm into 742 * Allow the hardware to automatically switch the clockdomain @clkdm into
@@ -835,7 +745,7 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
835 * framework, wkdep/sleepdep autodependencies are added; this is so 745 * framework, wkdep/sleepdep autodependencies are added; this is so
836 * device drivers can read and write to the device. No return value. 746 * device drivers can read and write to the device. No return value.
837 */ 747 */
838void omap2_clkdm_allow_idle(struct clockdomain *clkdm) 748void clkdm_allow_idle(struct clockdomain *clkdm)
839{ 749{
840 if (!clkdm) 750 if (!clkdm)
841 return; 751 return;
@@ -846,27 +756,18 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
846 return; 756 return;
847 } 757 }
848 758
759 if (!arch_clkdm || !arch_clkdm->clkdm_allow_idle)
760 return;
761
849 pr_debug("clockdomain: enabling automatic idle transitions for %s\n", 762 pr_debug("clockdomain: enabling automatic idle transitions for %s\n",
850 clkdm->name); 763 clkdm->name);
851 764
852 /* 765 arch_clkdm->clkdm_allow_idle(clkdm);
853 * XXX This should be removed once TI adds wakeup/sleep
854 * dependency code and data for OMAP4.
855 */
856 if (cpu_is_omap44xx()) {
857 pr_err("clockdomain: %s: OMAP4 wakeup/sleep dependency support: not yet implemented\n", clkdm->name);
858 } else {
859 if (atomic_read(&clkdm->usecount) > 0)
860 _clkdm_add_autodeps(clkdm);
861 }
862
863 _enable_hwsup(clkdm);
864
865 pwrdm_clkdm_state_switch(clkdm); 766 pwrdm_clkdm_state_switch(clkdm);
866} 767}
867 768
868/** 769/**
869 * omap2_clkdm_deny_idle - disable hwsup idle transitions for clkdm 770 * clkdm_deny_idle - disable hwsup idle transitions for clkdm
870 * @clkdm: struct clockdomain * 771 * @clkdm: struct clockdomain *
871 * 772 *
872 * Prevent the hardware from automatically switching the clockdomain 773 * Prevent the hardware from automatically switching the clockdomain
@@ -874,7 +775,7 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
874 * downstream clocks enabled in the clock framework, wkdep/sleepdep 775 * downstream clocks enabled in the clock framework, wkdep/sleepdep
875 * autodependencies are removed. No return value. 776 * autodependencies are removed. No return value.
876 */ 777 */
877void omap2_clkdm_deny_idle(struct clockdomain *clkdm) 778void clkdm_deny_idle(struct clockdomain *clkdm)
878{ 779{
879 if (!clkdm) 780 if (!clkdm)
880 return; 781 return;
@@ -885,28 +786,20 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
885 return; 786 return;
886 } 787 }
887 788
789 if (!arch_clkdm || !arch_clkdm->clkdm_deny_idle)
790 return;
791
888 pr_debug("clockdomain: disabling automatic idle transitions for %s\n", 792 pr_debug("clockdomain: disabling automatic idle transitions for %s\n",
889 clkdm->name); 793 clkdm->name);
890 794
891 _disable_hwsup(clkdm); 795 arch_clkdm->clkdm_deny_idle(clkdm);
892
893 /*
894 * XXX This should be removed once TI adds wakeup/sleep
895 * dependency code and data for OMAP4.
896 */
897 if (cpu_is_omap44xx()) {
898 pr_err("clockdomain: %s: OMAP4 wakeup/sleep dependency support: not yet implemented\n", clkdm->name);
899 } else {
900 if (atomic_read(&clkdm->usecount) > 0)
901 _clkdm_del_autodeps(clkdm);
902 }
903} 796}
904 797
905 798
906/* Clockdomain-to-clock framework interface code */ 799/* Clockdomain-to-clock framework interface code */
907 800
908/** 801/**
909 * omap2_clkdm_clk_enable - add an enabled downstream clock to this clkdm 802 * clkdm_clk_enable - add an enabled downstream clock to this clkdm
910 * @clkdm: struct clockdomain * 803 * @clkdm: struct clockdomain *
911 * @clk: struct clk * of the enabled downstream clock 804 * @clk: struct clk * of the enabled downstream clock
912 * 805 *
@@ -919,10 +812,8 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
919 * by on-chip processors. Returns -EINVAL if passed null pointers; 812 * by on-chip processors. Returns -EINVAL if passed null pointers;
920 * returns 0 upon success or if the clockdomain is in hwsup idle mode. 813 * returns 0 upon success or if the clockdomain is in hwsup idle mode.
921 */ 814 */
922int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk) 815int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
923{ 816{
924 bool hwsup = false;
925
926 /* 817 /*
927 * XXX Rewrite this code to maintain a list of enabled 818 * XXX Rewrite this code to maintain a list of enabled
928 * downstream clocks for debugging purposes? 819 * downstream clocks for debugging purposes?
@@ -931,6 +822,9 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
931 if (!clkdm || !clk) 822 if (!clkdm || !clk)
932 return -EINVAL; 823 return -EINVAL;
933 824
825 if (!arch_clkdm || !arch_clkdm->clkdm_clk_enable)
826 return -EINVAL;
827
934 if (atomic_inc_return(&clkdm->usecount) > 1) 828 if (atomic_inc_return(&clkdm->usecount) > 1)
935 return 0; 829 return 0;
936 830
@@ -939,31 +833,7 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
939 pr_debug("clockdomain: clkdm %s: clk %s now enabled\n", clkdm->name, 833 pr_debug("clockdomain: clkdm %s: clk %s now enabled\n", clkdm->name,
940 clk->name); 834 clk->name);
941 835
942 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 836 arch_clkdm->clkdm_clk_enable(clkdm);
943
944 if (!clkdm->clktrctrl_mask)
945 return 0;
946
947 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
948 clkdm->clktrctrl_mask);
949
950 } else if (cpu_is_omap44xx()) {
951
952 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
953 clkdm->cm_inst,
954 clkdm->clkdm_offs);
955
956 }
957
958 if (hwsup) {
959 /* Disable HW transitions when we are changing deps */
960 _disable_hwsup(clkdm);
961 _clkdm_add_autodeps(clkdm);
962 _enable_hwsup(clkdm);
963 } else {
964 omap2_clkdm_wakeup(clkdm);
965 }
966
967 pwrdm_wait_transition(clkdm->pwrdm.ptr); 837 pwrdm_wait_transition(clkdm->pwrdm.ptr);
968 pwrdm_clkdm_state_switch(clkdm); 838 pwrdm_clkdm_state_switch(clkdm);
969 839
@@ -971,7 +841,7 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
971} 841}
972 842
973/** 843/**
974 * omap2_clkdm_clk_disable - remove an enabled downstream clock from this clkdm 844 * clkdm_clk_disable - remove an enabled downstream clock from this clkdm
975 * @clkdm: struct clockdomain * 845 * @clkdm: struct clockdomain *
976 * @clk: struct clk * of the disabled downstream clock 846 * @clk: struct clk * of the disabled downstream clock
977 * 847 *
@@ -984,10 +854,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
984 * is enabled; or returns 0 upon success or if the clockdomain is in 854 * is enabled; or returns 0 upon success or if the clockdomain is in
985 * hwsup idle mode. 855 * hwsup idle mode.
986 */ 856 */
987int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) 857int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
988{ 858{
989 bool hwsup = false;
990
991 /* 859 /*
992 * XXX Rewrite this code to maintain a list of enabled 860 * XXX Rewrite this code to maintain a list of enabled
993 * downstream clocks for debugging purposes? 861 * downstream clocks for debugging purposes?
@@ -996,6 +864,9 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
996 if (!clkdm || !clk) 864 if (!clkdm || !clk)
997 return -EINVAL; 865 return -EINVAL;
998 866
867 if (!arch_clkdm || !arch_clkdm->clkdm_clk_disable)
868 return -EINVAL;
869
999#ifdef DEBUG 870#ifdef DEBUG
1000 if (atomic_read(&clkdm->usecount) == 0) { 871 if (atomic_read(&clkdm->usecount) == 0) {
1001 WARN_ON(1); /* underflow */ 872 WARN_ON(1); /* underflow */
@@ -1011,31 +882,7 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
1011 pr_debug("clockdomain: clkdm %s: clk %s now disabled\n", clkdm->name, 882 pr_debug("clockdomain: clkdm %s: clk %s now disabled\n", clkdm->name,
1012 clk->name); 883 clk->name);
1013 884
1014 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 885 arch_clkdm->clkdm_clk_disable(clkdm);
1015
1016 if (!clkdm->clktrctrl_mask)
1017 return 0;
1018
1019 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
1020 clkdm->clktrctrl_mask);
1021
1022 } else if (cpu_is_omap44xx()) {
1023
1024 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
1025 clkdm->cm_inst,
1026 clkdm->clkdm_offs);
1027
1028 }
1029
1030 if (hwsup) {
1031 /* Disable HW transitions when we are changing deps */
1032 _disable_hwsup(clkdm);
1033 _clkdm_del_autodeps(clkdm);
1034 _enable_hwsup(clkdm);
1035 } else {
1036 omap2_clkdm_sleep(clkdm);
1037 }
1038
1039 pwrdm_clkdm_state_switch(clkdm); 886 pwrdm_clkdm_state_switch(clkdm);
1040 887
1041 return 0; 888 return 0;
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index 9b459c26fb85..85b3dce65640 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -4,7 +4,7 @@
4 * OMAP2/3 clockdomain framework functions 4 * OMAP2/3 clockdomain framework functions
5 * 5 *
6 * Copyright (C) 2008 Texas Instruments, Inc. 6 * Copyright (C) 2008 Texas Instruments, Inc.
7 * Copyright (C) 2008-2010 Nokia Corporation 7 * Copyright (C) 2008-2011 Nokia Corporation
8 * 8 *
9 * Paul Walmsley 9 * Paul Walmsley
10 * 10 *
@@ -22,11 +22,19 @@
22#include <plat/clock.h> 22#include <plat/clock.h>
23#include <plat/cpu.h> 23#include <plat/cpu.h>
24 24
25/* Clockdomain capability flags */ 25/*
26 * Clockdomain flags
27 *
28 * XXX Document CLKDM_CAN_* flags
29 *
30 * CLKDM_NO_AUTODEPS: Prevent "autodeps" from being added/removed from this
31 * clockdomain. (Currently, this applies to OMAP3 clockdomains only.)
32 */
26#define CLKDM_CAN_FORCE_SLEEP (1 << 0) 33#define CLKDM_CAN_FORCE_SLEEP (1 << 0)
27#define CLKDM_CAN_FORCE_WAKEUP (1 << 1) 34#define CLKDM_CAN_FORCE_WAKEUP (1 << 1)
28#define CLKDM_CAN_ENABLE_AUTO (1 << 2) 35#define CLKDM_CAN_ENABLE_AUTO (1 << 2)
29#define CLKDM_CAN_DISABLE_AUTO (1 << 3) 36#define CLKDM_CAN_DISABLE_AUTO (1 << 3)
37#define CLKDM_NO_AUTODEPS (1 << 4)
30 38
31#define CLKDM_CAN_HWSUP (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO) 39#define CLKDM_CAN_HWSUP (CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_DISABLE_AUTO)
32#define CLKDM_CAN_SWSUP (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP) 40#define CLKDM_CAN_SWSUP (CLKDM_CAN_FORCE_SLEEP | CLKDM_CAN_FORCE_WAKEUP)
@@ -116,7 +124,42 @@ struct clockdomain {
116 struct list_head node; 124 struct list_head node;
117}; 125};
118 126
119void clkdm_init(struct clockdomain **clkdms, struct clkdm_autodep *autodeps); 127/**
128 * struct clkdm_ops - Arch specfic function implementations
129 * @clkdm_add_wkdep: Add a wakeup dependency between clk domains
130 * @clkdm_del_wkdep: Delete a wakeup dependency between clk domains
131 * @clkdm_read_wkdep: Read wakeup dependency state between clk domains
132 * @clkdm_clear_all_wkdeps: Remove all wakeup dependencies from the clk domain
133 * @clkdm_add_sleepdep: Add a sleep dependency between clk domains
134 * @clkdm_del_sleepdep: Delete a sleep dependency between clk domains
135 * @clkdm_read_sleepdep: Read sleep dependency state between clk domains
136 * @clkdm_clear_all_sleepdeps: Remove all sleep dependencies from the clk domain
137 * @clkdm_sleep: Force a clockdomain to sleep
138 * @clkdm_wakeup: Force a clockdomain to wakeup
139 * @clkdm_allow_idle: Enable hw supervised idle transitions for clock domain
140 * @clkdm_deny_idle: Disable hw supervised idle transitions for clock domain
141 * @clkdm_clk_enable: Put the clkdm in right state for a clock enable
142 * @clkdm_clk_disable: Put the clkdm in right state for a clock disable
143 */
144struct clkdm_ops {
145 int (*clkdm_add_wkdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
146 int (*clkdm_del_wkdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
147 int (*clkdm_read_wkdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
148 int (*clkdm_clear_all_wkdeps)(struct clockdomain *clkdm);
149 int (*clkdm_add_sleepdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
150 int (*clkdm_del_sleepdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
151 int (*clkdm_read_sleepdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
152 int (*clkdm_clear_all_sleepdeps)(struct clockdomain *clkdm);
153 int (*clkdm_sleep)(struct clockdomain *clkdm);
154 int (*clkdm_wakeup)(struct clockdomain *clkdm);
155 void (*clkdm_allow_idle)(struct clockdomain *clkdm);
156 void (*clkdm_deny_idle)(struct clockdomain *clkdm);
157 int (*clkdm_clk_enable)(struct clockdomain *clkdm);
158 int (*clkdm_clk_disable)(struct clockdomain *clkdm);
159};
160
161void clkdm_init(struct clockdomain **clkdms, struct clkdm_autodep *autodeps,
162 struct clkdm_ops *custom_funcs);
120struct clockdomain *clkdm_lookup(const char *name); 163struct clockdomain *clkdm_lookup(const char *name);
121 164
122int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user), 165int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user),
@@ -132,16 +175,23 @@ int clkdm_del_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
132int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2); 175int clkdm_read_sleepdep(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
133int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm); 176int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm);
134 177
135void omap2_clkdm_allow_idle(struct clockdomain *clkdm); 178void clkdm_allow_idle(struct clockdomain *clkdm);
136void omap2_clkdm_deny_idle(struct clockdomain *clkdm); 179void clkdm_deny_idle(struct clockdomain *clkdm);
137 180
138int omap2_clkdm_wakeup(struct clockdomain *clkdm); 181int clkdm_wakeup(struct clockdomain *clkdm);
139int omap2_clkdm_sleep(struct clockdomain *clkdm); 182int clkdm_sleep(struct clockdomain *clkdm);
140 183
141int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk); 184int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk);
142int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk); 185int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
143 186
144extern void __init omap2_clockdomains_init(void); 187extern void __init omap2xxx_clockdomains_init(void);
188extern void __init omap3xxx_clockdomains_init(void);
145extern void __init omap44xx_clockdomains_init(void); 189extern void __init omap44xx_clockdomains_init(void);
190extern void _clkdm_add_autodeps(struct clockdomain *clkdm);
191extern void _clkdm_del_autodeps(struct clockdomain *clkdm);
192
193extern struct clkdm_ops omap2_clkdm_operations;
194extern struct clkdm_ops omap3_clkdm_operations;
195extern struct clkdm_ops omap4_clkdm_operations;
146 196
147#endif 197#endif
diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
new file mode 100644
index 000000000000..48d0db7e6069
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
@@ -0,0 +1,274 @@
1/*
2 * OMAP2 and OMAP3 clockdomain control
3 *
4 * Copyright (C) 2008-2010 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Derived from mach-omap2/clockdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/types.h>
16#include <plat/prcm.h>
17#include "prm.h"
18#include "prm2xxx_3xxx.h"
19#include "cm.h"
20#include "cm2xxx_3xxx.h"
21#include "cm-regbits-24xx.h"
22#include "cm-regbits-34xx.h"
23#include "prm-regbits-24xx.h"
24#include "clockdomain.h"
25
26static int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
27 struct clockdomain *clkdm2)
28{
29 omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit),
30 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
31 return 0;
32}
33
34static int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
35 struct clockdomain *clkdm2)
36{
37 omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
38 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
39 return 0;
40}
41
42static int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
43 struct clockdomain *clkdm2)
44{
45 return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
46 PM_WKDEP, (1 << clkdm2->dep_bit));
47}
48
49static int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
50{
51 struct clkdm_dep *cd;
52 u32 mask = 0;
53
54 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
55 if (!omap_chip_is(cd->omap_chip))
56 continue;
57 if (!cd->clkdm)
58 continue; /* only happens if data is erroneous */
59
60 /* PRM accesses are slow, so minimize them */
61 mask |= 1 << cd->clkdm->dep_bit;
62 atomic_set(&cd->wkdep_usecount, 0);
63 }
64
65 omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
66 PM_WKDEP);
67 return 0;
68}
69
70static int omap3_clkdm_add_sleepdep(struct clockdomain *clkdm1,
71 struct clockdomain *clkdm2)
72{
73 omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit),
74 clkdm1->pwrdm.ptr->prcm_offs,
75 OMAP3430_CM_SLEEPDEP);
76 return 0;
77}
78
79static int omap3_clkdm_del_sleepdep(struct clockdomain *clkdm1,
80 struct clockdomain *clkdm2)
81{
82 omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
83 clkdm1->pwrdm.ptr->prcm_offs,
84 OMAP3430_CM_SLEEPDEP);
85 return 0;
86}
87
88static int omap3_clkdm_read_sleepdep(struct clockdomain *clkdm1,
89 struct clockdomain *clkdm2)
90{
91 return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
92 OMAP3430_CM_SLEEPDEP, (1 << clkdm2->dep_bit));
93}
94
95static int omap3_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
96{
97 struct clkdm_dep *cd;
98 u32 mask = 0;
99
100 for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) {
101 if (!omap_chip_is(cd->omap_chip))
102 continue;
103 if (!cd->clkdm)
104 continue; /* only happens if data is erroneous */
105
106 /* PRM accesses are slow, so minimize them */
107 mask |= 1 << cd->clkdm->dep_bit;
108 atomic_set(&cd->sleepdep_usecount, 0);
109 }
110 omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
111 OMAP3430_CM_SLEEPDEP);
112 return 0;
113}
114
115static int omap2_clkdm_sleep(struct clockdomain *clkdm)
116{
117 omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
118 clkdm->pwrdm.ptr->prcm_offs,
119 OMAP2_PM_PWSTCTRL);
120 return 0;
121}
122
123static int omap2_clkdm_wakeup(struct clockdomain *clkdm)
124{
125 omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
126 clkdm->pwrdm.ptr->prcm_offs,
127 OMAP2_PM_PWSTCTRL);
128 return 0;
129}
130
131static void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
132{
133 if (atomic_read(&clkdm->usecount) > 0)
134 _clkdm_add_autodeps(clkdm);
135
136 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
137 clkdm->clktrctrl_mask);
138}
139
140static void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
141{
142 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
143 clkdm->clktrctrl_mask);
144
145 if (atomic_read(&clkdm->usecount) > 0)
146 _clkdm_del_autodeps(clkdm);
147}
148
149static void _enable_hwsup(struct clockdomain *clkdm)
150{
151 if (cpu_is_omap24xx())
152 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
153 clkdm->clktrctrl_mask);
154 else if (cpu_is_omap34xx())
155 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
156 clkdm->clktrctrl_mask);
157}
158
159static void _disable_hwsup(struct clockdomain *clkdm)
160{
161 if (cpu_is_omap24xx())
162 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
163 clkdm->clktrctrl_mask);
164 else if (cpu_is_omap34xx())
165 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
166 clkdm->clktrctrl_mask);
167}
168
169
170static int omap2_clkdm_clk_enable(struct clockdomain *clkdm)
171{
172 bool hwsup = false;
173
174 if (!clkdm->clktrctrl_mask)
175 return 0;
176
177 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
178 clkdm->clktrctrl_mask);
179
180 if (hwsup) {
181 /* Disable HW transitions when we are changing deps */
182 _disable_hwsup(clkdm);
183 _clkdm_add_autodeps(clkdm);
184 _enable_hwsup(clkdm);
185 } else {
186 clkdm_wakeup(clkdm);
187 }
188
189 return 0;
190}
191
192static int omap2_clkdm_clk_disable(struct clockdomain *clkdm)
193{
194 bool hwsup = false;
195
196 if (!clkdm->clktrctrl_mask)
197 return 0;
198
199 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
200 clkdm->clktrctrl_mask);
201
202 if (hwsup) {
203 /* Disable HW transitions when we are changing deps */
204 _disable_hwsup(clkdm);
205 _clkdm_del_autodeps(clkdm);
206 _enable_hwsup(clkdm);
207 } else {
208 clkdm_sleep(clkdm);
209 }
210
211 return 0;
212}
213
214static int omap3_clkdm_sleep(struct clockdomain *clkdm)
215{
216 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
217 clkdm->clktrctrl_mask);
218 return 0;
219}
220
221static int omap3_clkdm_wakeup(struct clockdomain *clkdm)
222{
223 omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
224 clkdm->clktrctrl_mask);
225 return 0;
226}
227
228static void omap3_clkdm_allow_idle(struct clockdomain *clkdm)
229{
230 if (atomic_read(&clkdm->usecount) > 0)
231 _clkdm_add_autodeps(clkdm);
232
233 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
234 clkdm->clktrctrl_mask);
235}
236
237static void omap3_clkdm_deny_idle(struct clockdomain *clkdm)
238{
239 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
240 clkdm->clktrctrl_mask);
241
242 if (atomic_read(&clkdm->usecount) > 0)
243 _clkdm_del_autodeps(clkdm);
244}
245
246struct clkdm_ops omap2_clkdm_operations = {
247 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
248 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
249 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
250 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
251 .clkdm_sleep = omap2_clkdm_sleep,
252 .clkdm_wakeup = omap2_clkdm_wakeup,
253 .clkdm_allow_idle = omap2_clkdm_allow_idle,
254 .clkdm_deny_idle = omap2_clkdm_deny_idle,
255 .clkdm_clk_enable = omap2_clkdm_clk_enable,
256 .clkdm_clk_disable = omap2_clkdm_clk_disable,
257};
258
259struct clkdm_ops omap3_clkdm_operations = {
260 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
261 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
262 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
263 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
264 .clkdm_add_sleepdep = omap3_clkdm_add_sleepdep,
265 .clkdm_del_sleepdep = omap3_clkdm_del_sleepdep,
266 .clkdm_read_sleepdep = omap3_clkdm_read_sleepdep,
267 .clkdm_clear_all_sleepdeps = omap3_clkdm_clear_all_sleepdeps,
268 .clkdm_sleep = omap3_clkdm_sleep,
269 .clkdm_wakeup = omap3_clkdm_wakeup,
270 .clkdm_allow_idle = omap3_clkdm_allow_idle,
271 .clkdm_deny_idle = omap3_clkdm_deny_idle,
272 .clkdm_clk_enable = omap2_clkdm_clk_enable,
273 .clkdm_clk_disable = omap2_clkdm_clk_disable,
274};
diff --git a/arch/arm/mach-omap2/clockdomain44xx.c b/arch/arm/mach-omap2/clockdomain44xx.c
new file mode 100644
index 000000000000..a1a4ecd26544
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomain44xx.c
@@ -0,0 +1,137 @@
1/*
2 * OMAP4 clockdomain control
3 *
4 * Copyright (C) 2008-2010 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Derived from mach-omap2/clockdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include "clockdomain.h"
17#include "cminst44xx.h"
18#include "cm44xx.h"
19
20static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1,
21 struct clockdomain *clkdm2)
22{
23 omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit),
24 clkdm1->prcm_partition,
25 clkdm1->cm_inst, clkdm1->clkdm_offs +
26 OMAP4_CM_STATICDEP);
27 return 0;
28}
29
30static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1,
31 struct clockdomain *clkdm2)
32{
33 omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit),
34 clkdm1->prcm_partition,
35 clkdm1->cm_inst, clkdm1->clkdm_offs +
36 OMAP4_CM_STATICDEP);
37 return 0;
38}
39
40static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1,
41 struct clockdomain *clkdm2)
42{
43 return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition,
44 clkdm1->cm_inst, clkdm1->clkdm_offs +
45 OMAP4_CM_STATICDEP,
46 (1 << clkdm2->dep_bit));
47}
48
49static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
50{
51 struct clkdm_dep *cd;
52 u32 mask = 0;
53
54 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
55 if (!omap_chip_is(cd->omap_chip))
56 continue;
57 if (!cd->clkdm)
58 continue; /* only happens if data is erroneous */
59
60 mask |= 1 << cd->clkdm->dep_bit;
61 atomic_set(&cd->wkdep_usecount, 0);
62 }
63
64 omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition,
65 clkdm->cm_inst, clkdm->clkdm_offs +
66 OMAP4_CM_STATICDEP);
67 return 0;
68}
69
70static int omap4_clkdm_sleep(struct clockdomain *clkdm)
71{
72 omap4_cminst_clkdm_force_sleep(clkdm->prcm_partition,
73 clkdm->cm_inst, clkdm->clkdm_offs);
74 return 0;
75}
76
77static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
78{
79 omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
80 clkdm->cm_inst, clkdm->clkdm_offs);
81 return 0;
82}
83
84static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
85{
86 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
87 clkdm->cm_inst, clkdm->clkdm_offs);
88}
89
90static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
91{
92 omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
93 clkdm->cm_inst, clkdm->clkdm_offs);
94}
95
96static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
97{
98 bool hwsup = false;
99
100 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
101 clkdm->cm_inst, clkdm->clkdm_offs);
102
103 if (!hwsup)
104 clkdm_wakeup(clkdm);
105
106 return 0;
107}
108
109static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
110{
111 bool hwsup = false;
112
113 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
114 clkdm->cm_inst, clkdm->clkdm_offs);
115
116 if (!hwsup)
117 clkdm_sleep(clkdm);
118
119 return 0;
120}
121
122struct clkdm_ops omap4_clkdm_operations = {
123 .clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep,
124 .clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep,
125 .clkdm_read_wkdep = omap4_clkdm_read_wkup_sleep_dep,
126 .clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
127 .clkdm_add_sleepdep = omap4_clkdm_add_wkup_sleep_dep,
128 .clkdm_del_sleepdep = omap4_clkdm_del_wkup_sleep_dep,
129 .clkdm_read_sleepdep = omap4_clkdm_read_wkup_sleep_dep,
130 .clkdm_clear_all_sleepdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
131 .clkdm_sleep = omap4_clkdm_sleep,
132 .clkdm_wakeup = omap4_clkdm_wakeup,
133 .clkdm_allow_idle = omap4_clkdm_allow_idle,
134 .clkdm_deny_idle = omap4_clkdm_deny_idle,
135 .clkdm_clk_enable = omap4_clkdm_clk_enable,
136 .clkdm_clk_disable = omap4_clkdm_clk_disable,
137};
diff --git a/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c b/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
index e6f0d18d5e8d..13bde95b6790 100644
--- a/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
+++ b/arch/arm/mach-omap2/clockdomains2xxx_3xxx_data.c
@@ -89,6 +89,8 @@ static struct clkdm_dep gfx_sgx_wkdeps[] = {
89 89
90/* 24XX-specific possible dependencies */ 90/* 24XX-specific possible dependencies */
91 91
92#ifdef CONFIG_ARCH_OMAP2
93
92/* Wakeup dependency source arrays */ 94/* Wakeup dependency source arrays */
93 95
94/* 2420/2430 PM_WKDEP_DSP: CORE, MPU, WKUP */ 96/* 2420/2430 PM_WKDEP_DSP: CORE, MPU, WKUP */
@@ -168,6 +170,7 @@ static struct clkdm_dep core_24xx_wkdeps[] = {
168 { NULL }, 170 { NULL },
169}; 171};
170 172
173#endif /* CONFIG_ARCH_OMAP2 */
171 174
172/* 2430-specific possible wakeup dependencies */ 175/* 2430-specific possible wakeup dependencies */
173 176
@@ -854,7 +857,12 @@ static struct clockdomain *clockdomains_omap2[] __initdata = {
854 NULL, 857 NULL,
855}; 858};
856 859
857void __init omap2_clockdomains_init(void) 860void __init omap2xxx_clockdomains_init(void)
861{
862 clkdm_init(clockdomains_omap2, clkdm_autodeps, &omap2_clkdm_operations);
863}
864
865void __init omap3xxx_clockdomains_init(void)
858{ 866{
859 clkdm_init(clockdomains_omap2, clkdm_autodeps); 867 clkdm_init(clockdomains_omap2, clkdm_autodeps, &omap3_clkdm_operations);
860} 868}
diff --git a/arch/arm/mach-omap2/clockdomains44xx_data.c b/arch/arm/mach-omap2/clockdomains44xx_data.c
index 10622c914abc..a607ec196e8b 100644
--- a/arch/arm/mach-omap2/clockdomains44xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains44xx_data.c
@@ -18,11 +18,6 @@
18 * published by the Free Software Foundation. 18 * published by the Free Software Foundation.
19 */ 19 */
20 20
21/*
22 * To-Do List
23 * -> Populate the Sleep/Wakeup dependencies for the domains
24 */
25
26#include <linux/kernel.h> 21#include <linux/kernel.h>
27#include <linux/io.h> 22#include <linux/io.h>
28 23
@@ -35,6 +30,355 @@
35#include "prcm44xx.h" 30#include "prcm44xx.h"
36#include "prcm_mpu44xx.h" 31#include "prcm_mpu44xx.h"
37 32
33/* Static Dependencies for OMAP4 Clock Domains */
34
35static struct clkdm_dep ducati_wkup_sleep_deps[] = {
36 {
37 .clkdm_name = "abe_clkdm",
38 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
39 },
40 {
41 .clkdm_name = "ivahd_clkdm",
42 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
43 },
44 {
45 .clkdm_name = "l3_1_clkdm",
46 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
47 },
48 {
49 .clkdm_name = "l3_2_clkdm",
50 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
51 },
52 {
53 .clkdm_name = "l3_dss_clkdm",
54 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
55 },
56 {
57 .clkdm_name = "l3_emif_clkdm",
58 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
59 },
60 {
61 .clkdm_name = "l3_gfx_clkdm",
62 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
63 },
64 {
65 .clkdm_name = "l3_init_clkdm",
66 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
67 },
68 {
69 .clkdm_name = "l4_cfg_clkdm",
70 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
71 },
72 {
73 .clkdm_name = "l4_per_clkdm",
74 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
75 },
76 {
77 .clkdm_name = "l4_secure_clkdm",
78 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
79 },
80 {
81 .clkdm_name = "l4_wkup_clkdm",
82 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
83 },
84 {
85 .clkdm_name = "tesla_clkdm",
86 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
87 },
88 { NULL },
89};
90
91static struct clkdm_dep iss_wkup_sleep_deps[] = {
92 {
93 .clkdm_name = "ivahd_clkdm",
94 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
95 },
96 {
97 .clkdm_name = "l3_1_clkdm",
98 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
99 },
100 {
101 .clkdm_name = "l3_emif_clkdm",
102 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
103 },
104 { NULL },
105};
106
107static struct clkdm_dep ivahd_wkup_sleep_deps[] = {
108 {
109 .clkdm_name = "l3_1_clkdm",
110 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
111 },
112 {
113 .clkdm_name = "l3_emif_clkdm",
114 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
115 },
116 { NULL },
117};
118
119static struct clkdm_dep l3_d2d_wkup_sleep_deps[] = {
120 {
121 .clkdm_name = "abe_clkdm",
122 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
123 },
124 {
125 .clkdm_name = "ivahd_clkdm",
126 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
127 },
128 {
129 .clkdm_name = "l3_1_clkdm",
130 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
131 },
132 {
133 .clkdm_name = "l3_2_clkdm",
134 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
135 },
136 {
137 .clkdm_name = "l3_emif_clkdm",
138 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
139 },
140 {
141 .clkdm_name = "l3_init_clkdm",
142 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
143 },
144 {
145 .clkdm_name = "l4_cfg_clkdm",
146 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
147 },
148 {
149 .clkdm_name = "l4_per_clkdm",
150 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
151 },
152 { NULL },
153};
154
155static struct clkdm_dep l3_dma_wkup_sleep_deps[] = {
156 {
157 .clkdm_name = "abe_clkdm",
158 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
159 },
160 {
161 .clkdm_name = "ducati_clkdm",
162 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
163 },
164 {
165 .clkdm_name = "ivahd_clkdm",
166 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
167 },
168 {
169 .clkdm_name = "l3_1_clkdm",
170 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
171 },
172 {
173 .clkdm_name = "l3_dss_clkdm",
174 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
175 },
176 {
177 .clkdm_name = "l3_emif_clkdm",
178 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
179 },
180 {
181 .clkdm_name = "l3_init_clkdm",
182 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
183 },
184 {
185 .clkdm_name = "l4_cfg_clkdm",
186 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
187 },
188 {
189 .clkdm_name = "l4_per_clkdm",
190 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
191 },
192 {
193 .clkdm_name = "l4_secure_clkdm",
194 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
195 },
196 {
197 .clkdm_name = "l4_wkup_clkdm",
198 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
199 },
200 { NULL },
201};
202
203static struct clkdm_dep l3_dss_wkup_sleep_deps[] = {
204 {
205 .clkdm_name = "ivahd_clkdm",
206 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
207 },
208 {
209 .clkdm_name = "l3_2_clkdm",
210 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
211 },
212 {
213 .clkdm_name = "l3_emif_clkdm",
214 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
215 },
216 { NULL },
217};
218
219static struct clkdm_dep l3_gfx_wkup_sleep_deps[] = {
220 {
221 .clkdm_name = "ivahd_clkdm",
222 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
223 },
224 {
225 .clkdm_name = "l3_1_clkdm",
226 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
227 },
228 {
229 .clkdm_name = "l3_emif_clkdm",
230 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
231 },
232 { NULL },
233};
234
235static struct clkdm_dep l3_init_wkup_sleep_deps[] = {
236 {
237 .clkdm_name = "abe_clkdm",
238 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
239 },
240 {
241 .clkdm_name = "ivahd_clkdm",
242 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
243 },
244 {
245 .clkdm_name = "l3_emif_clkdm",
246 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
247 },
248 {
249 .clkdm_name = "l4_cfg_clkdm",
250 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
251 },
252 {
253 .clkdm_name = "l4_per_clkdm",
254 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
255 },
256 {
257 .clkdm_name = "l4_secure_clkdm",
258 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
259 },
260 {
261 .clkdm_name = "l4_wkup_clkdm",
262 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
263 },
264 { NULL },
265};
266
267static struct clkdm_dep l4_secure_wkup_sleep_deps[] = {
268 {
269 .clkdm_name = "l3_1_clkdm",
270 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
271 },
272 {
273 .clkdm_name = "l3_emif_clkdm",
274 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
275 },
276 {
277 .clkdm_name = "l4_per_clkdm",
278 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
279 },
280 { NULL },
281};
282
283static struct clkdm_dep mpuss_wkup_sleep_deps[] = {
284 {
285 .clkdm_name = "abe_clkdm",
286 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
287 },
288 {
289 .clkdm_name = "ducati_clkdm",
290 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
291 },
292 {
293 .clkdm_name = "ivahd_clkdm",
294 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
295 },
296 {
297 .clkdm_name = "l3_1_clkdm",
298 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
299 },
300 {
301 .clkdm_name = "l3_2_clkdm",
302 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
303 },
304 {
305 .clkdm_name = "l3_dss_clkdm",
306 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
307 },
308 {
309 .clkdm_name = "l3_emif_clkdm",
310 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
311 },
312 {
313 .clkdm_name = "l3_gfx_clkdm",
314 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
315 },
316 {
317 .clkdm_name = "l3_init_clkdm",
318 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
319 },
320 {
321 .clkdm_name = "l4_cfg_clkdm",
322 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
323 },
324 {
325 .clkdm_name = "l4_per_clkdm",
326 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
327 },
328 {
329 .clkdm_name = "l4_secure_clkdm",
330 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
331 },
332 {
333 .clkdm_name = "l4_wkup_clkdm",
334 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
335 },
336 {
337 .clkdm_name = "tesla_clkdm",
338 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
339 },
340 { NULL },
341};
342
343static struct clkdm_dep tesla_wkup_sleep_deps[] = {
344 {
345 .clkdm_name = "abe_clkdm",
346 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
347 },
348 {
349 .clkdm_name = "ivahd_clkdm",
350 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
351 },
352 {
353 .clkdm_name = "l3_1_clkdm",
354 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
355 },
356 {
357 .clkdm_name = "l3_2_clkdm",
358 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
359 },
360 {
361 .clkdm_name = "l3_emif_clkdm",
362 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
363 },
364 {
365 .clkdm_name = "l3_init_clkdm",
366 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
367 },
368 {
369 .clkdm_name = "l4_cfg_clkdm",
370 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
371 },
372 {
373 .clkdm_name = "l4_per_clkdm",
374 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
375 },
376 {
377 .clkdm_name = "l4_wkup_clkdm",
378 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430)
379 },
380 { NULL },
381};
38 382
39static struct clockdomain l4_cefuse_44xx_clkdm = { 383static struct clockdomain l4_cefuse_44xx_clkdm = {
40 .name = "l4_cefuse_clkdm", 384 .name = "l4_cefuse_clkdm",
@@ -52,6 +396,7 @@ static struct clockdomain l4_cfg_44xx_clkdm = {
52 .prcm_partition = OMAP4430_CM2_PARTITION, 396 .prcm_partition = OMAP4430_CM2_PARTITION,
53 .cm_inst = OMAP4430_CM2_CORE_INST, 397 .cm_inst = OMAP4430_CM2_CORE_INST,
54 .clkdm_offs = OMAP4430_CM2_CORE_L4CFG_CDOFFS, 398 .clkdm_offs = OMAP4430_CM2_CORE_L4CFG_CDOFFS,
399 .dep_bit = OMAP4430_L4CFG_STATDEP_SHIFT,
55 .flags = CLKDM_CAN_HWSUP, 400 .flags = CLKDM_CAN_HWSUP,
56 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 401 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
57}; 402};
@@ -62,6 +407,9 @@ static struct clockdomain tesla_44xx_clkdm = {
62 .prcm_partition = OMAP4430_CM1_PARTITION, 407 .prcm_partition = OMAP4430_CM1_PARTITION,
63 .cm_inst = OMAP4430_CM1_TESLA_INST, 408 .cm_inst = OMAP4430_CM1_TESLA_INST,
64 .clkdm_offs = OMAP4430_CM1_TESLA_TESLA_CDOFFS, 409 .clkdm_offs = OMAP4430_CM1_TESLA_TESLA_CDOFFS,
410 .dep_bit = OMAP4430_TESLA_STATDEP_SHIFT,
411 .wkdep_srcs = tesla_wkup_sleep_deps,
412 .sleepdep_srcs = tesla_wkup_sleep_deps,
65 .flags = CLKDM_CAN_HWSUP_SWSUP, 413 .flags = CLKDM_CAN_HWSUP_SWSUP,
66 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 414 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
67}; 415};
@@ -72,6 +420,9 @@ static struct clockdomain l3_gfx_44xx_clkdm = {
72 .prcm_partition = OMAP4430_CM2_PARTITION, 420 .prcm_partition = OMAP4430_CM2_PARTITION,
73 .cm_inst = OMAP4430_CM2_GFX_INST, 421 .cm_inst = OMAP4430_CM2_GFX_INST,
74 .clkdm_offs = OMAP4430_CM2_GFX_GFX_CDOFFS, 422 .clkdm_offs = OMAP4430_CM2_GFX_GFX_CDOFFS,
423 .dep_bit = OMAP4430_GFX_STATDEP_SHIFT,
424 .wkdep_srcs = l3_gfx_wkup_sleep_deps,
425 .sleepdep_srcs = l3_gfx_wkup_sleep_deps,
75 .flags = CLKDM_CAN_HWSUP_SWSUP, 426 .flags = CLKDM_CAN_HWSUP_SWSUP,
76 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 427 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
77}; 428};
@@ -82,6 +433,9 @@ static struct clockdomain ivahd_44xx_clkdm = {
82 .prcm_partition = OMAP4430_CM2_PARTITION, 433 .prcm_partition = OMAP4430_CM2_PARTITION,
83 .cm_inst = OMAP4430_CM2_IVAHD_INST, 434 .cm_inst = OMAP4430_CM2_IVAHD_INST,
84 .clkdm_offs = OMAP4430_CM2_IVAHD_IVAHD_CDOFFS, 435 .clkdm_offs = OMAP4430_CM2_IVAHD_IVAHD_CDOFFS,
436 .dep_bit = OMAP4430_IVAHD_STATDEP_SHIFT,
437 .wkdep_srcs = ivahd_wkup_sleep_deps,
438 .sleepdep_srcs = ivahd_wkup_sleep_deps,
85 .flags = CLKDM_CAN_HWSUP_SWSUP, 439 .flags = CLKDM_CAN_HWSUP_SWSUP,
86 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 440 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
87}; 441};
@@ -92,6 +446,9 @@ static struct clockdomain l4_secure_44xx_clkdm = {
92 .prcm_partition = OMAP4430_CM2_PARTITION, 446 .prcm_partition = OMAP4430_CM2_PARTITION,
93 .cm_inst = OMAP4430_CM2_L4PER_INST, 447 .cm_inst = OMAP4430_CM2_L4PER_INST,
94 .clkdm_offs = OMAP4430_CM2_L4PER_L4SEC_CDOFFS, 448 .clkdm_offs = OMAP4430_CM2_L4PER_L4SEC_CDOFFS,
449 .dep_bit = OMAP4430_L4SEC_STATDEP_SHIFT,
450 .wkdep_srcs = l4_secure_wkup_sleep_deps,
451 .sleepdep_srcs = l4_secure_wkup_sleep_deps,
95 .flags = CLKDM_CAN_HWSUP_SWSUP, 452 .flags = CLKDM_CAN_HWSUP_SWSUP,
96 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 453 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
97}; 454};
@@ -102,6 +459,7 @@ static struct clockdomain l4_per_44xx_clkdm = {
102 .prcm_partition = OMAP4430_CM2_PARTITION, 459 .prcm_partition = OMAP4430_CM2_PARTITION,
103 .cm_inst = OMAP4430_CM2_L4PER_INST, 460 .cm_inst = OMAP4430_CM2_L4PER_INST,
104 .clkdm_offs = OMAP4430_CM2_L4PER_L4PER_CDOFFS, 461 .clkdm_offs = OMAP4430_CM2_L4PER_L4PER_CDOFFS,
462 .dep_bit = OMAP4430_L4PER_STATDEP_SHIFT,
105 .flags = CLKDM_CAN_HWSUP_SWSUP, 463 .flags = CLKDM_CAN_HWSUP_SWSUP,
106 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 464 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
107}; 465};
@@ -112,6 +470,7 @@ static struct clockdomain abe_44xx_clkdm = {
112 .prcm_partition = OMAP4430_CM1_PARTITION, 470 .prcm_partition = OMAP4430_CM1_PARTITION,
113 .cm_inst = OMAP4430_CM1_ABE_INST, 471 .cm_inst = OMAP4430_CM1_ABE_INST,
114 .clkdm_offs = OMAP4430_CM1_ABE_ABE_CDOFFS, 472 .clkdm_offs = OMAP4430_CM1_ABE_ABE_CDOFFS,
473 .dep_bit = OMAP4430_ABE_STATDEP_SHIFT,
115 .flags = CLKDM_CAN_HWSUP_SWSUP, 474 .flags = CLKDM_CAN_HWSUP_SWSUP,
116 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 475 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
117}; 476};
@@ -131,6 +490,9 @@ static struct clockdomain l3_init_44xx_clkdm = {
131 .prcm_partition = OMAP4430_CM2_PARTITION, 490 .prcm_partition = OMAP4430_CM2_PARTITION,
132 .cm_inst = OMAP4430_CM2_L3INIT_INST, 491 .cm_inst = OMAP4430_CM2_L3INIT_INST,
133 .clkdm_offs = OMAP4430_CM2_L3INIT_L3INIT_CDOFFS, 492 .clkdm_offs = OMAP4430_CM2_L3INIT_L3INIT_CDOFFS,
493 .dep_bit = OMAP4430_L3INIT_STATDEP_SHIFT,
494 .wkdep_srcs = l3_init_wkup_sleep_deps,
495 .sleepdep_srcs = l3_init_wkup_sleep_deps,
134 .flags = CLKDM_CAN_HWSUP_SWSUP, 496 .flags = CLKDM_CAN_HWSUP_SWSUP,
135 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 497 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
136}; 498};
@@ -141,6 +503,8 @@ static struct clockdomain mpuss_44xx_clkdm = {
141 .prcm_partition = OMAP4430_CM1_PARTITION, 503 .prcm_partition = OMAP4430_CM1_PARTITION,
142 .cm_inst = OMAP4430_CM1_MPU_INST, 504 .cm_inst = OMAP4430_CM1_MPU_INST,
143 .clkdm_offs = OMAP4430_CM1_MPU_MPU_CDOFFS, 505 .clkdm_offs = OMAP4430_CM1_MPU_MPU_CDOFFS,
506 .wkdep_srcs = mpuss_wkup_sleep_deps,
507 .sleepdep_srcs = mpuss_wkup_sleep_deps,
144 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 508 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
145 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 509 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
146}; 510};
@@ -150,7 +514,7 @@ static struct clockdomain mpu0_44xx_clkdm = {
150 .pwrdm = { .name = "cpu0_pwrdm" }, 514 .pwrdm = { .name = "cpu0_pwrdm" },
151 .prcm_partition = OMAP4430_PRCM_MPU_PARTITION, 515 .prcm_partition = OMAP4430_PRCM_MPU_PARTITION,
152 .cm_inst = OMAP4430_PRCM_MPU_CPU0_INST, 516 .cm_inst = OMAP4430_PRCM_MPU_CPU0_INST,
153 .clkdm_offs = OMAP4430_PRCM_MPU_CPU0_MPU_CDOFFS, 517 .clkdm_offs = OMAP4430_PRCM_MPU_CPU0_CPU0_CDOFFS,
154 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 518 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
155 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 519 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
156}; 520};
@@ -160,7 +524,7 @@ static struct clockdomain mpu1_44xx_clkdm = {
160 .pwrdm = { .name = "cpu1_pwrdm" }, 524 .pwrdm = { .name = "cpu1_pwrdm" },
161 .prcm_partition = OMAP4430_PRCM_MPU_PARTITION, 525 .prcm_partition = OMAP4430_PRCM_MPU_PARTITION,
162 .cm_inst = OMAP4430_PRCM_MPU_CPU1_INST, 526 .cm_inst = OMAP4430_PRCM_MPU_CPU1_INST,
163 .clkdm_offs = OMAP4430_PRCM_MPU_CPU1_MPU_CDOFFS, 527 .clkdm_offs = OMAP4430_PRCM_MPU_CPU1_CPU1_CDOFFS,
164 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 528 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
165 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 529 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
166}; 530};
@@ -171,6 +535,7 @@ static struct clockdomain l3_emif_44xx_clkdm = {
171 .prcm_partition = OMAP4430_CM2_PARTITION, 535 .prcm_partition = OMAP4430_CM2_PARTITION,
172 .cm_inst = OMAP4430_CM2_CORE_INST, 536 .cm_inst = OMAP4430_CM2_CORE_INST,
173 .clkdm_offs = OMAP4430_CM2_CORE_MEMIF_CDOFFS, 537 .clkdm_offs = OMAP4430_CM2_CORE_MEMIF_CDOFFS,
538 .dep_bit = OMAP4430_MEMIF_STATDEP_SHIFT,
174 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 539 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
175 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 540 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
176}; 541};
@@ -191,6 +556,9 @@ static struct clockdomain ducati_44xx_clkdm = {
191 .prcm_partition = OMAP4430_CM2_PARTITION, 556 .prcm_partition = OMAP4430_CM2_PARTITION,
192 .cm_inst = OMAP4430_CM2_CORE_INST, 557 .cm_inst = OMAP4430_CM2_CORE_INST,
193 .clkdm_offs = OMAP4430_CM2_CORE_DUCATI_CDOFFS, 558 .clkdm_offs = OMAP4430_CM2_CORE_DUCATI_CDOFFS,
559 .dep_bit = OMAP4430_DUCATI_STATDEP_SHIFT,
560 .wkdep_srcs = ducati_wkup_sleep_deps,
561 .sleepdep_srcs = ducati_wkup_sleep_deps,
194 .flags = CLKDM_CAN_HWSUP_SWSUP, 562 .flags = CLKDM_CAN_HWSUP_SWSUP,
195 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 563 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
196}; 564};
@@ -201,6 +569,7 @@ static struct clockdomain l3_2_44xx_clkdm = {
201 .prcm_partition = OMAP4430_CM2_PARTITION, 569 .prcm_partition = OMAP4430_CM2_PARTITION,
202 .cm_inst = OMAP4430_CM2_CORE_INST, 570 .cm_inst = OMAP4430_CM2_CORE_INST,
203 .clkdm_offs = OMAP4430_CM2_CORE_L3_2_CDOFFS, 571 .clkdm_offs = OMAP4430_CM2_CORE_L3_2_CDOFFS,
572 .dep_bit = OMAP4430_L3_2_STATDEP_SHIFT,
204 .flags = CLKDM_CAN_HWSUP, 573 .flags = CLKDM_CAN_HWSUP,
205 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 574 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
206}; 575};
@@ -211,6 +580,7 @@ static struct clockdomain l3_1_44xx_clkdm = {
211 .prcm_partition = OMAP4430_CM2_PARTITION, 580 .prcm_partition = OMAP4430_CM2_PARTITION,
212 .cm_inst = OMAP4430_CM2_CORE_INST, 581 .cm_inst = OMAP4430_CM2_CORE_INST,
213 .clkdm_offs = OMAP4430_CM2_CORE_L3_1_CDOFFS, 582 .clkdm_offs = OMAP4430_CM2_CORE_L3_1_CDOFFS,
583 .dep_bit = OMAP4430_L3_1_STATDEP_SHIFT,
214 .flags = CLKDM_CAN_HWSUP, 584 .flags = CLKDM_CAN_HWSUP,
215 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 585 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
216}; 586};
@@ -221,6 +591,8 @@ static struct clockdomain l3_d2d_44xx_clkdm = {
221 .prcm_partition = OMAP4430_CM2_PARTITION, 591 .prcm_partition = OMAP4430_CM2_PARTITION,
222 .cm_inst = OMAP4430_CM2_CORE_INST, 592 .cm_inst = OMAP4430_CM2_CORE_INST,
223 .clkdm_offs = OMAP4430_CM2_CORE_D2D_CDOFFS, 593 .clkdm_offs = OMAP4430_CM2_CORE_D2D_CDOFFS,
594 .wkdep_srcs = l3_d2d_wkup_sleep_deps,
595 .sleepdep_srcs = l3_d2d_wkup_sleep_deps,
224 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 596 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
225 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 597 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
226}; 598};
@@ -231,6 +603,8 @@ static struct clockdomain iss_44xx_clkdm = {
231 .prcm_partition = OMAP4430_CM2_PARTITION, 603 .prcm_partition = OMAP4430_CM2_PARTITION,
232 .cm_inst = OMAP4430_CM2_CAM_INST, 604 .cm_inst = OMAP4430_CM2_CAM_INST,
233 .clkdm_offs = OMAP4430_CM2_CAM_CAM_CDOFFS, 605 .clkdm_offs = OMAP4430_CM2_CAM_CAM_CDOFFS,
606 .wkdep_srcs = iss_wkup_sleep_deps,
607 .sleepdep_srcs = iss_wkup_sleep_deps,
234 .flags = CLKDM_CAN_HWSUP_SWSUP, 608 .flags = CLKDM_CAN_HWSUP_SWSUP,
235 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 609 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
236}; 610};
@@ -241,6 +615,9 @@ static struct clockdomain l3_dss_44xx_clkdm = {
241 .prcm_partition = OMAP4430_CM2_PARTITION, 615 .prcm_partition = OMAP4430_CM2_PARTITION,
242 .cm_inst = OMAP4430_CM2_DSS_INST, 616 .cm_inst = OMAP4430_CM2_DSS_INST,
243 .clkdm_offs = OMAP4430_CM2_DSS_DSS_CDOFFS, 617 .clkdm_offs = OMAP4430_CM2_DSS_DSS_CDOFFS,
618 .dep_bit = OMAP4430_DSS_STATDEP_SHIFT,
619 .wkdep_srcs = l3_dss_wkup_sleep_deps,
620 .sleepdep_srcs = l3_dss_wkup_sleep_deps,
244 .flags = CLKDM_CAN_HWSUP_SWSUP, 621 .flags = CLKDM_CAN_HWSUP_SWSUP,
245 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 622 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
246}; 623};
@@ -251,6 +628,7 @@ static struct clockdomain l4_wkup_44xx_clkdm = {
251 .prcm_partition = OMAP4430_PRM_PARTITION, 628 .prcm_partition = OMAP4430_PRM_PARTITION,
252 .cm_inst = OMAP4430_PRM_WKUP_CM_INST, 629 .cm_inst = OMAP4430_PRM_WKUP_CM_INST,
253 .clkdm_offs = OMAP4430_PRM_WKUP_CM_WKUP_CDOFFS, 630 .clkdm_offs = OMAP4430_PRM_WKUP_CM_WKUP_CDOFFS,
631 .dep_bit = OMAP4430_L4WKUP_STATDEP_SHIFT,
254 .flags = CLKDM_CAN_HWSUP, 632 .flags = CLKDM_CAN_HWSUP,
255 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 633 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
256}; 634};
@@ -271,6 +649,8 @@ static struct clockdomain l3_dma_44xx_clkdm = {
271 .prcm_partition = OMAP4430_CM2_PARTITION, 649 .prcm_partition = OMAP4430_CM2_PARTITION,
272 .cm_inst = OMAP4430_CM2_CORE_INST, 650 .cm_inst = OMAP4430_CM2_CORE_INST,
273 .clkdm_offs = OMAP4430_CM2_CORE_SDMA_CDOFFS, 651 .clkdm_offs = OMAP4430_CM2_CORE_SDMA_CDOFFS,
652 .wkdep_srcs = l3_dma_wkup_sleep_deps,
653 .sleepdep_srcs = l3_dma_wkup_sleep_deps,
274 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP, 654 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
275 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 655 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
276}; 656};
@@ -305,5 +685,5 @@ static struct clockdomain *clockdomains_omap44xx[] __initdata = {
305 685
306void __init omap44xx_clockdomains_init(void) 686void __init omap44xx_clockdomains_init(void)
307{ 687{
308 clkdm_init(clockdomains_omap44xx, NULL); 688 clkdm_init(clockdomains_omap44xx, NULL, &omap4_clkdm_operations);
309} 689}
diff --git a/arch/arm/mach-omap2/cm-regbits-24xx.h b/arch/arm/mach-omap2/cm-regbits-24xx.h
index d70660e82fe6..686290437568 100644
--- a/arch/arm/mach-omap2/cm-regbits-24xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-24xx.h
@@ -210,8 +210,11 @@
210#define OMAP24XX_AUTO_USB_MASK (1 << 0) 210#define OMAP24XX_AUTO_USB_MASK (1 << 0)
211 211
212/* CM_AUTOIDLE3_CORE */ 212/* CM_AUTOIDLE3_CORE */
213#define OMAP24XX_AUTO_SDRC_SHIFT 2
213#define OMAP24XX_AUTO_SDRC_MASK (1 << 2) 214#define OMAP24XX_AUTO_SDRC_MASK (1 << 2)
215#define OMAP24XX_AUTO_GPMC_SHIFT 1
214#define OMAP24XX_AUTO_GPMC_MASK (1 << 1) 216#define OMAP24XX_AUTO_GPMC_MASK (1 << 1)
217#define OMAP24XX_AUTO_SDMA_SHIFT 0
215#define OMAP24XX_AUTO_SDMA_MASK (1 << 0) 218#define OMAP24XX_AUTO_SDMA_MASK (1 << 0)
216 219
217/* CM_AUTOIDLE4_CORE */ 220/* CM_AUTOIDLE4_CORE */
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.c b/arch/arm/mach-omap2/cm2xxx_3xxx.c
index 96954aa48671..9d0dec806e92 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.c
@@ -25,6 +25,14 @@
25#include "cm-regbits-24xx.h" 25#include "cm-regbits-24xx.h"
26#include "cm-regbits-34xx.h" 26#include "cm-regbits-34xx.h"
27 27
28/* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */
29#define DPLL_AUTOIDLE_DISABLE 0x0
30#define OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP 0x3
31
32/* CM_AUTOIDLE_PLL.AUTO_* bit values for APLLs (OMAP2xxx only) */
33#define OMAP2XXX_APLL_AUTOIDLE_DISABLE 0x0
34#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3
35
28static const u8 cm_idlest_offs[] = { 36static const u8 cm_idlest_offs[] = {
29 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3 37 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3
30}; 38};
@@ -125,6 +133,67 @@ void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask)
125 _write_clktrctrl(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, module, mask); 133 _write_clktrctrl(OMAP34XX_CLKSTCTRL_FORCE_WAKEUP, module, mask);
126} 134}
127 135
136/*
137 * DPLL autoidle control
138 */
139
140static void _omap2xxx_set_dpll_autoidle(u8 m)
141{
142 u32 v;
143
144 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
145 v &= ~OMAP24XX_AUTO_DPLL_MASK;
146 v |= m << OMAP24XX_AUTO_DPLL_SHIFT;
147 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
148}
149
150void omap2xxx_cm_set_dpll_disable_autoidle(void)
151{
152 _omap2xxx_set_dpll_autoidle(OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP);
153}
154
155void omap2xxx_cm_set_dpll_auto_low_power_stop(void)
156{
157 _omap2xxx_set_dpll_autoidle(DPLL_AUTOIDLE_DISABLE);
158}
159
160/*
161 * APLL autoidle control
162 */
163
164static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask)
165{
166 u32 v;
167
168 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
169 v &= ~mask;
170 v |= m << __ffs(mask);
171 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
172}
173
174void omap2xxx_cm_set_apll54_disable_autoidle(void)
175{
176 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
177 OMAP24XX_AUTO_54M_MASK);
178}
179
180void omap2xxx_cm_set_apll54_auto_low_power_stop(void)
181{
182 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
183 OMAP24XX_AUTO_54M_MASK);
184}
185
186void omap2xxx_cm_set_apll96_disable_autoidle(void)
187{
188 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
189 OMAP24XX_AUTO_96M_MASK);
190}
191
192void omap2xxx_cm_set_apll96_auto_low_power_stop(void)
193{
194 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
195 OMAP24XX_AUTO_96M_MASK);
196}
128 197
129/* 198/*
130 * 199 *
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.h b/arch/arm/mach-omap2/cm2xxx_3xxx.h
index 5e9ea5bd60b9..088bbad73db5 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.h
@@ -122,6 +122,14 @@ extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
122extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask); 122extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask);
123extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask); 123extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask);
124 124
125extern void omap2xxx_cm_set_dpll_disable_autoidle(void);
126extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void);
127
128extern void omap2xxx_cm_set_apll54_disable_autoidle(void);
129extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void);
130extern void omap2xxx_cm_set_apll96_disable_autoidle(void);
131extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
132
125#endif 133#endif
126 134
127/* CM register bits shared between 24XX and 3430 */ 135/* CM register bits shared between 24XX and 3430 */
diff --git a/arch/arm/mach-omap2/cm44xx.h b/arch/arm/mach-omap2/cm44xx.h
index 48fc3f426fbd..0b87ec82b41c 100644
--- a/arch/arm/mach-omap2/cm44xx.h
+++ b/arch/arm/mach-omap2/cm44xx.h
@@ -21,6 +21,7 @@
21#include "cm.h" 21#include "cm.h"
22 22
23#define OMAP4_CM_CLKSTCTRL 0x0000 23#define OMAP4_CM_CLKSTCTRL 0x0000
24#define OMAP4_CM_STATICDEP 0x0004
24 25
25/* Function prototypes */ 26/* Function prototypes */
26# ifndef __ASSEMBLER__ 27# ifndef __ASSEMBLER__
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index c04bbbea17a5..a482bfa0a954 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -73,6 +73,27 @@ u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, s16 inst,
73 return v; 73 return v;
74} 74}
75 75
76u32 omap4_cminst_set_inst_reg_bits(u32 bits, u8 part, s16 inst, s16 idx)
77{
78 return omap4_cminst_rmw_inst_reg_bits(bits, bits, part, inst, idx);
79}
80
81u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, s16 inst, s16 idx)
82{
83 return omap4_cminst_rmw_inst_reg_bits(bits, 0x0, part, inst, idx);
84}
85
86u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx, u32 mask)
87{
88 u32 v;
89
90 v = omap4_cminst_read_inst_reg(part, inst, idx);
91 v &= mask;
92 v >>= __ffs(mask);
93
94 return v;
95}
96
76/* 97/*
77 * 98 *
78 */ 99 */
diff --git a/arch/arm/mach-omap2/cminst44xx.h b/arch/arm/mach-omap2/cminst44xx.h
index a6abd0a8cb82..2b32c181a2ee 100644
--- a/arch/arm/mach-omap2/cminst44xx.h
+++ b/arch/arm/mach-omap2/cminst44xx.h
@@ -25,6 +25,12 @@ extern u32 omap4_cminst_read_inst_reg(u8 part, s16 inst, u16 idx);
25extern void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx); 25extern void omap4_cminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx);
26extern u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part, 26extern u32 omap4_cminst_rmw_inst_reg_bits(u32 mask, u32 bits, u8 part,
27 s16 inst, s16 idx); 27 s16 inst, s16 idx);
28extern u32 omap4_cminst_set_inst_reg_bits(u32 bits, u8 part, s16 inst,
29 s16 idx);
30extern u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, s16 inst,
31 s16 idx);
32extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx,
33 u32 mask);
28 34
29extern int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg); 35extern int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg);
30 36
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index cba437dd002b..a44c52303405 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -100,14 +100,14 @@ static int omap3_idle_bm_check(void)
100static int _cpuidle_allow_idle(struct powerdomain *pwrdm, 100static int _cpuidle_allow_idle(struct powerdomain *pwrdm,
101 struct clockdomain *clkdm) 101 struct clockdomain *clkdm)
102{ 102{
103 omap2_clkdm_allow_idle(clkdm); 103 clkdm_allow_idle(clkdm);
104 return 0; 104 return 0;
105} 105}
106 106
107static int _cpuidle_deny_idle(struct powerdomain *pwrdm, 107static int _cpuidle_deny_idle(struct powerdomain *pwrdm,
108 struct clockdomain *clkdm) 108 struct clockdomain *clkdm)
109{ 109{
110 omap2_clkdm_deny_idle(clkdm); 110 clkdm_deny_idle(clkdm);
111 return 0; 111 return 0;
112} 112}
113 113
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c
new file mode 100644
index 000000000000..4e4da6160d05
--- /dev/null
+++ b/arch/arm/mach-omap2/dpll44xx.c
@@ -0,0 +1,84 @@
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 */
25int 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
44void 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
62void 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}
79
80const struct clkops clkops_omap4_dpllmx_ops = {
81 .allow_idle = omap4_dpllmx_allow_gatectrl,
82 .deny_idle = omap4_dpllmx_deny_gatectrl,
83};
84
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 657f3c84687c..441e79d043a7 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -356,15 +356,15 @@ void __init omap2_init_common_infrastructure(void)
356 356
357 if (cpu_is_omap242x()) { 357 if (cpu_is_omap242x()) {
358 omap2xxx_powerdomains_init(); 358 omap2xxx_powerdomains_init();
359 omap2_clockdomains_init(); 359 omap2xxx_clockdomains_init();
360 omap2420_hwmod_init(); 360 omap2420_hwmod_init();
361 } else if (cpu_is_omap243x()) { 361 } else if (cpu_is_omap243x()) {
362 omap2xxx_powerdomains_init(); 362 omap2xxx_powerdomains_init();
363 omap2_clockdomains_init(); 363 omap2xxx_clockdomains_init();
364 omap2430_hwmod_init(); 364 omap2430_hwmod_init();
365 } else if (cpu_is_omap34xx()) { 365 } else if (cpu_is_omap34xx()) {
366 omap3xxx_powerdomains_init(); 366 omap3xxx_powerdomains_init();
367 omap2_clockdomains_init(); 367 omap3xxx_clockdomains_init();
368 omap3xxx_hwmod_init(); 368 omap3xxx_hwmod_init();
369 } else if (cpu_is_omap44xx()) { 369 } else if (cpu_is_omap44xx()) {
370 omap44xx_powerdomains_init(); 370 omap44xx_powerdomains_init();
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 1125134c9a7f..4c8329e4e6e1 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -370,7 +370,7 @@ static int _set_module_autoidle(struct omap_hwmod *oh, u8 autoidle,
370 } 370 }
371 371
372 autoidle_shift = oh->class->sysc->sysc_fields->autoidle_shift; 372 autoidle_shift = oh->class->sysc->sysc_fields->autoidle_shift;
373 autoidle_mask = (0x3 << autoidle_shift); 373 autoidle_mask = (0x1 << autoidle_shift);
374 374
375 *v &= ~autoidle_mask; 375 *v &= ~autoidle_mask;
376 *v |= autoidle << autoidle_shift; 376 *v |= autoidle << autoidle_shift;
@@ -457,14 +457,18 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
457 * will be accessed by a particular initiator (e.g., if a module will 457 * will be accessed by a particular initiator (e.g., if a module will
458 * be accessed by the IVA, there should be a sleepdep between the IVA 458 * be accessed by the IVA, there should be a sleepdep between the IVA
459 * initiator and the module). Only applies to modules in smart-idle 459 * initiator and the module). Only applies to modules in smart-idle
460 * mode. Returns -EINVAL upon error or passes along 460 * mode. If the clockdomain is marked as not needing autodeps, return
461 * clkdm_add_sleepdep() value upon success. 461 * 0 without doing anything. Otherwise, returns -EINVAL upon error or
462 * passes along clkdm_add_sleepdep() value upon success.
462 */ 463 */
463static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) 464static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
464{ 465{
465 if (!oh->_clk) 466 if (!oh->_clk)
466 return -EINVAL; 467 return -EINVAL;
467 468
469 if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS)
470 return 0;
471
468 return clkdm_add_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); 472 return clkdm_add_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm);
469} 473}
470 474
@@ -477,14 +481,18 @@ static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
477 * be accessed by a particular initiator (e.g., if a module will not 481 * be accessed by a particular initiator (e.g., if a module will not
478 * be accessed by the IVA, there should be no sleepdep between the IVA 482 * be accessed by the IVA, there should be no sleepdep between the IVA
479 * initiator and the module). Only applies to modules in smart-idle 483 * initiator and the module). Only applies to modules in smart-idle
480 * mode. Returns -EINVAL upon error or passes along 484 * mode. If the clockdomain is marked as not needing autodeps, return
481 * clkdm_del_sleepdep() value upon success. 485 * 0 without doing anything. Returns -EINVAL upon error or passes
486 * along clkdm_del_sleepdep() value upon success.
482 */ 487 */
483static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) 488static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
484{ 489{
485 if (!oh->_clk) 490 if (!oh->_clk)
486 return -EINVAL; 491 return -EINVAL;
487 492
493 if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS)
494 return 0;
495
488 return clkdm_del_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); 496 return clkdm_del_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm);
489} 497}
490 498
@@ -921,7 +929,7 @@ static int _init_clocks(struct omap_hwmod *oh, void *data)
921 if (!ret) 929 if (!ret)
922 oh->_state = _HWMOD_STATE_CLKS_INITED; 930 oh->_state = _HWMOD_STATE_CLKS_INITED;
923 931
924 return 0; 932 return ret;
925} 933}
926 934
927/** 935/**
@@ -967,25 +975,29 @@ static int _wait_target_ready(struct omap_hwmod *oh)
967} 975}
968 976
969/** 977/**
970 * _lookup_hardreset - return the register bit shift for this hwmod/reset line 978 * _lookup_hardreset - fill register bit info for this hwmod/reset line
971 * @oh: struct omap_hwmod * 979 * @oh: struct omap_hwmod *
972 * @name: name of the reset line in the context of this hwmod 980 * @name: name of the reset line in the context of this hwmod
981 * @ohri: struct omap_hwmod_rst_info * that this function will fill in
973 * 982 *
974 * Return the bit position of the reset line that match the 983 * Return the bit position of the reset line that match the
975 * input name. Return -ENOENT if not found. 984 * input name. Return -ENOENT if not found.
976 */ 985 */
977static u8 _lookup_hardreset(struct omap_hwmod *oh, const char *name) 986static u8 _lookup_hardreset(struct omap_hwmod *oh, const char *name,
987 struct omap_hwmod_rst_info *ohri)
978{ 988{
979 int i; 989 int i;
980 990
981 for (i = 0; i < oh->rst_lines_cnt; i++) { 991 for (i = 0; i < oh->rst_lines_cnt; i++) {
982 const char *rst_line = oh->rst_lines[i].name; 992 const char *rst_line = oh->rst_lines[i].name;
983 if (!strcmp(rst_line, name)) { 993 if (!strcmp(rst_line, name)) {
984 u8 shift = oh->rst_lines[i].rst_shift; 994 ohri->rst_shift = oh->rst_lines[i].rst_shift;
985 pr_debug("omap_hwmod: %s: _lookup_hardreset: %s: %d\n", 995 ohri->st_shift = oh->rst_lines[i].st_shift;
986 oh->name, rst_line, shift); 996 pr_debug("omap_hwmod: %s: %s: %s: rst %d st %d\n",
997 oh->name, __func__, rst_line, ohri->rst_shift,
998 ohri->st_shift);
987 999
988 return shift; 1000 return 0;
989 } 1001 }
990 } 1002 }
991 1003
@@ -1004,21 +1016,22 @@ static u8 _lookup_hardreset(struct omap_hwmod *oh, const char *name)
1004 */ 1016 */
1005static int _assert_hardreset(struct omap_hwmod *oh, const char *name) 1017static int _assert_hardreset(struct omap_hwmod *oh, const char *name)
1006{ 1018{
1007 u8 shift; 1019 struct omap_hwmod_rst_info ohri;
1020 u8 ret;
1008 1021
1009 if (!oh) 1022 if (!oh)
1010 return -EINVAL; 1023 return -EINVAL;
1011 1024
1012 shift = _lookup_hardreset(oh, name); 1025 ret = _lookup_hardreset(oh, name, &ohri);
1013 if (IS_ERR_VALUE(shift)) 1026 if (IS_ERR_VALUE(ret))
1014 return shift; 1027 return ret;
1015 1028
1016 if (cpu_is_omap24xx() || cpu_is_omap34xx()) 1029 if (cpu_is_omap24xx() || cpu_is_omap34xx())
1017 return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs, 1030 return omap2_prm_assert_hardreset(oh->prcm.omap2.module_offs,
1018 shift); 1031 ohri.rst_shift);
1019 else if (cpu_is_omap44xx()) 1032 else if (cpu_is_omap44xx())
1020 return omap4_prm_assert_hardreset(oh->prcm.omap4.rstctrl_reg, 1033 return omap4_prm_assert_hardreset(oh->prcm.omap4.rstctrl_reg,
1021 shift); 1034 ohri.rst_shift);
1022 else 1035 else
1023 return -EINVAL; 1036 return -EINVAL;
1024} 1037}
@@ -1035,29 +1048,34 @@ static int _assert_hardreset(struct omap_hwmod *oh, const char *name)
1035 */ 1048 */
1036static int _deassert_hardreset(struct omap_hwmod *oh, const char *name) 1049static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
1037{ 1050{
1038 u8 shift; 1051 struct omap_hwmod_rst_info ohri;
1039 int r; 1052 int ret;
1040 1053
1041 if (!oh) 1054 if (!oh)
1042 return -EINVAL; 1055 return -EINVAL;
1043 1056
1044 shift = _lookup_hardreset(oh, name); 1057 ret = _lookup_hardreset(oh, name, &ohri);
1045 if (IS_ERR_VALUE(shift)) 1058 if (IS_ERR_VALUE(ret))
1046 return shift; 1059 return ret;
1047 1060
1048 if (cpu_is_omap24xx() || cpu_is_omap34xx()) 1061 if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
1049 r = omap2_prm_deassert_hardreset(oh->prcm.omap2.module_offs, 1062 ret = omap2_prm_deassert_hardreset(oh->prcm.omap2.module_offs,
1050 shift); 1063 ohri.rst_shift,
1051 else if (cpu_is_omap44xx()) 1064 ohri.st_shift);
1052 r = omap4_prm_deassert_hardreset(oh->prcm.omap4.rstctrl_reg, 1065 } else if (cpu_is_omap44xx()) {
1053 shift); 1066 if (ohri.st_shift)
1054 else 1067 pr_err("omap_hwmod: %s: %s: hwmod data error: OMAP4 does not support st_shift\n",
1068 oh->name, name);
1069 ret = omap4_prm_deassert_hardreset(oh->prcm.omap4.rstctrl_reg,
1070 ohri.rst_shift);
1071 } else {
1055 return -EINVAL; 1072 return -EINVAL;
1073 }
1056 1074
1057 if (r == -EBUSY) 1075 if (ret == -EBUSY)
1058 pr_warning("omap_hwmod: %s: failed to hardreset\n", oh->name); 1076 pr_warning("omap_hwmod: %s: failed to hardreset\n", oh->name);
1059 1077
1060 return r; 1078 return ret;
1061} 1079}
1062 1080
1063/** 1081/**
@@ -1070,21 +1088,22 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name)
1070 */ 1088 */
1071static int _read_hardreset(struct omap_hwmod *oh, const char *name) 1089static int _read_hardreset(struct omap_hwmod *oh, const char *name)
1072{ 1090{
1073 u8 shift; 1091 struct omap_hwmod_rst_info ohri;
1092 u8 ret;
1074 1093
1075 if (!oh) 1094 if (!oh)
1076 return -EINVAL; 1095 return -EINVAL;
1077 1096
1078 shift = _lookup_hardreset(oh, name); 1097 ret = _lookup_hardreset(oh, name, &ohri);
1079 if (IS_ERR_VALUE(shift)) 1098 if (IS_ERR_VALUE(ret))
1080 return shift; 1099 return ret;
1081 1100
1082 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 1101 if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
1083 return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs, 1102 return omap2_prm_is_hardreset_asserted(oh->prcm.omap2.module_offs,
1084 shift); 1103 ohri.st_shift);
1085 } else if (cpu_is_omap44xx()) { 1104 } else if (cpu_is_omap44xx()) {
1086 return omap4_prm_is_hardreset_asserted(oh->prcm.omap4.rstctrl_reg, 1105 return omap4_prm_is_hardreset_asserted(oh->prcm.omap4.rstctrl_reg,
1087 shift); 1106 ohri.rst_shift);
1088 } else { 1107 } else {
1089 return -EINVAL; 1108 return -EINVAL;
1090 } 1109 }
@@ -1283,6 +1302,42 @@ static int _idle(struct omap_hwmod *oh)
1283} 1302}
1284 1303
1285/** 1304/**
1305 * omap_hwmod_set_ocp_autoidle - set the hwmod's OCP autoidle bit
1306 * @oh: struct omap_hwmod *
1307 * @autoidle: desired AUTOIDLE bitfield value (0 or 1)
1308 *
1309 * Sets the IP block's OCP autoidle bit in hardware, and updates our
1310 * local copy. Intended to be used by drivers that require
1311 * direct manipulation of the AUTOIDLE bits.
1312 * Returns -EINVAL if @oh is null or is not in the ENABLED state, or passes
1313 * along the return value from _set_module_autoidle().
1314 *
1315 * Any users of this function should be scrutinized carefully.
1316 */
1317int omap_hwmod_set_ocp_autoidle(struct omap_hwmod *oh, u8 autoidle)
1318{
1319 u32 v;
1320 int retval = 0;
1321 unsigned long flags;
1322
1323 if (!oh || oh->_state != _HWMOD_STATE_ENABLED)
1324 return -EINVAL;
1325
1326 spin_lock_irqsave(&oh->_lock, flags);
1327
1328 v = oh->_sysc_cache;
1329
1330 retval = _set_module_autoidle(oh, autoidle, &v);
1331
1332 if (!retval)
1333 _write_sysconfig(v, oh);
1334
1335 spin_unlock_irqrestore(&oh->_lock, flags);
1336
1337 return retval;
1338}
1339
1340/**
1286 * _shutdown - shutdown an omap_hwmod 1341 * _shutdown - shutdown an omap_hwmod
1287 * @oh: struct omap_hwmod * 1342 * @oh: struct omap_hwmod *
1288 * 1343 *
@@ -2286,3 +2341,29 @@ u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh)
2286 2341
2287 return ret; 2342 return ret;
2288} 2343}
2344
2345/**
2346 * omap_hwmod_no_setup_reset - prevent a hwmod from being reset upon setup
2347 * @oh: struct omap_hwmod *
2348 *
2349 * Prevent the hwmod @oh from being reset during the setup process.
2350 * Intended for use by board-*.c files on boards with devices that
2351 * cannot tolerate being reset. Must be called before the hwmod has
2352 * been set up. Returns 0 upon success or negative error code upon
2353 * failure.
2354 */
2355int omap_hwmod_no_setup_reset(struct omap_hwmod *oh)
2356{
2357 if (!oh)
2358 return -EINVAL;
2359
2360 if (oh->_state != _HWMOD_STATE_REGISTERED) {
2361 pr_err("omap_hwmod: %s: cannot prevent setup reset; in wrong state\n",
2362 oh->name);
2363 return -EINVAL;
2364 }
2365
2366 oh->flags |= HWMOD_INIT_NO_RESET;
2367
2368 return 0;
2369}
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 61e58bd27aec..62823467163b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -988,7 +988,7 @@ static struct omap_hwmod_class_sysconfig omap2420_wd_timer_sysc = {
988 .sysc_offs = 0x0010, 988 .sysc_offs = 0x0010,
989 .syss_offs = 0x0014, 989 .syss_offs = 0x0014,
990 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SOFTRESET | 990 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SOFTRESET |
991 SYSC_HAS_AUTOIDLE), 991 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
992 .sysc_fields = &omap_hwmod_sysc_type1, 992 .sysc_fields = &omap_hwmod_sysc_type1,
993}; 993};
994 994
@@ -1029,7 +1029,7 @@ static struct omap_hwmod_class_sysconfig uart_sysc = {
1029 .syss_offs = 0x58, 1029 .syss_offs = 0x58,
1030 .sysc_flags = (SYSC_HAS_SIDLEMODE | 1030 .sysc_flags = (SYSC_HAS_SIDLEMODE |
1031 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | 1031 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
1032 SYSC_HAS_AUTOIDLE), 1032 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
1033 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 1033 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1034 .sysc_fields = &omap_hwmod_sysc_type1, 1034 .sysc_fields = &omap_hwmod_sysc_type1,
1035}; 1035};
@@ -1441,7 +1441,7 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = {
1441 .rev_offs = 0x00, 1441 .rev_offs = 0x00,
1442 .sysc_offs = 0x20, 1442 .sysc_offs = 0x20,
1443 .syss_offs = 0x10, 1443 .syss_offs = 0x10,
1444 .sysc_flags = SYSC_HAS_SOFTRESET, 1444 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
1445 .sysc_fields = &omap_hwmod_sysc_type1, 1445 .sysc_fields = &omap_hwmod_sysc_type1,
1446}; 1446};
1447 1447
@@ -1613,7 +1613,8 @@ static struct omap_hwmod_class_sysconfig omap242x_gpio_sysc = {
1613 .sysc_offs = 0x0010, 1613 .sysc_offs = 0x0010,
1614 .syss_offs = 0x0014, 1614 .syss_offs = 0x0014,
1615 .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE | 1615 .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
1616 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE), 1616 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
1617 SYSS_HAS_RESET_STATUS),
1617 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 1618 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1618 .sysc_fields = &omap_hwmod_sysc_type1, 1619 .sysc_fields = &omap_hwmod_sysc_type1,
1619}; 1620};
@@ -1755,7 +1756,7 @@ static struct omap_hwmod_class_sysconfig omap2420_dma_sysc = {
1755 .syss_offs = 0x0028, 1756 .syss_offs = 0x0028,
1756 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_MIDLEMODE | 1757 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_MIDLEMODE |
1757 SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_EMUFREE | 1758 SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_EMUFREE |
1758 SYSC_HAS_AUTOIDLE), 1759 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
1759 .idlemodes = (MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART), 1760 .idlemodes = (MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
1760 .sysc_fields = &omap_hwmod_sysc_type1, 1761 .sysc_fields = &omap_hwmod_sysc_type1,
1761}; 1762};
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 490789a6bed0..0fdf2cabfb12 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -1088,7 +1088,7 @@ static struct omap_hwmod_class_sysconfig omap2430_wd_timer_sysc = {
1088 .sysc_offs = 0x0010, 1088 .sysc_offs = 0x0010,
1089 .syss_offs = 0x0014, 1089 .syss_offs = 0x0014,
1090 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SOFTRESET | 1090 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SOFTRESET |
1091 SYSC_HAS_AUTOIDLE), 1091 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
1092 .sysc_fields = &omap_hwmod_sysc_type1, 1092 .sysc_fields = &omap_hwmod_sysc_type1,
1093}; 1093};
1094 1094
@@ -1129,7 +1129,7 @@ static struct omap_hwmod_class_sysconfig uart_sysc = {
1129 .syss_offs = 0x58, 1129 .syss_offs = 0x58,
1130 .sysc_flags = (SYSC_HAS_SIDLEMODE | 1130 .sysc_flags = (SYSC_HAS_SIDLEMODE |
1131 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | 1131 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
1132 SYSC_HAS_AUTOIDLE), 1132 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
1133 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 1133 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1134 .sysc_fields = &omap_hwmod_sysc_type1, 1134 .sysc_fields = &omap_hwmod_sysc_type1,
1135}; 1135};
@@ -1516,7 +1516,8 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = {
1516 .rev_offs = 0x00, 1516 .rev_offs = 0x00,
1517 .sysc_offs = 0x20, 1517 .sysc_offs = 0x20,
1518 .syss_offs = 0x10, 1518 .syss_offs = 0x10,
1519 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE), 1519 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
1520 SYSS_HAS_RESET_STATUS),
1520 .sysc_fields = &omap_hwmod_sysc_type1, 1521 .sysc_fields = &omap_hwmod_sysc_type1,
1521}; 1522};
1522 1523
@@ -1714,7 +1715,8 @@ static struct omap_hwmod_class_sysconfig omap243x_gpio_sysc = {
1714 .sysc_offs = 0x0010, 1715 .sysc_offs = 0x0010,
1715 .syss_offs = 0x0014, 1716 .syss_offs = 0x0014,
1716 .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE | 1717 .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
1717 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE), 1718 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
1719 SYSS_HAS_RESET_STATUS),
1718 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 1720 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1719 .sysc_fields = &omap_hwmod_sysc_type1, 1721 .sysc_fields = &omap_hwmod_sysc_type1,
1720}; 1722};
@@ -1886,7 +1888,7 @@ static struct omap_hwmod_class_sysconfig omap2430_dma_sysc = {
1886 .syss_offs = 0x0028, 1888 .syss_offs = 0x0028,
1887 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_MIDLEMODE | 1889 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_MIDLEMODE |
1888 SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_EMUFREE | 1890 SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_EMUFREE |
1889 SYSC_HAS_AUTOIDLE), 1891 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
1890 .idlemodes = (MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART), 1892 .idlemodes = (MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
1891 .sysc_fields = &omap_hwmod_sysc_type1, 1893 .sysc_fields = &omap_hwmod_sysc_type1,
1892}; 1894};
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index c4ca005f8bb5..c819c306693a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -23,7 +23,6 @@
23#include <plat/i2c.h> 23#include <plat/i2c.h>
24#include <plat/gpio.h> 24#include <plat/gpio.h>
25#include <plat/mmc.h> 25#include <plat/mmc.h>
26#include <plat/smartreflex.h>
27#include <plat/mcbsp.h> 26#include <plat/mcbsp.h>
28#include <plat/mcspi.h> 27#include <plat/mcspi.h>
29#include <plat/dmtimer.h> 28#include <plat/dmtimer.h>
@@ -491,26 +490,12 @@ static struct omap_hwmod_ocp_if *am35xx_usbhsotg_slaves[] = {
491/* Slave interfaces on the L4_CORE interconnect */ 490/* Slave interfaces on the L4_CORE interconnect */
492static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = { 491static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = {
493 &omap3xxx_l3_main__l4_core, 492 &omap3xxx_l3_main__l4_core,
494 &omap3_l4_core__sr1,
495 &omap3_l4_core__sr2,
496};
497
498/* Master interfaces on the L4_CORE interconnect */
499static struct omap_hwmod_ocp_if *omap3xxx_l4_core_masters[] = {
500 &omap3xxx_l4_core__l4_wkup,
501 &omap3_l4_core__uart1,
502 &omap3_l4_core__uart2,
503 &omap3_l4_core__i2c1,
504 &omap3_l4_core__i2c2,
505 &omap3_l4_core__i2c3,
506}; 493};
507 494
508/* L4 CORE */ 495/* L4 CORE */
509static struct omap_hwmod omap3xxx_l4_core_hwmod = { 496static struct omap_hwmod omap3xxx_l4_core_hwmod = {
510 .name = "l4_core", 497 .name = "l4_core",
511 .class = &l4_hwmod_class, 498 .class = &l4_hwmod_class,
512 .masters = omap3xxx_l4_core_masters,
513 .masters_cnt = ARRAY_SIZE(omap3xxx_l4_core_masters),
514 .slaves = omap3xxx_l4_core_slaves, 499 .slaves = omap3xxx_l4_core_slaves,
515 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_core_slaves), 500 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_core_slaves),
516 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), 501 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
@@ -522,18 +507,10 @@ static struct omap_hwmod_ocp_if *omap3xxx_l4_per_slaves[] = {
522 &omap3xxx_l3_main__l4_per, 507 &omap3xxx_l3_main__l4_per,
523}; 508};
524 509
525/* Master interfaces on the L4_PER interconnect */
526static struct omap_hwmod_ocp_if *omap3xxx_l4_per_masters[] = {
527 &omap3_l4_per__uart3,
528 &omap3_l4_per__uart4,
529};
530
531/* L4 PER */ 510/* L4 PER */
532static struct omap_hwmod omap3xxx_l4_per_hwmod = { 511static struct omap_hwmod omap3xxx_l4_per_hwmod = {
533 .name = "l4_per", 512 .name = "l4_per",
534 .class = &l4_hwmod_class, 513 .class = &l4_hwmod_class,
535 .masters = omap3xxx_l4_per_masters,
536 .masters_cnt = ARRAY_SIZE(omap3xxx_l4_per_masters),
537 .slaves = omap3xxx_l4_per_slaves, 514 .slaves = omap3xxx_l4_per_slaves,
538 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_per_slaves), 515 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_per_slaves),
539 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), 516 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
@@ -545,16 +522,10 @@ static struct omap_hwmod_ocp_if *omap3xxx_l4_wkup_slaves[] = {
545 &omap3xxx_l4_core__l4_wkup, 522 &omap3xxx_l4_core__l4_wkup,
546}; 523};
547 524
548/* Master interfaces on the L4_WKUP interconnect */
549static struct omap_hwmod_ocp_if *omap3xxx_l4_wkup_masters[] = {
550};
551
552/* L4 WKUP */ 525/* L4 WKUP */
553static struct omap_hwmod omap3xxx_l4_wkup_hwmod = { 526static struct omap_hwmod omap3xxx_l4_wkup_hwmod = {
554 .name = "l4_wkup", 527 .name = "l4_wkup",
555 .class = &l4_hwmod_class, 528 .class = &l4_hwmod_class,
556 .masters = omap3xxx_l4_wkup_masters,
557 .masters_cnt = ARRAY_SIZE(omap3xxx_l4_wkup_masters),
558 .slaves = omap3xxx_l4_wkup_slaves, 529 .slaves = omap3xxx_l4_wkup_slaves,
559 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_wkup_slaves), 530 .slaves_cnt = ARRAY_SIZE(omap3xxx_l4_wkup_slaves),
560 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), 531 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
@@ -1268,7 +1239,8 @@ static struct omap_hwmod_class_sysconfig omap3xxx_wd_timer_sysc = {
1268 .syss_offs = 0x0014, 1239 .syss_offs = 0x0014,
1269 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_EMUFREE | 1240 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_EMUFREE |
1270 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | 1241 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
1271 SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY), 1242 SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
1243 SYSS_HAS_RESET_STATUS),
1272 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 1244 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1273 .sysc_fields = &omap_hwmod_sysc_type1, 1245 .sysc_fields = &omap_hwmod_sysc_type1,
1274}; 1246};
@@ -1280,7 +1252,7 @@ static struct omap_hwmod_class_sysconfig i2c_sysc = {
1280 .syss_offs = 0x10, 1252 .syss_offs = 0x10,
1281 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | 1253 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
1282 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | 1254 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
1283 SYSC_HAS_AUTOIDLE), 1255 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
1284 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 1256 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1285 .sysc_fields = &omap_hwmod_sysc_type1, 1257 .sysc_fields = &omap_hwmod_sysc_type1,
1286}; 1258};
@@ -1312,6 +1284,11 @@ static struct omap_hwmod omap3xxx_wd_timer2_hwmod = {
1312 .slaves = omap3xxx_wd_timer2_slaves, 1284 .slaves = omap3xxx_wd_timer2_slaves,
1313 .slaves_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_slaves), 1285 .slaves_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_slaves),
1314 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), 1286 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
1287 /*
1288 * XXX: Use software supervised mode, HW supervised smartidle seems to
1289 * block CORE power domain idle transitions. Maybe a HW bug in wdt2?
1290 */
1291 .flags = HWMOD_SWSUP_SIDLE,
1315}; 1292};
1316 1293
1317/* UART common */ 1294/* UART common */
@@ -1322,7 +1299,7 @@ static struct omap_hwmod_class_sysconfig uart_sysc = {
1322 .syss_offs = 0x58, 1299 .syss_offs = 0x58,
1323 .sysc_flags = (SYSC_HAS_SIDLEMODE | 1300 .sysc_flags = (SYSC_HAS_SIDLEMODE |
1324 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | 1301 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
1325 SYSC_HAS_AUTOIDLE), 1302 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
1326 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 1303 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1327 .sysc_fields = &omap_hwmod_sysc_type1, 1304 .sysc_fields = &omap_hwmod_sysc_type1,
1328}; 1305};
@@ -2128,7 +2105,8 @@ static struct omap_hwmod_class_sysconfig omap3xxx_gpio_sysc = {
2128 .sysc_offs = 0x0010, 2105 .sysc_offs = 0x0010,
2129 .syss_offs = 0x0014, 2106 .syss_offs = 0x0014,
2130 .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE | 2107 .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
2131 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE), 2108 SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
2109 SYSS_HAS_RESET_STATUS),
2132 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 2110 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
2133 .sysc_fields = &omap_hwmod_sysc_type1, 2111 .sysc_fields = &omap_hwmod_sysc_type1,
2134}; 2112};
@@ -2382,7 +2360,8 @@ static struct omap_hwmod_class_sysconfig omap3xxx_dma_sysc = {
2382 .syss_offs = 0x0028, 2360 .syss_offs = 0x0028,
2383 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET | 2361 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
2384 SYSC_HAS_MIDLEMODE | SYSC_HAS_CLOCKACTIVITY | 2362 SYSC_HAS_MIDLEMODE | SYSC_HAS_CLOCKACTIVITY |
2385 SYSC_HAS_EMUFREE | SYSC_HAS_AUTOIDLE), 2363 SYSC_HAS_EMUFREE | SYSC_HAS_AUTOIDLE |
2364 SYSS_HAS_RESET_STATUS),
2386 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 2365 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
2387 MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART), 2366 MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
2388 .sysc_fields = &omap_hwmod_sysc_type1, 2367 .sysc_fields = &omap_hwmod_sysc_type1,
diff --git a/arch/arm/mach-omap2/omap_opp_data.h b/arch/arm/mach-omap2/omap_opp_data.h
index 46ac27dd6c84..c784c12f98a1 100644
--- a/arch/arm/mach-omap2/omap_opp_data.h
+++ b/arch/arm/mach-omap2/omap_opp_data.h
@@ -21,6 +21,8 @@
21 21
22#include <plat/omap_hwmod.h> 22#include <plat/omap_hwmod.h>
23 23
24#include "voltage.h"
25
24/* 26/*
25 * *BIG FAT WARNING*: 27 * *BIG FAT WARNING*:
26 * USE the following ONLY in opp data initialization common to an SoC. 28 * USE the following ONLY in opp data initialization common to an SoC.
@@ -65,8 +67,30 @@ struct omap_opp_def {
65 .u_volt = _uv, \ 67 .u_volt = _uv, \
66} 68}
67 69
70/*
71 * Initialization wrapper used to define SmartReflex process data
72 * XXX Is this needed? Just use C99 initializers in data files?
73 */
74#define VOLT_DATA_DEFINE(_v_nom, _efuse_offs, _errminlimit, _errgain) \
75{ \
76 .volt_nominal = _v_nom, \
77 .sr_efuse_offs = _efuse_offs, \
78 .sr_errminlimit = _errminlimit, \
79 .vp_errgain = _errgain \
80}
81
68/* Use this to initialize the default table */ 82/* Use this to initialize the default table */
69extern int __init omap_init_opp_table(struct omap_opp_def *opp_def, 83extern int __init omap_init_opp_table(struct omap_opp_def *opp_def,
70 u32 opp_def_size); 84 u32 opp_def_size);
71 85
86
87extern struct omap_volt_data omap34xx_vddmpu_volt_data[];
88extern struct omap_volt_data omap34xx_vddcore_volt_data[];
89extern struct omap_volt_data omap36xx_vddmpu_volt_data[];
90extern struct omap_volt_data omap36xx_vddcore_volt_data[];
91
92extern struct omap_volt_data omap44xx_vdd_mpu_volt_data[];
93extern struct omap_volt_data omap44xx_vdd_iva_volt_data[];
94extern struct omap_volt_data omap44xx_vdd_core_volt_data[];
95
72#endif /* __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H */ 96#endif /* __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H */
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index b341c36a93f3..0a8e74e3e811 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -18,7 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/i2c/twl.h> 19#include <linux/i2c/twl.h>
20 20
21#include <plat/voltage.h> 21#include "voltage.h"
22 22
23#include "pm.h" 23#include "pm.h"
24 24
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c
index fd3a1af8d51e..d2bd1bd83bf0 100644
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -4,8 +4,9 @@
4 * Copyright (C) 2009-2010 Texas Instruments Incorporated - http://www.ti.com/ 4 * Copyright (C) 2009-2010 Texas Instruments Incorporated - http://www.ti.com/
5 * Nishanth Menon 5 * Nishanth Menon
6 * Kevin Hilman 6 * Kevin Hilman
7 * Copyright (C) 2010 Nokia Corporation. 7 * Copyright (C) 2010-2011 Nokia Corporation.
8 * Eduardo Valentin 8 * Eduardo Valentin
9 * Paul Walmsley
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
@@ -20,9 +21,72 @@
20 21
21#include <plat/cpu.h> 22#include <plat/cpu.h>
22 23
24#include "control.h"
23#include "omap_opp_data.h" 25#include "omap_opp_data.h"
24#include "pm.h" 26#include "pm.h"
25 27
28/* 34xx */
29
30/* VDD1 */
31
32#define OMAP3430_VDD_MPU_OPP1_UV 975000
33#define OMAP3430_VDD_MPU_OPP2_UV 1075000
34#define OMAP3430_VDD_MPU_OPP3_UV 1200000
35#define OMAP3430_VDD_MPU_OPP4_UV 1270000
36#define OMAP3430_VDD_MPU_OPP5_UV 1350000
37
38struct omap_volt_data omap34xx_vddmpu_volt_data[] = {
39 VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD1, 0xf4, 0x0c),
40 VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD1, 0xf4, 0x0c),
41 VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD1, 0xf9, 0x18),
42 VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP4_UV, OMAP343X_CONTROL_FUSE_OPP4_VDD1, 0xf9, 0x18),
43 VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP5_UV, OMAP343X_CONTROL_FUSE_OPP5_VDD1, 0xf9, 0x18),
44 VOLT_DATA_DEFINE(0, 0, 0, 0),
45};
46
47/* VDD2 */
48
49#define OMAP3430_VDD_CORE_OPP1_UV 975000
50#define OMAP3430_VDD_CORE_OPP2_UV 1050000
51#define OMAP3430_VDD_CORE_OPP3_UV 1150000
52
53struct omap_volt_data omap34xx_vddcore_volt_data[] = {
54 VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD2, 0xf4, 0x0c),
55 VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD2, 0xf4, 0x0c),
56 VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD2, 0xf9, 0x18),
57 VOLT_DATA_DEFINE(0, 0, 0, 0),
58};
59
60/* 36xx */
61
62/* VDD1 */
63
64#define OMAP3630_VDD_MPU_OPP50_UV 1012500
65#define OMAP3630_VDD_MPU_OPP100_UV 1200000
66#define OMAP3630_VDD_MPU_OPP120_UV 1325000
67#define OMAP3630_VDD_MPU_OPP1G_UV 1375000
68
69struct omap_volt_data omap36xx_vddmpu_volt_data[] = {
70 VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD1, 0xf4, 0x0c),
71 VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD1, 0xf9, 0x16),
72 VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP120_UV, OMAP3630_CONTROL_FUSE_OPP120_VDD1, 0xfa, 0x23),
73 VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP1G_UV, OMAP3630_CONTROL_FUSE_OPP1G_VDD1, 0xfa, 0x27),
74 VOLT_DATA_DEFINE(0, 0, 0, 0),
75};
76
77/* VDD2 */
78
79#define OMAP3630_VDD_CORE_OPP50_UV 1000000
80#define OMAP3630_VDD_CORE_OPP100_UV 1200000
81
82struct omap_volt_data omap36xx_vddcore_volt_data[] = {
83 VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD2, 0xf4, 0x0c),
84 VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD2, 0xf9, 0x16),
85 VOLT_DATA_DEFINE(0, 0, 0, 0),
86};
87
88/* OPP data */
89
26static struct omap_opp_def __initdata omap34xx_opp_def_list[] = { 90static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {
27 /* MPU OPP1 */ 91 /* MPU OPP1 */
28 OPP_INITIALIZER("mpu", true, 125000000, 975000), 92 OPP_INITIALIZER("mpu", true, 125000000, 975000),
diff --git a/arch/arm/mach-omap2/opp4xxx_data.c b/arch/arm/mach-omap2/opp4xxx_data.c
index f0e9939a7217..5030794d73ff 100644
--- a/arch/arm/mach-omap2/opp4xxx_data.c
+++ b/arch/arm/mach-omap2/opp4xxx_data.c
@@ -5,8 +5,9 @@
5 * Nishanth Menon 5 * Nishanth Menon
6 * Kevin Hilman 6 * Kevin Hilman
7 * Thara Gopinath 7 * Thara Gopinath
8 * Copyright (C) 2010 Nokia Corporation. 8 * Copyright (C) 2010-2011 Nokia Corporation.
9 * Eduardo Valentin 9 * Eduardo Valentin
10 * Paul Walmsley
10 * 11 *
11 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
@@ -21,9 +22,49 @@
21 22
22#include <plat/cpu.h> 23#include <plat/cpu.h>
23 24
25#include "control.h"
24#include "omap_opp_data.h" 26#include "omap_opp_data.h"
25#include "pm.h" 27#include "pm.h"
26 28
29/*
30 * Structures containing OMAP4430 voltage supported and various
31 * voltage dependent data for each VDD.
32 */
33
34#define OMAP4430_VDD_MPU_OPP50_UV 930000
35#define OMAP4430_VDD_MPU_OPP100_UV 1100000
36#define OMAP4430_VDD_MPU_OPPTURBO_UV 1260000
37#define OMAP4430_VDD_MPU_OPPNITRO_UV 1350000
38
39struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = {
40 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c),
41 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16),
42 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23),
43 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO, 0xfa, 0x27),
44 VOLT_DATA_DEFINE(0, 0, 0, 0),
45};
46
47#define OMAP4430_VDD_IVA_OPP50_UV 930000
48#define OMAP4430_VDD_IVA_OPP100_UV 1100000
49#define OMAP4430_VDD_IVA_OPPTURBO_UV 1260000
50
51struct omap_volt_data omap44xx_vdd_iva_volt_data[] = {
52 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c),
53 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16),
54 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23),
55 VOLT_DATA_DEFINE(0, 0, 0, 0),
56};
57
58#define OMAP4430_VDD_CORE_OPP50_UV 930000
59#define OMAP4430_VDD_CORE_OPP100_UV 1100000
60
61struct omap_volt_data omap44xx_vdd_core_volt_data[] = {
62 VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c),
63 VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16),
64 VOLT_DATA_DEFINE(0, 0, 0, 0),
65};
66
67
27static struct omap_opp_def __initdata omap44xx_opp_def_list[] = { 68static struct omap_opp_def __initdata omap44xx_opp_def_list[] = {
28 /* MPU OPP1 - OPP50 */ 69 /* MPU OPP1 - OPP50 */
29 OPP_INITIALIZER("mpu", true, 300000000, 1100000), 70 OPP_INITIALIZER("mpu", true, 300000000, 1100000),
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 6e4eb7ff95a8..30af3351c2d6 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -18,8 +18,8 @@
18#include <plat/omap-pm.h> 18#include <plat/omap-pm.h>
19#include <plat/omap_device.h> 19#include <plat/omap_device.h>
20#include <plat/common.h> 20#include <plat/common.h>
21#include <plat/voltage.h>
22 21
22#include "voltage.h"
23#include "powerdomain.h" 23#include "powerdomain.h"
24#include "clockdomain.h" 24#include "clockdomain.h"
25#include "pm.h" 25#include "pm.h"
@@ -126,7 +126,7 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
126 (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) { 126 (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) {
127 sleep_switch = LOWPOWERSTATE_SWITCH; 127 sleep_switch = LOWPOWERSTATE_SWITCH;
128 } else { 128 } else {
129 omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]); 129 clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
130 pwrdm_wait_transition(pwrdm); 130 pwrdm_wait_transition(pwrdm);
131 sleep_switch = FORCEWAKEUP_SWITCH; 131 sleep_switch = FORCEWAKEUP_SWITCH;
132 } 132 }
@@ -142,9 +142,9 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
142 switch (sleep_switch) { 142 switch (sleep_switch) {
143 case FORCEWAKEUP_SWITCH: 143 case FORCEWAKEUP_SWITCH:
144 if (pwrdm->pwrdm_clkdms[0]->flags & CLKDM_CAN_ENABLE_AUTO) 144 if (pwrdm->pwrdm_clkdms[0]->flags & CLKDM_CAN_ENABLE_AUTO)
145 omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]); 145 clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
146 else 146 else
147 omap2_clkdm_sleep(pwrdm->pwrdm_clkdms[0]); 147 clkdm_sleep(pwrdm->pwrdm_clkdms[0]);
148 break; 148 break;
149 case LOWPOWERSTATE_SWITCH: 149 case LOWPOWERSTATE_SWITCH:
150 pwrdm_set_lowpwrstchange(pwrdm); 150 pwrdm_set_lowpwrstchange(pwrdm);
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index 10f8747ba572..df3ded6fe194 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -364,10 +364,10 @@ static const struct platform_suspend_ops __initdata omap_pm_ops;
364static int __init clkdms_setup(struct clockdomain *clkdm, void *unused) 364static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
365{ 365{
366 if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) 366 if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
367 omap2_clkdm_allow_idle(clkdm); 367 clkdm_allow_idle(clkdm);
368 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && 368 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
369 atomic_read(&clkdm->usecount) == 0) 369 atomic_read(&clkdm->usecount) == 0)
370 omap2_clkdm_sleep(clkdm); 370 clkdm_sleep(clkdm);
371 return 0; 371 return 0;
372} 372}
373 373
@@ -376,7 +376,10 @@ static void __init prcm_setup_regs(void)
376 int i, num_mem_banks; 376 int i, num_mem_banks;
377 struct powerdomain *pwrdm; 377 struct powerdomain *pwrdm;
378 378
379 /* Enable autoidle */ 379 /*
380 * Enable autoidle
381 * XXX This should be handled by hwmod code or PRCM init code
382 */
380 omap2_prm_write_mod_reg(OMAP24XX_AUTOIDLE_MASK, OCP_MOD, 383 omap2_prm_write_mod_reg(OMAP24XX_AUTOIDLE_MASK, OCP_MOD,
381 OMAP2_PRCM_SYSCONFIG_OFFSET); 384 OMAP2_PRCM_SYSCONFIG_OFFSET);
382 385
@@ -402,80 +405,16 @@ static void __init prcm_setup_regs(void)
402 405
403 pwrdm = clkdm_get_pwrdm(dsp_clkdm); 406 pwrdm = clkdm_get_pwrdm(dsp_clkdm);
404 pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF); 407 pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF);
405 omap2_clkdm_sleep(dsp_clkdm); 408 clkdm_sleep(dsp_clkdm);
406 409
407 pwrdm = clkdm_get_pwrdm(gfx_clkdm); 410 pwrdm = clkdm_get_pwrdm(gfx_clkdm);
408 pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF); 411 pwrdm_set_next_pwrst(pwrdm, PWRDM_POWER_OFF);
409 omap2_clkdm_sleep(gfx_clkdm); 412 clkdm_sleep(gfx_clkdm);
410 413
411 /* Enable hardware-supervised idle for all clkdms */ 414 /* Enable hardware-supervised idle for all clkdms */
412 clkdm_for_each(clkdms_setup, NULL); 415 clkdm_for_each(clkdms_setup, NULL);
413 clkdm_add_wkdep(mpu_clkdm, wkup_clkdm); 416 clkdm_add_wkdep(mpu_clkdm, wkup_clkdm);
414 417
415 /* Enable clock autoidle for all domains */
416 omap2_cm_write_mod_reg(OMAP24XX_AUTO_CAM_MASK |
417 OMAP24XX_AUTO_MAILBOXES_MASK |
418 OMAP24XX_AUTO_WDT4_MASK |
419 OMAP2420_AUTO_WDT3_MASK |
420 OMAP24XX_AUTO_MSPRO_MASK |
421 OMAP2420_AUTO_MMC_MASK |
422 OMAP24XX_AUTO_FAC_MASK |
423 OMAP2420_AUTO_EAC_MASK |
424 OMAP24XX_AUTO_HDQ_MASK |
425 OMAP24XX_AUTO_UART2_MASK |
426 OMAP24XX_AUTO_UART1_MASK |
427 OMAP24XX_AUTO_I2C2_MASK |
428 OMAP24XX_AUTO_I2C1_MASK |
429 OMAP24XX_AUTO_MCSPI2_MASK |
430 OMAP24XX_AUTO_MCSPI1_MASK |
431 OMAP24XX_AUTO_MCBSP2_MASK |
432 OMAP24XX_AUTO_MCBSP1_MASK |
433 OMAP24XX_AUTO_GPT12_MASK |
434 OMAP24XX_AUTO_GPT11_MASK |
435 OMAP24XX_AUTO_GPT10_MASK |
436 OMAP24XX_AUTO_GPT9_MASK |
437 OMAP24XX_AUTO_GPT8_MASK |
438 OMAP24XX_AUTO_GPT7_MASK |
439 OMAP24XX_AUTO_GPT6_MASK |
440 OMAP24XX_AUTO_GPT5_MASK |
441 OMAP24XX_AUTO_GPT4_MASK |
442 OMAP24XX_AUTO_GPT3_MASK |
443 OMAP24XX_AUTO_GPT2_MASK |
444 OMAP2420_AUTO_VLYNQ_MASK |
445 OMAP24XX_AUTO_DSS_MASK,
446 CORE_MOD, CM_AUTOIDLE1);
447 omap2_cm_write_mod_reg(OMAP24XX_AUTO_UART3_MASK |
448 OMAP24XX_AUTO_SSI_MASK |
449 OMAP24XX_AUTO_USB_MASK,
450 CORE_MOD, CM_AUTOIDLE2);
451 omap2_cm_write_mod_reg(OMAP24XX_AUTO_SDRC_MASK |
452 OMAP24XX_AUTO_GPMC_MASK |
453 OMAP24XX_AUTO_SDMA_MASK,
454 CORE_MOD, CM_AUTOIDLE3);
455 omap2_cm_write_mod_reg(OMAP24XX_AUTO_PKA_MASK |
456 OMAP24XX_AUTO_AES_MASK |
457 OMAP24XX_AUTO_RNG_MASK |
458 OMAP24XX_AUTO_SHA_MASK |
459 OMAP24XX_AUTO_DES_MASK,
460 CORE_MOD, OMAP24XX_CM_AUTOIDLE4);
461
462 omap2_cm_write_mod_reg(OMAP2420_AUTO_DSP_IPI_MASK, OMAP24XX_DSP_MOD,
463 CM_AUTOIDLE);
464
465 /* Put DPLL and both APLLs into autoidle mode */
466 omap2_cm_write_mod_reg((0x03 << OMAP24XX_AUTO_DPLL_SHIFT) |
467 (0x03 << OMAP24XX_AUTO_96M_SHIFT) |
468 (0x03 << OMAP24XX_AUTO_54M_SHIFT),
469 PLL_MOD, CM_AUTOIDLE);
470
471 omap2_cm_write_mod_reg(OMAP24XX_AUTO_OMAPCTRL_MASK |
472 OMAP24XX_AUTO_WDT1_MASK |
473 OMAP24XX_AUTO_MPU_WDT_MASK |
474 OMAP24XX_AUTO_GPIOS_MASK |
475 OMAP24XX_AUTO_32KSYNC_MASK |
476 OMAP24XX_AUTO_GPT1_MASK,
477 WKUP_MOD, CM_AUTOIDLE);
478
479 /* REVISIT: Configure number of 32 kHz clock cycles for sys_clk 418 /* REVISIT: Configure number of 32 kHz clock cycles for sys_clk
480 * stabilisation */ 419 * stabilisation */
481 omap2_prm_write_mod_reg(15 << OMAP_SETUP_TIME_SHIFT, OMAP24XX_GR_MOD, 420 omap2_prm_write_mod_reg(15 << OMAP_SETUP_TIME_SHIFT, OMAP24XX_GR_MOD,
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 1883a464aace..b5361a1260fc 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -491,7 +491,7 @@ console_still_active:
491 491
492 pwrdm_post_transition(); 492 pwrdm_post_transition();
493 493
494 omap2_clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]); 494 clkdm_allow_idle(mpu_pwrdm->pwrdm_clkdms[0]);
495} 495}
496 496
497int omap3_can_sleep(void) 497int omap3_can_sleep(void)
@@ -683,134 +683,15 @@ static void __init omap3_d2d_idle(void)
683 683
684static void __init prcm_setup_regs(void) 684static void __init prcm_setup_regs(void)
685{ 685{
686 u32 omap3630_auto_uart4_mask = cpu_is_omap3630() ?
687 OMAP3630_AUTO_UART4_MASK : 0;
688 u32 omap3630_en_uart4_mask = cpu_is_omap3630() ? 686 u32 omap3630_en_uart4_mask = cpu_is_omap3630() ?
689 OMAP3630_EN_UART4_MASK : 0; 687 OMAP3630_EN_UART4_MASK : 0;
690 u32 omap3630_grpsel_uart4_mask = cpu_is_omap3630() ? 688 u32 omap3630_grpsel_uart4_mask = cpu_is_omap3630() ?
691 OMAP3630_GRPSEL_UART4_MASK : 0; 689 OMAP3630_GRPSEL_UART4_MASK : 0;
692 690
693 /* 691 /* XXX This should be handled by hwmod code or SCM init code */
694 * Enable interface clock autoidle for all modules.
695 * Note that in the long run this should be done by clockfw
696 */
697 omap2_cm_write_mod_reg(
698 OMAP3430_AUTO_MODEM_MASK |
699 OMAP3430ES2_AUTO_MMC3_MASK |
700 OMAP3430ES2_AUTO_ICR_MASK |
701 OMAP3430_AUTO_AES2_MASK |
702 OMAP3430_AUTO_SHA12_MASK |
703 OMAP3430_AUTO_DES2_MASK |
704 OMAP3430_AUTO_MMC2_MASK |
705 OMAP3430_AUTO_MMC1_MASK |
706 OMAP3430_AUTO_MSPRO_MASK |
707 OMAP3430_AUTO_HDQ_MASK |
708 OMAP3430_AUTO_MCSPI4_MASK |
709 OMAP3430_AUTO_MCSPI3_MASK |
710 OMAP3430_AUTO_MCSPI2_MASK |
711 OMAP3430_AUTO_MCSPI1_MASK |
712 OMAP3430_AUTO_I2C3_MASK |
713 OMAP3430_AUTO_I2C2_MASK |
714 OMAP3430_AUTO_I2C1_MASK |
715 OMAP3430_AUTO_UART2_MASK |
716 OMAP3430_AUTO_UART1_MASK |
717 OMAP3430_AUTO_GPT11_MASK |
718 OMAP3430_AUTO_GPT10_MASK |
719 OMAP3430_AUTO_MCBSP5_MASK |
720 OMAP3430_AUTO_MCBSP1_MASK |
721 OMAP3430ES1_AUTO_FAC_MASK | /* This is es1 only */
722 OMAP3430_AUTO_MAILBOXES_MASK |
723 OMAP3430_AUTO_OMAPCTRL_MASK |
724 OMAP3430ES1_AUTO_FSHOSTUSB_MASK |
725 OMAP3430_AUTO_HSOTGUSB_MASK |
726 OMAP3430_AUTO_SAD2D_MASK |
727 OMAP3430_AUTO_SSI_MASK,
728 CORE_MOD, CM_AUTOIDLE1);
729
730 omap2_cm_write_mod_reg(
731 OMAP3430_AUTO_PKA_MASK |
732 OMAP3430_AUTO_AES1_MASK |
733 OMAP3430_AUTO_RNG_MASK |
734 OMAP3430_AUTO_SHA11_MASK |
735 OMAP3430_AUTO_DES1_MASK,
736 CORE_MOD, CM_AUTOIDLE2);
737
738 if (omap_rev() > OMAP3430_REV_ES1_0) {
739 omap2_cm_write_mod_reg(
740 OMAP3430_AUTO_MAD2D_MASK |
741 OMAP3430ES2_AUTO_USBTLL_MASK,
742 CORE_MOD, CM_AUTOIDLE3);
743 }
744
745 omap2_cm_write_mod_reg(
746 OMAP3430_AUTO_WDT2_MASK |
747 OMAP3430_AUTO_WDT1_MASK |
748 OMAP3430_AUTO_GPIO1_MASK |
749 OMAP3430_AUTO_32KSYNC_MASK |
750 OMAP3430_AUTO_GPT12_MASK |
751 OMAP3430_AUTO_GPT1_MASK,
752 WKUP_MOD, CM_AUTOIDLE);
753
754 omap2_cm_write_mod_reg(
755 OMAP3430_AUTO_DSS_MASK,
756 OMAP3430_DSS_MOD,
757 CM_AUTOIDLE);
758
759 omap2_cm_write_mod_reg(
760 OMAP3430_AUTO_CAM_MASK,
761 OMAP3430_CAM_MOD,
762 CM_AUTOIDLE);
763
764 omap2_cm_write_mod_reg(
765 omap3630_auto_uart4_mask |
766 OMAP3430_AUTO_GPIO6_MASK |
767 OMAP3430_AUTO_GPIO5_MASK |
768 OMAP3430_AUTO_GPIO4_MASK |
769 OMAP3430_AUTO_GPIO3_MASK |
770 OMAP3430_AUTO_GPIO2_MASK |
771 OMAP3430_AUTO_WDT3_MASK |
772 OMAP3430_AUTO_UART3_MASK |
773 OMAP3430_AUTO_GPT9_MASK |
774 OMAP3430_AUTO_GPT8_MASK |
775 OMAP3430_AUTO_GPT7_MASK |
776 OMAP3430_AUTO_GPT6_MASK |
777 OMAP3430_AUTO_GPT5_MASK |
778 OMAP3430_AUTO_GPT4_MASK |
779 OMAP3430_AUTO_GPT3_MASK |
780 OMAP3430_AUTO_GPT2_MASK |
781 OMAP3430_AUTO_MCBSP4_MASK |
782 OMAP3430_AUTO_MCBSP3_MASK |
783 OMAP3430_AUTO_MCBSP2_MASK,
784 OMAP3430_PER_MOD,
785 CM_AUTOIDLE);
786
787 if (omap_rev() > OMAP3430_REV_ES1_0) {
788 omap2_cm_write_mod_reg(
789 OMAP3430ES2_AUTO_USBHOST_MASK,
790 OMAP3430ES2_USBHOST_MOD,
791 CM_AUTOIDLE);
792 }
793
794 omap_ctrl_writel(OMAP3430_AUTOIDLE_MASK, OMAP2_CONTROL_SYSCONFIG); 692 omap_ctrl_writel(OMAP3430_AUTOIDLE_MASK, OMAP2_CONTROL_SYSCONFIG);
795 693
796 /* 694 /*
797 * Set all plls to autoidle. This is needed until autoidle is
798 * enabled by clockfw
799 */
800 omap2_cm_write_mod_reg(1 << OMAP3430_AUTO_IVA2_DPLL_SHIFT,
801 OMAP3430_IVA2_MOD, CM_AUTOIDLE2);
802 omap2_cm_write_mod_reg(1 << OMAP3430_AUTO_MPU_DPLL_SHIFT,
803 MPU_MOD,
804 CM_AUTOIDLE2);
805 omap2_cm_write_mod_reg((1 << OMAP3430_AUTO_PERIPH_DPLL_SHIFT) |
806 (1 << OMAP3430_AUTO_CORE_DPLL_SHIFT),
807 PLL_MOD,
808 CM_AUTOIDLE);
809 omap2_cm_write_mod_reg(1 << OMAP3430ES2_AUTO_PERIPH2_DPLL_SHIFT,
810 PLL_MOD,
811 CM_AUTOIDLE2);
812
813 /*
814 * Enable control of expternal oscillator through 695 * Enable control of expternal oscillator through
815 * sys_clkreq. In the long run clock framework should 696 * sys_clkreq. In the long run clock framework should
816 * take care of this. 697 * take care of this.
@@ -969,10 +850,10 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
969static int __init clkdms_setup(struct clockdomain *clkdm, void *unused) 850static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
970{ 851{
971 if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) 852 if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
972 omap2_clkdm_allow_idle(clkdm); 853 clkdm_allow_idle(clkdm);
973 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && 854 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
974 atomic_read(&clkdm->usecount) == 0) 855 atomic_read(&clkdm->usecount) == 0)
975 omap2_clkdm_sleep(clkdm); 856 clkdm_sleep(clkdm);
976 return 0; 857 return 0;
977} 858}
978 859
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index eaed0df16699..a11be81997c5 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -2,7 +2,7 @@
2 * OMAP powerdomain control 2 * OMAP powerdomain control
3 * 3 *
4 * Copyright (C) 2007-2008 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation 5 * Copyright (C) 2007-2011 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
8 * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com> 8 * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com>
@@ -938,3 +938,44 @@ u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm)
938 938
939 return count; 939 return count;
940} 940}
941
942/**
943 * pwrdm_can_ever_lose_context - can this powerdomain ever lose context?
944 * @pwrdm: struct powerdomain *
945 *
946 * Given a struct powerdomain * @pwrdm, returns 1 if the powerdomain
947 * can lose either memory or logic context or if @pwrdm is invalid, or
948 * returns 0 otherwise. This function is not concerned with how the
949 * powerdomain registers are programmed (i.e., to go off or not); it's
950 * concerned with whether it's ever possible for this powerdomain to
951 * go off while some other part of the chip is active. This function
952 * assumes that every powerdomain can go to either ON or INACTIVE.
953 */
954bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm)
955{
956 int i;
957
958 if (IS_ERR_OR_NULL(pwrdm)) {
959 pr_debug("powerdomain: %s: invalid powerdomain pointer\n",
960 __func__);
961 return 1;
962 }
963
964 if (pwrdm->pwrsts & PWRSTS_OFF)
965 return 1;
966
967 if (pwrdm->pwrsts & PWRSTS_RET) {
968 if (pwrdm->pwrsts_logic_ret & PWRSTS_OFF)
969 return 1;
970
971 for (i = 0; i < pwrdm->banks; i++)
972 if (pwrdm->pwrsts_mem_ret[i] & PWRSTS_OFF)
973 return 1;
974 }
975
976 for (i = 0; i < pwrdm->banks; i++)
977 if (pwrdm->pwrsts_mem_on[i] & PWRSTS_OFF)
978 return 1;
979
980 return 0;
981}
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index c66431edfeb7..027f40bd235d 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -2,7 +2,7 @@
2 * OMAP2/3/4 powerdomain control 2 * OMAP2/3/4 powerdomain control
3 * 3 *
4 * Copyright (C) 2007-2008, 2010 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008, 2010 Texas Instruments, Inc.
5 * Copyright (C) 2007-2010 Nokia Corporation 5 * Copyright (C) 2007-2011 Nokia Corporation
6 * 6 *
7 * Paul Walmsley 7 * Paul Walmsley
8 * 8 *
@@ -34,17 +34,14 @@
34 34
35/* Powerdomain allowable state bitfields */ 35/* Powerdomain allowable state bitfields */
36#define PWRSTS_ON (1 << PWRDM_POWER_ON) 36#define PWRSTS_ON (1 << PWRDM_POWER_ON)
37#define PWRSTS_INACTIVE (1 << PWRDM_POWER_INACTIVE)
38#define PWRSTS_RET (1 << PWRDM_POWER_RET)
37#define PWRSTS_OFF (1 << PWRDM_POWER_OFF) 39#define PWRSTS_OFF (1 << PWRDM_POWER_OFF)
38#define PWRSTS_OFF_ON ((1 << PWRDM_POWER_OFF) | \
39 (1 << PWRDM_POWER_ON))
40 40
41#define PWRSTS_OFF_RET ((1 << PWRDM_POWER_OFF) | \ 41#define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON)
42 (1 << PWRDM_POWER_RET)) 42#define PWRSTS_OFF_RET (PWRSTS_OFF | PWRSTS_RET)
43 43#define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON)
44#define PWRSTS_RET_ON ((1 << PWRDM_POWER_RET) | \ 44#define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | PWRSTS_ON)
45 (1 << PWRDM_POWER_ON))
46
47#define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | (1 << PWRDM_POWER_ON))
48 45
49 46
50/* Powerdomain flags */ 47/* Powerdomain flags */
@@ -165,7 +162,6 @@ struct pwrdm_ops {
165 int (*pwrdm_wait_transition)(struct powerdomain *pwrdm); 162 int (*pwrdm_wait_transition)(struct powerdomain *pwrdm);
166}; 163};
167 164
168void pwrdm_fw_init(void);
169void pwrdm_init(struct powerdomain **pwrdm_list, struct pwrdm_ops *custom_funcs); 165void pwrdm_init(struct powerdomain **pwrdm_list, struct pwrdm_ops *custom_funcs);
170 166
171struct powerdomain *pwrdm_lookup(const char *name); 167struct powerdomain *pwrdm_lookup(const char *name);
@@ -212,6 +208,7 @@ int pwrdm_pre_transition(void);
212int pwrdm_post_transition(void); 208int pwrdm_post_transition(void);
213int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm); 209int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm);
214u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm); 210u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm);
211bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm);
215 212
216extern void omap2xxx_powerdomains_init(void); 213extern void omap2xxx_powerdomains_init(void);
217extern void omap3xxx_powerdomains_init(void); 214extern void omap3xxx_powerdomains_init(void);
diff --git a/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c b/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c
index 5b4dd971320a..4210c3399769 100644
--- a/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c
@@ -2,7 +2,7 @@
2 * OMAP2/3 common powerdomain definitions 2 * OMAP2/3 common powerdomain definitions
3 * 3 *
4 * Copyright (C) 2007-2008 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
5 * Copyright (C) 2007-2010 Nokia Corporation 5 * Copyright (C) 2007-2011 Nokia Corporation
6 * 6 *
7 * Paul Walmsley, Jouni Högander 7 * Paul Walmsley, Jouni Högander
8 * 8 *
@@ -62,13 +62,13 @@ struct powerdomain gfx_omap2_pwrdm = {
62 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | 62 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX |
63 CHIP_IS_OMAP3430ES1), 63 CHIP_IS_OMAP3430ES1),
64 .pwrsts = PWRSTS_OFF_RET_ON, 64 .pwrsts = PWRSTS_OFF_RET_ON,
65 .pwrsts_logic_ret = PWRDM_POWER_RET, 65 .pwrsts_logic_ret = PWRSTS_RET,
66 .banks = 1, 66 .banks = 1,
67 .pwrsts_mem_ret = { 67 .pwrsts_mem_ret = {
68 [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ 68 [0] = PWRSTS_RET, /* MEMRETSTATE */
69 }, 69 },
70 .pwrsts_mem_on = { 70 .pwrsts_mem_on = {
71 [0] = PWRDM_POWER_ON, /* MEMONSTATE */ 71 [0] = PWRSTS_ON, /* MEMONSTATE */
72 }, 72 },
73}; 73};
74 74
@@ -76,4 +76,5 @@ struct powerdomain wkup_omap2_pwrdm = {
76 .name = "wkup_pwrdm", 76 .name = "wkup_pwrdm",
77 .prcm_offs = WKUP_MOD, 77 .prcm_offs = WKUP_MOD,
78 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430), 78 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430),
79 .pwrsts = PWRSTS_ON,
79}; 80};
diff --git a/arch/arm/mach-omap2/powerdomains2xxx_data.c b/arch/arm/mach-omap2/powerdomains2xxx_data.c
index 78739e10f5b9..cc389fb2005d 100644
--- a/arch/arm/mach-omap2/powerdomains2xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains2xxx_data.c
@@ -2,7 +2,7 @@
2 * OMAP2XXX powerdomain definitions 2 * OMAP2XXX powerdomain definitions
3 * 3 *
4 * Copyright (C) 2007-2008 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
5 * Copyright (C) 2007-2010 Nokia Corporation 5 * Copyright (C) 2007-2011 Nokia Corporation
6 * 6 *
7 * Paul Walmsley, Jouni Högander 7 * Paul Walmsley, Jouni Högander
8 * 8 *
@@ -30,13 +30,13 @@ static struct powerdomain dsp_pwrdm = {
30 .prcm_offs = OMAP24XX_DSP_MOD, 30 .prcm_offs = OMAP24XX_DSP_MOD,
31 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX), 31 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP24XX),
32 .pwrsts = PWRSTS_OFF_RET_ON, 32 .pwrsts = PWRSTS_OFF_RET_ON,
33 .pwrsts_logic_ret = PWRDM_POWER_RET, 33 .pwrsts_logic_ret = PWRSTS_RET,
34 .banks = 1, 34 .banks = 1,
35 .pwrsts_mem_ret = { 35 .pwrsts_mem_ret = {
36 [0] = PWRDM_POWER_RET, 36 [0] = PWRSTS_RET,
37 }, 37 },
38 .pwrsts_mem_on = { 38 .pwrsts_mem_on = {
39 [0] = PWRDM_POWER_ON, 39 [0] = PWRSTS_ON,
40 }, 40 },
41}; 41};
42 42
@@ -48,10 +48,10 @@ static struct powerdomain mpu_24xx_pwrdm = {
48 .pwrsts_logic_ret = PWRSTS_OFF_RET, 48 .pwrsts_logic_ret = PWRSTS_OFF_RET,
49 .banks = 1, 49 .banks = 1,
50 .pwrsts_mem_ret = { 50 .pwrsts_mem_ret = {
51 [0] = PWRDM_POWER_RET, 51 [0] = PWRSTS_RET,
52 }, 52 },
53 .pwrsts_mem_on = { 53 .pwrsts_mem_on = {
54 [0] = PWRDM_POWER_ON, 54 [0] = PWRSTS_ON,
55 }, 55 },
56}; 56};
57 57
@@ -87,13 +87,13 @@ static struct powerdomain mdm_pwrdm = {
87 .prcm_offs = OMAP2430_MDM_MOD, 87 .prcm_offs = OMAP2430_MDM_MOD,
88 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), 88 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
89 .pwrsts = PWRSTS_OFF_RET_ON, 89 .pwrsts = PWRSTS_OFF_RET_ON,
90 .pwrsts_logic_ret = PWRDM_POWER_RET, 90 .pwrsts_logic_ret = PWRSTS_RET,
91 .banks = 1, 91 .banks = 1,
92 .pwrsts_mem_ret = { 92 .pwrsts_mem_ret = {
93 [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ 93 [0] = PWRSTS_RET, /* MEMRETSTATE */
94 }, 94 },
95 .pwrsts_mem_on = { 95 .pwrsts_mem_on = {
96 [0] = PWRDM_POWER_ON, /* MEMONSTATE */ 96 [0] = PWRSTS_ON, /* MEMONSTATE */
97 }, 97 },
98}; 98};
99 99
diff --git a/arch/arm/mach-omap2/powerdomains3xxx_data.c b/arch/arm/mach-omap2/powerdomains3xxx_data.c
index e1bec562625b..9c9c113788b9 100644
--- a/arch/arm/mach-omap2/powerdomains3xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains3xxx_data.c
@@ -2,7 +2,7 @@
2 * OMAP3 powerdomain definitions 2 * OMAP3 powerdomain definitions
3 * 3 *
4 * Copyright (C) 2007-2008 Texas Instruments, Inc. 4 * Copyright (C) 2007-2008 Texas Instruments, Inc.
5 * Copyright (C) 2007-2010 Nokia Corporation 5 * Copyright (C) 2007-2011 Nokia Corporation
6 * 6 *
7 * Paul Walmsley, Jouni Högander 7 * Paul Walmsley, Jouni Högander
8 * 8 *
@@ -47,10 +47,10 @@ static struct powerdomain iva2_pwrdm = {
47 [3] = PWRSTS_OFF_RET, 47 [3] = PWRSTS_OFF_RET,
48 }, 48 },
49 .pwrsts_mem_on = { 49 .pwrsts_mem_on = {
50 [0] = PWRDM_POWER_ON, 50 [0] = PWRSTS_ON,
51 [1] = PWRDM_POWER_ON, 51 [1] = PWRSTS_ON,
52 [2] = PWRSTS_OFF_ON, 52 [2] = PWRSTS_OFF_ON,
53 [3] = PWRDM_POWER_ON, 53 [3] = PWRSTS_ON,
54 }, 54 },
55}; 55};
56 56
@@ -128,13 +128,13 @@ static struct powerdomain dss_pwrdm = {
128 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), 128 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
129 .prcm_offs = OMAP3430_DSS_MOD, 129 .prcm_offs = OMAP3430_DSS_MOD,
130 .pwrsts = PWRSTS_OFF_RET_ON, 130 .pwrsts = PWRSTS_OFF_RET_ON,
131 .pwrsts_logic_ret = PWRDM_POWER_RET, 131 .pwrsts_logic_ret = PWRSTS_RET,
132 .banks = 1, 132 .banks = 1,
133 .pwrsts_mem_ret = { 133 .pwrsts_mem_ret = {
134 [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ 134 [0] = PWRSTS_RET, /* MEMRETSTATE */
135 }, 135 },
136 .pwrsts_mem_on = { 136 .pwrsts_mem_on = {
137 [0] = PWRDM_POWER_ON, /* MEMONSTATE */ 137 [0] = PWRSTS_ON, /* MEMONSTATE */
138 }, 138 },
139}; 139};
140 140
@@ -149,13 +149,13 @@ static struct powerdomain sgx_pwrdm = {
149 .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2), 149 .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
150 /* XXX This is accurate for 3430 SGX, but what about GFX? */ 150 /* XXX This is accurate for 3430 SGX, but what about GFX? */
151 .pwrsts = PWRSTS_OFF_ON, 151 .pwrsts = PWRSTS_OFF_ON,
152 .pwrsts_logic_ret = PWRDM_POWER_RET, 152 .pwrsts_logic_ret = PWRSTS_RET,
153 .banks = 1, 153 .banks = 1,
154 .pwrsts_mem_ret = { 154 .pwrsts_mem_ret = {
155 [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ 155 [0] = PWRSTS_RET, /* MEMRETSTATE */
156 }, 156 },
157 .pwrsts_mem_on = { 157 .pwrsts_mem_on = {
158 [0] = PWRDM_POWER_ON, /* MEMONSTATE */ 158 [0] = PWRSTS_ON, /* MEMONSTATE */
159 }, 159 },
160}; 160};
161 161
@@ -164,13 +164,13 @@ static struct powerdomain cam_pwrdm = {
164 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), 164 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
165 .prcm_offs = OMAP3430_CAM_MOD, 165 .prcm_offs = OMAP3430_CAM_MOD,
166 .pwrsts = PWRSTS_OFF_RET_ON, 166 .pwrsts = PWRSTS_OFF_RET_ON,
167 .pwrsts_logic_ret = PWRDM_POWER_RET, 167 .pwrsts_logic_ret = PWRSTS_RET,
168 .banks = 1, 168 .banks = 1,
169 .pwrsts_mem_ret = { 169 .pwrsts_mem_ret = {
170 [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ 170 [0] = PWRSTS_RET, /* MEMRETSTATE */
171 }, 171 },
172 .pwrsts_mem_on = { 172 .pwrsts_mem_on = {
173 [0] = PWRDM_POWER_ON, /* MEMONSTATE */ 173 [0] = PWRSTS_ON, /* MEMONSTATE */
174 }, 174 },
175}; 175};
176 176
@@ -182,10 +182,10 @@ static struct powerdomain per_pwrdm = {
182 .pwrsts_logic_ret = PWRSTS_OFF_RET, 182 .pwrsts_logic_ret = PWRSTS_OFF_RET,
183 .banks = 1, 183 .banks = 1,
184 .pwrsts_mem_ret = { 184 .pwrsts_mem_ret = {
185 [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ 185 [0] = PWRSTS_RET, /* MEMRETSTATE */
186 }, 186 },
187 .pwrsts_mem_on = { 187 .pwrsts_mem_on = {
188 [0] = PWRDM_POWER_ON, /* MEMONSTATE */ 188 [0] = PWRSTS_ON, /* MEMONSTATE */
189 }, 189 },
190}; 190};
191 191
@@ -200,7 +200,7 @@ static struct powerdomain neon_pwrdm = {
200 .prcm_offs = OMAP3430_NEON_MOD, 200 .prcm_offs = OMAP3430_NEON_MOD,
201 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), 201 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
202 .pwrsts = PWRSTS_OFF_RET_ON, 202 .pwrsts = PWRSTS_OFF_RET_ON,
203 .pwrsts_logic_ret = PWRDM_POWER_RET, 203 .pwrsts_logic_ret = PWRSTS_RET,
204}; 204};
205 205
206static struct powerdomain usbhost_pwrdm = { 206static struct powerdomain usbhost_pwrdm = {
@@ -208,7 +208,7 @@ static struct powerdomain usbhost_pwrdm = {
208 .prcm_offs = OMAP3430ES2_USBHOST_MOD, 208 .prcm_offs = OMAP3430ES2_USBHOST_MOD,
209 .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2), 209 .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
210 .pwrsts = PWRSTS_OFF_RET_ON, 210 .pwrsts = PWRSTS_OFF_RET_ON,
211 .pwrsts_logic_ret = PWRDM_POWER_RET, 211 .pwrsts_logic_ret = PWRSTS_RET,
212 /* 212 /*
213 * REVISIT: Enabling usb host save and restore mechanism seems to 213 * REVISIT: Enabling usb host save and restore mechanism seems to
214 * leave the usb host domain permanently in ACTIVE mode after 214 * leave the usb host domain permanently in ACTIVE mode after
@@ -218,10 +218,10 @@ static struct powerdomain usbhost_pwrdm = {
218 /*.flags = PWRDM_HAS_HDWR_SAR,*/ /* for USBHOST ctrlr only */ 218 /*.flags = PWRDM_HAS_HDWR_SAR,*/ /* for USBHOST ctrlr only */
219 .banks = 1, 219 .banks = 1,
220 .pwrsts_mem_ret = { 220 .pwrsts_mem_ret = {
221 [0] = PWRDM_POWER_RET, /* MEMRETSTATE */ 221 [0] = PWRSTS_RET, /* MEMRETSTATE */
222 }, 222 },
223 .pwrsts_mem_on = { 223 .pwrsts_mem_on = {
224 [0] = PWRDM_POWER_ON, /* MEMONSTATE */ 224 [0] = PWRSTS_ON, /* MEMONSTATE */
225 }, 225 },
226}; 226};
227 227
diff --git a/arch/arm/mach-omap2/powerdomains44xx_data.c b/arch/arm/mach-omap2/powerdomains44xx_data.c
index 26d7641076d7..c4222c7036a5 100644
--- a/arch/arm/mach-omap2/powerdomains44xx_data.c
+++ b/arch/arm/mach-omap2/powerdomains44xx_data.c
@@ -2,7 +2,7 @@
2 * OMAP4 Power domains framework 2 * OMAP4 Power domains framework
3 * 3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc. 4 * Copyright (C) 2009-2010 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation 5 * Copyright (C) 2009-2011 Nokia Corporation
6 * 6 *
7 * Abhijit Pagare (abhijitpagare@ti.com) 7 * Abhijit Pagare (abhijitpagare@ti.com)
8 * Benoit Cousson (b-cousson@ti.com) 8 * Benoit Cousson (b-cousson@ti.com)
@@ -40,18 +40,18 @@ static struct powerdomain core_44xx_pwrdm = {
40 .pwrsts_logic_ret = PWRSTS_OFF_RET, 40 .pwrsts_logic_ret = PWRSTS_OFF_RET,
41 .banks = 5, 41 .banks = 5,
42 .pwrsts_mem_ret = { 42 .pwrsts_mem_ret = {
43 [0] = PWRDM_POWER_OFF, /* core_nret_bank */ 43 [0] = PWRSTS_OFF, /* core_nret_bank */
44 [1] = PWRSTS_OFF_RET, /* core_ocmram */ 44 [1] = PWRSTS_OFF_RET, /* core_ocmram */
45 [2] = PWRDM_POWER_RET, /* core_other_bank */ 45 [2] = PWRSTS_RET, /* core_other_bank */
46 [3] = PWRSTS_OFF_RET, /* ducati_l2ram */ 46 [3] = PWRSTS_OFF_RET, /* ducati_l2ram */
47 [4] = PWRSTS_OFF_RET, /* ducati_unicache */ 47 [4] = PWRSTS_OFF_RET, /* ducati_unicache */
48 }, 48 },
49 .pwrsts_mem_on = { 49 .pwrsts_mem_on = {
50 [0] = PWRDM_POWER_ON, /* core_nret_bank */ 50 [0] = PWRSTS_ON, /* core_nret_bank */
51 [1] = PWRSTS_OFF_RET, /* core_ocmram */ 51 [1] = PWRSTS_OFF_RET, /* core_ocmram */
52 [2] = PWRDM_POWER_ON, /* core_other_bank */ 52 [2] = PWRSTS_ON, /* core_other_bank */
53 [3] = PWRDM_POWER_ON, /* ducati_l2ram */ 53 [3] = PWRSTS_ON, /* ducati_l2ram */
54 [4] = PWRDM_POWER_ON, /* ducati_unicache */ 54 [4] = PWRSTS_ON, /* ducati_unicache */
55 }, 55 },
56 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, 56 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
57}; 57};
@@ -65,10 +65,10 @@ static struct powerdomain gfx_44xx_pwrdm = {
65 .pwrsts = PWRSTS_OFF_ON, 65 .pwrsts = PWRSTS_OFF_ON,
66 .banks = 1, 66 .banks = 1,
67 .pwrsts_mem_ret = { 67 .pwrsts_mem_ret = {
68 [0] = PWRDM_POWER_OFF, /* gfx_mem */ 68 [0] = PWRSTS_OFF, /* gfx_mem */
69 }, 69 },
70 .pwrsts_mem_on = { 70 .pwrsts_mem_on = {
71 [0] = PWRDM_POWER_ON, /* gfx_mem */ 71 [0] = PWRSTS_ON, /* gfx_mem */
72 }, 72 },
73 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, 73 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
74}; 74};
@@ -80,15 +80,15 @@ static struct powerdomain abe_44xx_pwrdm = {
80 .prcm_partition = OMAP4430_PRM_PARTITION, 80 .prcm_partition = OMAP4430_PRM_PARTITION,
81 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 81 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
82 .pwrsts = PWRSTS_OFF_RET_ON, 82 .pwrsts = PWRSTS_OFF_RET_ON,
83 .pwrsts_logic_ret = PWRDM_POWER_OFF, 83 .pwrsts_logic_ret = PWRSTS_OFF,
84 .banks = 2, 84 .banks = 2,
85 .pwrsts_mem_ret = { 85 .pwrsts_mem_ret = {
86 [0] = PWRDM_POWER_RET, /* aessmem */ 86 [0] = PWRSTS_RET, /* aessmem */
87 [1] = PWRDM_POWER_OFF, /* periphmem */ 87 [1] = PWRSTS_OFF, /* periphmem */
88 }, 88 },
89 .pwrsts_mem_on = { 89 .pwrsts_mem_on = {
90 [0] = PWRDM_POWER_ON, /* aessmem */ 90 [0] = PWRSTS_ON, /* aessmem */
91 [1] = PWRDM_POWER_ON, /* periphmem */ 91 [1] = PWRSTS_ON, /* periphmem */
92 }, 92 },
93 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, 93 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
94}; 94};
@@ -103,10 +103,10 @@ static struct powerdomain dss_44xx_pwrdm = {
103 .pwrsts_logic_ret = PWRSTS_OFF, 103 .pwrsts_logic_ret = PWRSTS_OFF,
104 .banks = 1, 104 .banks = 1,
105 .pwrsts_mem_ret = { 105 .pwrsts_mem_ret = {
106 [0] = PWRDM_POWER_OFF, /* dss_mem */ 106 [0] = PWRSTS_OFF, /* dss_mem */
107 }, 107 },
108 .pwrsts_mem_on = { 108 .pwrsts_mem_on = {
109 [0] = PWRDM_POWER_ON, /* dss_mem */ 109 [0] = PWRSTS_ON, /* dss_mem */
110 }, 110 },
111 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, 111 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
112}; 112};
@@ -121,14 +121,14 @@ static struct powerdomain tesla_44xx_pwrdm = {
121 .pwrsts_logic_ret = PWRSTS_OFF_RET, 121 .pwrsts_logic_ret = PWRSTS_OFF_RET,
122 .banks = 3, 122 .banks = 3,
123 .pwrsts_mem_ret = { 123 .pwrsts_mem_ret = {
124 [0] = PWRDM_POWER_RET, /* tesla_edma */ 124 [0] = PWRSTS_RET, /* tesla_edma */
125 [1] = PWRSTS_OFF_RET, /* tesla_l1 */ 125 [1] = PWRSTS_OFF_RET, /* tesla_l1 */
126 [2] = PWRSTS_OFF_RET, /* tesla_l2 */ 126 [2] = PWRSTS_OFF_RET, /* tesla_l2 */
127 }, 127 },
128 .pwrsts_mem_on = { 128 .pwrsts_mem_on = {
129 [0] = PWRDM_POWER_ON, /* tesla_edma */ 129 [0] = PWRSTS_ON, /* tesla_edma */
130 [1] = PWRDM_POWER_ON, /* tesla_l1 */ 130 [1] = PWRSTS_ON, /* tesla_l1 */
131 [2] = PWRDM_POWER_ON, /* tesla_l2 */ 131 [2] = PWRSTS_ON, /* tesla_l2 */
132 }, 132 },
133 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, 133 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
134}; 134};
@@ -142,10 +142,10 @@ static struct powerdomain wkup_44xx_pwrdm = {
142 .pwrsts = PWRSTS_ON, 142 .pwrsts = PWRSTS_ON,
143 .banks = 1, 143 .banks = 1,
144 .pwrsts_mem_ret = { 144 .pwrsts_mem_ret = {
145 [0] = PWRDM_POWER_OFF, /* wkup_bank */ 145 [0] = PWRSTS_OFF, /* wkup_bank */
146 }, 146 },
147 .pwrsts_mem_on = { 147 .pwrsts_mem_on = {
148 [0] = PWRDM_POWER_ON, /* wkup_bank */ 148 [0] = PWRSTS_ON, /* wkup_bank */
149 }, 149 },
150}; 150};
151 151
@@ -162,7 +162,7 @@ static struct powerdomain cpu0_44xx_pwrdm = {
162 [0] = PWRSTS_OFF_RET, /* cpu0_l1 */ 162 [0] = PWRSTS_OFF_RET, /* cpu0_l1 */
163 }, 163 },
164 .pwrsts_mem_on = { 164 .pwrsts_mem_on = {
165 [0] = PWRDM_POWER_ON, /* cpu0_l1 */ 165 [0] = PWRSTS_ON, /* cpu0_l1 */
166 }, 166 },
167}; 167};
168 168
@@ -179,7 +179,7 @@ static struct powerdomain cpu1_44xx_pwrdm = {
179 [0] = PWRSTS_OFF_RET, /* cpu1_l1 */ 179 [0] = PWRSTS_OFF_RET, /* cpu1_l1 */
180 }, 180 },
181 .pwrsts_mem_on = { 181 .pwrsts_mem_on = {
182 [0] = PWRDM_POWER_ON, /* cpu1_l1 */ 182 [0] = PWRSTS_ON, /* cpu1_l1 */
183 }, 183 },
184}; 184};
185 185
@@ -192,10 +192,10 @@ static struct powerdomain emu_44xx_pwrdm = {
192 .pwrsts = PWRSTS_OFF_ON, 192 .pwrsts = PWRSTS_OFF_ON,
193 .banks = 1, 193 .banks = 1,
194 .pwrsts_mem_ret = { 194 .pwrsts_mem_ret = {
195 [0] = PWRDM_POWER_OFF, /* emu_bank */ 195 [0] = PWRSTS_OFF, /* emu_bank */
196 }, 196 },
197 .pwrsts_mem_on = { 197 .pwrsts_mem_on = {
198 [0] = PWRDM_POWER_ON, /* emu_bank */ 198 [0] = PWRSTS_ON, /* emu_bank */
199 }, 199 },
200}; 200};
201 201
@@ -211,12 +211,12 @@ static struct powerdomain mpu_44xx_pwrdm = {
211 .pwrsts_mem_ret = { 211 .pwrsts_mem_ret = {
212 [0] = PWRSTS_OFF_RET, /* mpu_l1 */ 212 [0] = PWRSTS_OFF_RET, /* mpu_l1 */
213 [1] = PWRSTS_OFF_RET, /* mpu_l2 */ 213 [1] = PWRSTS_OFF_RET, /* mpu_l2 */
214 [2] = PWRDM_POWER_RET, /* mpu_ram */ 214 [2] = PWRSTS_RET, /* mpu_ram */
215 }, 215 },
216 .pwrsts_mem_on = { 216 .pwrsts_mem_on = {
217 [0] = PWRDM_POWER_ON, /* mpu_l1 */ 217 [0] = PWRSTS_ON, /* mpu_l1 */
218 [1] = PWRDM_POWER_ON, /* mpu_l2 */ 218 [1] = PWRSTS_ON, /* mpu_l2 */
219 [2] = PWRDM_POWER_ON, /* mpu_ram */ 219 [2] = PWRSTS_ON, /* mpu_ram */
220 }, 220 },
221}; 221};
222 222
@@ -227,19 +227,19 @@ static struct powerdomain ivahd_44xx_pwrdm = {
227 .prcm_partition = OMAP4430_PRM_PARTITION, 227 .prcm_partition = OMAP4430_PRM_PARTITION,
228 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), 228 .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
229 .pwrsts = PWRSTS_OFF_RET_ON, 229 .pwrsts = PWRSTS_OFF_RET_ON,
230 .pwrsts_logic_ret = PWRDM_POWER_OFF, 230 .pwrsts_logic_ret = PWRSTS_OFF,
231 .banks = 4, 231 .banks = 4,
232 .pwrsts_mem_ret = { 232 .pwrsts_mem_ret = {
233 [0] = PWRDM_POWER_OFF, /* hwa_mem */ 233 [0] = PWRSTS_OFF, /* hwa_mem */
234 [1] = PWRSTS_OFF_RET, /* sl2_mem */ 234 [1] = PWRSTS_OFF_RET, /* sl2_mem */
235 [2] = PWRSTS_OFF_RET, /* tcm1_mem */ 235 [2] = PWRSTS_OFF_RET, /* tcm1_mem */
236 [3] = PWRSTS_OFF_RET, /* tcm2_mem */ 236 [3] = PWRSTS_OFF_RET, /* tcm2_mem */
237 }, 237 },
238 .pwrsts_mem_on = { 238 .pwrsts_mem_on = {
239 [0] = PWRDM_POWER_ON, /* hwa_mem */ 239 [0] = PWRSTS_ON, /* hwa_mem */
240 [1] = PWRDM_POWER_ON, /* sl2_mem */ 240 [1] = PWRSTS_ON, /* sl2_mem */
241 [2] = PWRDM_POWER_ON, /* tcm1_mem */ 241 [2] = PWRSTS_ON, /* tcm1_mem */
242 [3] = PWRDM_POWER_ON, /* tcm2_mem */ 242 [3] = PWRSTS_ON, /* tcm2_mem */
243 }, 243 },
244 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, 244 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
245}; 245};
@@ -253,10 +253,10 @@ static struct powerdomain cam_44xx_pwrdm = {
253 .pwrsts = PWRSTS_OFF_ON, 253 .pwrsts = PWRSTS_OFF_ON,
254 .banks = 1, 254 .banks = 1,
255 .pwrsts_mem_ret = { 255 .pwrsts_mem_ret = {
256 [0] = PWRDM_POWER_OFF, /* cam_mem */ 256 [0] = PWRSTS_OFF, /* cam_mem */
257 }, 257 },
258 .pwrsts_mem_on = { 258 .pwrsts_mem_on = {
259 [0] = PWRDM_POWER_ON, /* cam_mem */ 259 [0] = PWRSTS_ON, /* cam_mem */
260 }, 260 },
261 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, 261 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
262}; 262};
@@ -271,10 +271,10 @@ static struct powerdomain l3init_44xx_pwrdm = {
271 .pwrsts_logic_ret = PWRSTS_OFF_RET, 271 .pwrsts_logic_ret = PWRSTS_OFF_RET,
272 .banks = 1, 272 .banks = 1,
273 .pwrsts_mem_ret = { 273 .pwrsts_mem_ret = {
274 [0] = PWRDM_POWER_OFF, /* l3init_bank1 */ 274 [0] = PWRSTS_OFF, /* l3init_bank1 */
275 }, 275 },
276 .pwrsts_mem_on = { 276 .pwrsts_mem_on = {
277 [0] = PWRDM_POWER_ON, /* l3init_bank1 */ 277 [0] = PWRSTS_ON, /* l3init_bank1 */
278 }, 278 },
279 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, 279 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
280}; 280};
@@ -289,12 +289,12 @@ static struct powerdomain l4per_44xx_pwrdm = {
289 .pwrsts_logic_ret = PWRSTS_OFF_RET, 289 .pwrsts_logic_ret = PWRSTS_OFF_RET,
290 .banks = 2, 290 .banks = 2,
291 .pwrsts_mem_ret = { 291 .pwrsts_mem_ret = {
292 [0] = PWRDM_POWER_OFF, /* nonretained_bank */ 292 [0] = PWRSTS_OFF, /* nonretained_bank */
293 [1] = PWRDM_POWER_RET, /* retained_bank */ 293 [1] = PWRSTS_RET, /* retained_bank */
294 }, 294 },
295 .pwrsts_mem_on = { 295 .pwrsts_mem_on = {
296 [0] = PWRDM_POWER_ON, /* nonretained_bank */ 296 [0] = PWRSTS_ON, /* nonretained_bank */
297 [1] = PWRDM_POWER_ON, /* retained_bank */ 297 [1] = PWRSTS_ON, /* retained_bank */
298 }, 298 },
299 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE, 299 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
300}; 300};
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.h b/arch/arm/mach-omap2/prcm_mpu44xx.h
index 3300ff6e3cfe..d22d1b43bccd 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.h
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.h
@@ -38,8 +38,8 @@
38#define OMAP4430_PRCM_MPU_CPU1_INST 0x0800 38#define OMAP4430_PRCM_MPU_CPU1_INST 0x0800
39 39
40/* PRCM_MPU clockdomain register offsets (from instance start) */ 40/* PRCM_MPU clockdomain register offsets (from instance start) */
41#define OMAP4430_PRCM_MPU_CPU0_MPU_CDOFFS 0x0018 41#define OMAP4430_PRCM_MPU_CPU0_CPU0_CDOFFS 0x0018
42#define OMAP4430_PRCM_MPU_CPU1_MPU_CDOFFS 0x0018 42#define OMAP4430_PRCM_MPU_CPU1_CPU1_CDOFFS 0x0018
43 43
44 44
45/* 45/*
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index ec0362574b5e..051213fbc346 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -118,7 +118,8 @@ int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
118/** 118/**
119 * omap2_prm_deassert_hardreset - deassert a submodule hardreset line and wait 119 * omap2_prm_deassert_hardreset - deassert a submodule hardreset line and wait
120 * @prm_mod: PRM submodule base (e.g. CORE_MOD) 120 * @prm_mod: PRM submodule base (e.g. CORE_MOD)
121 * @shift: register bit shift corresponding to the reset line to deassert 121 * @rst_shift: register bit shift corresponding to the reset line to deassert
122 * @st_shift: register bit shift for the status of the deasserted submodule
122 * 123 *
123 * Some IPs like dsp or iva contain processors that require an HW 124 * Some IPs like dsp or iva contain processors that require an HW
124 * reset line to be asserted / deasserted in order to fully enable the 125 * reset line to be asserted / deasserted in order to fully enable the
@@ -129,27 +130,28 @@ int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
129 * -EINVAL upon an argument error, -EEXIST if the submodule was already out 130 * -EINVAL upon an argument error, -EEXIST if the submodule was already out
130 * of reset, or -EBUSY if the submodule did not exit reset promptly. 131 * of reset, or -EBUSY if the submodule did not exit reset promptly.
131 */ 132 */
132int omap2_prm_deassert_hardreset(s16 prm_mod, u8 shift) 133int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
133{ 134{
134 u32 mask; 135 u32 rst, st;
135 int c; 136 int c;
136 137
137 if (!(cpu_is_omap24xx() || cpu_is_omap34xx())) 138 if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
138 return -EINVAL; 139 return -EINVAL;
139 140
140 mask = 1 << shift; 141 rst = 1 << rst_shift;
142 st = 1 << st_shift;
141 143
142 /* Check the current status to avoid de-asserting the line twice */ 144 /* Check the current status to avoid de-asserting the line twice */
143 if (omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL, mask) == 0) 145 if (omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL, rst) == 0)
144 return -EEXIST; 146 return -EEXIST;
145 147
146 /* Clear the reset status by writing 1 to the status bit */ 148 /* Clear the reset status by writing 1 to the status bit */
147 omap2_prm_rmw_mod_reg_bits(0xffffffff, mask, prm_mod, OMAP2_RM_RSTST); 149 omap2_prm_rmw_mod_reg_bits(0xffffffff, st, prm_mod, OMAP2_RM_RSTST);
148 /* de-assert the reset control line */ 150 /* de-assert the reset control line */
149 omap2_prm_rmw_mod_reg_bits(mask, 0, prm_mod, OMAP2_RM_RSTCTRL); 151 omap2_prm_rmw_mod_reg_bits(rst, 0, prm_mod, OMAP2_RM_RSTCTRL);
150 /* wait the status to be set */ 152 /* wait the status to be set */
151 omap_test_timeout(omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTST, 153 omap_test_timeout(omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTST,
152 mask), 154 st),
153 MAX_MODULE_HARDRESET_WAIT, c); 155 MAX_MODULE_HARDRESET_WAIT, c);
154 156
155 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; 157 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h
index 49654c8d18f5..a1fc62a39dbb 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -282,7 +282,8 @@ static inline int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
282 "not suppose to be used on omap4\n"); 282 "not suppose to be used on omap4\n");
283 return 0; 283 return 0;
284} 284}
285static inline int omap2_prm_deassert_hardreset(s16 prm_mod, u8 shift) 285static inline int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift,
286 u8 st_shift)
286{ 287{
287 WARN(1, "prm: omap2xxx/omap3xxx specific function and " 288 WARN(1, "prm: omap2xxx/omap3xxx specific function and "
288 "not suppose to be used on omap4\n"); 289 "not suppose to be used on omap4\n");
@@ -300,7 +301,7 @@ extern u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask);
300/* These omap2_ PRM functions apply to both OMAP2 and 3 */ 301/* These omap2_ PRM functions apply to both OMAP2 and 3 */
301extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift); 302extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift);
302extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift); 303extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift);
303extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 shift); 304extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift);
304 305
305#endif /* CONFIG_ARCH_OMAP4 */ 306#endif /* CONFIG_ARCH_OMAP4 */
306#endif 307#endif
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
index 60e70552b4c5..f438cf4d847b 100644
--- a/arch/arm/mach-omap2/smartreflex-class3.c
+++ b/arch/arm/mach-omap2/smartreflex-class3.c
@@ -11,7 +11,7 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13
14#include <plat/smartreflex.h> 14#include "smartreflex.h"
15 15
16static int sr_class3_enable(struct voltagedomain *voltdm) 16static int sr_class3_enable(struct voltagedomain *voltdm)
17{ 17{
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 0ab4dd5081ee..8f674c9442bf 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -26,9 +26,9 @@
26#include <linux/pm_runtime.h> 26#include <linux/pm_runtime.h>
27 27
28#include <plat/common.h> 28#include <plat/common.h>
29#include <plat/smartreflex.h>
30 29
31#include "pm.h" 30#include "pm.h"
31#include "smartreflex.h"
32 32
33#define SMARTREFLEX_NAME_LEN 16 33#define SMARTREFLEX_NAME_LEN 16
34#define NVALUE_NAME_LEN 40 34#define NVALUE_NAME_LEN 40
diff --git a/arch/arm/mach-omap2/smartreflex.h b/arch/arm/mach-omap2/smartreflex.h
new file mode 100644
index 000000000000..5f35b9e25556
--- /dev/null
+++ b/arch/arm/mach-omap2/smartreflex.h
@@ -0,0 +1,246 @@
1/*
2 * OMAP Smartreflex Defines and Routines
3 *
4 * Author: Thara Gopinath <thara@ti.com>
5 *
6 * Copyright (C) 2010 Texas Instruments, Inc.
7 * Thara Gopinath <thara@ti.com>
8 *
9 * Copyright (C) 2008 Nokia Corporation
10 * Kalle Jokiniemi
11 *
12 * Copyright (C) 2007 Texas Instruments, Inc.
13 * Lesly A M <x0080970@ti.com>
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 */
19
20#ifndef __ASM_ARM_OMAP_SMARTREFLEX_H
21#define __ASM_ARM_OMAP_SMARTREFLEX_H
22
23#include <linux/platform_device.h>
24
25#include "voltage.h"
26
27/*
28 * Different Smartreflex IPs version. The v1 is the 65nm version used in
29 * OMAP3430. The v2 is the update for the 45nm version of the IP
30 * used in OMAP3630 and OMAP4430
31 */
32#define SR_TYPE_V1 1
33#define SR_TYPE_V2 2
34
35/* SMART REFLEX REG ADDRESS OFFSET */
36#define SRCONFIG 0x00
37#define SRSTATUS 0x04
38#define SENVAL 0x08
39#define SENMIN 0x0C
40#define SENMAX 0x10
41#define SENAVG 0x14
42#define AVGWEIGHT 0x18
43#define NVALUERECIPROCAL 0x1c
44#define SENERROR_V1 0x20
45#define ERRCONFIG_V1 0x24
46#define IRQ_EOI 0x20
47#define IRQSTATUS_RAW 0x24
48#define IRQSTATUS 0x28
49#define IRQENABLE_SET 0x2C
50#define IRQENABLE_CLR 0x30
51#define SENERROR_V2 0x34
52#define ERRCONFIG_V2 0x38
53
54/* Bit/Shift Positions */
55
56/* SRCONFIG */
57#define SRCONFIG_ACCUMDATA_SHIFT 22
58#define SRCONFIG_SRCLKLENGTH_SHIFT 12
59#define SRCONFIG_SENNENABLE_V1_SHIFT 5
60#define SRCONFIG_SENPENABLE_V1_SHIFT 3
61#define SRCONFIG_SENNENABLE_V2_SHIFT 1
62#define SRCONFIG_SENPENABLE_V2_SHIFT 0
63#define SRCONFIG_CLKCTRL_SHIFT 0
64
65#define SRCONFIG_ACCUMDATA_MASK (0x3ff << 22)
66
67#define SRCONFIG_SRENABLE BIT(11)
68#define SRCONFIG_SENENABLE BIT(10)
69#define SRCONFIG_ERRGEN_EN BIT(9)
70#define SRCONFIG_MINMAXAVG_EN BIT(8)
71#define SRCONFIG_DELAYCTRL BIT(2)
72
73/* AVGWEIGHT */
74#define AVGWEIGHT_SENPAVGWEIGHT_SHIFT 2
75#define AVGWEIGHT_SENNAVGWEIGHT_SHIFT 0
76
77/* NVALUERECIPROCAL */
78#define NVALUERECIPROCAL_SENPGAIN_SHIFT 20
79#define NVALUERECIPROCAL_SENNGAIN_SHIFT 16
80#define NVALUERECIPROCAL_RNSENP_SHIFT 8
81#define NVALUERECIPROCAL_RNSENN_SHIFT 0
82
83/* ERRCONFIG */
84#define ERRCONFIG_ERRWEIGHT_SHIFT 16
85#define ERRCONFIG_ERRMAXLIMIT_SHIFT 8
86#define ERRCONFIG_ERRMINLIMIT_SHIFT 0
87
88#define SR_ERRWEIGHT_MASK (0x07 << 16)
89#define SR_ERRMAXLIMIT_MASK (0xff << 8)
90#define SR_ERRMINLIMIT_MASK (0xff << 0)
91
92#define ERRCONFIG_VPBOUNDINTEN_V1 BIT(31)
93#define ERRCONFIG_VPBOUNDINTST_V1 BIT(30)
94#define ERRCONFIG_MCUACCUMINTEN BIT(29)
95#define ERRCONFIG_MCUACCUMINTST BIT(28)
96#define ERRCONFIG_MCUVALIDINTEN BIT(27)
97#define ERRCONFIG_MCUVALIDINTST BIT(26)
98#define ERRCONFIG_MCUBOUNDINTEN BIT(25)
99#define ERRCONFIG_MCUBOUNDINTST BIT(24)
100#define ERRCONFIG_MCUDISACKINTEN BIT(23)
101#define ERRCONFIG_VPBOUNDINTST_V2 BIT(23)
102#define ERRCONFIG_MCUDISACKINTST BIT(22)
103#define ERRCONFIG_VPBOUNDINTEN_V2 BIT(22)
104
105#define ERRCONFIG_STATUS_V1_MASK (ERRCONFIG_VPBOUNDINTST_V1 | \
106 ERRCONFIG_MCUACCUMINTST | \
107 ERRCONFIG_MCUVALIDINTST | \
108 ERRCONFIG_MCUBOUNDINTST | \
109 ERRCONFIG_MCUDISACKINTST)
110/* IRQSTATUS */
111#define IRQSTATUS_MCUACCUMINT BIT(3)
112#define IRQSTATUS_MCVALIDINT BIT(2)
113#define IRQSTATUS_MCBOUNDSINT BIT(1)
114#define IRQSTATUS_MCUDISABLEACKINT BIT(0)
115
116/* IRQENABLE_SET and IRQENABLE_CLEAR */
117#define IRQENABLE_MCUACCUMINT BIT(3)
118#define IRQENABLE_MCUVALIDINT BIT(2)
119#define IRQENABLE_MCUBOUNDSINT BIT(1)
120#define IRQENABLE_MCUDISABLEACKINT BIT(0)
121
122/* Common Bit values */
123
124#define SRCLKLENGTH_12MHZ_SYSCLK 0x3c
125#define SRCLKLENGTH_13MHZ_SYSCLK 0x41
126#define SRCLKLENGTH_19MHZ_SYSCLK 0x60
127#define SRCLKLENGTH_26MHZ_SYSCLK 0x82
128#define SRCLKLENGTH_38MHZ_SYSCLK 0xC0
129
130/*
131 * 3430 specific values. Maybe these should be passed from board file or
132 * pmic structures.
133 */
134#define OMAP3430_SR_ACCUMDATA 0x1f4
135
136#define OMAP3430_SR1_SENPAVGWEIGHT 0x03
137#define OMAP3430_SR1_SENNAVGWEIGHT 0x03
138
139#define OMAP3430_SR2_SENPAVGWEIGHT 0x01
140#define OMAP3430_SR2_SENNAVGWEIGHT 0x01
141
142#define OMAP3430_SR_ERRWEIGHT 0x04
143#define OMAP3430_SR_ERRMAXLIMIT 0x02
144
145/**
146 * struct omap_sr_pmic_data - Strucutre to be populated by pmic code to pass
147 * pmic specific info to smartreflex driver
148 *
149 * @sr_pmic_init: API to initialize smartreflex on the PMIC side.
150 */
151struct omap_sr_pmic_data {
152 void (*sr_pmic_init) (void);
153};
154
155#ifdef CONFIG_OMAP_SMARTREFLEX
156/*
157 * The smart reflex driver supports CLASS1 CLASS2 and CLASS3 SR.
158 * The smartreflex class driver should pass the class type.
159 * Should be used to populate the class_type field of the
160 * omap_smartreflex_class_data structure.
161 */
162#define SR_CLASS1 0x1
163#define SR_CLASS2 0x2
164#define SR_CLASS3 0x3
165
166/**
167 * struct omap_sr_class_data - Smartreflex class driver info
168 *
169 * @enable: API to enable a particular class smaartreflex.
170 * @disable: API to disable a particular class smartreflex.
171 * @configure: API to configure a particular class smartreflex.
172 * @notify: API to notify the class driver about an event in SR.
173 * Not needed for class3.
174 * @notify_flags: specify the events to be notified to the class driver
175 * @class_type: specify which smartreflex class.
176 * Can be used by the SR driver to take any class
177 * based decisions.
178 */
179struct omap_sr_class_data {
180 int (*enable)(struct voltagedomain *voltdm);
181 int (*disable)(struct voltagedomain *voltdm, int is_volt_reset);
182 int (*configure)(struct voltagedomain *voltdm);
183 int (*notify)(struct voltagedomain *voltdm, u32 status);
184 u8 notify_flags;
185 u8 class_type;
186};
187
188/**
189 * struct omap_sr_nvalue_table - Smartreflex n-target value info
190 *
191 * @efuse_offs: The offset of the efuse where n-target values are stored.
192 * @nvalue: The n-target value.
193 */
194struct omap_sr_nvalue_table {
195 u32 efuse_offs;
196 u32 nvalue;
197};
198
199/**
200 * struct omap_sr_data - Smartreflex platform data.
201 *
202 * @ip_type: Smartreflex IP type.
203 * @senp_mod: SENPENABLE value for the sr
204 * @senn_mod: SENNENABLE value for sr
205 * @nvalue_count: Number of distinct nvalues in the nvalue table
206 * @enable_on_init: whether this sr module needs to enabled at
207 * boot up or not.
208 * @nvalue_table: table containing the efuse offsets and nvalues
209 * corresponding to them.
210 * @voltdm: Pointer to the voltage domain associated with the SR
211 */
212struct omap_sr_data {
213 int ip_type;
214 u32 senp_mod;
215 u32 senn_mod;
216 int nvalue_count;
217 bool enable_on_init;
218 struct omap_sr_nvalue_table *nvalue_table;
219 struct voltagedomain *voltdm;
220};
221
222/* Smartreflex module enable/disable interface */
223void omap_sr_enable(struct voltagedomain *voltdm);
224void omap_sr_disable(struct voltagedomain *voltdm);
225void omap_sr_disable_reset_volt(struct voltagedomain *voltdm);
226
227/* API to register the pmic specific data with the smartreflex driver. */
228void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data);
229
230/* Smartreflex driver hooks to be called from Smartreflex class driver */
231int sr_enable(struct voltagedomain *voltdm, unsigned long volt);
232void sr_disable(struct voltagedomain *voltdm);
233int sr_configure_errgen(struct voltagedomain *voltdm);
234int sr_configure_minmax(struct voltagedomain *voltdm);
235
236/* API to register the smartreflex class driver with the smartreflex driver */
237int sr_register_class(struct omap_sr_class_data *class_data);
238#else
239static inline void omap_sr_enable(struct voltagedomain *voltdm) {}
240static inline void omap_sr_disable(struct voltagedomain *voltdm) {}
241static inline void omap_sr_disable_reset_volt(
242 struct voltagedomain *voltdm) {}
243static inline void omap_sr_register_pmic(
244 struct omap_sr_pmic_data *pmic_data) {}
245#endif
246#endif
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index b1e0af18a26a..10d3c5ee8018 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -23,9 +23,9 @@
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <plat/omap_device.h> 25#include <plat/omap_device.h>
26#include <plat/smartreflex.h>
27#include <plat/voltage.h>
28 26
27#include "smartreflex.h"
28#include "voltage.h"
29#include "control.h" 29#include "control.h"
30#include "pm.h" 30#include "pm.h"
31 31
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h
new file mode 100644
index 000000000000..e7767771de49
--- /dev/null
+++ b/arch/arm/mach-omap2/vc.h
@@ -0,0 +1,83 @@
1/*
2 * OMAP3/4 Voltage Controller (VC) structure and macro definitions
3 *
4 * Copyright (C) 2007, 2010 Texas Instruments, Inc.
5 * Rajendra Nayak <rnayak@ti.com>
6 * Lesly A M <x0080970@ti.com>
7 * Thara Gopinath <thara@ti.com>
8 *
9 * Copyright (C) 2008, 2011 Nokia Corporation
10 * Kalle Jokiniemi
11 * Paul Walmsley
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License version
15 * 2 as published by the Free Software Foundation.
16 */
17#ifndef __ARCH_ARM_MACH_OMAP2_VC_H
18#define __ARCH_ARM_MACH_OMAP2_VC_H
19
20#include <linux/kernel.h>
21
22/**
23 * struct omap_vc_common_data - per-VC register/bitfield data
24 * @cmd_on_mask: ON bitmask in PRM_VC_CMD_VAL* register
25 * @valid: VALID bitmask in PRM_VC_BYPASS_VAL register
26 * @smps_sa_reg: Offset of PRM_VC_SMPS_SA reg from PRM start
27 * @smps_volra_reg: Offset of PRM_VC_SMPS_VOL_RA reg from PRM start
28 * @bypass_val_reg: Offset of PRM_VC_BYPASS_VAL reg from PRM start
29 * @data_shift: DATA field shift in PRM_VC_BYPASS_VAL register
30 * @slaveaddr_shift: SLAVEADDR field shift in PRM_VC_BYPASS_VAL register
31 * @regaddr_shift: REGADDR field shift in PRM_VC_BYPASS_VAL register
32 * @cmd_on_shift: ON field shift in PRM_VC_CMD_VAL_* register
33 * @cmd_onlp_shift: ONLP field shift in PRM_VC_CMD_VAL_* register
34 * @cmd_ret_shift: RET field shift in PRM_VC_CMD_VAL_* register
35 * @cmd_off_shift: OFF field shift in PRM_VC_CMD_VAL_* register
36 *
37 * XXX One of cmd_on_mask and cmd_on_shift are not needed
38 * XXX VALID should probably be a shift, not a mask
39 */
40struct omap_vc_common_data {
41 u32 cmd_on_mask;
42 u32 valid;
43 u8 smps_sa_reg;
44 u8 smps_volra_reg;
45 u8 bypass_val_reg;
46 u8 data_shift;
47 u8 slaveaddr_shift;
48 u8 regaddr_shift;
49 u8 cmd_on_shift;
50 u8 cmd_onlp_shift;
51 u8 cmd_ret_shift;
52 u8 cmd_off_shift;
53};
54
55/**
56 * struct omap_vc_instance_data - VC per-instance data
57 * @vc_common: pointer to VC common data for this platform
58 * @smps_sa_mask: SA* bitmask in the PRM_VC_SMPS_SA register
59 * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register
60 * @smps_sa_shift: SA* field shift in the PRM_VC_SMPS_SA register
61 * @smps_volra_shift: VOLRA* field shift in the PRM_VC_VOL_RA register
62 *
63 * XXX It is not necessary to have both a *_mask and a *_shift -
64 * remove one
65 */
66struct omap_vc_instance_data {
67 const struct omap_vc_common_data *vc_common;
68 u32 smps_sa_mask;
69 u32 smps_volra_mask;
70 u8 cmdval_reg;
71 u8 smps_sa_shift;
72 u8 smps_volra_shift;
73};
74
75extern struct omap_vc_instance_data omap3_vc1_data;
76extern struct omap_vc_instance_data omap3_vc2_data;
77
78extern struct omap_vc_instance_data omap4_vc_mpu_data;
79extern struct omap_vc_instance_data omap4_vc_iva_data;
80extern struct omap_vc_instance_data omap4_vc_core_data;
81
82#endif
83
diff --git a/arch/arm/mach-omap2/vc3xxx_data.c b/arch/arm/mach-omap2/vc3xxx_data.c
new file mode 100644
index 000000000000..f37dc4bc379a
--- /dev/null
+++ b/arch/arm/mach-omap2/vc3xxx_data.c
@@ -0,0 +1,63 @@
1/*
2 * OMAP3 Voltage Controller (VC) data
3 *
4 * Copyright (C) 2007, 2010 Texas Instruments, Inc.
5 * Rajendra Nayak <rnayak@ti.com>
6 * Lesly A M <x0080970@ti.com>
7 * Thara Gopinath <thara@ti.com>
8 *
9 * Copyright (C) 2008, 2011 Nokia Corporation
10 * Kalle Jokiniemi
11 * Paul Walmsley
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17#include <linux/io.h>
18#include <linux/err.h>
19#include <linux/init.h>
20
21#include <plat/common.h>
22
23#include "prm-regbits-34xx.h"
24#include "voltage.h"
25
26#include "vc.h"
27
28/*
29 * VC data common to 34xx/36xx chips
30 * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file.
31 */
32static struct omap_vc_common_data omap3_vc_common = {
33 .smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET,
34 .smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET,
35 .bypass_val_reg = OMAP3_PRM_VC_BYPASS_VAL_OFFSET,
36 .data_shift = OMAP3430_DATA_SHIFT,
37 .slaveaddr_shift = OMAP3430_SLAVEADDR_SHIFT,
38 .regaddr_shift = OMAP3430_REGADDR_SHIFT,
39 .valid = OMAP3430_VALID_MASK,
40 .cmd_on_shift = OMAP3430_VC_CMD_ON_SHIFT,
41 .cmd_on_mask = OMAP3430_VC_CMD_ON_MASK,
42 .cmd_onlp_shift = OMAP3430_VC_CMD_ONLP_SHIFT,
43 .cmd_ret_shift = OMAP3430_VC_CMD_RET_SHIFT,
44 .cmd_off_shift = OMAP3430_VC_CMD_OFF_SHIFT,
45};
46
47struct omap_vc_instance_data omap3_vc1_data = {
48 .vc_common = &omap3_vc_common,
49 .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_0_OFFSET,
50 .smps_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA0_SHIFT,
51 .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA0_MASK,
52 .smps_volra_shift = OMAP3430_VOLRA0_SHIFT,
53 .smps_volra_mask = OMAP3430_VOLRA0_MASK,
54};
55
56struct omap_vc_instance_data omap3_vc2_data = {
57 .vc_common = &omap3_vc_common,
58 .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_1_OFFSET,
59 .smps_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT,
60 .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA1_MASK,
61 .smps_volra_shift = OMAP3430_VOLRA1_SHIFT,
62 .smps_volra_mask = OMAP3430_VOLRA1_MASK,
63};
diff --git a/arch/arm/mach-omap2/vc44xx_data.c b/arch/arm/mach-omap2/vc44xx_data.c
new file mode 100644
index 000000000000..a98da8ddec52
--- /dev/null
+++ b/arch/arm/mach-omap2/vc44xx_data.c
@@ -0,0 +1,75 @@
1/*
2 * OMAP4 Voltage Controller (VC) data
3 *
4 * Copyright (C) 2007, 2010 Texas Instruments, Inc.
5 * Rajendra Nayak <rnayak@ti.com>
6 * Lesly A M <x0080970@ti.com>
7 * Thara Gopinath <thara@ti.com>
8 *
9 * Copyright (C) 2008, 2011 Nokia Corporation
10 * Kalle Jokiniemi
11 * Paul Walmsley
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17#include <linux/io.h>
18#include <linux/err.h>
19#include <linux/init.h>
20
21#include <plat/common.h>
22
23#include "prm44xx.h"
24#include "prm-regbits-44xx.h"
25#include "voltage.h"
26
27#include "vc.h"
28
29/*
30 * VC data common to 44xx chips
31 * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file.
32 */
33static const struct omap_vc_common_data omap4_vc_common = {
34 .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET,
35 .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET,
36 .bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET,
37 .data_shift = OMAP4430_DATA_SHIFT,
38 .slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT,
39 .regaddr_shift = OMAP4430_REGADDR_SHIFT,
40 .valid = OMAP4430_VALID_MASK,
41 .cmd_on_shift = OMAP4430_ON_SHIFT,
42 .cmd_on_mask = OMAP4430_ON_MASK,
43 .cmd_onlp_shift = OMAP4430_ONLP_SHIFT,
44 .cmd_ret_shift = OMAP4430_RET_SHIFT,
45 .cmd_off_shift = OMAP4430_OFF_SHIFT,
46};
47
48/* VC instance data for each controllable voltage line */
49struct omap_vc_instance_data omap4_vc_mpu_data = {
50 .vc_common = &omap4_vc_common,
51 .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET,
52 .smps_sa_shift = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_SHIFT,
53 .smps_sa_mask = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK,
54 .smps_volra_shift = OMAP4430_VOLRA_VDD_MPU_L_SHIFT,
55 .smps_volra_mask = OMAP4430_VOLRA_VDD_MPU_L_MASK,
56};
57
58struct omap_vc_instance_data omap4_vc_iva_data = {
59 .vc_common = &omap4_vc_common,
60 .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET,
61 .smps_sa_shift = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_SHIFT,
62 .smps_sa_mask = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK,
63 .smps_volra_shift = OMAP4430_VOLRA_VDD_IVA_L_SHIFT,
64 .smps_volra_mask = OMAP4430_VOLRA_VDD_IVA_L_MASK,
65};
66
67struct omap_vc_instance_data omap4_vc_core_data = {
68 .vc_common = &omap4_vc_common,
69 .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET,
70 .smps_sa_shift = OMAP4430_SA_VDD_CORE_L_0_6_SHIFT,
71 .smps_sa_mask = OMAP4430_SA_VDD_CORE_L_0_6_MASK,
72 .smps_volra_shift = OMAP4430_VOLRA_VDD_CORE_L_SHIFT,
73 .smps_volra_mask = OMAP4430_VOLRA_VDD_CORE_L_MASK,
74};
75
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index 12be525b8df4..c6facf7becf8 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -7,8 +7,9 @@
7 * Rajendra Nayak <rnayak@ti.com> 7 * Rajendra Nayak <rnayak@ti.com>
8 * Lesly A M <x0080970@ti.com> 8 * Lesly A M <x0080970@ti.com>
9 * 9 *
10 * Copyright (C) 2008 Nokia Corporation 10 * Copyright (C) 2008, 2011 Nokia Corporation
11 * Kalle Jokiniemi 11 * Kalle Jokiniemi
12 * Paul Walmsley
12 * 13 *
13 * Copyright (C) 2010 Texas Instruments, Inc. 14 * Copyright (C) 2010 Texas Instruments, Inc.
14 * Thara Gopinath <thara@ti.com> 15 * Thara Gopinath <thara@ti.com>
@@ -26,7 +27,6 @@
26#include <linux/slab.h> 27#include <linux/slab.h>
27 28
28#include <plat/common.h> 29#include <plat/common.h>
29#include <plat/voltage.h>
30 30
31#include "prm-regbits-34xx.h" 31#include "prm-regbits-34xx.h"
32#include "prm-regbits-44xx.h" 32#include "prm-regbits-44xx.h"
@@ -35,284 +35,30 @@
35#include "prminst44xx.h" 35#include "prminst44xx.h"
36#include "control.h" 36#include "control.h"
37 37
38#define VP_IDLE_TIMEOUT 200 38#include "voltage.h"
39#define VP_TRANXDONE_TIMEOUT 300 39
40#include "vc.h"
41#include "vp.h"
42
40#define VOLTAGE_DIR_SIZE 16 43#define VOLTAGE_DIR_SIZE 16
41 44
42/* Voltage processor register offsets */
43struct vp_reg_offs {
44 u8 vpconfig;
45 u8 vstepmin;
46 u8 vstepmax;
47 u8 vlimitto;
48 u8 vstatus;
49 u8 voltage;
50};
51
52/* Voltage Processor bit field values, shifts and masks */
53struct vp_reg_val {
54 /* PRM module */
55 u16 prm_mod;
56 /* VPx_VPCONFIG */
57 u32 vpconfig_erroroffset;
58 u16 vpconfig_errorgain;
59 u32 vpconfig_errorgain_mask;
60 u8 vpconfig_errorgain_shift;
61 u32 vpconfig_initvoltage_mask;
62 u8 vpconfig_initvoltage_shift;
63 u32 vpconfig_timeouten;
64 u32 vpconfig_initvdd;
65 u32 vpconfig_forceupdate;
66 u32 vpconfig_vpenable;
67 /* VPx_VSTEPMIN */
68 u8 vstepmin_stepmin;
69 u16 vstepmin_smpswaittimemin;
70 u8 vstepmin_stepmin_shift;
71 u8 vstepmin_smpswaittimemin_shift;
72 /* VPx_VSTEPMAX */
73 u8 vstepmax_stepmax;
74 u16 vstepmax_smpswaittimemax;
75 u8 vstepmax_stepmax_shift;
76 u8 vstepmax_smpswaittimemax_shift;
77 /* VPx_VLIMITTO */
78 u8 vlimitto_vddmin;
79 u8 vlimitto_vddmax;
80 u16 vlimitto_timeout;
81 u8 vlimitto_vddmin_shift;
82 u8 vlimitto_vddmax_shift;
83 u8 vlimitto_timeout_shift;
84 /* PRM_IRQSTATUS*/
85 u32 tranxdone_status;
86};
87
88/* Voltage controller registers and offsets */
89struct vc_reg_info {
90 /* PRM module */
91 u16 prm_mod;
92 /* VC register offsets */
93 u8 smps_sa_reg;
94 u8 smps_volra_reg;
95 u8 bypass_val_reg;
96 u8 cmdval_reg;
97 u8 voltsetup_reg;
98 /*VC_SMPS_SA*/
99 u8 smps_sa_shift;
100 u32 smps_sa_mask;
101 /* VC_SMPS_VOL_RA */
102 u8 smps_volra_shift;
103 u32 smps_volra_mask;
104 /* VC_BYPASS_VAL */
105 u8 data_shift;
106 u8 slaveaddr_shift;
107 u8 regaddr_shift;
108 u32 valid;
109 /* VC_CMD_VAL */
110 u8 cmd_on_shift;
111 u8 cmd_onlp_shift;
112 u8 cmd_ret_shift;
113 u8 cmd_off_shift;
114 u32 cmd_on_mask;
115 /* PRM_VOLTSETUP */
116 u8 voltsetup_shift;
117 u32 voltsetup_mask;
118};
119 45
120/** 46static struct omap_vdd_info **vdd_info;
121 * omap_vdd_info - Per Voltage Domain info 47
122 *
123 * @volt_data : voltage table having the distinct voltages supported
124 * by the domain and other associated per voltage data.
125 * @pmic_info : pmic specific parameters which should be populted by
126 * the pmic drivers.
127 * @vp_offs : structure containing the offsets for various
128 * vp registers
129 * @vp_reg : the register values, shifts, masks for various
130 * vp registers
131 * @vc_reg : structure containing various various vc registers,
132 * shifts, masks etc.
133 * @voltdm : pointer to the voltage domain structure
134 * @debug_dir : debug directory for this voltage domain.
135 * @curr_volt : current voltage for this vdd.
136 * @ocp_mod : The prm module for accessing the prm irqstatus reg.
137 * @prm_irqst_reg : prm irqstatus register.
138 * @vp_enabled : flag to keep track of whether vp is enabled or not
139 * @volt_scale : API to scale the voltage of the vdd.
140 */
141struct omap_vdd_info {
142 struct omap_volt_data *volt_data;
143 struct omap_volt_pmic_info *pmic_info;
144 struct vp_reg_offs vp_offs;
145 struct vp_reg_val vp_reg;
146 struct vc_reg_info vc_reg;
147 struct voltagedomain voltdm;
148 struct dentry *debug_dir;
149 u32 curr_volt;
150 u16 ocp_mod;
151 u8 prm_irqst_reg;
152 bool vp_enabled;
153 u32 (*read_reg) (u16 mod, u8 offset);
154 void (*write_reg) (u32 val, u16 mod, u8 offset);
155 int (*volt_scale) (struct omap_vdd_info *vdd,
156 unsigned long target_volt);
157};
158
159static struct omap_vdd_info *vdd_info;
160/* 48/*
161 * Number of scalable voltage domains. 49 * Number of scalable voltage domains.
162 */ 50 */
163static int nr_scalable_vdd; 51static int nr_scalable_vdd;
164 52
165/* OMAP3 VDD sturctures */ 53/* XXX document */
166static struct omap_vdd_info omap3_vdd_info[] = { 54static s16 prm_mod_offs;
167 { 55static s16 prm_irqst_ocp_mod_offs;
168 .vp_offs = {
169 .vpconfig = OMAP3_PRM_VP1_CONFIG_OFFSET,
170 .vstepmin = OMAP3_PRM_VP1_VSTEPMIN_OFFSET,
171 .vstepmax = OMAP3_PRM_VP1_VSTEPMAX_OFFSET,
172 .vlimitto = OMAP3_PRM_VP1_VLIMITTO_OFFSET,
173 .vstatus = OMAP3_PRM_VP1_STATUS_OFFSET,
174 .voltage = OMAP3_PRM_VP1_VOLTAGE_OFFSET,
175 },
176 .voltdm = {
177 .name = "mpu",
178 },
179 },
180 {
181 .vp_offs = {
182 .vpconfig = OMAP3_PRM_VP2_CONFIG_OFFSET,
183 .vstepmin = OMAP3_PRM_VP2_VSTEPMIN_OFFSET,
184 .vstepmax = OMAP3_PRM_VP2_VSTEPMAX_OFFSET,
185 .vlimitto = OMAP3_PRM_VP2_VLIMITTO_OFFSET,
186 .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET,
187 .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET,
188 },
189 .voltdm = {
190 .name = "core",
191 },
192 },
193};
194
195#define OMAP3_NR_SCALABLE_VDD ARRAY_SIZE(omap3_vdd_info)
196
197/* OMAP4 VDD sturctures */
198static struct omap_vdd_info omap4_vdd_info[] = {
199 {
200 .vp_offs = {
201 .vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET,
202 .vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET,
203 .vstepmax = OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET,
204 .vlimitto = OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET,
205 .vstatus = OMAP4_PRM_VP_MPU_STATUS_OFFSET,
206 .voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET,
207 },
208 .voltdm = {
209 .name = "mpu",
210 },
211 },
212 {
213 .vp_offs = {
214 .vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET,
215 .vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET,
216 .vstepmax = OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET,
217 .vlimitto = OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET,
218 .vstatus = OMAP4_PRM_VP_IVA_STATUS_OFFSET,
219 .voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET,
220 },
221 .voltdm = {
222 .name = "iva",
223 },
224 },
225 {
226 .vp_offs = {
227 .vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET,
228 .vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET,
229 .vstepmax = OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET,
230 .vlimitto = OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET,
231 .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET,
232 .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET,
233 },
234 .voltdm = {
235 .name = "core",
236 },
237 },
238};
239
240#define OMAP4_NR_SCALABLE_VDD ARRAY_SIZE(omap4_vdd_info)
241
242/*
243 * Structures containing OMAP3430/OMAP3630 voltage supported and various
244 * voltage dependent data for each VDD.
245 */
246#define VOLT_DATA_DEFINE(_v_nom, _efuse_offs, _errminlimit, _errgain) \
247{ \
248 .volt_nominal = _v_nom, \
249 .sr_efuse_offs = _efuse_offs, \
250 .sr_errminlimit = _errminlimit, \
251 .vp_errgain = _errgain \
252}
253
254/* VDD1 */
255static struct omap_volt_data omap34xx_vddmpu_volt_data[] = {
256 VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD1, 0xf4, 0x0c),
257 VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD1, 0xf4, 0x0c),
258 VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD1, 0xf9, 0x18),
259 VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP4_UV, OMAP343X_CONTROL_FUSE_OPP4_VDD1, 0xf9, 0x18),
260 VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP5_UV, OMAP343X_CONTROL_FUSE_OPP5_VDD1, 0xf9, 0x18),
261 VOLT_DATA_DEFINE(0, 0, 0, 0),
262};
263
264static struct omap_volt_data omap36xx_vddmpu_volt_data[] = {
265 VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD1, 0xf4, 0x0c),
266 VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD1, 0xf9, 0x16),
267 VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP120_UV, OMAP3630_CONTROL_FUSE_OPP120_VDD1, 0xfa, 0x23),
268 VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP1G_UV, OMAP3630_CONTROL_FUSE_OPP1G_VDD1, 0xfa, 0x27),
269 VOLT_DATA_DEFINE(0, 0, 0, 0),
270};
271
272/* VDD2 */
273static struct omap_volt_data omap34xx_vddcore_volt_data[] = {
274 VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD2, 0xf4, 0x0c),
275 VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD2, 0xf4, 0x0c),
276 VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD2, 0xf9, 0x18),
277 VOLT_DATA_DEFINE(0, 0, 0, 0),
278};
279
280static struct omap_volt_data omap36xx_vddcore_volt_data[] = {
281 VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD2, 0xf4, 0x0c),
282 VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD2, 0xf9, 0x16),
283 VOLT_DATA_DEFINE(0, 0, 0, 0),
284};
285
286/*
287 * Structures containing OMAP4430 voltage supported and various
288 * voltage dependent data for each VDD.
289 */
290static struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = {
291 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c),
292 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16),
293 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23),
294 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO, 0xfa, 0x27),
295 VOLT_DATA_DEFINE(0, 0, 0, 0),
296};
297
298static struct omap_volt_data omap44xx_vdd_iva_volt_data[] = {
299 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c),
300 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16),
301 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23),
302 VOLT_DATA_DEFINE(0, 0, 0, 0),
303};
304
305static struct omap_volt_data omap44xx_vdd_core_volt_data[] = {
306 VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c),
307 VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16),
308 VOLT_DATA_DEFINE(0, 0, 0, 0),
309};
310 56
311static struct dentry *voltage_dir; 57static struct dentry *voltage_dir;
312 58
313/* Init function pointers */ 59/* Init function pointers */
314static void (*vc_init) (struct omap_vdd_info *vdd); 60static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
315static int (*vdd_data_configure) (struct omap_vdd_info *vdd); 61 unsigned long target_volt);
316 62
317static u32 omap3_voltage_read_reg(u16 mod, u8 offset) 63static u32 omap3_voltage_read_reg(u16 mod, u8 offset)
318{ 64{
@@ -335,6 +81,62 @@ static void omap4_voltage_write_reg(u32 val, u16 mod, u8 offset)
335 omap4_prminst_write_inst_reg(val, OMAP4430_PRM_PARTITION, mod, offset); 81 omap4_prminst_write_inst_reg(val, OMAP4430_PRM_PARTITION, mod, offset);
336} 82}
337 83
84static int __init _config_common_vdd_data(struct omap_vdd_info *vdd)
85{
86 char *sys_ck_name;
87 struct clk *sys_ck;
88 u32 sys_clk_speed, timeout_val, waittime;
89
90 /*
91 * XXX Clockfw should handle this, or this should be in a
92 * struct record
93 */
94 if (cpu_is_omap24xx() || cpu_is_omap34xx())
95 sys_ck_name = "sys_ck";
96 else if (cpu_is_omap44xx())
97 sys_ck_name = "sys_clkin_ck";
98 else
99 return -EINVAL;
100
101 /*
102 * Sys clk rate is require to calculate vp timeout value and
103 * smpswaittimemin and smpswaittimemax.
104 */
105 sys_ck = clk_get(NULL, sys_ck_name);
106 if (IS_ERR(sys_ck)) {
107 pr_warning("%s: Could not get the sys clk to calculate"
108 "various vdd_%s params\n", __func__, vdd->voltdm.name);
109 return -EINVAL;
110 }
111 sys_clk_speed = clk_get_rate(sys_ck);
112 clk_put(sys_ck);
113 /* Divide to avoid overflow */
114 sys_clk_speed /= 1000;
115
116 /* Generic voltage parameters */
117 vdd->curr_volt = 1200000;
118 vdd->volt_scale = vp_forceupdate_scale_voltage;
119 vdd->vp_enabled = false;
120
121 vdd->vp_rt_data.vpconfig_erroroffset =
122 (vdd->pmic_info->vp_erroroffset <<
123 vdd->vp_data->vp_common->vpconfig_erroroffset_shift);
124
125 timeout_val = (sys_clk_speed * vdd->pmic_info->vp_timeout_us) / 1000;
126 vdd->vp_rt_data.vlimitto_timeout = timeout_val;
127 vdd->vp_rt_data.vlimitto_vddmin = vdd->pmic_info->vp_vddmin;
128 vdd->vp_rt_data.vlimitto_vddmax = vdd->pmic_info->vp_vddmax;
129
130 waittime = ((vdd->pmic_info->step_size / vdd->pmic_info->slew_rate) *
131 sys_clk_speed) / 1000;
132 vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime;
133 vdd->vp_rt_data.vstepmax_smpswaittimemax = waittime;
134 vdd->vp_rt_data.vstepmin_stepmin = vdd->pmic_info->vp_vstepmin;
135 vdd->vp_rt_data.vstepmax_stepmax = vdd->pmic_info->vp_vstepmax;
136
137 return 0;
138}
139
338/* Voltage debugfs support */ 140/* Voltage debugfs support */
339static int vp_volt_debug_get(void *data, u64 *val) 141static int vp_volt_debug_get(void *data, u64 *val)
340{ 142{
@@ -346,7 +148,7 @@ static int vp_volt_debug_get(void *data, u64 *val)
346 return -EINVAL; 148 return -EINVAL;
347 } 149 }
348 150
349 vsel = vdd->read_reg(vdd->vp_reg.prm_mod, vdd->vp_offs.voltage); 151 vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage);
350 pr_notice("curr_vsel = %x\n", vsel); 152 pr_notice("curr_vsel = %x\n", vsel);
351 153
352 if (!vdd->pmic_info->vsel_to_uv) { 154 if (!vdd->pmic_info->vsel_to_uv) {
@@ -379,7 +181,6 @@ DEFINE_SIMPLE_ATTRIBUTE(nom_volt_debug_fops, nom_volt_debug_get, NULL,
379static void vp_latch_vsel(struct omap_vdd_info *vdd) 181static void vp_latch_vsel(struct omap_vdd_info *vdd)
380{ 182{
381 u32 vpconfig; 183 u32 vpconfig;
382 u16 mod;
383 unsigned long uvdc; 184 unsigned long uvdc;
384 char vsel; 185 char vsel;
385 186
@@ -396,30 +197,27 @@ static void vp_latch_vsel(struct omap_vdd_info *vdd)
396 return; 197 return;
397 } 198 }
398 199
399 mod = vdd->vp_reg.prm_mod;
400
401 vsel = vdd->pmic_info->uv_to_vsel(uvdc); 200 vsel = vdd->pmic_info->uv_to_vsel(uvdc);
402 201
403 vpconfig = vdd->read_reg(mod, vdd->vp_offs.vpconfig); 202 vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
404 vpconfig &= ~(vdd->vp_reg.vpconfig_initvoltage_mask | 203 vpconfig &= ~(vdd->vp_data->vp_common->vpconfig_initvoltage_mask |
405 vdd->vp_reg.vpconfig_initvdd); 204 vdd->vp_data->vp_common->vpconfig_initvdd);
406 vpconfig |= vsel << vdd->vp_reg.vpconfig_initvoltage_shift; 205 vpconfig |= vsel << vdd->vp_data->vp_common->vpconfig_initvoltage_shift;
407 206
408 vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); 207 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
409 208
410 /* Trigger initVDD value copy to voltage processor */ 209 /* Trigger initVDD value copy to voltage processor */
411 vdd->write_reg((vpconfig | vdd->vp_reg.vpconfig_initvdd), mod, 210 vdd->write_reg((vpconfig | vdd->vp_data->vp_common->vpconfig_initvdd),
412 vdd->vp_offs.vpconfig); 211 prm_mod_offs, vdd->vp_data->vpconfig);
413 212
414 /* Clear initVDD copy trigger bit */ 213 /* Clear initVDD copy trigger bit */
415 vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); 214 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
416} 215}
417 216
418/* Generic voltage init functions */ 217/* Generic voltage init functions */
419static void __init vp_init(struct omap_vdd_info *vdd) 218static void __init vp_init(struct omap_vdd_info *vdd)
420{ 219{
421 u32 vp_val; 220 u32 vp_val;
422 u16 mod;
423 221
424 if (!vdd->read_reg || !vdd->write_reg) { 222 if (!vdd->read_reg || !vdd->write_reg) {
425 pr_err("%s: No read/write API for accessing vdd_%s regs\n", 223 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
@@ -427,33 +225,31 @@ static void __init vp_init(struct omap_vdd_info *vdd)
427 return; 225 return;
428 } 226 }
429 227
430 mod = vdd->vp_reg.prm_mod; 228 vp_val = vdd->vp_rt_data.vpconfig_erroroffset |
431 229 (vdd->vp_rt_data.vpconfig_errorgain <<
432 vp_val = vdd->vp_reg.vpconfig_erroroffset | 230 vdd->vp_data->vp_common->vpconfig_errorgain_shift) |
433 (vdd->vp_reg.vpconfig_errorgain << 231 vdd->vp_data->vp_common->vpconfig_timeouten;
434 vdd->vp_reg.vpconfig_errorgain_shift) | 232 vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vpconfig);
435 vdd->vp_reg.vpconfig_timeouten; 233
436 vdd->write_reg(vp_val, mod, vdd->vp_offs.vpconfig); 234 vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin <<
437 235 vdd->vp_data->vp_common->vstepmin_smpswaittimemin_shift) |
438 vp_val = ((vdd->vp_reg.vstepmin_smpswaittimemin << 236 (vdd->vp_rt_data.vstepmin_stepmin <<
439 vdd->vp_reg.vstepmin_smpswaittimemin_shift) | 237 vdd->vp_data->vp_common->vstepmin_stepmin_shift));
440 (vdd->vp_reg.vstepmin_stepmin << 238 vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vstepmin);
441 vdd->vp_reg.vstepmin_stepmin_shift)); 239
442 vdd->write_reg(vp_val, mod, vdd->vp_offs.vstepmin); 240 vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax <<
443 241 vdd->vp_data->vp_common->vstepmax_smpswaittimemax_shift) |
444 vp_val = ((vdd->vp_reg.vstepmax_smpswaittimemax << 242 (vdd->vp_rt_data.vstepmax_stepmax <<
445 vdd->vp_reg.vstepmax_smpswaittimemax_shift) | 243 vdd->vp_data->vp_common->vstepmax_stepmax_shift));
446 (vdd->vp_reg.vstepmax_stepmax << 244 vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vstepmax);
447 vdd->vp_reg.vstepmax_stepmax_shift)); 245
448 vdd->write_reg(vp_val, mod, vdd->vp_offs.vstepmax); 246 vp_val = ((vdd->vp_rt_data.vlimitto_vddmax <<
449 247 vdd->vp_data->vp_common->vlimitto_vddmax_shift) |
450 vp_val = ((vdd->vp_reg.vlimitto_vddmax << 248 (vdd->vp_rt_data.vlimitto_vddmin <<
451 vdd->vp_reg.vlimitto_vddmax_shift) | 249 vdd->vp_data->vp_common->vlimitto_vddmin_shift) |
452 (vdd->vp_reg.vlimitto_vddmin << 250 (vdd->vp_rt_data.vlimitto_timeout <<
453 vdd->vp_reg.vlimitto_vddmin_shift) | 251 vdd->vp_data->vp_common->vlimitto_timeout_shift));
454 (vdd->vp_reg.vlimitto_timeout << 252 vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vlimitto);
455 vdd->vp_reg.vlimitto_timeout_shift));
456 vdd->write_reg(vp_val, mod, vdd->vp_offs.vlimitto);
457} 253}
458 254
459static void __init vdd_debugfs_init(struct omap_vdd_info *vdd) 255static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
@@ -480,23 +276,23 @@ static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
480 } 276 }
481 277
482 (void) debugfs_create_x16("vp_errorgain", S_IRUGO, vdd->debug_dir, 278 (void) debugfs_create_x16("vp_errorgain", S_IRUGO, vdd->debug_dir,
483 &(vdd->vp_reg.vpconfig_errorgain)); 279 &(vdd->vp_rt_data.vpconfig_errorgain));
484 (void) debugfs_create_x16("vp_smpswaittimemin", S_IRUGO, 280 (void) debugfs_create_x16("vp_smpswaittimemin", S_IRUGO,
485 vdd->debug_dir, 281 vdd->debug_dir,
486 &(vdd->vp_reg.vstepmin_smpswaittimemin)); 282 &(vdd->vp_rt_data.vstepmin_smpswaittimemin));
487 (void) debugfs_create_x8("vp_stepmin", S_IRUGO, vdd->debug_dir, 283 (void) debugfs_create_x8("vp_stepmin", S_IRUGO, vdd->debug_dir,
488 &(vdd->vp_reg.vstepmin_stepmin)); 284 &(vdd->vp_rt_data.vstepmin_stepmin));
489 (void) debugfs_create_x16("vp_smpswaittimemax", S_IRUGO, 285 (void) debugfs_create_x16("vp_smpswaittimemax", S_IRUGO,
490 vdd->debug_dir, 286 vdd->debug_dir,
491 &(vdd->vp_reg.vstepmax_smpswaittimemax)); 287 &(vdd->vp_rt_data.vstepmax_smpswaittimemax));
492 (void) debugfs_create_x8("vp_stepmax", S_IRUGO, vdd->debug_dir, 288 (void) debugfs_create_x8("vp_stepmax", S_IRUGO, vdd->debug_dir,
493 &(vdd->vp_reg.vstepmax_stepmax)); 289 &(vdd->vp_rt_data.vstepmax_stepmax));
494 (void) debugfs_create_x8("vp_vddmax", S_IRUGO, vdd->debug_dir, 290 (void) debugfs_create_x8("vp_vddmax", S_IRUGO, vdd->debug_dir,
495 &(vdd->vp_reg.vlimitto_vddmax)); 291 &(vdd->vp_rt_data.vlimitto_vddmax));
496 (void) debugfs_create_x8("vp_vddmin", S_IRUGO, vdd->debug_dir, 292 (void) debugfs_create_x8("vp_vddmin", S_IRUGO, vdd->debug_dir,
497 &(vdd->vp_reg.vlimitto_vddmin)); 293 &(vdd->vp_rt_data.vlimitto_vddmin));
498 (void) debugfs_create_x16("vp_timeout", S_IRUGO, vdd->debug_dir, 294 (void) debugfs_create_x16("vp_timeout", S_IRUGO, vdd->debug_dir,
499 &(vdd->vp_reg.vlimitto_timeout)); 295 &(vdd->vp_rt_data.vlimitto_timeout));
500 (void) debugfs_create_file("curr_vp_volt", S_IRUGO, vdd->debug_dir, 296 (void) debugfs_create_file("curr_vp_volt", S_IRUGO, vdd->debug_dir,
501 (void *) vdd, &vp_volt_debug_fops); 297 (void *) vdd, &vp_volt_debug_fops);
502 (void) debugfs_create_file("curr_nominal_volt", S_IRUGO, 298 (void) debugfs_create_file("curr_nominal_volt", S_IRUGO,
@@ -509,8 +305,12 @@ static int _pre_volt_scale(struct omap_vdd_info *vdd,
509 unsigned long target_volt, u8 *target_vsel, u8 *current_vsel) 305 unsigned long target_volt, u8 *target_vsel, u8 *current_vsel)
510{ 306{
511 struct omap_volt_data *volt_data; 307 struct omap_volt_data *volt_data;
308 const struct omap_vc_common_data *vc_common;
309 const struct omap_vp_common_data *vp_common;
512 u32 vc_cmdval, vp_errgain_val; 310 u32 vc_cmdval, vp_errgain_val;
513 u16 vp_mod, vc_mod; 311
312 vc_common = vdd->vc_data->vc_common;
313 vp_common = vdd->vp_data->vp_common;
514 314
515 /* Check if suffiecient pmic info is available for this vdd */ 315 /* Check if suffiecient pmic info is available for this vdd */
516 if (!vdd->pmic_info) { 316 if (!vdd->pmic_info) {
@@ -532,33 +332,30 @@ static int _pre_volt_scale(struct omap_vdd_info *vdd,
532 return -EINVAL; 332 return -EINVAL;
533 } 333 }
534 334
535 vp_mod = vdd->vp_reg.prm_mod;
536 vc_mod = vdd->vc_reg.prm_mod;
537
538 /* Get volt_data corresponding to target_volt */ 335 /* Get volt_data corresponding to target_volt */
539 volt_data = omap_voltage_get_voltdata(&vdd->voltdm, target_volt); 336 volt_data = omap_voltage_get_voltdata(&vdd->voltdm, target_volt);
540 if (IS_ERR(volt_data)) 337 if (IS_ERR(volt_data))
541 volt_data = NULL; 338 volt_data = NULL;
542 339
543 *target_vsel = vdd->pmic_info->uv_to_vsel(target_volt); 340 *target_vsel = vdd->pmic_info->uv_to_vsel(target_volt);
544 *current_vsel = vdd->read_reg(vp_mod, vdd->vp_offs.voltage); 341 *current_vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage);
545 342
546 /* Setting the ON voltage to the new target voltage */ 343 /* Setting the ON voltage to the new target voltage */
547 vc_cmdval = vdd->read_reg(vc_mod, vdd->vc_reg.cmdval_reg); 344 vc_cmdval = vdd->read_reg(prm_mod_offs, vdd->vc_data->cmdval_reg);
548 vc_cmdval &= ~vdd->vc_reg.cmd_on_mask; 345 vc_cmdval &= ~vc_common->cmd_on_mask;
549 vc_cmdval |= (*target_vsel << vdd->vc_reg.cmd_on_shift); 346 vc_cmdval |= (*target_vsel << vc_common->cmd_on_shift);
550 vdd->write_reg(vc_cmdval, vc_mod, vdd->vc_reg.cmdval_reg); 347 vdd->write_reg(vc_cmdval, prm_mod_offs, vdd->vc_data->cmdval_reg);
551 348
552 /* Setting vp errorgain based on the voltage */ 349 /* Setting vp errorgain based on the voltage */
553 if (volt_data) { 350 if (volt_data) {
554 vp_errgain_val = vdd->read_reg(vp_mod, 351 vp_errgain_val = vdd->read_reg(prm_mod_offs,
555 vdd->vp_offs.vpconfig); 352 vdd->vp_data->vpconfig);
556 vdd->vp_reg.vpconfig_errorgain = volt_data->vp_errgain; 353 vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain;
557 vp_errgain_val &= ~vdd->vp_reg.vpconfig_errorgain_mask; 354 vp_errgain_val &= ~vp_common->vpconfig_errorgain_mask;
558 vp_errgain_val |= vdd->vp_reg.vpconfig_errorgain << 355 vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain <<
559 vdd->vp_reg.vpconfig_errorgain_shift; 356 vp_common->vpconfig_errorgain_shift;
560 vdd->write_reg(vp_errgain_val, vp_mod, 357 vdd->write_reg(vp_errgain_val, prm_mod_offs,
561 vdd->vp_offs.vpconfig); 358 vdd->vp_data->vpconfig);
562 } 359 }
563 360
564 return 0; 361 return 0;
@@ -584,7 +381,6 @@ static int vc_bypass_scale_voltage(struct omap_vdd_info *vdd,
584{ 381{
585 u32 loop_cnt = 0, retries_cnt = 0; 382 u32 loop_cnt = 0, retries_cnt = 0;
586 u32 vc_valid, vc_bypass_val_reg, vc_bypass_value; 383 u32 vc_valid, vc_bypass_val_reg, vc_bypass_value;
587 u16 mod;
588 u8 target_vsel, current_vsel; 384 u8 target_vsel, current_vsel;
589 int ret; 385 int ret;
590 386
@@ -592,20 +388,19 @@ static int vc_bypass_scale_voltage(struct omap_vdd_info *vdd,
592 if (ret) 388 if (ret)
593 return ret; 389 return ret;
594 390
595 mod = vdd->vc_reg.prm_mod; 391 vc_valid = vdd->vc_data->vc_common->valid;
596 392 vc_bypass_val_reg = vdd->vc_data->vc_common->bypass_val_reg;
597 vc_valid = vdd->vc_reg.valid; 393 vc_bypass_value = (target_vsel << vdd->vc_data->vc_common->data_shift) |
598 vc_bypass_val_reg = vdd->vc_reg.bypass_val_reg;
599 vc_bypass_value = (target_vsel << vdd->vc_reg.data_shift) |
600 (vdd->pmic_info->pmic_reg << 394 (vdd->pmic_info->pmic_reg <<
601 vdd->vc_reg.regaddr_shift) | 395 vdd->vc_data->vc_common->regaddr_shift) |
602 (vdd->pmic_info->i2c_slave_addr << 396 (vdd->pmic_info->i2c_slave_addr <<
603 vdd->vc_reg.slaveaddr_shift); 397 vdd->vc_data->vc_common->slaveaddr_shift);
604 398
605 vdd->write_reg(vc_bypass_value, mod, vc_bypass_val_reg); 399 vdd->write_reg(vc_bypass_value, prm_mod_offs, vc_bypass_val_reg);
606 vdd->write_reg(vc_bypass_value | vc_valid, mod, vc_bypass_val_reg); 400 vdd->write_reg(vc_bypass_value | vc_valid, prm_mod_offs,
401 vc_bypass_val_reg);
607 402
608 vc_bypass_value = vdd->read_reg(mod, vc_bypass_val_reg); 403 vc_bypass_value = vdd->read_reg(prm_mod_offs, vc_bypass_val_reg);
609 /* 404 /*
610 * Loop till the bypass command is acknowledged from the SMPS. 405 * Loop till the bypass command is acknowledged from the SMPS.
611 * NOTE: This is legacy code. The loop count and retry count needs 406 * NOTE: This is legacy code. The loop count and retry count needs
@@ -624,7 +419,8 @@ static int vc_bypass_scale_voltage(struct omap_vdd_info *vdd,
624 loop_cnt = 0; 419 loop_cnt = 0;
625 udelay(10); 420 udelay(10);
626 } 421 }
627 vc_bypass_value = vdd->read_reg(mod, vc_bypass_val_reg); 422 vc_bypass_value = vdd->read_reg(prm_mod_offs,
423 vc_bypass_val_reg);
628 } 424 }
629 425
630 _post_volt_scale(vdd, target_volt, target_vsel, current_vsel); 426 _post_volt_scale(vdd, target_volt, target_vsel, current_vsel);
@@ -636,7 +432,6 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
636 unsigned long target_volt) 432 unsigned long target_volt)
637{ 433{
638 u32 vpconfig; 434 u32 vpconfig;
639 u16 mod, ocp_mod;
640 u8 target_vsel, current_vsel, prm_irqst_reg; 435 u8 target_vsel, current_vsel, prm_irqst_reg;
641 int ret, timeout = 0; 436 int ret, timeout = 0;
642 437
@@ -644,20 +439,18 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
644 if (ret) 439 if (ret)
645 return ret; 440 return ret;
646 441
647 mod = vdd->vp_reg.prm_mod; 442 prm_irqst_reg = vdd->vp_data->prm_irqst_data->prm_irqst_reg;
648 ocp_mod = vdd->ocp_mod;
649 prm_irqst_reg = vdd->prm_irqst_reg;
650 443
651 /* 444 /*
652 * Clear all pending TransactionDone interrupt/status. Typical latency 445 * Clear all pending TransactionDone interrupt/status. Typical latency
653 * is <3us 446 * is <3us
654 */ 447 */
655 while (timeout++ < VP_TRANXDONE_TIMEOUT) { 448 while (timeout++ < VP_TRANXDONE_TIMEOUT) {
656 vdd->write_reg(vdd->vp_reg.tranxdone_status, 449 vdd->write_reg(vdd->vp_data->prm_irqst_data->tranxdone_status,
657 ocp_mod, prm_irqst_reg); 450 prm_irqst_ocp_mod_offs, prm_irqst_reg);
658 if (!(vdd->read_reg(ocp_mod, prm_irqst_reg) & 451 if (!(vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) &
659 vdd->vp_reg.tranxdone_status)) 452 vdd->vp_data->prm_irqst_data->tranxdone_status))
660 break; 453 break;
661 udelay(1); 454 udelay(1);
662 } 455 }
663 if (timeout >= VP_TRANXDONE_TIMEOUT) { 456 if (timeout >= VP_TRANXDONE_TIMEOUT) {
@@ -667,30 +460,30 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
667 } 460 }
668 461
669 /* Configure for VP-Force Update */ 462 /* Configure for VP-Force Update */
670 vpconfig = vdd->read_reg(mod, vdd->vp_offs.vpconfig); 463 vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
671 vpconfig &= ~(vdd->vp_reg.vpconfig_initvdd | 464 vpconfig &= ~(vdd->vp_data->vp_common->vpconfig_initvdd |
672 vdd->vp_reg.vpconfig_forceupdate | 465 vdd->vp_data->vp_common->vpconfig_forceupdate |
673 vdd->vp_reg.vpconfig_initvoltage_mask); 466 vdd->vp_data->vp_common->vpconfig_initvoltage_mask);
674 vpconfig |= ((target_vsel << 467 vpconfig |= ((target_vsel <<
675 vdd->vp_reg.vpconfig_initvoltage_shift)); 468 vdd->vp_data->vp_common->vpconfig_initvoltage_shift));
676 vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); 469 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
677 470
678 /* Trigger initVDD value copy to voltage processor */ 471 /* Trigger initVDD value copy to voltage processor */
679 vpconfig |= vdd->vp_reg.vpconfig_initvdd; 472 vpconfig |= vdd->vp_data->vp_common->vpconfig_initvdd;
680 vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); 473 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
681 474
682 /* Force update of voltage */ 475 /* Force update of voltage */
683 vpconfig |= vdd->vp_reg.vpconfig_forceupdate; 476 vpconfig |= vdd->vp_data->vp_common->vpconfig_forceupdate;
684 vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); 477 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
685 478
686 /* 479 /*
687 * Wait for TransactionDone. Typical latency is <200us. 480 * Wait for TransactionDone. Typical latency is <200us.
688 * Depends on SMPSWAITTIMEMIN/MAX and voltage change 481 * Depends on SMPSWAITTIMEMIN/MAX and voltage change
689 */ 482 */
690 timeout = 0; 483 timeout = 0;
691 omap_test_timeout((vdd->read_reg(ocp_mod, prm_irqst_reg) & 484 omap_test_timeout((vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) &
692 vdd->vp_reg.tranxdone_status), 485 vdd->vp_data->prm_irqst_data->tranxdone_status),
693 VP_TRANXDONE_TIMEOUT, timeout); 486 VP_TRANXDONE_TIMEOUT, timeout);
694 if (timeout >= VP_TRANXDONE_TIMEOUT) 487 if (timeout >= VP_TRANXDONE_TIMEOUT)
695 pr_err("%s: vdd_%s TRANXDONE timeout exceeded." 488 pr_err("%s: vdd_%s TRANXDONE timeout exceeded."
696 "TRANXDONE never got set after the voltage update\n", 489 "TRANXDONE never got set after the voltage update\n",
@@ -704,11 +497,11 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
704 */ 497 */
705 timeout = 0; 498 timeout = 0;
706 while (timeout++ < VP_TRANXDONE_TIMEOUT) { 499 while (timeout++ < VP_TRANXDONE_TIMEOUT) {
707 vdd->write_reg(vdd->vp_reg.tranxdone_status, 500 vdd->write_reg(vdd->vp_data->prm_irqst_data->tranxdone_status,
708 ocp_mod, prm_irqst_reg); 501 prm_irqst_ocp_mod_offs, prm_irqst_reg);
709 if (!(vdd->read_reg(ocp_mod, prm_irqst_reg) & 502 if (!(vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) &
710 vdd->vp_reg.tranxdone_status)) 503 vdd->vp_data->prm_irqst_data->tranxdone_status))
711 break; 504 break;
712 udelay(1); 505 udelay(1);
713 } 506 }
714 507
@@ -717,222 +510,95 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd,
717 "to clear the TRANXDONE status\n", 510 "to clear the TRANXDONE status\n",
718 __func__, vdd->voltdm.name); 511 __func__, vdd->voltdm.name);
719 512
720 vpconfig = vdd->read_reg(mod, vdd->vp_offs.vpconfig); 513 vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
721 /* Clear initVDD copy trigger bit */ 514 /* Clear initVDD copy trigger bit */
722 vpconfig &= ~vdd->vp_reg.vpconfig_initvdd;; 515 vpconfig &= ~vdd->vp_data->vp_common->vpconfig_initvdd;
723 vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); 516 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
724 /* Clear force bit */ 517 /* Clear force bit */
725 vpconfig &= ~vdd->vp_reg.vpconfig_forceupdate; 518 vpconfig &= ~vdd->vp_data->vp_common->vpconfig_forceupdate;
726 vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); 519 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
727 520
728 return 0; 521 return 0;
729} 522}
730 523
731/* OMAP3 specific voltage init functions */ 524static void __init omap3_vfsm_init(struct omap_vdd_info *vdd)
525{
526 /*
527 * Voltage Manager FSM parameters init
528 * XXX This data should be passed in from the board file
529 */
530 vdd->write_reg(OMAP3_CLKSETUP, prm_mod_offs, OMAP3_PRM_CLKSETUP_OFFSET);
531 vdd->write_reg(OMAP3_VOLTOFFSET, prm_mod_offs,
532 OMAP3_PRM_VOLTOFFSET_OFFSET);
533 vdd->write_reg(OMAP3_VOLTSETUP2, prm_mod_offs,
534 OMAP3_PRM_VOLTSETUP2_OFFSET);
535}
732 536
733/*
734 * Intializes the voltage controller registers with the PMIC and board
735 * specific parameters and voltage setup times for OMAP3.
736 */
737static void __init omap3_vc_init(struct omap_vdd_info *vdd) 537static void __init omap3_vc_init(struct omap_vdd_info *vdd)
738{ 538{
739 u32 vc_val;
740 u16 mod;
741 u8 on_vsel, onlp_vsel, ret_vsel, off_vsel;
742 static bool is_initialized; 539 static bool is_initialized;
540 u8 on_vsel, onlp_vsel, ret_vsel, off_vsel;
541 u32 vc_val;
743 542
744 if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) { 543 if (is_initialized)
745 pr_err("%s: PMIC info requried to configure vc for"
746 "vdd_%s not populated.Hence cannot initialize vc\n",
747 __func__, vdd->voltdm.name);
748 return;
749 }
750
751 if (!vdd->read_reg || !vdd->write_reg) {
752 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
753 __func__, vdd->voltdm.name);
754 return; 544 return;
755 }
756
757 mod = vdd->vc_reg.prm_mod;
758
759 /* Set up the SMPS_SA(i2c slave address in VC */
760 vc_val = vdd->read_reg(mod, vdd->vc_reg.smps_sa_reg);
761 vc_val &= ~vdd->vc_reg.smps_sa_mask;
762 vc_val |= vdd->pmic_info->i2c_slave_addr << vdd->vc_reg.smps_sa_shift;
763 vdd->write_reg(vc_val, mod, vdd->vc_reg.smps_sa_reg);
764
765 /* Setup the VOLRA(pmic reg addr) in VC */
766 vc_val = vdd->read_reg(mod, vdd->vc_reg.smps_volra_reg);
767 vc_val &= ~vdd->vc_reg.smps_volra_mask;
768 vc_val |= vdd->pmic_info->pmic_reg << vdd->vc_reg.smps_volra_shift;
769 vdd->write_reg(vc_val, mod, vdd->vc_reg.smps_volra_reg);
770
771 /*Configure the setup times */
772 vc_val = vdd->read_reg(mod, vdd->vc_reg.voltsetup_reg);
773 vc_val &= ~vdd->vc_reg.voltsetup_mask;
774 vc_val |= vdd->pmic_info->volt_setup_time <<
775 vdd->vc_reg.voltsetup_shift;
776 vdd->write_reg(vc_val, mod, vdd->vc_reg.voltsetup_reg);
777 545
778 /* Set up the on, inactive, retention and off voltage */ 546 /* Set up the on, inactive, retention and off voltage */
779 on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->on_volt); 547 on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->on_volt);
780 onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->onlp_volt); 548 onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->onlp_volt);
781 ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->ret_volt); 549 ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->ret_volt);
782 off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->off_volt); 550 off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->off_volt);
783 vc_val = ((on_vsel << vdd->vc_reg.cmd_on_shift) | 551 vc_val = ((on_vsel << vdd->vc_data->vc_common->cmd_on_shift) |
784 (onlp_vsel << vdd->vc_reg.cmd_onlp_shift) | 552 (onlp_vsel << vdd->vc_data->vc_common->cmd_onlp_shift) |
785 (ret_vsel << vdd->vc_reg.cmd_ret_shift) | 553 (ret_vsel << vdd->vc_data->vc_common->cmd_ret_shift) |
786 (off_vsel << vdd->vc_reg.cmd_off_shift)); 554 (off_vsel << vdd->vc_data->vc_common->cmd_off_shift));
787 vdd->write_reg(vc_val, mod, vdd->vc_reg.cmdval_reg); 555 vdd->write_reg(vc_val, prm_mod_offs, vdd->vc_data->cmdval_reg);
788
789 if (is_initialized)
790 return;
791 556
792 /* Generic VC parameters init */ 557 /*
793 vdd->write_reg(OMAP3430_CMD1_MASK | OMAP3430_RAV1_MASK, mod, 558 * Generic VC parameters init
559 * XXX This data should be abstracted out
560 */
561 vdd->write_reg(OMAP3430_CMD1_MASK | OMAP3430_RAV1_MASK, prm_mod_offs,
794 OMAP3_PRM_VC_CH_CONF_OFFSET); 562 OMAP3_PRM_VC_CH_CONF_OFFSET);
795 vdd->write_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN_MASK, mod, 563 vdd->write_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN_MASK, prm_mod_offs,
796 OMAP3_PRM_VC_I2C_CFG_OFFSET); 564 OMAP3_PRM_VC_I2C_CFG_OFFSET);
797 vdd->write_reg(OMAP3_CLKSETUP, mod, OMAP3_PRM_CLKSETUP_OFFSET); 565
798 vdd->write_reg(OMAP3_VOLTOFFSET, mod, OMAP3_PRM_VOLTOFFSET_OFFSET); 566 omap3_vfsm_init(vdd);
799 vdd->write_reg(OMAP3_VOLTSETUP2, mod, OMAP3_PRM_VOLTSETUP2_OFFSET); 567
800 is_initialized = true; 568 is_initialized = true;
801} 569}
802 570
803/* Sets up all the VDD related info for OMAP3 */ 571
804static int __init omap3_vdd_data_configure(struct omap_vdd_info *vdd) 572/* OMAP4 specific voltage init functions */
573static void __init omap4_vc_init(struct omap_vdd_info *vdd)
805{ 574{
806 struct clk *sys_ck; 575 static bool is_initialized;
807 u32 sys_clk_speed, timeout_val, waittime; 576 u32 vc_val;
808 577
809 if (!vdd->pmic_info) { 578 if (is_initialized)
810 pr_err("%s: PMIC info requried to configure vdd_%s not" 579 return;
811 "populated.Hence cannot initialize vdd_%s\n",
812 __func__, vdd->voltdm.name, vdd->voltdm.name);
813 return -EINVAL;
814 }
815 580
816 if (!strcmp(vdd->voltdm.name, "mpu")) { 581 /* TODO: Configure setup times and CMD_VAL values*/
817 if (cpu_is_omap3630())
818 vdd->volt_data = omap36xx_vddmpu_volt_data;
819 else
820 vdd->volt_data = omap34xx_vddmpu_volt_data;
821
822 vdd->vp_reg.tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK;
823 vdd->vc_reg.cmdval_reg = OMAP3_PRM_VC_CMD_VAL_0_OFFSET;
824 vdd->vc_reg.smps_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA0_SHIFT;
825 vdd->vc_reg.smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA0_MASK;
826 vdd->vc_reg.smps_volra_shift = OMAP3430_VOLRA0_SHIFT;
827 vdd->vc_reg.smps_volra_mask = OMAP3430_VOLRA0_MASK;
828 vdd->vc_reg.voltsetup_shift = OMAP3430_SETUP_TIME1_SHIFT;
829 vdd->vc_reg.voltsetup_mask = OMAP3430_SETUP_TIME1_MASK;
830 } else if (!strcmp(vdd->voltdm.name, "core")) {
831 if (cpu_is_omap3630())
832 vdd->volt_data = omap36xx_vddcore_volt_data;
833 else
834 vdd->volt_data = omap34xx_vddcore_volt_data;
835
836 vdd->vp_reg.tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK;
837 vdd->vc_reg.cmdval_reg = OMAP3_PRM_VC_CMD_VAL_1_OFFSET;
838 vdd->vc_reg.smps_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT;
839 vdd->vc_reg.smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA1_MASK;
840 vdd->vc_reg.smps_volra_shift = OMAP3430_VOLRA1_SHIFT;
841 vdd->vc_reg.smps_volra_mask = OMAP3430_VOLRA1_MASK;
842 vdd->vc_reg.voltsetup_shift = OMAP3430_SETUP_TIME2_SHIFT;
843 vdd->vc_reg.voltsetup_mask = OMAP3430_SETUP_TIME2_MASK;
844 } else {
845 pr_warning("%s: vdd_%s does not exisit in OMAP3\n",
846 __func__, vdd->voltdm.name);
847 return -EINVAL;
848 }
849 582
850 /* 583 /*
851 * Sys clk rate is require to calculate vp timeout value and 584 * Generic VC parameters init
852 * smpswaittimemin and smpswaittimemax. 585 * XXX This data should be abstracted out
853 */ 586 */
854 sys_ck = clk_get(NULL, "sys_ck"); 587 vc_val = (OMAP4430_RAV_VDD_MPU_L_MASK | OMAP4430_CMD_VDD_MPU_L_MASK |
855 if (IS_ERR(sys_ck)) { 588 OMAP4430_RAV_VDD_IVA_L_MASK | OMAP4430_CMD_VDD_IVA_L_MASK |
856 pr_warning("%s: Could not get the sys clk to calculate" 589 OMAP4430_RAV_VDD_CORE_L_MASK | OMAP4430_CMD_VDD_CORE_L_MASK);
857 "various vdd_%s params\n", __func__, vdd->voltdm.name); 590 vdd->write_reg(vc_val, prm_mod_offs, OMAP4_PRM_VC_CFG_CHANNEL_OFFSET);
858 return -EINVAL;
859 }
860 sys_clk_speed = clk_get_rate(sys_ck);
861 clk_put(sys_ck);
862 /* Divide to avoid overflow */
863 sys_clk_speed /= 1000;
864
865 /* Generic voltage parameters */
866 vdd->curr_volt = 1200000;
867 vdd->ocp_mod = OCP_MOD;
868 vdd->prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET;
869 vdd->read_reg = omap3_voltage_read_reg;
870 vdd->write_reg = omap3_voltage_write_reg;
871 vdd->volt_scale = vp_forceupdate_scale_voltage;
872 vdd->vp_enabled = false;
873 591
874 /* VC parameters */ 592 /* XXX These are magic numbers and do not belong! */
875 vdd->vc_reg.prm_mod = OMAP3430_GR_MOD; 593 vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT);
876 vdd->vc_reg.smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET; 594 vdd->write_reg(vc_val, prm_mod_offs, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
877 vdd->vc_reg.smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET;
878 vdd->vc_reg.bypass_val_reg = OMAP3_PRM_VC_BYPASS_VAL_OFFSET;
879 vdd->vc_reg.voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET;
880 vdd->vc_reg.data_shift = OMAP3430_DATA_SHIFT;
881 vdd->vc_reg.slaveaddr_shift = OMAP3430_SLAVEADDR_SHIFT;
882 vdd->vc_reg.regaddr_shift = OMAP3430_REGADDR_SHIFT;
883 vdd->vc_reg.valid = OMAP3430_VALID_MASK;
884 vdd->vc_reg.cmd_on_shift = OMAP3430_VC_CMD_ON_SHIFT;
885 vdd->vc_reg.cmd_on_mask = OMAP3430_VC_CMD_ON_MASK;
886 vdd->vc_reg.cmd_onlp_shift = OMAP3430_VC_CMD_ONLP_SHIFT;
887 vdd->vc_reg.cmd_ret_shift = OMAP3430_VC_CMD_RET_SHIFT;
888 vdd->vc_reg.cmd_off_shift = OMAP3430_VC_CMD_OFF_SHIFT;
889
890 vdd->vp_reg.prm_mod = OMAP3430_GR_MOD;
891
892 /* VPCONFIG bit fields */
893 vdd->vp_reg.vpconfig_erroroffset = (vdd->pmic_info->vp_erroroffset <<
894 OMAP3430_ERROROFFSET_SHIFT);
895 vdd->vp_reg.vpconfig_errorgain_mask = OMAP3430_ERRORGAIN_MASK;
896 vdd->vp_reg.vpconfig_errorgain_shift = OMAP3430_ERRORGAIN_SHIFT;
897 vdd->vp_reg.vpconfig_initvoltage_shift = OMAP3430_INITVOLTAGE_SHIFT;
898 vdd->vp_reg.vpconfig_initvoltage_mask = OMAP3430_INITVOLTAGE_MASK;
899 vdd->vp_reg.vpconfig_timeouten = OMAP3430_TIMEOUTEN_MASK;
900 vdd->vp_reg.vpconfig_initvdd = OMAP3430_INITVDD_MASK;
901 vdd->vp_reg.vpconfig_forceupdate = OMAP3430_FORCEUPDATE_MASK;
902 vdd->vp_reg.vpconfig_vpenable = OMAP3430_VPENABLE_MASK;
903
904 /* VSTEPMIN VSTEPMAX bit fields */
905 waittime = ((vdd->pmic_info->step_size / vdd->pmic_info->slew_rate) *
906 sys_clk_speed) / 1000;
907 vdd->vp_reg.vstepmin_smpswaittimemin = waittime;
908 vdd->vp_reg.vstepmax_smpswaittimemax = waittime;
909 vdd->vp_reg.vstepmin_stepmin = vdd->pmic_info->vp_vstepmin;
910 vdd->vp_reg.vstepmax_stepmax = vdd->pmic_info->vp_vstepmax;
911 vdd->vp_reg.vstepmin_smpswaittimemin_shift =
912 OMAP3430_SMPSWAITTIMEMIN_SHIFT;
913 vdd->vp_reg.vstepmax_smpswaittimemax_shift =
914 OMAP3430_SMPSWAITTIMEMAX_SHIFT;
915 vdd->vp_reg.vstepmin_stepmin_shift = OMAP3430_VSTEPMIN_SHIFT;
916 vdd->vp_reg.vstepmax_stepmax_shift = OMAP3430_VSTEPMAX_SHIFT;
917
918 /* VLIMITTO bit fields */
919 timeout_val = (sys_clk_speed * vdd->pmic_info->vp_timeout_us) / 1000;
920 vdd->vp_reg.vlimitto_timeout = timeout_val;
921 vdd->vp_reg.vlimitto_vddmin = vdd->pmic_info->vp_vddmin;
922 vdd->vp_reg.vlimitto_vddmax = vdd->pmic_info->vp_vddmax;
923 vdd->vp_reg.vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT;
924 vdd->vp_reg.vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT;
925 vdd->vp_reg.vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT;
926 595
927 return 0; 596 is_initialized = true;
928} 597}
929 598
930/* OMAP4 specific voltage init functions */ 599static void __init omap_vc_init(struct omap_vdd_info *vdd)
931static void __init omap4_vc_init(struct omap_vdd_info *vdd)
932{ 600{
933 u32 vc_val; 601 u32 vc_val;
934 u16 mod;
935 static bool is_initialized;
936 602
937 if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) { 603 if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) {
938 pr_err("%s: PMIC info requried to configure vc for" 604 pr_err("%s: PMIC info requried to configure vc for"
@@ -947,173 +613,61 @@ static void __init omap4_vc_init(struct omap_vdd_info *vdd)
947 return; 613 return;
948 } 614 }
949 615
950 mod = vdd->vc_reg.prm_mod;
951
952 /* Set up the SMPS_SA(i2c slave address in VC */ 616 /* Set up the SMPS_SA(i2c slave address in VC */
953 vc_val = vdd->read_reg(mod, vdd->vc_reg.smps_sa_reg); 617 vc_val = vdd->read_reg(prm_mod_offs,
954 vc_val &= ~vdd->vc_reg.smps_sa_mask; 618 vdd->vc_data->vc_common->smps_sa_reg);
955 vc_val |= vdd->pmic_info->i2c_slave_addr << vdd->vc_reg.smps_sa_shift; 619 vc_val &= ~vdd->vc_data->smps_sa_mask;
956 vdd->write_reg(vc_val, mod, vdd->vc_reg.smps_sa_reg); 620 vc_val |= vdd->pmic_info->i2c_slave_addr << vdd->vc_data->smps_sa_shift;
621 vdd->write_reg(vc_val, prm_mod_offs,
622 vdd->vc_data->vc_common->smps_sa_reg);
957 623
958 /* Setup the VOLRA(pmic reg addr) in VC */ 624 /* Setup the VOLRA(pmic reg addr) in VC */
959 vc_val = vdd->read_reg(mod, vdd->vc_reg.smps_volra_reg); 625 vc_val = vdd->read_reg(prm_mod_offs,
960 vc_val &= ~vdd->vc_reg.smps_volra_mask; 626 vdd->vc_data->vc_common->smps_volra_reg);
961 vc_val |= vdd->pmic_info->pmic_reg << vdd->vc_reg.smps_volra_shift; 627 vc_val &= ~vdd->vc_data->smps_volra_mask;
962 vdd->write_reg(vc_val, mod, vdd->vc_reg.smps_volra_reg); 628 vc_val |= vdd->pmic_info->pmic_reg << vdd->vc_data->smps_volra_shift;
963 629 vdd->write_reg(vc_val, prm_mod_offs,
964 /* TODO: Configure setup times and CMD_VAL values*/ 630 vdd->vc_data->vc_common->smps_volra_reg);
965 631
966 if (is_initialized) 632 /* Configure the setup times */
967 return; 633 vc_val = vdd->read_reg(prm_mod_offs, vdd->vfsm->voltsetup_reg);
968 634 vc_val &= ~vdd->vfsm->voltsetup_mask;
969 /* Generic VC parameters init */ 635 vc_val |= vdd->pmic_info->volt_setup_time <<
970 vc_val = (OMAP4430_RAV_VDD_MPU_L_MASK | OMAP4430_CMD_VDD_MPU_L_MASK | 636 vdd->vfsm->voltsetup_shift;
971 OMAP4430_RAV_VDD_IVA_L_MASK | OMAP4430_CMD_VDD_IVA_L_MASK | 637 vdd->write_reg(vc_val, prm_mod_offs, vdd->vfsm->voltsetup_reg);
972 OMAP4430_RAV_VDD_CORE_L_MASK | OMAP4430_CMD_VDD_CORE_L_MASK);
973 vdd->write_reg(vc_val, mod, OMAP4_PRM_VC_CFG_CHANNEL_OFFSET);
974
975 vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT);
976 vdd->write_reg(vc_val, mod, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
977 638
978 is_initialized = true; 639 if (cpu_is_omap34xx())
640 omap3_vc_init(vdd);
641 else if (cpu_is_omap44xx())
642 omap4_vc_init(vdd);
979} 643}
980 644
981/* Sets up all the VDD related info for OMAP4 */ 645static int __init omap_vdd_data_configure(struct omap_vdd_info *vdd)
982static int __init omap4_vdd_data_configure(struct omap_vdd_info *vdd)
983{ 646{
984 struct clk *sys_ck; 647 int ret = -EINVAL;
985 u32 sys_clk_speed, timeout_val, waittime;
986 648
987 if (!vdd->pmic_info) { 649 if (!vdd->pmic_info) {
988 pr_err("%s: PMIC info requried to configure vdd_%s not" 650 pr_err("%s: PMIC info requried to configure vdd_%s not"
989 "populated.Hence cannot initialize vdd_%s\n", 651 "populated.Hence cannot initialize vdd_%s\n",
990 __func__, vdd->voltdm.name, vdd->voltdm.name); 652 __func__, vdd->voltdm.name, vdd->voltdm.name);
991 return -EINVAL; 653 goto ovdc_out;
992 } 654 }
993 655
994 if (!strcmp(vdd->voltdm.name, "mpu")) { 656 if (IS_ERR_VALUE(_config_common_vdd_data(vdd)))
995 vdd->volt_data = omap44xx_vdd_mpu_volt_data; 657 goto ovdc_out;
996 vdd->vp_reg.tranxdone_status =
997 OMAP4430_VP_MPU_TRANXDONE_ST_MASK;
998 vdd->vc_reg.cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET;
999 vdd->vc_reg.smps_sa_shift =
1000 OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_SHIFT;
1001 vdd->vc_reg.smps_sa_mask =
1002 OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK;
1003 vdd->vc_reg.smps_volra_shift = OMAP4430_VOLRA_VDD_MPU_L_SHIFT;
1004 vdd->vc_reg.smps_volra_mask = OMAP4430_VOLRA_VDD_MPU_L_MASK;
1005 vdd->vc_reg.voltsetup_reg =
1006 OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET;
1007 vdd->prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET;
1008 } else if (!strcmp(vdd->voltdm.name, "core")) {
1009 vdd->volt_data = omap44xx_vdd_core_volt_data;
1010 vdd->vp_reg.tranxdone_status =
1011 OMAP4430_VP_CORE_TRANXDONE_ST_MASK;
1012 vdd->vc_reg.cmdval_reg =
1013 OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET;
1014 vdd->vc_reg.smps_sa_shift = OMAP4430_SA_VDD_CORE_L_0_6_SHIFT;
1015 vdd->vc_reg.smps_sa_mask = OMAP4430_SA_VDD_CORE_L_0_6_MASK;
1016 vdd->vc_reg.smps_volra_shift = OMAP4430_VOLRA_VDD_CORE_L_SHIFT;
1017 vdd->vc_reg.smps_volra_mask = OMAP4430_VOLRA_VDD_CORE_L_MASK;
1018 vdd->vc_reg.voltsetup_reg =
1019 OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET;
1020 vdd->prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET;
1021 } else if (!strcmp(vdd->voltdm.name, "iva")) {
1022 vdd->volt_data = omap44xx_vdd_iva_volt_data;
1023 vdd->vp_reg.tranxdone_status =
1024 OMAP4430_VP_IVA_TRANXDONE_ST_MASK;
1025 vdd->vc_reg.cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET;
1026 vdd->vc_reg.smps_sa_shift =
1027 OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_SHIFT;
1028 vdd->vc_reg.smps_sa_mask =
1029 OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK;
1030 vdd->vc_reg.smps_volra_shift = OMAP4430_VOLRA_VDD_IVA_L_SHIFT;
1031 vdd->vc_reg.smps_volra_mask = OMAP4430_VOLRA_VDD_IVA_L_MASK;
1032 vdd->vc_reg.voltsetup_reg =
1033 OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET;
1034 vdd->prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET;
1035 } else {
1036 pr_warning("%s: vdd_%s does not exisit in OMAP4\n",
1037 __func__, vdd->voltdm.name);
1038 return -EINVAL;
1039 }
1040 658
1041 /* 659 if (cpu_is_omap34xx()) {
1042 * Sys clk rate is require to calculate vp timeout value and 660 vdd->read_reg = omap3_voltage_read_reg;
1043 * smpswaittimemin and smpswaittimemax. 661 vdd->write_reg = omap3_voltage_write_reg;
1044 */ 662 ret = 0;
1045 sys_ck = clk_get(NULL, "sys_clkin_ck"); 663 } else if (cpu_is_omap44xx()) {
1046 if (IS_ERR(sys_ck)) { 664 vdd->read_reg = omap4_voltage_read_reg;
1047 pr_warning("%s: Could not get the sys clk to calculate" 665 vdd->write_reg = omap4_voltage_write_reg;
1048 "various vdd_%s params\n", __func__, vdd->voltdm.name); 666 ret = 0;
1049 return -EINVAL;
1050 } 667 }
1051 sys_clk_speed = clk_get_rate(sys_ck);
1052 clk_put(sys_ck);
1053 /* Divide to avoid overflow */
1054 sys_clk_speed /= 1000;
1055
1056 /* Generic voltage parameters */
1057 vdd->curr_volt = 1200000;
1058 vdd->ocp_mod = OMAP4430_PRM_OCP_SOCKET_INST;
1059 vdd->read_reg = omap4_voltage_read_reg;
1060 vdd->write_reg = omap4_voltage_write_reg;
1061 vdd->volt_scale = vp_forceupdate_scale_voltage;
1062 vdd->vp_enabled = false;
1063 668
1064 /* VC parameters */ 669ovdc_out:
1065 vdd->vc_reg.prm_mod = OMAP4430_PRM_DEVICE_INST; 670 return ret;
1066 vdd->vc_reg.smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET;
1067 vdd->vc_reg.smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET;
1068 vdd->vc_reg.bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET;
1069 vdd->vc_reg.data_shift = OMAP4430_DATA_SHIFT;
1070 vdd->vc_reg.slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT;
1071 vdd->vc_reg.regaddr_shift = OMAP4430_REGADDR_SHIFT;
1072 vdd->vc_reg.valid = OMAP4430_VALID_MASK;
1073 vdd->vc_reg.cmd_on_shift = OMAP4430_ON_SHIFT;
1074 vdd->vc_reg.cmd_on_mask = OMAP4430_ON_MASK;
1075 vdd->vc_reg.cmd_onlp_shift = OMAP4430_ONLP_SHIFT;
1076 vdd->vc_reg.cmd_ret_shift = OMAP4430_RET_SHIFT;
1077 vdd->vc_reg.cmd_off_shift = OMAP4430_OFF_SHIFT;
1078
1079 vdd->vp_reg.prm_mod = OMAP4430_PRM_DEVICE_INST;
1080
1081 /* VPCONFIG bit fields */
1082 vdd->vp_reg.vpconfig_erroroffset = (vdd->pmic_info->vp_erroroffset <<
1083 OMAP4430_ERROROFFSET_SHIFT);
1084 vdd->vp_reg.vpconfig_errorgain_mask = OMAP4430_ERRORGAIN_MASK;
1085 vdd->vp_reg.vpconfig_errorgain_shift = OMAP4430_ERRORGAIN_SHIFT;
1086 vdd->vp_reg.vpconfig_initvoltage_shift = OMAP4430_INITVOLTAGE_SHIFT;
1087 vdd->vp_reg.vpconfig_initvoltage_mask = OMAP4430_INITVOLTAGE_MASK;
1088 vdd->vp_reg.vpconfig_timeouten = OMAP4430_TIMEOUTEN_MASK;
1089 vdd->vp_reg.vpconfig_initvdd = OMAP4430_INITVDD_MASK;
1090 vdd->vp_reg.vpconfig_forceupdate = OMAP4430_FORCEUPDATE_MASK;
1091 vdd->vp_reg.vpconfig_vpenable = OMAP4430_VPENABLE_MASK;
1092
1093 /* VSTEPMIN VSTEPMAX bit fields */
1094 waittime = ((vdd->pmic_info->step_size / vdd->pmic_info->slew_rate) *
1095 sys_clk_speed) / 1000;
1096 vdd->vp_reg.vstepmin_smpswaittimemin = waittime;
1097 vdd->vp_reg.vstepmax_smpswaittimemax = waittime;
1098 vdd->vp_reg.vstepmin_stepmin = vdd->pmic_info->vp_vstepmin;
1099 vdd->vp_reg.vstepmax_stepmax = vdd->pmic_info->vp_vstepmax;
1100 vdd->vp_reg.vstepmin_smpswaittimemin_shift =
1101 OMAP4430_SMPSWAITTIMEMIN_SHIFT;
1102 vdd->vp_reg.vstepmax_smpswaittimemax_shift =
1103 OMAP4430_SMPSWAITTIMEMAX_SHIFT;
1104 vdd->vp_reg.vstepmin_stepmin_shift = OMAP4430_VSTEPMIN_SHIFT;
1105 vdd->vp_reg.vstepmax_stepmax_shift = OMAP4430_VSTEPMAX_SHIFT;
1106
1107 /* VLIMITTO bit fields */
1108 timeout_val = (sys_clk_speed * vdd->pmic_info->vp_timeout_us) / 1000;
1109 vdd->vp_reg.vlimitto_timeout = timeout_val;
1110 vdd->vp_reg.vlimitto_vddmin = vdd->pmic_info->vp_vddmin;
1111 vdd->vp_reg.vlimitto_vddmax = vdd->pmic_info->vp_vddmax;
1112 vdd->vp_reg.vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT;
1113 vdd->vp_reg.vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT;
1114 vdd->vp_reg.vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT;
1115
1116 return 0;
1117} 671}
1118 672
1119/* Public functions */ 673/* Public functions */
@@ -1161,8 +715,7 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
1161 return 0; 715 return 0;
1162 } 716 }
1163 717
1164 curr_vsel = vdd->read_reg(vdd->vp_reg.prm_mod, 718 curr_vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage);
1165 vdd->vp_offs.voltage);
1166 719
1167 if (!vdd->pmic_info || !vdd->pmic_info->vsel_to_uv) { 720 if (!vdd->pmic_info || !vdd->pmic_info->vsel_to_uv) {
1168 pr_warning("%s: PMIC function to convert vsel to voltage" 721 pr_warning("%s: PMIC function to convert vsel to voltage"
@@ -1184,7 +737,6 @@ void omap_vp_enable(struct voltagedomain *voltdm)
1184{ 737{
1185 struct omap_vdd_info *vdd; 738 struct omap_vdd_info *vdd;
1186 u32 vpconfig; 739 u32 vpconfig;
1187 u16 mod;
1188 740
1189 if (!voltdm || IS_ERR(voltdm)) { 741 if (!voltdm || IS_ERR(voltdm)) {
1190 pr_warning("%s: VDD specified does not exist!\n", __func__); 742 pr_warning("%s: VDD specified does not exist!\n", __func__);
@@ -1198,8 +750,6 @@ void omap_vp_enable(struct voltagedomain *voltdm)
1198 return; 750 return;
1199 } 751 }
1200 752
1201 mod = vdd->vp_reg.prm_mod;
1202
1203 /* If VP is already enabled, do nothing. Return */ 753 /* If VP is already enabled, do nothing. Return */
1204 if (vdd->vp_enabled) 754 if (vdd->vp_enabled)
1205 return; 755 return;
@@ -1207,9 +757,9 @@ void omap_vp_enable(struct voltagedomain *voltdm)
1207 vp_latch_vsel(vdd); 757 vp_latch_vsel(vdd);
1208 758
1209 /* Enable VP */ 759 /* Enable VP */
1210 vpconfig = vdd->read_reg(mod, vdd->vp_offs.vpconfig); 760 vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
1211 vpconfig |= vdd->vp_reg.vpconfig_vpenable; 761 vpconfig |= vdd->vp_data->vp_common->vpconfig_vpenable;
1212 vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); 762 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
1213 vdd->vp_enabled = true; 763 vdd->vp_enabled = true;
1214} 764}
1215 765
@@ -1224,7 +774,6 @@ void omap_vp_disable(struct voltagedomain *voltdm)
1224{ 774{
1225 struct omap_vdd_info *vdd; 775 struct omap_vdd_info *vdd;
1226 u32 vpconfig; 776 u32 vpconfig;
1227 u16 mod;
1228 int timeout; 777 int timeout;
1229 778
1230 if (!voltdm || IS_ERR(voltdm)) { 779 if (!voltdm || IS_ERR(voltdm)) {
@@ -1239,8 +788,6 @@ void omap_vp_disable(struct voltagedomain *voltdm)
1239 return; 788 return;
1240 } 789 }
1241 790
1242 mod = vdd->vp_reg.prm_mod;
1243
1244 /* If VP is already disabled, do nothing. Return */ 791 /* If VP is already disabled, do nothing. Return */
1245 if (!vdd->vp_enabled) { 792 if (!vdd->vp_enabled) {
1246 pr_warning("%s: Trying to disable VP for vdd_%s when" 793 pr_warning("%s: Trying to disable VP for vdd_%s when"
@@ -1249,14 +796,14 @@ void omap_vp_disable(struct voltagedomain *voltdm)
1249 } 796 }
1250 797
1251 /* Disable VP */ 798 /* Disable VP */
1252 vpconfig = vdd->read_reg(mod, vdd->vp_offs.vpconfig); 799 vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig);
1253 vpconfig &= ~vdd->vp_reg.vpconfig_vpenable; 800 vpconfig &= ~vdd->vp_data->vp_common->vpconfig_vpenable;
1254 vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); 801 vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig);
1255 802
1256 /* 803 /*
1257 * Wait for VP idle Typical latency is <2us. Maximum latency is ~100us 804 * Wait for VP idle Typical latency is <2us. Maximum latency is ~100us
1258 */ 805 */
1259 omap_test_timeout((vdd->read_reg(mod, vdd->vp_offs.vstatus)), 806 omap_test_timeout((vdd->read_reg(prm_mod_offs, vdd->vp_data->vstatus)),
1260 VP_IDLE_TIMEOUT, timeout); 807 VP_IDLE_TIMEOUT, timeout);
1261 808
1262 if (timeout >= VP_IDLE_TIMEOUT) 809 if (timeout >= VP_IDLE_TIMEOUT)
@@ -1509,8 +1056,8 @@ struct voltagedomain *omap_voltage_domain_lookup(char *name)
1509 } 1056 }
1510 1057
1511 for (i = 0; i < nr_scalable_vdd; i++) { 1058 for (i = 0; i < nr_scalable_vdd; i++) {
1512 if (!(strcmp(name, vdd_info[i].voltdm.name))) 1059 if (!(strcmp(name, vdd_info[i]->voltdm.name)))
1513 return &vdd_info[i].voltdm; 1060 return &vdd_info[i]->voltdm;
1514 } 1061 }
1515 1062
1516 return ERR_PTR(-EINVAL); 1063 return ERR_PTR(-EINVAL);
@@ -1538,35 +1085,24 @@ int __init omap_voltage_late_init(void)
1538 pr_err("%s: Unable to create voltage debugfs main dir\n", 1085 pr_err("%s: Unable to create voltage debugfs main dir\n",
1539 __func__); 1086 __func__);
1540 for (i = 0; i < nr_scalable_vdd; i++) { 1087 for (i = 0; i < nr_scalable_vdd; i++) {
1541 if (vdd_data_configure(&vdd_info[i])) 1088 if (omap_vdd_data_configure(vdd_info[i]))
1542 continue; 1089 continue;
1543 vc_init(&vdd_info[i]); 1090 omap_vc_init(vdd_info[i]);
1544 vp_init(&vdd_info[i]); 1091 vp_init(vdd_info[i]);
1545 vdd_debugfs_init(&vdd_info[i]); 1092 vdd_debugfs_init(vdd_info[i]);
1546 } 1093 }
1547 1094
1548 return 0; 1095 return 0;
1549} 1096}
1550 1097
1551/** 1098/* XXX document */
1552 * omap_voltage_early_init()- Volatage driver early init 1099int __init omap_voltage_early_init(s16 prm_mod, s16 prm_irqst_ocp_mod,
1553 */ 1100 struct omap_vdd_info *omap_vdd_array[],
1554static int __init omap_voltage_early_init(void) 1101 u8 omap_vdd_count)
1555{ 1102{
1556 if (cpu_is_omap34xx()) { 1103 prm_mod_offs = prm_mod;
1557 vdd_info = omap3_vdd_info; 1104 prm_irqst_ocp_mod_offs = prm_irqst_ocp_mod;
1558 nr_scalable_vdd = OMAP3_NR_SCALABLE_VDD; 1105 vdd_info = omap_vdd_array;
1559 vc_init = omap3_vc_init; 1106 nr_scalable_vdd = omap_vdd_count;
1560 vdd_data_configure = omap3_vdd_data_configure;
1561 } else if (cpu_is_omap44xx()) {
1562 vdd_info = omap4_vdd_info;
1563 nr_scalable_vdd = OMAP4_NR_SCALABLE_VDD;
1564 vc_init = omap4_vc_init;
1565 vdd_data_configure = omap4_vdd_data_configure;
1566 } else {
1567 pr_warning("%s: voltage driver support not added\n", __func__);
1568 }
1569
1570 return 0; 1107 return 0;
1571} 1108}
1572core_initcall(omap_voltage_early_init);
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
new file mode 100644
index 000000000000..e9f5408244e0
--- /dev/null
+++ b/arch/arm/mach-omap2/voltage.h
@@ -0,0 +1,184 @@
1/*
2 * OMAP Voltage Management Routines
3 *
4 * Author: Thara Gopinath <thara@ti.com>
5 *
6 * Copyright (C) 2009 Texas Instruments, Inc.
7 * Thara Gopinath <thara@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __ARCH_ARM_MACH_OMAP2_VOLTAGE_H
15#define __ARCH_ARM_MACH_OMAP2_VOLTAGE_H
16
17#include <linux/err.h>
18
19#include "vc.h"
20#include "vp.h"
21
22/* XXX document */
23#define VOLTSCALE_VPFORCEUPDATE 1
24#define VOLTSCALE_VCBYPASS 2
25
26/*
27 * OMAP3 GENERIC setup times. Revisit to see if these needs to be
28 * passed from board or PMIC file
29 */
30#define OMAP3_CLKSETUP 0xff
31#define OMAP3_VOLTOFFSET 0xff
32#define OMAP3_VOLTSETUP2 0xff
33
34/**
35 * struct omap_vfsm_instance_data - per-voltage manager FSM register/bitfield
36 * data
37 * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register
38 * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base
39 * @voltsetup_shift: SETUP_TIME* field shift in the PRM_VOLTSETUP* register
40 *
41 * XXX What about VOLTOFFSET/VOLTCTRL?
42 * XXX It is not necessary to have both a _mask and a _shift for the same
43 * bitfield - remove one!
44 */
45struct omap_vfsm_instance_data {
46 u32 voltsetup_mask;
47 u8 voltsetup_reg;
48 u8 voltsetup_shift;
49};
50
51/**
52 * struct voltagedomain - omap voltage domain global structure.
53 * @name: Name of the voltage domain which can be used as a unique
54 * identifier.
55 */
56struct voltagedomain {
57 char *name;
58};
59
60/**
61 * struct omap_volt_data - Omap voltage specific data.
62 * @voltage_nominal: The possible voltage value in uV
63 * @sr_efuse_offs: The offset of the efuse register(from system
64 * control module base address) from where to read
65 * the n-target value for the smartreflex module.
66 * @sr_errminlimit: Error min limit value for smartreflex. This value
67 * differs at differnet opp and thus is linked
68 * with voltage.
69 * @vp_errorgain: Error gain value for the voltage processor. This
70 * field also differs according to the voltage/opp.
71 */
72struct omap_volt_data {
73 u32 volt_nominal;
74 u32 sr_efuse_offs;
75 u8 sr_errminlimit;
76 u8 vp_errgain;
77};
78
79/**
80 * struct omap_volt_pmic_info - PMIC specific data required by voltage driver.
81 * @slew_rate: PMIC slew rate (in uv/us)
82 * @step_size: PMIC voltage step size (in uv)
83 * @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV.
84 * @uv_to_vsel: PMIC API to convert voltage in uV to vsel value.
85 */
86struct omap_volt_pmic_info {
87 int slew_rate;
88 int step_size;
89 u32 on_volt;
90 u32 onlp_volt;
91 u32 ret_volt;
92 u32 off_volt;
93 u16 volt_setup_time;
94 u8 vp_erroroffset;
95 u8 vp_vstepmin;
96 u8 vp_vstepmax;
97 u8 vp_vddmin;
98 u8 vp_vddmax;
99 u8 vp_timeout_us;
100 u8 i2c_slave_addr;
101 u8 pmic_reg;
102 unsigned long (*vsel_to_uv) (const u8 vsel);
103 u8 (*uv_to_vsel) (unsigned long uV);
104};
105
106/**
107 * omap_vdd_info - Per Voltage Domain info
108 *
109 * @volt_data : voltage table having the distinct voltages supported
110 * by the domain and other associated per voltage data.
111 * @pmic_info : pmic specific parameters which should be populted by
112 * the pmic drivers.
113 * @vp_data : the register values, shifts, masks for various
114 * vp registers
115 * @vp_rt_data : VP data derived at runtime, not predefined
116 * @vc_data : structure containing various various vc registers,
117 * shifts, masks etc.
118 * @vfsm : voltage manager FSM data
119 * @voltdm : pointer to the voltage domain structure
120 * @debug_dir : debug directory for this voltage domain.
121 * @curr_volt : current voltage for this vdd.
122 * @vp_enabled : flag to keep track of whether vp is enabled or not
123 * @volt_scale : API to scale the voltage of the vdd.
124 */
125struct omap_vdd_info {
126 struct omap_volt_data *volt_data;
127 struct omap_volt_pmic_info *pmic_info;
128 struct omap_vp_instance_data *vp_data;
129 struct omap_vp_runtime_data vp_rt_data;
130 struct omap_vc_instance_data *vc_data;
131 const struct omap_vfsm_instance_data *vfsm;
132 struct voltagedomain voltdm;
133 struct dentry *debug_dir;
134 u32 curr_volt;
135 bool vp_enabled;
136 u32 (*read_reg) (u16 mod, u8 offset);
137 void (*write_reg) (u32 val, u16 mod, u8 offset);
138 int (*volt_scale) (struct omap_vdd_info *vdd,
139 unsigned long target_volt);
140};
141
142unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm);
143void omap_vp_enable(struct voltagedomain *voltdm);
144void omap_vp_disable(struct voltagedomain *voltdm);
145int omap_voltage_scale_vdd(struct voltagedomain *voltdm,
146 unsigned long target_volt);
147void omap_voltage_reset(struct voltagedomain *voltdm);
148void omap_voltage_get_volttable(struct voltagedomain *voltdm,
149 struct omap_volt_data **volt_data);
150struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
151 unsigned long volt);
152unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm);
153struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm);
154int __init omap_voltage_early_init(s16 prm_mod, s16 prm_irqst_mod,
155 struct omap_vdd_info *omap_vdd_array[],
156 u8 omap_vdd_count);
157#ifdef CONFIG_PM
158int omap_voltage_register_pmic(struct voltagedomain *voltdm,
159 struct omap_volt_pmic_info *pmic_info);
160void omap_change_voltscale_method(struct voltagedomain *voltdm,
161 int voltscale_method);
162/* API to get the voltagedomain pointer */
163struct voltagedomain *omap_voltage_domain_lookup(char *name);
164
165int omap_voltage_late_init(void);
166#else
167static inline int omap_voltage_register_pmic(struct voltagedomain *voltdm,
168 struct omap_volt_pmic_info *pmic_info)
169{
170 return -EINVAL;
171}
172static inline void omap_change_voltscale_method(struct voltagedomain *voltdm,
173 int voltscale_method) {}
174static inline int omap_voltage_late_init(void)
175{
176 return -EINVAL;
177}
178static inline struct voltagedomain *omap_voltage_domain_lookup(char *name)
179{
180 return ERR_PTR(-EINVAL);
181}
182#endif
183
184#endif
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
new file mode 100644
index 000000000000..def230fd2fde
--- /dev/null
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -0,0 +1,95 @@
1/*
2 * OMAP3 voltage domain data
3 *
4 * Copyright (C) 2007, 2010 Texas Instruments, Inc.
5 * Rajendra Nayak <rnayak@ti.com>
6 * Lesly A M <x0080970@ti.com>
7 * Thara Gopinath <thara@ti.com>
8 *
9 * Copyright (C) 2008, 2011 Nokia Corporation
10 * Kalle Jokiniemi
11 * Paul Walmsley
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17#include <linux/kernel.h>
18#include <linux/err.h>
19#include <linux/init.h>
20
21#include <plat/common.h>
22#include <plat/cpu.h>
23
24#include "prm-regbits-34xx.h"
25#include "omap_opp_data.h"
26#include "voltage.h"
27#include "vc.h"
28#include "vp.h"
29
30/*
31 * VDD data
32 */
33
34static const struct omap_vfsm_instance_data omap3_vdd1_vfsm_data = {
35 .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
36 .voltsetup_shift = OMAP3430_SETUP_TIME1_SHIFT,
37 .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK,
38};
39
40static struct omap_vdd_info omap3_vdd1_info = {
41 .vp_data = &omap3_vp1_data,
42 .vc_data = &omap3_vc1_data,
43 .vfsm = &omap3_vdd1_vfsm_data,
44 .voltdm = {
45 .name = "mpu",
46 },
47};
48
49static const struct omap_vfsm_instance_data omap3_vdd2_vfsm_data = {
50 .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
51 .voltsetup_shift = OMAP3430_SETUP_TIME2_SHIFT,
52 .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK,
53};
54
55static struct omap_vdd_info omap3_vdd2_info = {
56 .vp_data = &omap3_vp2_data,
57 .vc_data = &omap3_vc2_data,
58 .vfsm = &omap3_vdd2_vfsm_data,
59 .voltdm = {
60 .name = "core",
61 },
62};
63
64/* OMAP3 VDD structures */
65static struct omap_vdd_info *omap3_vdd_info[] = {
66 &omap3_vdd1_info,
67 &omap3_vdd2_info,
68};
69
70/* OMAP3 specific voltage init functions */
71static int __init omap3xxx_voltage_early_init(void)
72{
73 s16 prm_mod = OMAP3430_GR_MOD;
74 s16 prm_irqst_ocp_mod = OCP_MOD;
75
76 if (!cpu_is_omap34xx())
77 return 0;
78
79 /*
80 * XXX Will depend on the process, validation, and binning
81 * for the currently-running IC
82 */
83 if (cpu_is_omap3630()) {
84 omap3_vdd1_info.volt_data = omap36xx_vddmpu_volt_data;
85 omap3_vdd2_info.volt_data = omap36xx_vddcore_volt_data;
86 } else {
87 omap3_vdd1_info.volt_data = omap34xx_vddmpu_volt_data;
88 omap3_vdd2_info.volt_data = omap34xx_vddcore_volt_data;
89 }
90
91 return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
92 omap3_vdd_info,
93 ARRAY_SIZE(omap3_vdd_info));
94};
95core_initcall(omap3xxx_voltage_early_init);
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
new file mode 100644
index 000000000000..cb64996de0e1
--- /dev/null
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -0,0 +1,102 @@
1/*
2 * OMAP3/OMAP4 Voltage Management Routines
3 *
4 * Author: Thara Gopinath <thara@ti.com>
5 *
6 * Copyright (C) 2007 Texas Instruments, Inc.
7 * Rajendra Nayak <rnayak@ti.com>
8 * Lesly A M <x0080970@ti.com>
9 *
10 * Copyright (C) 2008 Nokia Corporation
11 * Kalle Jokiniemi
12 *
13 * Copyright (C) 2010 Texas Instruments, Inc.
14 * Thara Gopinath <thara@ti.com>
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 */
20#include <linux/kernel.h>
21#include <linux/err.h>
22#include <linux/init.h>
23
24#include <plat/common.h>
25
26#include "prm-regbits-44xx.h"
27#include "prm44xx.h"
28#include "prcm44xx.h"
29#include "prminst44xx.h"
30#include "voltage.h"
31#include "omap_opp_data.h"
32#include "vc.h"
33#include "vp.h"
34
35static const struct omap_vfsm_instance_data omap4_vdd_mpu_vfsm_data = {
36 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
37};
38
39static struct omap_vdd_info omap4_vdd_mpu_info = {
40 .vp_data = &omap4_vp_mpu_data,
41 .vc_data = &omap4_vc_mpu_data,
42 .vfsm = &omap4_vdd_mpu_vfsm_data,
43 .voltdm = {
44 .name = "mpu",
45 },
46};
47
48static const struct omap_vfsm_instance_data omap4_vdd_iva_vfsm_data = {
49 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
50};
51
52static struct omap_vdd_info omap4_vdd_iva_info = {
53 .vp_data = &omap4_vp_iva_data,
54 .vc_data = &omap4_vc_iva_data,
55 .vfsm = &omap4_vdd_iva_vfsm_data,
56 .voltdm = {
57 .name = "iva",
58 },
59};
60
61static const struct omap_vfsm_instance_data omap4_vdd_core_vfsm_data = {
62 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
63};
64
65static struct omap_vdd_info omap4_vdd_core_info = {
66 .vp_data = &omap4_vp_core_data,
67 .vc_data = &omap4_vc_core_data,
68 .vfsm = &omap4_vdd_core_vfsm_data,
69 .voltdm = {
70 .name = "core",
71 },
72};
73
74/* OMAP4 VDD structures */
75static struct omap_vdd_info *omap4_vdd_info[] = {
76 &omap4_vdd_mpu_info,
77 &omap4_vdd_iva_info,
78 &omap4_vdd_core_info,
79};
80
81/* OMAP4 specific voltage init functions */
82static int __init omap44xx_voltage_early_init(void)
83{
84 s16 prm_mod = OMAP4430_PRM_DEVICE_INST;
85 s16 prm_irqst_ocp_mod = OMAP4430_PRM_OCP_SOCKET_INST;
86
87 if (!cpu_is_omap44xx())
88 return 0;
89
90 /*
91 * XXX Will depend on the process, validation, and binning
92 * for the currently-running IC
93 */
94 omap4_vdd_mpu_info.volt_data = omap44xx_vdd_mpu_volt_data;
95 omap4_vdd_iva_info.volt_data = omap44xx_vdd_iva_volt_data;
96 omap4_vdd_core_info.volt_data = omap44xx_vdd_core_volt_data;
97
98 return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod,
99 omap4_vdd_info,
100 ARRAY_SIZE(omap4_vdd_info));
101};
102core_initcall(omap44xx_voltage_early_init);
diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h
new file mode 100644
index 000000000000..7ce134f7de79
--- /dev/null
+++ b/arch/arm/mach-omap2/vp.h
@@ -0,0 +1,143 @@
1/*
2 * OMAP3/4 Voltage Processor (VP) structure and macro definitions
3 *
4 * Copyright (C) 2007, 2010 Texas Instruments, Inc.
5 * Rajendra Nayak <rnayak@ti.com>
6 * Lesly A M <x0080970@ti.com>
7 * Thara Gopinath <thara@ti.com>
8 *
9 * Copyright (C) 2008, 2011 Nokia Corporation
10 * Kalle Jokiniemi
11 * Paul Walmsley
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License version
15 * 2 as published by the Free Software Foundation.
16 */
17#ifndef __ARCH_ARM_MACH_OMAP2_VP_H
18#define __ARCH_ARM_MACH_OMAP2_VP_H
19
20#include <linux/kernel.h>
21
22/* XXX document */
23#define VP_IDLE_TIMEOUT 200
24#define VP_TRANXDONE_TIMEOUT 300
25
26
27/**
28 * struct omap_vp_common_data - register data common to all VDDs
29 * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
30 * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
31 * @vpconfig_timeouten_mask: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
32 * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
33 * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
34 * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
35 * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
36 * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
37 * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
38 * @vpconfig_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
39 * @vpconfig_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
40 * @vpconfig_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
41 * @vpconfig_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
42 * @vpconfig_vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
43 * @vpconfig_vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
44 * @vpconfig_vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
45 *
46 * XXX It it not necessary to have both a mask and a shift for the same
47 * bitfield - remove one
48 * XXX Many of these fields are wrongly named -- e.g., vpconfig_smps* -- fix!
49 */
50struct omap_vp_common_data {
51 u32 vpconfig_errorgain_mask;
52 u32 vpconfig_initvoltage_mask;
53 u32 vpconfig_timeouten;
54 u32 vpconfig_initvdd;
55 u32 vpconfig_forceupdate;
56 u32 vpconfig_vpenable;
57 u8 vpconfig_erroroffset_shift;
58 u8 vpconfig_errorgain_shift;
59 u8 vpconfig_initvoltage_shift;
60 u8 vstepmin_stepmin_shift;
61 u8 vstepmin_smpswaittimemin_shift;
62 u8 vstepmax_stepmax_shift;
63 u8 vstepmax_smpswaittimemax_shift;
64 u8 vlimitto_vddmin_shift;
65 u8 vlimitto_vddmax_shift;
66 u8 vlimitto_timeout_shift;
67};
68
69/**
70 * struct omap_vp_prm_irqst_data - PRM_IRQSTATUS_MPU.VP_TRANXDONE_ST data
71 * @prm_irqst_reg: reg offset for PRM_IRQSTATUS_MPU from top of PRM
72 * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
73 *
74 * XXX prm_irqst_reg does not belong here
75 * XXX Note that on OMAP3, VP_TRANXDONE interrupt may not work due to a
76 * hardware bug
77 * XXX This structure is probably not needed
78 */
79struct omap_vp_prm_irqst_data {
80 u8 prm_irqst_reg;
81 u32 tranxdone_status;
82};
83
84/**
85 * struct omap_vp_instance_data - VP register offsets (per-VDD)
86 * @vp_common: pointer to struct omap_vp_common_data * for this SoC
87 * @prm_irqst_data: pointer to struct omap_vp_prm_irqst_data for this VDD
88 * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
89 * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
90 * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
91 * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
92 * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
93 *
94 * XXX vp_common is probably not needed since it is per-SoC
95 */
96struct omap_vp_instance_data {
97 const struct omap_vp_common_data *vp_common;
98 const struct omap_vp_prm_irqst_data *prm_irqst_data;
99 u8 vpconfig;
100 u8 vstepmin;
101 u8 vstepmax;
102 u8 vlimitto;
103 u8 vstatus;
104 u8 voltage;
105};
106
107/**
108 * struct omap_vp_runtime_data - VP data populated at runtime by code
109 * @vpconfig_erroroffset: value of ERROROFFSET bitfield in PRM_VP*_CONFIG
110 * @vpconfig_errorgain: value of ERRORGAIN bitfield in PRM_VP*_CONFIG
111 * @vstepmin_smpswaittimemin: value of SMPSWAITTIMEMIN bitfield in PRM_VP*_VSTEPMIN
112 * @vstepmax_smpswaittimemax: value of SMPSWAITTIMEMAX bitfield in PRM_VP*_VSTEPMAX
113 * @vlimitto_timeout: value of TIMEOUT bitfield in PRM_VP*_VLIMITTO
114 * @vstepmin_stepmin: value of VSTEPMIN bitfield in PRM_VP*_VSTEPMIN
115 * @vstepmax_stepmax: value of VSTEPMAX bitfield in PRM_VP*_VSTEPMAX
116 * @vlimitto_vddmin: value of VDDMIN bitfield in PRM_VP*_VLIMITTO
117 * @vlimitto_vddmax: value of VDDMAX bitfield in PRM_VP*_VLIMITTO
118 *
119 * XXX Is this structure really needed? Why not just program the
120 * device directly? They are in PRM space, therefore in the WKUP
121 * powerdomain, so register contents should not be lost in off-mode.
122 * XXX Some of these fields are incorrectly named, e.g., vstep*
123 */
124struct omap_vp_runtime_data {
125 u32 vpconfig_erroroffset;
126 u16 vpconfig_errorgain;
127 u16 vstepmin_smpswaittimemin;
128 u16 vstepmax_smpswaittimemax;
129 u16 vlimitto_timeout;
130 u8 vstepmin_stepmin;
131 u8 vstepmax_stepmax;
132 u8 vlimitto_vddmin;
133 u8 vlimitto_vddmax;
134};
135
136extern struct omap_vp_instance_data omap3_vp1_data;
137extern struct omap_vp_instance_data omap3_vp2_data;
138
139extern struct omap_vp_instance_data omap4_vp_mpu_data;
140extern struct omap_vp_instance_data omap4_vp_iva_data;
141extern struct omap_vp_instance_data omap4_vp_core_data;
142
143#endif
diff --git a/arch/arm/mach-omap2/vp3xxx_data.c b/arch/arm/mach-omap2/vp3xxx_data.c
new file mode 100644
index 000000000000..645217094e51
--- /dev/null
+++ b/arch/arm/mach-omap2/vp3xxx_data.c
@@ -0,0 +1,82 @@
1/*
2 * OMAP3 Voltage Processor (VP) data
3 *
4 * Copyright (C) 2007, 2010 Texas Instruments, Inc.
5 * Rajendra Nayak <rnayak@ti.com>
6 * Lesly A M <x0080970@ti.com>
7 * Thara Gopinath <thara@ti.com>
8 *
9 * Copyright (C) 2008, 2011 Nokia Corporation
10 * Kalle Jokiniemi
11 * Paul Walmsley
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
18#include <linux/io.h>
19#include <linux/err.h>
20#include <linux/init.h>
21
22#include <plat/common.h>
23
24#include "prm-regbits-34xx.h"
25#include "voltage.h"
26
27#include "vp.h"
28
29/*
30 * VP data common to 34xx/36xx chips
31 * XXX This stuff presumably belongs in the vp3xxx.c or vp.c file.
32 */
33static const struct omap_vp_common_data omap3_vp_common = {
34 .vpconfig_erroroffset_shift = OMAP3430_ERROROFFSET_SHIFT,
35 .vpconfig_errorgain_mask = OMAP3430_ERRORGAIN_MASK,
36 .vpconfig_errorgain_shift = OMAP3430_ERRORGAIN_SHIFT,
37 .vpconfig_initvoltage_shift = OMAP3430_INITVOLTAGE_SHIFT,
38 .vpconfig_initvoltage_mask = OMAP3430_INITVOLTAGE_MASK,
39 .vpconfig_timeouten = OMAP3430_TIMEOUTEN_MASK,
40 .vpconfig_initvdd = OMAP3430_INITVDD_MASK,
41 .vpconfig_forceupdate = OMAP3430_FORCEUPDATE_MASK,
42 .vpconfig_vpenable = OMAP3430_VPENABLE_MASK,
43 .vstepmin_smpswaittimemin_shift = OMAP3430_SMPSWAITTIMEMIN_SHIFT,
44 .vstepmax_smpswaittimemax_shift = OMAP3430_SMPSWAITTIMEMAX_SHIFT,
45 .vstepmin_stepmin_shift = OMAP3430_VSTEPMIN_SHIFT,
46 .vstepmax_stepmax_shift = OMAP3430_VSTEPMAX_SHIFT,
47 .vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT,
48 .vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT,
49 .vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT,
50};
51
52static const struct omap_vp_prm_irqst_data omap3_vp1_prm_irqst_data = {
53 .prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
54 .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
55};
56
57struct omap_vp_instance_data omap3_vp1_data = {
58 .vp_common = &omap3_vp_common,
59 .vpconfig = OMAP3_PRM_VP1_CONFIG_OFFSET,
60 .vstepmin = OMAP3_PRM_VP1_VSTEPMIN_OFFSET,
61 .vstepmax = OMAP3_PRM_VP1_VSTEPMAX_OFFSET,
62 .vlimitto = OMAP3_PRM_VP1_VLIMITTO_OFFSET,
63 .vstatus = OMAP3_PRM_VP1_STATUS_OFFSET,
64 .voltage = OMAP3_PRM_VP1_VOLTAGE_OFFSET,
65 .prm_irqst_data = &omap3_vp1_prm_irqst_data,
66};
67
68static const struct omap_vp_prm_irqst_data omap3_vp2_prm_irqst_data = {
69 .prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
70 .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
71};
72
73struct omap_vp_instance_data omap3_vp2_data = {
74 .vp_common = &omap3_vp_common,
75 .vpconfig = OMAP3_PRM_VP2_CONFIG_OFFSET,
76 .vstepmin = OMAP3_PRM_VP2_VSTEPMIN_OFFSET,
77 .vstepmax = OMAP3_PRM_VP2_VSTEPMAX_OFFSET,
78 .vlimitto = OMAP3_PRM_VP2_VLIMITTO_OFFSET,
79 .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET,
80 .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET,
81 .prm_irqst_data = &omap3_vp2_prm_irqst_data,
82};
diff --git a/arch/arm/mach-omap2/vp44xx_data.c b/arch/arm/mach-omap2/vp44xx_data.c
new file mode 100644
index 000000000000..65d1ad63800a
--- /dev/null
+++ b/arch/arm/mach-omap2/vp44xx_data.c
@@ -0,0 +1,100 @@
1/*
2 * OMAP3 Voltage Processor (VP) data
3 *
4 * Copyright (C) 2007, 2010 Texas Instruments, Inc.
5 * Rajendra Nayak <rnayak@ti.com>
6 * Lesly A M <x0080970@ti.com>
7 * Thara Gopinath <thara@ti.com>
8 *
9 * Copyright (C) 2008, 2011 Nokia Corporation
10 * Kalle Jokiniemi
11 * Paul Walmsley
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
18#include <linux/io.h>
19#include <linux/err.h>
20#include <linux/init.h>
21
22#include <plat/common.h>
23
24#include "prm44xx.h"
25#include "prm-regbits-44xx.h"
26#include "voltage.h"
27
28#include "vp.h"
29
30/*
31 * VP data common to 44xx chips
32 * XXX This stuff presumably belongs in the vp44xx.c or vp.c file.
33 */
34static const struct omap_vp_common_data omap4_vp_common = {
35 .vpconfig_erroroffset_shift = OMAP4430_ERROROFFSET_SHIFT,
36 .vpconfig_errorgain_mask = OMAP4430_ERRORGAIN_MASK,
37 .vpconfig_errorgain_shift = OMAP4430_ERRORGAIN_SHIFT,
38 .vpconfig_initvoltage_shift = OMAP4430_INITVOLTAGE_SHIFT,
39 .vpconfig_initvoltage_mask = OMAP4430_INITVOLTAGE_MASK,
40 .vpconfig_timeouten = OMAP4430_TIMEOUTEN_MASK,
41 .vpconfig_initvdd = OMAP4430_INITVDD_MASK,
42 .vpconfig_forceupdate = OMAP4430_FORCEUPDATE_MASK,
43 .vpconfig_vpenable = OMAP4430_VPENABLE_MASK,
44 .vstepmin_smpswaittimemin_shift = OMAP4430_SMPSWAITTIMEMIN_SHIFT,
45 .vstepmax_smpswaittimemax_shift = OMAP4430_SMPSWAITTIMEMAX_SHIFT,
46 .vstepmin_stepmin_shift = OMAP4430_VSTEPMIN_SHIFT,
47 .vstepmax_stepmax_shift = OMAP4430_VSTEPMAX_SHIFT,
48 .vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT,
49 .vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT,
50 .vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT,
51};
52
53static const struct omap_vp_prm_irqst_data omap4_vp_mpu_prm_irqst_data = {
54 .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET,
55 .tranxdone_status = OMAP4430_VP_MPU_TRANXDONE_ST_MASK,
56};
57
58struct omap_vp_instance_data omap4_vp_mpu_data = {
59 .vp_common = &omap4_vp_common,
60 .vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET,
61 .vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET,
62 .vstepmax = OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET,
63 .vlimitto = OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET,
64 .vstatus = OMAP4_PRM_VP_MPU_STATUS_OFFSET,
65 .voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET,
66 .prm_irqst_data = &omap4_vp_mpu_prm_irqst_data,
67};
68
69static const struct omap_vp_prm_irqst_data omap4_vp_iva_prm_irqst_data = {
70 .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
71 .tranxdone_status = OMAP4430_VP_IVA_TRANXDONE_ST_MASK,
72};
73
74struct omap_vp_instance_data omap4_vp_iva_data = {
75 .vp_common = &omap4_vp_common,
76 .vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET,
77 .vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET,
78 .vstepmax = OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET,
79 .vlimitto = OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET,
80 .vstatus = OMAP4_PRM_VP_IVA_STATUS_OFFSET,
81 .voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET,
82 .prm_irqst_data = &omap4_vp_iva_prm_irqst_data,
83};
84
85static const struct omap_vp_prm_irqst_data omap4_vp_core_prm_irqst_data = {
86 .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET,
87 .tranxdone_status = OMAP4430_VP_CORE_TRANXDONE_ST_MASK,
88};
89
90struct omap_vp_instance_data omap4_vp_core_data = {
91 .vp_common = &omap4_vp_common,
92 .vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET,
93 .vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET,
94 .vstepmax = OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET,
95 .vlimitto = OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET,
96 .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET,
97 .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET,
98 .prm_irqst_data = &omap4_vp_core_prm_irqst_data,
99};
100