2010-06-16 23:49:48 +07:00
|
|
|
/*
|
|
|
|
* OMAP MPUSS low power code
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Texas Instruments, Inc.
|
|
|
|
* Santosh Shilimkar <santosh.shilimkar@ti.com>
|
|
|
|
*
|
|
|
|
* OMAP4430 MPUSS mainly consists of dual Cortex-A9 with per-CPU
|
|
|
|
* Local timer and Watchdog, GIC, SCU, PL310 L2 cache controller,
|
|
|
|
* CPU0 and CPU1 LPRM modules.
|
|
|
|
* CPU0, CPU1 and MPUSS each have there own power domain and
|
|
|
|
* hence multiple low power combinations of MPUSS are possible.
|
|
|
|
*
|
|
|
|
* The CPU0 and CPU1 can't support Closed switch Retention (CSWR)
|
|
|
|
* because the mode is not supported by hw constraints of dormant
|
|
|
|
* mode. While waking up from the dormant mode, a reset signal
|
|
|
|
* to the Cortex-A9 processor must be asserted by the external
|
|
|
|
* power controller.
|
|
|
|
*
|
|
|
|
* With architectural inputs and hardware recommendations, only
|
|
|
|
* below modes are supported from power gain vs latency point of view.
|
|
|
|
*
|
|
|
|
* CPU0 CPU1 MPUSS
|
|
|
|
* ----------------------------------------------
|
|
|
|
* ON ON ON
|
|
|
|
* ON(Inactive) OFF ON(Inactive)
|
|
|
|
* OFF OFF CSWR
|
2011-06-06 16:03:29 +07:00
|
|
|
* OFF OFF OSWR
|
|
|
|
* OFF OFF OFF(Device OFF *TBD)
|
2010-06-16 23:49:48 +07:00
|
|
|
* ----------------------------------------------
|
|
|
|
*
|
|
|
|
* Note: CPU0 is the master core and it is the last CPU to go down
|
|
|
|
* and first to wake-up when MPUSS low power states are excercised
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/linkage.h>
|
|
|
|
#include <linux/smp.h>
|
|
|
|
|
|
|
|
#include <asm/cacheflush.h>
|
|
|
|
#include <asm/tlbflush.h>
|
|
|
|
#include <asm/smp_scu.h>
|
|
|
|
#include <asm/pgalloc.h>
|
|
|
|
#include <asm/suspend.h>
|
2011-01-09 04:29:09 +07:00
|
|
|
#include <asm/hardware/cache-l2x0.h>
|
2010-06-16 23:49:48 +07:00
|
|
|
|
2012-10-06 03:25:59 +07:00
|
|
|
#include "soc.h"
|
2010-06-16 23:49:48 +07:00
|
|
|
#include "common.h"
|
2012-09-01 06:08:07 +07:00
|
|
|
#include "omap44xx.h"
|
2010-06-16 23:49:48 +07:00
|
|
|
#include "omap4-sar-layout.h"
|
|
|
|
#include "pm.h"
|
2011-06-06 16:03:29 +07:00
|
|
|
#include "prcm_mpu44xx.h"
|
|
|
|
#include "prminst44xx.h"
|
|
|
|
#include "prcm44xx.h"
|
|
|
|
#include "prm44xx.h"
|
|
|
|
#include "prm-regbits-44xx.h"
|
2010-06-16 23:49:48 +07:00
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
|
|
|
|
struct omap4_cpu_pm_info {
|
|
|
|
struct powerdomain *pwrdm;
|
|
|
|
void __iomem *scu_sar_addr;
|
|
|
|
void __iomem *wkup_sar_addr;
|
2011-01-09 04:29:09 +07:00
|
|
|
void __iomem *l2x0_sar_addr;
|
ARM: OMAP4460: Workaround for ROM bug because of CA9 r2pX GIC control register change.
On OMAP4+ devices, GIC register context is lost when MPUSS hits
the OSWR(Open Switch Retention). On the CPU wakeup path, ROM code
gets executed and one of the steps in it is to restore the
saved context of the GIC. The ROM Code GIC distributor restoration
is split in two parts: CPU specific register done by each CPU and
common register done by only one CPU.
Below is the abstract flow.
...............................................................
- MPUSS in OSWR state.
- CPU0 wakes up on the event(interrupt) and start executing ROM code.
[..]
- CPU0 executes "GIC Restoration:"
[...]
- CPU0 swicthes to non-secure mode and jumps to OS resume code.
[...]
- CPU0 is online in OS
- CPU0 enables the GIC distributor. GICD.Enable Non-secure = 1
- CPU0 wakes up CPU1 with clock-domain force wakeup method.
- CPU0 continues it's execution.
[..]
- CPU1 wakes up and start executing ROM code.
[..]
- CPU1 executes "GIC Restoration:"
[..]
- CPU1 swicthes to non-secure mode and jumps to OS resume code.
[...]
- CPU1 is online in OS and start executing.
[...] -
GIC Restoration: /* Common routine for HS and GP devices */
{
if (GICD != 1) { /* This will be true in OSWR state */
if (GIC_SAR_BACKUP_STATE == SAVED)
- CPU restores GIC distributor
else
- reconfigure GIC distributor to boot values.
GICD.Enable secure = 1
}
if (GIC_SAR_BACKUP_STATE == SAVED)
- CPU restore its GIC CPU interface registers if saved.
else
- reconfigure its GIC CPU interface registers to boot
values.
}
...............................................................
So as mentioned in the flow, GICD != 1 condition decides how
the GIC registers are handled in ROM code wakeup path from
OSWR. As evident from the flow, ROM code relies on the entire
GICD register value and not specific register bits.
The assumption was valid till CortexA9 r1pX version since there
was only one banked bit to control secure and non-secure GICD.
Secure view which ROM code sees:
bit 0 == Enable Non-secure
Non-secure view which HLOS sees:
bit 0 == Enable secure
But GICD register has changed between CortexA9 r1pX and r2pX.
On r2pX GICD register is composed of 2 bits.
Secure view which ROM code sees:
bit 1 == Enable Non-secure
bit 0 == Enable secure
Non-secure view which HLOS sees:
bit 0 == Enable Non-secure
Hence on OMAP4460(r2pX) devices, if you go through the
above flow again during CPU1 wakeup, GICD == 3 and hence
ROM code fails to understand the real wakeup power state
and reconfigures GIC distributor to boot values. This is
nasty since you loose the entire interrupt controller
context in a live system.
The ROM code fix done on next OMAP4 device (OMAP4470 - r2px) is to
check "GICD.Enable secure != 1" for GIC restoration in OSWR wakeup path.
Since ROM code can't be fixed on OMAP4460 devices, a work around
needs to be implemented. As evident from the flow, as long as
CPU1 sees GICD == 1 in it's wakeup path from OSWR, the issue
won't happen. Below is the flow with the work-around.
...............................................................
- MPUSS in OSWR state.
- CPU0 wakes up on the event(interrupt) and start executing ROM code.
[..]
- CPU0 executes "GIC Restoration:"
[..]
- CPU0 swicthes to non-secure mode and jumps to OS resume code.
[..]
- CPU0 is online in OS.
- CPU0 does GICD.Enable Non-secure = 0
- CPU0 wakes up CPU1 with clock domain force wakeup method.
- CPU0 waits for GICD.Enable Non-secure = 1
- CPU0 coninues it's execution.
[..]
- CPU1 wakes up and start executing ROM code.
[..]
- CPU1 executes "GIC Restoration:"
[..]
- CPU1 swicthes to non-secure mode and jumps to OS resume code.
[..]
- CPU1 is online in OS
- CPU1 does GICD.Enable Non-secure = 1
- CPU1 start executing
[...]
...............................................................
With this procedure, the GIC configuration done between the
CPU0 wakeup and CPU1 wakeup will not be lost but during this
short windows, the CPU0 will not receive interrupts.
The BUG is applicable to only OMAP4460(r2pX) devices.
OMAP4470 (also r2pX) is not affected by this bug because
ROM code has been fixed.
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
2012-10-18 16:20:05 +07:00
|
|
|
void (*secondary_startup)(void);
|
2010-06-16 23:49:48 +07:00
|
|
|
};
|
|
|
|
|
2013-04-05 19:59:00 +07:00
|
|
|
/**
|
|
|
|
* struct cpu_pm_ops - CPU pm operations
|
|
|
|
* @finish_suspend: CPU suspend finisher function pointer
|
|
|
|
* @resume: CPU resume function pointer
|
|
|
|
* @scu_prepare: CPU Snoop Control program function pointer
|
|
|
|
*
|
|
|
|
* Structure holds functions pointer for CPU low power operations like
|
|
|
|
* suspend, resume and scu programming.
|
|
|
|
*/
|
|
|
|
struct cpu_pm_ops {
|
|
|
|
int (*finish_suspend)(unsigned long cpu_state);
|
|
|
|
void (*resume)(void);
|
|
|
|
void (*scu_prepare)(unsigned int cpu_id, unsigned int cpu_state);
|
|
|
|
};
|
|
|
|
|
2010-06-16 23:49:48 +07:00
|
|
|
static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info);
|
2010-06-16 23:49:49 +07:00
|
|
|
static struct powerdomain *mpuss_pd;
|
2011-01-09 04:29:09 +07:00
|
|
|
static void __iomem *sar_base;
|
2010-06-16 23:49:48 +07:00
|
|
|
|
2013-04-05 19:59:00 +07:00
|
|
|
static int default_finish_suspend(unsigned long cpu_state)
|
|
|
|
{
|
|
|
|
omap_do_wfi();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dummy_cpu_resume(void)
|
|
|
|
{}
|
|
|
|
|
|
|
|
static void dummy_scu_prepare(unsigned int cpu_id, unsigned int cpu_state)
|
|
|
|
{}
|
|
|
|
|
|
|
|
struct cpu_pm_ops omap_pm_ops = {
|
|
|
|
.finish_suspend = default_finish_suspend,
|
|
|
|
.resume = dummy_cpu_resume,
|
|
|
|
.scu_prepare = dummy_scu_prepare,
|
|
|
|
};
|
|
|
|
|
2010-06-16 23:49:48 +07:00
|
|
|
/*
|
|
|
|
* Program the wakeup routine address for the CPU0 and CPU1
|
|
|
|
* used for OFF or DORMANT wakeup.
|
|
|
|
*/
|
|
|
|
static inline void set_cpu_wakeup_addr(unsigned int cpu_id, u32 addr)
|
|
|
|
{
|
|
|
|
struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id);
|
|
|
|
|
2014-04-16 00:37:46 +07:00
|
|
|
writel_relaxed(addr, pm_info->wkup_sar_addr);
|
2010-06-16 23:49:48 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Store the SCU power status value to scratchpad memory
|
|
|
|
*/
|
|
|
|
static void scu_pwrst_prepare(unsigned int cpu_id, unsigned int cpu_state)
|
|
|
|
{
|
|
|
|
struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id);
|
|
|
|
u32 scu_pwr_st;
|
|
|
|
|
|
|
|
switch (cpu_state) {
|
|
|
|
case PWRDM_POWER_RET:
|
|
|
|
scu_pwr_st = SCU_PM_DORMANT;
|
|
|
|
break;
|
|
|
|
case PWRDM_POWER_OFF:
|
|
|
|
scu_pwr_st = SCU_PM_POWEROFF;
|
|
|
|
break;
|
|
|
|
case PWRDM_POWER_ON:
|
|
|
|
case PWRDM_POWER_INACTIVE:
|
|
|
|
default:
|
|
|
|
scu_pwr_st = SCU_PM_NORMAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-04-16 00:37:46 +07:00
|
|
|
writel_relaxed(scu_pwr_st, pm_info->scu_sar_addr);
|
2010-06-16 23:49:48 +07:00
|
|
|
}
|
|
|
|
|
2011-06-06 16:03:29 +07:00
|
|
|
/* Helper functions for MPUSS OSWR */
|
|
|
|
static inline void mpuss_clear_prev_logic_pwrst(void)
|
|
|
|
{
|
|
|
|
u32 reg;
|
|
|
|
|
|
|
|
reg = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
|
|
|
|
OMAP4430_PRM_MPU_INST, OMAP4_RM_MPU_MPU_CONTEXT_OFFSET);
|
|
|
|
omap4_prminst_write_inst_reg(reg, OMAP4430_PRM_PARTITION,
|
|
|
|
OMAP4430_PRM_MPU_INST, OMAP4_RM_MPU_MPU_CONTEXT_OFFSET);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void cpu_clear_prev_logic_pwrst(unsigned int cpu_id)
|
|
|
|
{
|
|
|
|
u32 reg;
|
|
|
|
|
|
|
|
if (cpu_id) {
|
|
|
|
reg = omap4_prcm_mpu_read_inst_reg(OMAP4430_PRCM_MPU_CPU1_INST,
|
|
|
|
OMAP4_RM_CPU1_CPU1_CONTEXT_OFFSET);
|
|
|
|
omap4_prcm_mpu_write_inst_reg(reg, OMAP4430_PRCM_MPU_CPU1_INST,
|
|
|
|
OMAP4_RM_CPU1_CPU1_CONTEXT_OFFSET);
|
|
|
|
} else {
|
|
|
|
reg = omap4_prcm_mpu_read_inst_reg(OMAP4430_PRCM_MPU_CPU0_INST,
|
|
|
|
OMAP4_RM_CPU0_CPU0_CONTEXT_OFFSET);
|
|
|
|
omap4_prcm_mpu_write_inst_reg(reg, OMAP4430_PRCM_MPU_CPU0_INST,
|
|
|
|
OMAP4_RM_CPU0_CPU0_CONTEXT_OFFSET);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-09 04:29:09 +07:00
|
|
|
/*
|
|
|
|
* Store the CPU cluster state for L2X0 low power operations.
|
|
|
|
*/
|
|
|
|
static void l2x0_pwrst_prepare(unsigned int cpu_id, unsigned int save_state)
|
|
|
|
{
|
|
|
|
struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id);
|
|
|
|
|
2014-04-16 00:37:46 +07:00
|
|
|
writel_relaxed(save_state, pm_info->l2x0_sar_addr);
|
2011-01-09 04:29:09 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Save the L2X0 AUXCTRL and POR value to SAR memory. Its used to
|
|
|
|
* in every restore MPUSS OFF path.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_CACHE_L2X0
|
2014-04-05 16:57:44 +07:00
|
|
|
static void __init save_l2x0_context(void)
|
2011-01-09 04:29:09 +07:00
|
|
|
{
|
2014-06-06 05:57:04 +07:00
|
|
|
writel_relaxed(l2x0_saved_regs.aux_ctrl,
|
2014-04-05 16:57:44 +07:00
|
|
|
sar_base + L2X0_AUXCTRL_OFFSET);
|
2014-06-06 05:57:04 +07:00
|
|
|
writel_relaxed(l2x0_saved_regs.prefetch_ctrl,
|
2014-04-05 16:57:44 +07:00
|
|
|
sar_base + L2X0_PREFETCH_CTRL_OFFSET);
|
2011-01-09 04:29:09 +07:00
|
|
|
}
|
|
|
|
#else
|
2014-04-05 16:57:44 +07:00
|
|
|
static void __init save_l2x0_context(void)
|
2011-01-09 04:29:09 +07:00
|
|
|
{}
|
|
|
|
#endif
|
|
|
|
|
2010-06-16 23:49:48 +07:00
|
|
|
/**
|
|
|
|
* omap4_enter_lowpower: OMAP4 MPUSS Low Power Entry Function
|
|
|
|
* The purpose of this function is to manage low power programming
|
|
|
|
* of OMAP4 MPUSS subsystem
|
|
|
|
* @cpu : CPU ID
|
|
|
|
* @power_state: Low power state.
|
2010-06-16 23:49:49 +07:00
|
|
|
*
|
|
|
|
* MPUSS states for the context save:
|
|
|
|
* save_state =
|
|
|
|
* 0 - Nothing lost and no need to save: MPUSS INACTIVE
|
|
|
|
* 1 - CPUx L1 and logic lost: MPUSS CSWR
|
|
|
|
* 2 - CPUx L1 and logic lost + GIC lost: MPUSS OSWR
|
|
|
|
* 3 - CPUx L1 and logic lost + GIC + L2 lost: DEVICE OFF
|
2010-06-16 23:49:48 +07:00
|
|
|
*/
|
|
|
|
int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
|
|
|
|
{
|
2013-01-26 14:58:13 +07:00
|
|
|
struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu);
|
2010-06-16 23:49:48 +07:00
|
|
|
unsigned int save_state = 0;
|
|
|
|
unsigned int wakeup_cpu;
|
|
|
|
|
|
|
|
if (omap_rev() == OMAP4430_REV_ES1_0)
|
|
|
|
return -ENXIO;
|
|
|
|
|
|
|
|
switch (power_state) {
|
|
|
|
case PWRDM_POWER_ON:
|
|
|
|
case PWRDM_POWER_INACTIVE:
|
|
|
|
save_state = 0;
|
|
|
|
break;
|
|
|
|
case PWRDM_POWER_OFF:
|
|
|
|
save_state = 1;
|
|
|
|
break;
|
|
|
|
case PWRDM_POWER_RET:
|
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* CPUx CSWR is invalid hardware state. Also CPUx OSWR
|
|
|
|
* doesn't make much scense, since logic is lost and $L1
|
|
|
|
* needs to be cleaned because of coherency. This makes
|
|
|
|
* CPUx OSWR equivalent to CPUX OFF and hence not supported
|
|
|
|
*/
|
|
|
|
WARN_ON(1);
|
|
|
|
return -ENXIO;
|
|
|
|
}
|
|
|
|
|
2012-05-12 06:00:24 +07:00
|
|
|
pwrdm_pre_transition(NULL);
|
2011-01-10 02:32:15 +07:00
|
|
|
|
2011-06-06 16:03:29 +07:00
|
|
|
/*
|
|
|
|
* Check MPUSS next state and save interrupt controller if needed.
|
|
|
|
* In MPUSS OSWR or device OFF, interrupt controller contest is lost.
|
|
|
|
*/
|
|
|
|
mpuss_clear_prev_logic_pwrst();
|
|
|
|
if ((pwrdm_read_next_pwrst(mpuss_pd) == PWRDM_POWER_RET) &&
|
|
|
|
(pwrdm_read_logic_retst(mpuss_pd) == PWRDM_POWER_OFF))
|
|
|
|
save_state = 2;
|
|
|
|
|
|
|
|
cpu_clear_prev_logic_pwrst(cpu);
|
2013-01-26 14:58:13 +07:00
|
|
|
pwrdm_set_next_pwrst(pm_info->pwrdm, power_state);
|
2013-04-05 19:59:00 +07:00
|
|
|
set_cpu_wakeup_addr(cpu, virt_to_phys(omap_pm_ops.resume));
|
|
|
|
omap_pm_ops.scu_prepare(cpu, power_state);
|
2011-01-09 04:29:09 +07:00
|
|
|
l2x0_pwrst_prepare(cpu, save_state);
|
2010-06-16 23:49:48 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Call low level function with targeted low power state.
|
|
|
|
*/
|
2013-02-13 15:55:24 +07:00
|
|
|
if (save_state)
|
2013-04-05 19:59:00 +07:00
|
|
|
cpu_suspend(save_state, omap_pm_ops.finish_suspend);
|
2013-02-13 15:55:24 +07:00
|
|
|
else
|
2013-04-05 19:59:00 +07:00
|
|
|
omap_pm_ops.finish_suspend(save_state);
|
2010-06-16 23:49:48 +07:00
|
|
|
|
2013-10-23 02:07:15 +07:00
|
|
|
if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD) && cpu)
|
|
|
|
gic_dist_enable();
|
|
|
|
|
2010-06-16 23:49:48 +07:00
|
|
|
/*
|
|
|
|
* Restore the CPUx power state to ON otherwise CPUx
|
|
|
|
* power domain can transitions to programmed low power
|
|
|
|
* state while doing WFI outside the low powe code. On
|
|
|
|
* secure devices, CPUx does WFI which can result in
|
|
|
|
* domain transition
|
|
|
|
*/
|
|
|
|
wakeup_cpu = smp_processor_id();
|
2013-01-26 14:58:13 +07:00
|
|
|
pwrdm_set_next_pwrst(pm_info->pwrdm, PWRDM_POWER_ON);
|
2010-06-16 23:49:48 +07:00
|
|
|
|
2012-05-12 06:00:24 +07:00
|
|
|
pwrdm_post_transition(NULL);
|
2011-01-10 02:32:15 +07:00
|
|
|
|
2010-06-16 23:49:48 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-06-16 23:49:48 +07:00
|
|
|
/**
|
|
|
|
* omap4_hotplug_cpu: OMAP4 CPU hotplug entry
|
|
|
|
* @cpu : CPU ID
|
|
|
|
* @power_state: CPU low power state.
|
|
|
|
*/
|
2013-06-18 02:43:14 +07:00
|
|
|
int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
|
2010-06-16 23:49:48 +07:00
|
|
|
{
|
ARM: OMAP4460: Workaround for ROM bug because of CA9 r2pX GIC control register change.
On OMAP4+ devices, GIC register context is lost when MPUSS hits
the OSWR(Open Switch Retention). On the CPU wakeup path, ROM code
gets executed and one of the steps in it is to restore the
saved context of the GIC. The ROM Code GIC distributor restoration
is split in two parts: CPU specific register done by each CPU and
common register done by only one CPU.
Below is the abstract flow.
...............................................................
- MPUSS in OSWR state.
- CPU0 wakes up on the event(interrupt) and start executing ROM code.
[..]
- CPU0 executes "GIC Restoration:"
[...]
- CPU0 swicthes to non-secure mode and jumps to OS resume code.
[...]
- CPU0 is online in OS
- CPU0 enables the GIC distributor. GICD.Enable Non-secure = 1
- CPU0 wakes up CPU1 with clock-domain force wakeup method.
- CPU0 continues it's execution.
[..]
- CPU1 wakes up and start executing ROM code.
[..]
- CPU1 executes "GIC Restoration:"
[..]
- CPU1 swicthes to non-secure mode and jumps to OS resume code.
[...]
- CPU1 is online in OS and start executing.
[...] -
GIC Restoration: /* Common routine for HS and GP devices */
{
if (GICD != 1) { /* This will be true in OSWR state */
if (GIC_SAR_BACKUP_STATE == SAVED)
- CPU restores GIC distributor
else
- reconfigure GIC distributor to boot values.
GICD.Enable secure = 1
}
if (GIC_SAR_BACKUP_STATE == SAVED)
- CPU restore its GIC CPU interface registers if saved.
else
- reconfigure its GIC CPU interface registers to boot
values.
}
...............................................................
So as mentioned in the flow, GICD != 1 condition decides how
the GIC registers are handled in ROM code wakeup path from
OSWR. As evident from the flow, ROM code relies on the entire
GICD register value and not specific register bits.
The assumption was valid till CortexA9 r1pX version since there
was only one banked bit to control secure and non-secure GICD.
Secure view which ROM code sees:
bit 0 == Enable Non-secure
Non-secure view which HLOS sees:
bit 0 == Enable secure
But GICD register has changed between CortexA9 r1pX and r2pX.
On r2pX GICD register is composed of 2 bits.
Secure view which ROM code sees:
bit 1 == Enable Non-secure
bit 0 == Enable secure
Non-secure view which HLOS sees:
bit 0 == Enable Non-secure
Hence on OMAP4460(r2pX) devices, if you go through the
above flow again during CPU1 wakeup, GICD == 3 and hence
ROM code fails to understand the real wakeup power state
and reconfigures GIC distributor to boot values. This is
nasty since you loose the entire interrupt controller
context in a live system.
The ROM code fix done on next OMAP4 device (OMAP4470 - r2px) is to
check "GICD.Enable secure != 1" for GIC restoration in OSWR wakeup path.
Since ROM code can't be fixed on OMAP4460 devices, a work around
needs to be implemented. As evident from the flow, as long as
CPU1 sees GICD == 1 in it's wakeup path from OSWR, the issue
won't happen. Below is the flow with the work-around.
...............................................................
- MPUSS in OSWR state.
- CPU0 wakes up on the event(interrupt) and start executing ROM code.
[..]
- CPU0 executes "GIC Restoration:"
[..]
- CPU0 swicthes to non-secure mode and jumps to OS resume code.
[..]
- CPU0 is online in OS.
- CPU0 does GICD.Enable Non-secure = 0
- CPU0 wakes up CPU1 with clock domain force wakeup method.
- CPU0 waits for GICD.Enable Non-secure = 1
- CPU0 coninues it's execution.
[..]
- CPU1 wakes up and start executing ROM code.
[..]
- CPU1 executes "GIC Restoration:"
[..]
- CPU1 swicthes to non-secure mode and jumps to OS resume code.
[..]
- CPU1 is online in OS
- CPU1 does GICD.Enable Non-secure = 1
- CPU1 start executing
[...]
...............................................................
With this procedure, the GIC configuration done between the
CPU0 wakeup and CPU1 wakeup will not be lost but during this
short windows, the CPU0 will not receive interrupts.
The BUG is applicable to only OMAP4460(r2pX) devices.
OMAP4470 (also r2pX) is not affected by this bug because
ROM code has been fixed.
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
2012-10-18 16:20:05 +07:00
|
|
|
struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu);
|
2013-01-26 14:58:13 +07:00
|
|
|
unsigned int cpu_state = 0;
|
2010-06-16 23:49:48 +07:00
|
|
|
|
|
|
|
if (omap_rev() == OMAP4430_REV_ES1_0)
|
|
|
|
return -ENXIO;
|
|
|
|
|
|
|
|
if (power_state == PWRDM_POWER_OFF)
|
|
|
|
cpu_state = 1;
|
|
|
|
|
2013-01-26 14:58:13 +07:00
|
|
|
pwrdm_clear_all_prev_pwrst(pm_info->pwrdm);
|
|
|
|
pwrdm_set_next_pwrst(pm_info->pwrdm, power_state);
|
ARM: OMAP4460: Workaround for ROM bug because of CA9 r2pX GIC control register change.
On OMAP4+ devices, GIC register context is lost when MPUSS hits
the OSWR(Open Switch Retention). On the CPU wakeup path, ROM code
gets executed and one of the steps in it is to restore the
saved context of the GIC. The ROM Code GIC distributor restoration
is split in two parts: CPU specific register done by each CPU and
common register done by only one CPU.
Below is the abstract flow.
...............................................................
- MPUSS in OSWR state.
- CPU0 wakes up on the event(interrupt) and start executing ROM code.
[..]
- CPU0 executes "GIC Restoration:"
[...]
- CPU0 swicthes to non-secure mode and jumps to OS resume code.
[...]
- CPU0 is online in OS
- CPU0 enables the GIC distributor. GICD.Enable Non-secure = 1
- CPU0 wakes up CPU1 with clock-domain force wakeup method.
- CPU0 continues it's execution.
[..]
- CPU1 wakes up and start executing ROM code.
[..]
- CPU1 executes "GIC Restoration:"
[..]
- CPU1 swicthes to non-secure mode and jumps to OS resume code.
[...]
- CPU1 is online in OS and start executing.
[...] -
GIC Restoration: /* Common routine for HS and GP devices */
{
if (GICD != 1) { /* This will be true in OSWR state */
if (GIC_SAR_BACKUP_STATE == SAVED)
- CPU restores GIC distributor
else
- reconfigure GIC distributor to boot values.
GICD.Enable secure = 1
}
if (GIC_SAR_BACKUP_STATE == SAVED)
- CPU restore its GIC CPU interface registers if saved.
else
- reconfigure its GIC CPU interface registers to boot
values.
}
...............................................................
So as mentioned in the flow, GICD != 1 condition decides how
the GIC registers are handled in ROM code wakeup path from
OSWR. As evident from the flow, ROM code relies on the entire
GICD register value and not specific register bits.
The assumption was valid till CortexA9 r1pX version since there
was only one banked bit to control secure and non-secure GICD.
Secure view which ROM code sees:
bit 0 == Enable Non-secure
Non-secure view which HLOS sees:
bit 0 == Enable secure
But GICD register has changed between CortexA9 r1pX and r2pX.
On r2pX GICD register is composed of 2 bits.
Secure view which ROM code sees:
bit 1 == Enable Non-secure
bit 0 == Enable secure
Non-secure view which HLOS sees:
bit 0 == Enable Non-secure
Hence on OMAP4460(r2pX) devices, if you go through the
above flow again during CPU1 wakeup, GICD == 3 and hence
ROM code fails to understand the real wakeup power state
and reconfigures GIC distributor to boot values. This is
nasty since you loose the entire interrupt controller
context in a live system.
The ROM code fix done on next OMAP4 device (OMAP4470 - r2px) is to
check "GICD.Enable secure != 1" for GIC restoration in OSWR wakeup path.
Since ROM code can't be fixed on OMAP4460 devices, a work around
needs to be implemented. As evident from the flow, as long as
CPU1 sees GICD == 1 in it's wakeup path from OSWR, the issue
won't happen. Below is the flow with the work-around.
...............................................................
- MPUSS in OSWR state.
- CPU0 wakes up on the event(interrupt) and start executing ROM code.
[..]
- CPU0 executes "GIC Restoration:"
[..]
- CPU0 swicthes to non-secure mode and jumps to OS resume code.
[..]
- CPU0 is online in OS.
- CPU0 does GICD.Enable Non-secure = 0
- CPU0 wakes up CPU1 with clock domain force wakeup method.
- CPU0 waits for GICD.Enable Non-secure = 1
- CPU0 coninues it's execution.
[..]
- CPU1 wakes up and start executing ROM code.
[..]
- CPU1 executes "GIC Restoration:"
[..]
- CPU1 swicthes to non-secure mode and jumps to OS resume code.
[..]
- CPU1 is online in OS
- CPU1 does GICD.Enable Non-secure = 1
- CPU1 start executing
[...]
...............................................................
With this procedure, the GIC configuration done between the
CPU0 wakeup and CPU1 wakeup will not be lost but during this
short windows, the CPU0 will not receive interrupts.
The BUG is applicable to only OMAP4460(r2pX) devices.
OMAP4470 (also r2pX) is not affected by this bug because
ROM code has been fixed.
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
2012-10-18 16:20:05 +07:00
|
|
|
set_cpu_wakeup_addr(cpu, virt_to_phys(pm_info->secondary_startup));
|
2013-04-05 19:59:00 +07:00
|
|
|
omap_pm_ops.scu_prepare(cpu, power_state);
|
2010-06-16 23:49:48 +07:00
|
|
|
|
|
|
|
/*
|
2012-07-11 22:56:57 +07:00
|
|
|
* CPU never retuns back if targeted power state is OFF mode.
|
2010-06-16 23:49:48 +07:00
|
|
|
* CPU ONLINE follows normal CPU ONLINE ptah via
|
2013-04-05 19:59:02 +07:00
|
|
|
* omap4_secondary_startup().
|
2010-06-16 23:49:48 +07:00
|
|
|
*/
|
2013-04-05 19:59:00 +07:00
|
|
|
omap_pm_ops.finish_suspend(cpu_state);
|
2010-06-16 23:49:48 +07:00
|
|
|
|
2013-01-26 14:58:13 +07:00
|
|
|
pwrdm_set_next_pwrst(pm_info->pwrdm, PWRDM_POWER_ON);
|
2010-06-16 23:49:48 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-16 23:49:48 +07:00
|
|
|
/*
|
|
|
|
* Initialise OMAP4 MPUSS
|
|
|
|
*/
|
|
|
|
int __init omap4_mpuss_init(void)
|
|
|
|
{
|
|
|
|
struct omap4_cpu_pm_info *pm_info;
|
|
|
|
|
|
|
|
if (omap_rev() == OMAP4430_REV_ES1_0) {
|
|
|
|
WARN(1, "Power Management not supported on OMAP4430 ES1.0\n");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2011-01-09 04:29:09 +07:00
|
|
|
sar_base = omap4_get_sar_ram_base();
|
|
|
|
|
2010-06-16 23:49:48 +07:00
|
|
|
/* Initilaise per CPU PM information */
|
|
|
|
pm_info = &per_cpu(omap4_pm_info, 0x0);
|
|
|
|
pm_info->scu_sar_addr = sar_base + SCU_OFFSET0;
|
|
|
|
pm_info->wkup_sar_addr = sar_base + CPU0_WAKEUP_NS_PA_ADDR_OFFSET;
|
2011-01-09 04:29:09 +07:00
|
|
|
pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET0;
|
2010-06-16 23:49:48 +07:00
|
|
|
pm_info->pwrdm = pwrdm_lookup("cpu0_pwrdm");
|
|
|
|
if (!pm_info->pwrdm) {
|
|
|
|
pr_err("Lookup failed for CPU0 pwrdm\n");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear CPU previous power domain state */
|
|
|
|
pwrdm_clear_all_prev_pwrst(pm_info->pwrdm);
|
2011-06-06 16:03:29 +07:00
|
|
|
cpu_clear_prev_logic_pwrst(0);
|
2010-06-16 23:49:48 +07:00
|
|
|
|
|
|
|
/* Initialise CPU0 power domain state to ON */
|
|
|
|
pwrdm_set_next_pwrst(pm_info->pwrdm, PWRDM_POWER_ON);
|
|
|
|
|
|
|
|
pm_info = &per_cpu(omap4_pm_info, 0x1);
|
|
|
|
pm_info->scu_sar_addr = sar_base + SCU_OFFSET1;
|
|
|
|
pm_info->wkup_sar_addr = sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET;
|
2011-01-09 04:29:09 +07:00
|
|
|
pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1;
|
ARM: OMAP4460: Workaround for ROM bug because of CA9 r2pX GIC control register change.
On OMAP4+ devices, GIC register context is lost when MPUSS hits
the OSWR(Open Switch Retention). On the CPU wakeup path, ROM code
gets executed and one of the steps in it is to restore the
saved context of the GIC. The ROM Code GIC distributor restoration
is split in two parts: CPU specific register done by each CPU and
common register done by only one CPU.
Below is the abstract flow.
...............................................................
- MPUSS in OSWR state.
- CPU0 wakes up on the event(interrupt) and start executing ROM code.
[..]
- CPU0 executes "GIC Restoration:"
[...]
- CPU0 swicthes to non-secure mode and jumps to OS resume code.
[...]
- CPU0 is online in OS
- CPU0 enables the GIC distributor. GICD.Enable Non-secure = 1
- CPU0 wakes up CPU1 with clock-domain force wakeup method.
- CPU0 continues it's execution.
[..]
- CPU1 wakes up and start executing ROM code.
[..]
- CPU1 executes "GIC Restoration:"
[..]
- CPU1 swicthes to non-secure mode and jumps to OS resume code.
[...]
- CPU1 is online in OS and start executing.
[...] -
GIC Restoration: /* Common routine for HS and GP devices */
{
if (GICD != 1) { /* This will be true in OSWR state */
if (GIC_SAR_BACKUP_STATE == SAVED)
- CPU restores GIC distributor
else
- reconfigure GIC distributor to boot values.
GICD.Enable secure = 1
}
if (GIC_SAR_BACKUP_STATE == SAVED)
- CPU restore its GIC CPU interface registers if saved.
else
- reconfigure its GIC CPU interface registers to boot
values.
}
...............................................................
So as mentioned in the flow, GICD != 1 condition decides how
the GIC registers are handled in ROM code wakeup path from
OSWR. As evident from the flow, ROM code relies on the entire
GICD register value and not specific register bits.
The assumption was valid till CortexA9 r1pX version since there
was only one banked bit to control secure and non-secure GICD.
Secure view which ROM code sees:
bit 0 == Enable Non-secure
Non-secure view which HLOS sees:
bit 0 == Enable secure
But GICD register has changed between CortexA9 r1pX and r2pX.
On r2pX GICD register is composed of 2 bits.
Secure view which ROM code sees:
bit 1 == Enable Non-secure
bit 0 == Enable secure
Non-secure view which HLOS sees:
bit 0 == Enable Non-secure
Hence on OMAP4460(r2pX) devices, if you go through the
above flow again during CPU1 wakeup, GICD == 3 and hence
ROM code fails to understand the real wakeup power state
and reconfigures GIC distributor to boot values. This is
nasty since you loose the entire interrupt controller
context in a live system.
The ROM code fix done on next OMAP4 device (OMAP4470 - r2px) is to
check "GICD.Enable secure != 1" for GIC restoration in OSWR wakeup path.
Since ROM code can't be fixed on OMAP4460 devices, a work around
needs to be implemented. As evident from the flow, as long as
CPU1 sees GICD == 1 in it's wakeup path from OSWR, the issue
won't happen. Below is the flow with the work-around.
...............................................................
- MPUSS in OSWR state.
- CPU0 wakes up on the event(interrupt) and start executing ROM code.
[..]
- CPU0 executes "GIC Restoration:"
[..]
- CPU0 swicthes to non-secure mode and jumps to OS resume code.
[..]
- CPU0 is online in OS.
- CPU0 does GICD.Enable Non-secure = 0
- CPU0 wakes up CPU1 with clock domain force wakeup method.
- CPU0 waits for GICD.Enable Non-secure = 1
- CPU0 coninues it's execution.
[..]
- CPU1 wakes up and start executing ROM code.
[..]
- CPU1 executes "GIC Restoration:"
[..]
- CPU1 swicthes to non-secure mode and jumps to OS resume code.
[..]
- CPU1 is online in OS
- CPU1 does GICD.Enable Non-secure = 1
- CPU1 start executing
[...]
...............................................................
With this procedure, the GIC configuration done between the
CPU0 wakeup and CPU1 wakeup will not be lost but during this
short windows, the CPU0 will not receive interrupts.
The BUG is applicable to only OMAP4460(r2pX) devices.
OMAP4470 (also r2pX) is not affected by this bug because
ROM code has been fixed.
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
2012-10-18 16:20:05 +07:00
|
|
|
if (cpu_is_omap446x())
|
2013-04-05 19:59:02 +07:00
|
|
|
pm_info->secondary_startup = omap4460_secondary_startup;
|
ARM: OMAP4460: Workaround for ROM bug because of CA9 r2pX GIC control register change.
On OMAP4+ devices, GIC register context is lost when MPUSS hits
the OSWR(Open Switch Retention). On the CPU wakeup path, ROM code
gets executed and one of the steps in it is to restore the
saved context of the GIC. The ROM Code GIC distributor restoration
is split in two parts: CPU specific register done by each CPU and
common register done by only one CPU.
Below is the abstract flow.
...............................................................
- MPUSS in OSWR state.
- CPU0 wakes up on the event(interrupt) and start executing ROM code.
[..]
- CPU0 executes "GIC Restoration:"
[...]
- CPU0 swicthes to non-secure mode and jumps to OS resume code.
[...]
- CPU0 is online in OS
- CPU0 enables the GIC distributor. GICD.Enable Non-secure = 1
- CPU0 wakes up CPU1 with clock-domain force wakeup method.
- CPU0 continues it's execution.
[..]
- CPU1 wakes up and start executing ROM code.
[..]
- CPU1 executes "GIC Restoration:"
[..]
- CPU1 swicthes to non-secure mode and jumps to OS resume code.
[...]
- CPU1 is online in OS and start executing.
[...] -
GIC Restoration: /* Common routine for HS and GP devices */
{
if (GICD != 1) { /* This will be true in OSWR state */
if (GIC_SAR_BACKUP_STATE == SAVED)
- CPU restores GIC distributor
else
- reconfigure GIC distributor to boot values.
GICD.Enable secure = 1
}
if (GIC_SAR_BACKUP_STATE == SAVED)
- CPU restore its GIC CPU interface registers if saved.
else
- reconfigure its GIC CPU interface registers to boot
values.
}
...............................................................
So as mentioned in the flow, GICD != 1 condition decides how
the GIC registers are handled in ROM code wakeup path from
OSWR. As evident from the flow, ROM code relies on the entire
GICD register value and not specific register bits.
The assumption was valid till CortexA9 r1pX version since there
was only one banked bit to control secure and non-secure GICD.
Secure view which ROM code sees:
bit 0 == Enable Non-secure
Non-secure view which HLOS sees:
bit 0 == Enable secure
But GICD register has changed between CortexA9 r1pX and r2pX.
On r2pX GICD register is composed of 2 bits.
Secure view which ROM code sees:
bit 1 == Enable Non-secure
bit 0 == Enable secure
Non-secure view which HLOS sees:
bit 0 == Enable Non-secure
Hence on OMAP4460(r2pX) devices, if you go through the
above flow again during CPU1 wakeup, GICD == 3 and hence
ROM code fails to understand the real wakeup power state
and reconfigures GIC distributor to boot values. This is
nasty since you loose the entire interrupt controller
context in a live system.
The ROM code fix done on next OMAP4 device (OMAP4470 - r2px) is to
check "GICD.Enable secure != 1" for GIC restoration in OSWR wakeup path.
Since ROM code can't be fixed on OMAP4460 devices, a work around
needs to be implemented. As evident from the flow, as long as
CPU1 sees GICD == 1 in it's wakeup path from OSWR, the issue
won't happen. Below is the flow with the work-around.
...............................................................
- MPUSS in OSWR state.
- CPU0 wakes up on the event(interrupt) and start executing ROM code.
[..]
- CPU0 executes "GIC Restoration:"
[..]
- CPU0 swicthes to non-secure mode and jumps to OS resume code.
[..]
- CPU0 is online in OS.
- CPU0 does GICD.Enable Non-secure = 0
- CPU0 wakes up CPU1 with clock domain force wakeup method.
- CPU0 waits for GICD.Enable Non-secure = 1
- CPU0 coninues it's execution.
[..]
- CPU1 wakes up and start executing ROM code.
[..]
- CPU1 executes "GIC Restoration:"
[..]
- CPU1 swicthes to non-secure mode and jumps to OS resume code.
[..]
- CPU1 is online in OS
- CPU1 does GICD.Enable Non-secure = 1
- CPU1 start executing
[...]
...............................................................
With this procedure, the GIC configuration done between the
CPU0 wakeup and CPU1 wakeup will not be lost but during this
short windows, the CPU0 will not receive interrupts.
The BUG is applicable to only OMAP4460(r2pX) devices.
OMAP4470 (also r2pX) is not affected by this bug because
ROM code has been fixed.
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
2012-10-18 16:20:05 +07:00
|
|
|
else
|
2013-04-05 19:59:02 +07:00
|
|
|
pm_info->secondary_startup = omap4_secondary_startup;
|
ARM: OMAP4460: Workaround for ROM bug because of CA9 r2pX GIC control register change.
On OMAP4+ devices, GIC register context is lost when MPUSS hits
the OSWR(Open Switch Retention). On the CPU wakeup path, ROM code
gets executed and one of the steps in it is to restore the
saved context of the GIC. The ROM Code GIC distributor restoration
is split in two parts: CPU specific register done by each CPU and
common register done by only one CPU.
Below is the abstract flow.
...............................................................
- MPUSS in OSWR state.
- CPU0 wakes up on the event(interrupt) and start executing ROM code.
[..]
- CPU0 executes "GIC Restoration:"
[...]
- CPU0 swicthes to non-secure mode and jumps to OS resume code.
[...]
- CPU0 is online in OS
- CPU0 enables the GIC distributor. GICD.Enable Non-secure = 1
- CPU0 wakes up CPU1 with clock-domain force wakeup method.
- CPU0 continues it's execution.
[..]
- CPU1 wakes up and start executing ROM code.
[..]
- CPU1 executes "GIC Restoration:"
[..]
- CPU1 swicthes to non-secure mode and jumps to OS resume code.
[...]
- CPU1 is online in OS and start executing.
[...] -
GIC Restoration: /* Common routine for HS and GP devices */
{
if (GICD != 1) { /* This will be true in OSWR state */
if (GIC_SAR_BACKUP_STATE == SAVED)
- CPU restores GIC distributor
else
- reconfigure GIC distributor to boot values.
GICD.Enable secure = 1
}
if (GIC_SAR_BACKUP_STATE == SAVED)
- CPU restore its GIC CPU interface registers if saved.
else
- reconfigure its GIC CPU interface registers to boot
values.
}
...............................................................
So as mentioned in the flow, GICD != 1 condition decides how
the GIC registers are handled in ROM code wakeup path from
OSWR. As evident from the flow, ROM code relies on the entire
GICD register value and not specific register bits.
The assumption was valid till CortexA9 r1pX version since there
was only one banked bit to control secure and non-secure GICD.
Secure view which ROM code sees:
bit 0 == Enable Non-secure
Non-secure view which HLOS sees:
bit 0 == Enable secure
But GICD register has changed between CortexA9 r1pX and r2pX.
On r2pX GICD register is composed of 2 bits.
Secure view which ROM code sees:
bit 1 == Enable Non-secure
bit 0 == Enable secure
Non-secure view which HLOS sees:
bit 0 == Enable Non-secure
Hence on OMAP4460(r2pX) devices, if you go through the
above flow again during CPU1 wakeup, GICD == 3 and hence
ROM code fails to understand the real wakeup power state
and reconfigures GIC distributor to boot values. This is
nasty since you loose the entire interrupt controller
context in a live system.
The ROM code fix done on next OMAP4 device (OMAP4470 - r2px) is to
check "GICD.Enable secure != 1" for GIC restoration in OSWR wakeup path.
Since ROM code can't be fixed on OMAP4460 devices, a work around
needs to be implemented. As evident from the flow, as long as
CPU1 sees GICD == 1 in it's wakeup path from OSWR, the issue
won't happen. Below is the flow with the work-around.
...............................................................
- MPUSS in OSWR state.
- CPU0 wakes up on the event(interrupt) and start executing ROM code.
[..]
- CPU0 executes "GIC Restoration:"
[..]
- CPU0 swicthes to non-secure mode and jumps to OS resume code.
[..]
- CPU0 is online in OS.
- CPU0 does GICD.Enable Non-secure = 0
- CPU0 wakes up CPU1 with clock domain force wakeup method.
- CPU0 waits for GICD.Enable Non-secure = 1
- CPU0 coninues it's execution.
[..]
- CPU1 wakes up and start executing ROM code.
[..]
- CPU1 executes "GIC Restoration:"
[..]
- CPU1 swicthes to non-secure mode and jumps to OS resume code.
[..]
- CPU1 is online in OS
- CPU1 does GICD.Enable Non-secure = 1
- CPU1 start executing
[...]
...............................................................
With this procedure, the GIC configuration done between the
CPU0 wakeup and CPU1 wakeup will not be lost but during this
short windows, the CPU0 will not receive interrupts.
The BUG is applicable to only OMAP4460(r2pX) devices.
OMAP4470 (also r2pX) is not affected by this bug because
ROM code has been fixed.
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
2012-10-18 16:20:05 +07:00
|
|
|
|
2010-06-16 23:49:48 +07:00
|
|
|
pm_info->pwrdm = pwrdm_lookup("cpu1_pwrdm");
|
|
|
|
if (!pm_info->pwrdm) {
|
|
|
|
pr_err("Lookup failed for CPU1 pwrdm\n");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear CPU previous power domain state */
|
|
|
|
pwrdm_clear_all_prev_pwrst(pm_info->pwrdm);
|
2011-06-06 16:03:29 +07:00
|
|
|
cpu_clear_prev_logic_pwrst(1);
|
2010-06-16 23:49:48 +07:00
|
|
|
|
|
|
|
/* Initialise CPU1 power domain state to ON */
|
|
|
|
pwrdm_set_next_pwrst(pm_info->pwrdm, PWRDM_POWER_ON);
|
|
|
|
|
2010-06-16 23:49:49 +07:00
|
|
|
mpuss_pd = pwrdm_lookup("mpu_pwrdm");
|
|
|
|
if (!mpuss_pd) {
|
|
|
|
pr_err("Failed to lookup MPUSS power domain\n");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
pwrdm_clear_all_prev_pwrst(mpuss_pd);
|
2011-06-06 16:03:29 +07:00
|
|
|
mpuss_clear_prev_logic_pwrst();
|
2010-06-16 23:49:49 +07:00
|
|
|
|
2010-06-16 23:49:48 +07:00
|
|
|
/* Save device type on scratchpad for low level code to use */
|
|
|
|
if (omap_type() != OMAP2_DEVICE_TYPE_GP)
|
2014-04-16 00:37:46 +07:00
|
|
|
writel_relaxed(1, sar_base + OMAP_TYPE_OFFSET);
|
2010-06-16 23:49:48 +07:00
|
|
|
else
|
2014-04-16 00:37:46 +07:00
|
|
|
writel_relaxed(0, sar_base + OMAP_TYPE_OFFSET);
|
2010-06-16 23:49:48 +07:00
|
|
|
|
2011-01-09 04:29:09 +07:00
|
|
|
save_l2x0_context();
|
|
|
|
|
2013-04-05 19:59:00 +07:00
|
|
|
if (cpu_is_omap44xx()) {
|
|
|
|
omap_pm_ops.finish_suspend = omap4_finish_suspend;
|
|
|
|
omap_pm_ops.resume = omap4_cpu_resume;
|
|
|
|
omap_pm_ops.scu_prepare = scu_pwrst_prepare;
|
|
|
|
}
|
|
|
|
|
2010-06-16 23:49:48 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|