40 #include <linux/kernel.h>
42 #include <linux/errno.h>
43 #include <linux/linkage.h>
46 #include <asm/cacheflush.h>
47 #include <asm/tlbflush.h>
49 #include <asm/pgalloc.h>
50 #include <asm/suspend.h>
65 struct omap4_cpu_pm_info {
80 static inline void set_cpu_wakeup_addr(
unsigned int cpu_id,
u32 addr)
82 struct omap4_cpu_pm_info *pm_info = &
per_cpu(omap4_pm_info, cpu_id);
90 static inline void set_cpu_next_pwrst(
unsigned int cpu_id,
93 struct omap4_cpu_pm_info *pm_info = &
per_cpu(omap4_pm_info, cpu_id);
101 static inline unsigned int read_cpu_prev_pwrst(
unsigned int cpu_id)
103 struct omap4_cpu_pm_info *pm_info = &
per_cpu(omap4_pm_info, cpu_id);
111 static inline void clear_cpu_prev_pwrst(
unsigned int cpu_id)
113 struct omap4_cpu_pm_info *pm_info = &
per_cpu(omap4_pm_info, cpu_id);
121 static void scu_pwrst_prepare(
unsigned int cpu_id,
unsigned int cpu_state)
123 struct omap4_cpu_pm_info *pm_info = &
per_cpu(omap4_pm_info, cpu_id);
144 static inline void mpuss_clear_prev_logic_pwrst(
void)
154 static inline void cpu_clear_prev_logic_pwrst(
unsigned int cpu_id)
175 u32 omap4_mpuss_read_prev_context_state(
void)
188 static void l2x0_pwrst_prepare(
unsigned int cpu_id,
unsigned int save_state)
190 struct omap4_cpu_pm_info *pm_info = &
per_cpu(omap4_pm_info, cpu_id);
199 #ifdef CONFIG_CACHE_L2X0
200 static void save_l2x0_context(
void)
203 void __iomem *l2x0_base = omap4_get_l2cache_base();
211 static void save_l2x0_context(
void)
229 int omap4_enter_lowpower(
unsigned int cpu,
unsigned int power_state)
231 unsigned int save_state = 0;
232 unsigned int wakeup_cpu;
237 switch (power_state) {
263 mpuss_clear_prev_logic_pwrst();
268 cpu_clear_prev_logic_pwrst(cpu);
269 set_cpu_next_pwrst(cpu, power_state);
270 set_cpu_wakeup_addr(cpu,
virt_to_phys(omap4_cpu_resume));
271 scu_pwrst_prepare(cpu, power_state);
272 l2x0_pwrst_prepare(cpu, save_state);
299 int __cpuinit omap4_hotplug_cpu(
unsigned int cpu,
unsigned int power_state)
301 unsigned int cpu_state = 0;
309 clear_cpu_prev_pwrst(cpu);
310 set_cpu_next_pwrst(cpu, power_state);
311 set_cpu_wakeup_addr(cpu,
virt_to_phys(omap_secondary_startup));
312 scu_pwrst_prepare(cpu, power_state);
319 omap4_finish_suspend(cpu_state);
329 int __init omap4_mpuss_init(
void)
331 struct omap4_cpu_pm_info *pm_info;
334 WARN(1,
"Power Management not supported on OMAP4430 ES1.0\n");
341 pm_info = &
per_cpu(omap4_pm_info, 0x0);
346 if (!pm_info->pwrdm) {
347 pr_err(
"Lookup failed for CPU0 pwrdm\n");
353 cpu_clear_prev_logic_pwrst(0);
358 pm_info = &
per_cpu(omap4_pm_info, 0x1);
363 if (!pm_info->pwrdm) {
364 pr_err(
"Lookup failed for CPU1 pwrdm\n");
370 cpu_clear_prev_logic_pwrst(1);
377 pr_err(
"Failed to lookup MPUSS power domain\n");
381 mpuss_clear_prev_logic_pwrst();