aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/pm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 16:46:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 16:46:56 -0400
commit7b6181e06841f5ad15c4ff708b967b4db65a64de (patch)
treebdfcf5b74b692f76581156e452d268b64c795200 /arch/arm/mach-omap2/pm.c
parent72e58063d63c5f0a7bf65312f1e3a5ed9bb5c2ff (diff)
parentbc487fb341af05120bccb9f59ce76302391dcc77 (diff)
Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6
* 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6: (163 commits) omap: complete removal of machine_desc.io_pg_offst and .phys_io omap: UART: fix wakeup registers for OMAP24xx UART2 omap: Fix spotty MMC voltages ASoC: OMAP4: MCPDM: Remove unnecessary include of plat/control.h serial: omap-serial: fix signess error OMAP3: DMA: Errata i541: sDMA FIFO draining does not finish omap: dma: Fix buffering disable bit setting for omap24xx omap: serial: Fix the boot-up crash/reboot without CONFIG_PM OMAP3: PM: fix scratchpad memory accesses for off-mode omap4: pandaboard: enable the ehci port on pandaboard omap4: pandaboard: Fix the init if CONFIG_MMC_OMAP_HS is not set omap4: pandaboard: remove unused hsmmc definition OMAP: McBSP: Remove null omap44xx ops comment OMAP: McBSP: Swap CLKS source definition OMAP: McBSP: Fix CLKR and FSR signal muxing OMAP2+: clock: reduce the amount of standard debugging while disabling unused clocks OMAP: control: move plat-omap/control.h to mach-omap2/control.h OMAP: split plat-omap/common.c OMAP: McBSP: implement functional clock switching via clock framework OMAP: McBSP: implement McBSP CLKR and FSR signal muxing via mach-omap2/mcbsp.c ... Fixed up trivial conflicts in arch/arm/mach-omap2/ {board-zoom-peripherals.c,devices.c} as per Tony
Diffstat (limited to 'arch/arm/mach-omap2/pm.c')
-rw-r--r--arch/arm/mach-omap2/pm.c75
1 files changed, 69 insertions, 6 deletions
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 68f9f2e95891..59ca03b0e691 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -18,11 +18,15 @@
18#include <plat/omap_device.h> 18#include <plat/omap_device.h>
19#include <plat/common.h> 19#include <plat/common.h>
20 20
21#include <plat/powerdomain.h>
22#include <plat/clockdomain.h>
23
21static struct omap_device_pm_latency *pm_lats; 24static struct omap_device_pm_latency *pm_lats;
22 25
23static struct device *mpu_dev; 26static struct device *mpu_dev;
24static struct device *dsp_dev; 27static struct device *iva_dev;
25static struct device *l3_dev; 28static struct device *l3_dev;
29static struct device *dsp_dev;
26 30
27struct device *omap2_get_mpuss_device(void) 31struct device *omap2_get_mpuss_device(void)
28{ 32{
@@ -30,10 +34,10 @@ struct device *omap2_get_mpuss_device(void)
30 return mpu_dev; 34 return mpu_dev;
31} 35}
32 36
33struct device *omap2_get_dsp_device(void) 37struct device *omap2_get_iva_device(void)
34{ 38{
35 WARN_ON_ONCE(!dsp_dev); 39 WARN_ON_ONCE(!iva_dev);
36 return dsp_dev; 40 return iva_dev;
37} 41}
38 42
39struct device *omap2_get_l3_device(void) 43struct device *omap2_get_l3_device(void)
@@ -42,6 +46,13 @@ struct device *omap2_get_l3_device(void)
42 return l3_dev; 46 return l3_dev;
43} 47}
44 48
49struct device *omap4_get_dsp_device(void)
50{
51 WARN_ON_ONCE(!dsp_dev);
52 return dsp_dev;
53}
54EXPORT_SYMBOL(omap4_get_dsp_device);
55
45/* static int _init_omap_device(struct omap_hwmod *oh, void *user) */ 56/* static int _init_omap_device(struct omap_hwmod *oh, void *user) */
46static int _init_omap_device(char *name, struct device **new_dev) 57static int _init_omap_device(char *name, struct device **new_dev)
47{ 58{
@@ -69,8 +80,60 @@ static int _init_omap_device(char *name, struct device **new_dev)
69static void omap2_init_processor_devices(void) 80static void omap2_init_processor_devices(void)
70{ 81{
71 _init_omap_device("mpu", &mpu_dev); 82 _init_omap_device("mpu", &mpu_dev);
72 _init_omap_device("iva", &dsp_dev); 83 _init_omap_device("iva", &iva_dev);
73 _init_omap_device("l3_main", &l3_dev); 84 if (cpu_is_omap44xx()) {
85 _init_omap_device("l3_main_1", &l3_dev);
86 _init_omap_device("dsp", &dsp_dev);
87 } else {
88 _init_omap_device("l3_main", &l3_dev);
89 }
90}
91
92/*
93 * This sets pwrdm state (other than mpu & core. Currently only ON &
94 * RET are supported. Function is assuming that clkdm doesn't have
95 * hw_sup mode enabled.
96 */
97int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
98{
99 u32 cur_state;
100 int sleep_switch = 0;
101 int ret = 0;
102
103 if (pwrdm == NULL || IS_ERR(pwrdm))
104 return -EINVAL;
105
106 while (!(pwrdm->pwrsts & (1 << state))) {
107 if (state == PWRDM_POWER_OFF)
108 return ret;
109 state--;
110 }
111
112 cur_state = pwrdm_read_next_pwrst(pwrdm);
113 if (cur_state == state)
114 return ret;
115
116 if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) {
117 omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
118 sleep_switch = 1;
119 pwrdm_wait_transition(pwrdm);
120 }
121
122 ret = pwrdm_set_next_pwrst(pwrdm, state);
123 if (ret) {
124 printk(KERN_ERR "Unable to set state of powerdomain: %s\n",
125 pwrdm->name);
126 goto err;
127 }
128
129 if (sleep_switch) {
130 omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
131 pwrdm_wait_transition(pwrdm);
132 pwrdm_state_switch(pwrdm);
133 }
134
135err:
136 return ret;
74} 137}
75 138
76static int __init omap2_common_pm_init(void) 139static int __init omap2_common_pm_init(void)