aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap-mpuss-lowpower.c
diff options
context:
space:
mode:
authorSantosh Shilimkar <santosh.shilimkar@ti.com>2012-10-18 05:20:05 -0400
committerKevin Hilman <khilman@ti.com>2012-11-05 17:26:43 -0500
commitff999b8a0983ee15668394ed49e38d3568fc6859 (patch)
tree50f37fcc78c8772438e72bd3336417f00ae8fe95 /arch/arm/mach-omap2/omap-mpuss-lowpower.c
parentc962184459ab75502b242efb04291c2cf8700bc3 (diff)
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>
Diffstat (limited to 'arch/arm/mach-omap2/omap-mpuss-lowpower.c')
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index ff4e6a0e9c7c..c8bc3ad85f68 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -67,6 +67,7 @@ struct omap4_cpu_pm_info {
67 void __iomem *scu_sar_addr; 67 void __iomem *scu_sar_addr;
68 void __iomem *wkup_sar_addr; 68 void __iomem *wkup_sar_addr;
69 void __iomem *l2x0_sar_addr; 69 void __iomem *l2x0_sar_addr;
70 void (*secondary_startup)(void);
70}; 71};
71 72
72static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info); 73static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info);
@@ -299,6 +300,7 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
299int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state) 300int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
300{ 301{
301 unsigned int cpu_state = 0; 302 unsigned int cpu_state = 0;
303 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu);
302 304
303 if (omap_rev() == OMAP4430_REV_ES1_0) 305 if (omap_rev() == OMAP4430_REV_ES1_0)
304 return -ENXIO; 306 return -ENXIO;
@@ -308,7 +310,7 @@ int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
308 310
309 clear_cpu_prev_pwrst(cpu); 311 clear_cpu_prev_pwrst(cpu);
310 set_cpu_next_pwrst(cpu, power_state); 312 set_cpu_next_pwrst(cpu, power_state);
311 set_cpu_wakeup_addr(cpu, virt_to_phys(omap_secondary_startup)); 313 set_cpu_wakeup_addr(cpu, virt_to_phys(pm_info->secondary_startup));
312 scu_pwrst_prepare(cpu, power_state); 314 scu_pwrst_prepare(cpu, power_state);
313 315
314 /* 316 /*
@@ -359,6 +361,11 @@ int __init omap4_mpuss_init(void)
359 pm_info->scu_sar_addr = sar_base + SCU_OFFSET1; 361 pm_info->scu_sar_addr = sar_base + SCU_OFFSET1;
360 pm_info->wkup_sar_addr = sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET; 362 pm_info->wkup_sar_addr = sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET;
361 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1; 363 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1;
364 if (cpu_is_omap446x())
365 pm_info->secondary_startup = omap_secondary_startup_4460;
366 else
367 pm_info->secondary_startup = omap_secondary_startup;
368
362 pm_info->pwrdm = pwrdm_lookup("cpu1_pwrdm"); 369 pm_info->pwrdm = pwrdm_lookup("cpu1_pwrdm");
363 if (!pm_info->pwrdm) { 370 if (!pm_info->pwrdm) {
364 pr_err("Lookup failed for CPU1 pwrdm\n"); 371 pr_err("Lookup failed for CPU1 pwrdm\n");