Skip to contentSkip to conversation

CORE context save/restore

PATCH In review Rajendra Nayak 2 participants 5 messages Jul 1, 2008 – Jul 2, 2008

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 11/11 CORE context save/restore

This patch adds the CORE context save/restore routines
- save/restores the following
1) PRCM registers
2) INTC context
3) System Control module context
4) Padconf

---
 arch/arm/mach-omap2/cpuidle34xx.c   |  546 +++++++++++++++++++++++++++++++-----
 arch/arm/mach-omap2/cpuidle34xx.h   |   32 +-
 arch/arm/mach-omap2/pm34xx.c        |   45 ++
 arch/arm/mach-omap2/prm.h           |    2 
 arch/arm/mach-omap2/serial.c        |   19 -
 arch/arm/mach-omap2/sleep34xx.S     |   12 
 arch/arm/plat-omap/sram.c           |   15 
 include/asm-arm/arch-omap/common.h  |    2 
 include/asm-arm/arch-omap/control.h |   22 +
 include/asm-arm/arch-omap/prcm.h    |   58 +++
 10 files changed, 646 insertions(+), 107 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +480 -66
Index: linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.c
===================================================================
@@ -28,12 +28,22 @@
 #include <asm/arch/powerdomain.h>
 #include <asm/arch/clockdomain.h>
 #include <asm/arch/gpio.h>
+#include <asm/arch/gpmc.h>
+#include <asm/arch/control.h>
+#include <linux/sched.h>
 #include "cpuidle34xx.h"
+#include "cm.h"
+#include "cm-regbits-34xx.h"
+#include "prm-regbits-34xx.h"
+#include "prm.h"
+#include "pm.h"
+#include "clock34xx.h"
 
 #ifdef CONFIG_CPU_IDLE
 
 struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES];
 struct omap3_processor_cx current_cx_state;
+static int padconf_saved;
 
 static int omap3_idle_bm_check(void)
 {
@@ -42,6 +52,379 @@ static int omap3_idle_bm_check(void)
 	return 0;
 }
 
+void omap3_save_prcm_ctx(void)
+{
+	prcm_sleep_save[1] = omap_readl(INTC_MIR_0);
+	prcm_sleep_save[2] = omap_readl(INTC_MIR_1);
+	prcm_sleep_save[3] = omap_readl(INTC_MIR_2);
+	prcm_sleep_save[4] = omap_readl(CONTROL_PADCONF_SYS_NIRQ);
+	prcm_sleep_save[5] = omap_readl(OMAP34XX_GPIO1_IRQENABLE1);
+	prcm_sleep_save[6] = omap_readl(OMAP34XX_GPIO1_WAKEUPEN);
+	prcm_sleep_save[7] = cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL2);
+	prcm_sleep_save[8] = __raw_readl(OMAP3430_CM_SYSCONFIG);
+	prcm_sleep_save[9] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSEL);
+	prcm_sleep_save[10] = cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
+	prcm_sleep_save[11] = cm_read_mod_reg(OMAP3430_DSS_MOD, CM_CLKSEL);
+	prcm_sleep_save[12] = cm_read_mod_reg(OMAP3430_CAM_MOD, CM_CLKSEL);
+	prcm_sleep_save[13] = cm_read_mod_reg(OMAP3430_PER_MOD, CM_CLKSEL);
+	prcm_sleep_save[14] = cm_read_mod_reg(OMAP3430_EMU_MOD, CM_CLKSEL1);
+	prcm_sleep_save[15] = cm_read_mod_reg(OMAP3430_EMU_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[16] = cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[17] = cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKSEL5);
+	prcm_sleep_save[18] = __raw_readl(OMAP3430_CM_POLCTRL);
+	prcm_sleep_save[19] = cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_FCLKEN);
+	prcm_sleep_save[20] = cm_read_mod_reg(CORE_MOD, CM_FCLKEN1);
+	prcm_sleep_save[21] = cm_read_mod_reg(CORE_MOD, OMAP3430ES2_CM_FCLKEN3);
+	prcm_sleep_save[22] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_FCLKEN);
+	prcm_sleep_save[23] = cm_read_mod_reg(WKUP_MOD, CM_FCLKEN);
+	prcm_sleep_save[24] = cm_read_mod_reg(OMAP3430_DSS_MOD, CM_FCLKEN);
+	prcm_sleep_save[25] = cm_read_mod_reg(OMAP3430_CAM_MOD, CM_FCLKEN);
+	prcm_sleep_save[26] = cm_read_mod_reg(OMAP3430_PER_MOD, CM_FCLKEN);
+	prcm_sleep_save[27] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      CM_FCLKEN);
+	prcm_sleep_save[28] = cm_read_mod_reg(CORE_MOD, CM_ICLKEN1);
+	prcm_sleep_save[29] = cm_read_mod_reg(CORE_MOD, CM_ICLKEN2);
+	prcm_sleep_save[30] = cm_read_mod_reg(CORE_MOD, CM_ICLKEN3);
+	prcm_sleep_save[31] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_ICLKEN);
+	prcm_sleep_save[32] = cm_read_mod_reg(WKUP_MOD, CM_ICLKEN);
+	prcm_sleep_save[33] = cm_read_mod_reg(OMAP3430_DSS_MOD, CM_ICLKEN);
+	prcm_sleep_save[34] = cm_read_mod_reg(OMAP3430_CAM_MOD, CM_ICLKEN);
+	prcm_sleep_save[35] = cm_read_mod_reg(OMAP3430_PER_MOD, CM_ICLKEN);
+	prcm_sleep_save[36] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      CM_ICLKEN);
+	prcm_sleep_save[37] = cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[38] = cm_read_mod_reg(MPU_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[39] = cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[40] = cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[41] = cm_read_mod_reg(MPU_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[42] = cm_read_mod_reg(CORE_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[43] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD,
+							      CM_CLKSTCTRL);
+	prcm_sleep_save[44] = cm_read_mod_reg(OMAP3430_DSS_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[45] = cm_read_mod_reg(OMAP3430_CAM_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[46] = cm_read_mod_reg(OMAP3430_PER_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[47] = cm_read_mod_reg(OMAP3430_NEON_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[48] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      CM_CLKSTCTRL);
+	prcm_sleep_save[49] = cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE1);
+	prcm_sleep_save[50] = cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[51] = cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE3);
+	prcm_sleep_save[52] = cm_read_mod_reg(WKUP_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[53] = cm_read_mod_reg(OMAP3430_DSS_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[54] = cm_read_mod_reg(OMAP3430_CAM_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[55] = cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[56] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      CM_AUTOIDLE);
+	prcm_sleep_save[57] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD,
+						      OMAP3430_CM_SLEEPDEP);
+	prcm_sleep_save[58] = cm_read_mod_reg(OMAP3430_DSS_MOD,
+						      OMAP3430_CM_SLEEPDEP);
+	prcm_sleep_save[59] = cm_read_mod_reg(OMAP3430_CAM_MOD,
+						      OMAP3430_CM_SLEEPDEP);
+	prcm_sleep_save[60] = cm_read_mod_reg(OMAP3430_PER_MOD,
+						      OMAP3430_CM_SLEEPDEP);
+	prcm_sleep_save[61] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+						      OMAP3430_CM_SLEEPDEP);
+	prcm_sleep_save[62] = __raw_readl(OMAP3430_CM_CLKOUT_CTRL);
+	prcm_sleep_save[63] = __raw_readl(OMAP3430_PRM_CLKOUT_CTRL);
+	prcm_sleep_save[64] = prm_read_mod_reg(OMAP3430ES2_SGX_MOD, PM_WKDEP);
+	prcm_sleep_save[65] = prm_read_mod_reg(OMAP3430_DSS_MOD, PM_WKDEP);
+	prcm_sleep_save[66] = prm_read_mod_reg(OMAP3430_CAM_MOD, PM_WKDEP);
+	prcm_sleep_save[67] = prm_read_mod_reg(OMAP3430_PER_MOD, PM_WKDEP);
+	prcm_sleep_save[68] = prm_read_mod_reg(OMAP3430_NEON_MOD, PM_WKDEP);
+	prcm_sleep_save[69] = prm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							       PM_WKDEP);
+	prcm_sleep_save[70] = prm_read_mod_reg(CORE_MOD,
+					      OMAP3430_PM_MPUGRPSEL1);
+	prcm_sleep_save[71] = prm_read_mod_reg(OMAP3430_IVA2_MOD,
+					      OMAP3430_PM_IVAGRPSEL1);
+	prcm_sleep_save[72] = prm_read_mod_reg(CORE_MOD,
+					      OMAP3430ES2_PM_MPUGRPSEL3);
+	prcm_sleep_save[73] = prm_read_mod_reg(CORE_MOD,
+					      OMAP3430ES2_PM_IVAGRPSEL3);
+	prcm_sleep_save[74] = prm_read_mod_reg(WKUP_MOD, OMAP3430_PM_MPUGRPSEL);
+	prcm_sleep_save[75] = prm_read_mod_reg(WKUP_MOD,
+					      OMAP3430_PM_IVAGRPSEL);
+	prcm_sleep_save[76] = prm_read_mod_reg(OMAP3430_PER_MOD,
+					      OMAP3430_PM_MPUGRPSEL);
+	prcm_sleep_save[77] = prm_read_mod_reg(OMAP3430_PER_MOD,
+					      OMAP3430_PM_IVAGRPSEL);
+	prcm_sleep_save[78] = prm_read_mod_reg(WKUP_MOD, PM_WKEN);
+	return;
+}
+
+void omap3_restore_prcm_ctx(void)
+{
+	omap_writel(prcm_sleep_save[1], INTC_MIR_0);
+	omap_writel(prcm_sleep_save[2], INTC_MIR_1);
+	omap_writel(prcm_sleep_save[3], INTC_MIR_2);
+	omap_writel(prcm_sleep_save[4], CONTROL_PADCONF_SYS_NIRQ);
+	omap_writel(prcm_sleep_save[5], OMAP34XX_GPIO1_IRQENABLE1);
+	omap_writel(prcm_sleep_save[6], OMAP34XX_GPIO1_WAKEUPEN);
+	cm_write_mod_reg(prcm_sleep_save[7], OMAP3430_IVA2_MOD, CM_CLKSEL2);
+	__raw_writel(prcm_sleep_save[8], OMAP3430_CM_SYSCONFIG);
+	cm_write_mod_reg(prcm_sleep_save[9], OMAP3430ES2_SGX_MOD, CM_CLKSEL);
+	cm_write_mod_reg(prcm_sleep_save[10], WKUP_MOD, CM_CLKSEL);
+	cm_write_mod_reg(prcm_sleep_save[11], OMAP3430_DSS_MOD, CM_CLKSEL);
+	cm_write_mod_reg(prcm_sleep_save[12], OMAP3430_CAM_MOD, CM_CLKSEL);
+	cm_write_mod_reg(prcm_sleep_save[13], OMAP3430_PER_MOD, CM_CLKSEL);
+	cm_write_mod_reg(prcm_sleep_save[14], OMAP3430_EMU_MOD, CM_CLKSEL1);
+	cm_write_mod_reg(prcm_sleep_save[15], OMAP3430_EMU_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[16], PLL_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[17], PLL_MOD, OMAP3430ES2_CM_CLKSEL5);
+	__raw_writel(prcm_sleep_save[18], OMAP3430_CM_POLCTRL);
+	cm_write_mod_reg(prcm_sleep_save[19], OMAP3430_IVA2_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[20], CORE_MOD, CM_FCLKEN1);
+	cm_write_mod_reg(prcm_sleep_save[21], CORE_MOD, OMAP3430ES2_CM_FCLKEN3);
+	cm_write_mod_reg(prcm_sleep_save[22], OMAP3430ES2_SGX_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[23], WKUP_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[24], OMAP3430_DSS_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[25], OMAP3430_CAM_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[26], OMAP3430_PER_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[27], OMAP3430ES2_USBHOST_MOD,
+							       CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[28], CORE_MOD, CM_ICLKEN1);
+	cm_write_mod_reg(prcm_sleep_save[29], CORE_MOD, CM_ICLKEN2);
+	cm_write_mod_reg(prcm_sleep_save[30], CORE_MOD, CM_ICLKEN3);
+	cm_write_mod_reg(prcm_sleep_save[31], OMAP3430ES2_SGX_MOD, CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[32], WKUP_MOD, CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[33], OMAP3430_DSS_MOD, CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[34], OMAP3430_CAM_MOD, CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[35], OMAP3430_PER_MOD, CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[36], OMAP3430ES2_USBHOST_MOD,
+								CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[37], OMAP3430_IVA2_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[38], MPU_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[39], PLL_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[40], OMAP3430_IVA2_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[41], MPU_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[42], CORE_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[43], OMAP3430ES2_SGX_MOD,
+						       CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[44], OMAP3430_DSS_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[45], OMAP3430_CAM_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[46], OMAP3430_PER_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[47], OMAP3430_NEON_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[48], OMAP3430ES2_USBHOST_MOD,
+							       CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[49], CORE_MOD, CM_AUTOIDLE1);
+	cm_write_mod_reg(prcm_sleep_save[50], CORE_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[51], CORE_MOD, CM_AUTOIDLE3);
+	cm_write_mod_reg(prcm_sleep_save[52], WKUP_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[53], OMAP3430_DSS_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[54], OMAP3430_CAM_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[55], OMAP3430_PER_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[56], OMAP3430ES2_USBHOST_MOD,
+							       CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[57], OMAP3430ES2_SGX_MOD,
+						       OMAP3430_CM_SLEEPDEP);
+	cm_write_mod_reg(prcm_sleep_save[58], OMAP3430_DSS_MOD,
+						       OMAP3430_CM_SLEEPDEP);
+	cm_write_mod_reg(prcm_sleep_save[59], OMAP3430_CAM_MOD,
+						       OMAP3430_CM_SLEEPDEP);
+	cm_write_mod_reg(prcm_sleep_save[60], OMAP3430_PER_MOD,
+						       OMAP3430_CM_SLEEPDEP);
+	cm_write_mod_reg(prcm_sleep_save[61], OMAP3430ES2_USBHOST_MOD,
+						       OMAP3430_CM_SLEEPDEP);
+	__raw_writel(prcm_sleep_save[62], OMAP3430_CM_CLKOUT_CTRL);
+	__raw_writel(prcm_sleep_save[63], OMAP3430_PRM_CLKOUT_CTRL);
+	prm_write_mod_reg(prcm_sleep_save[64], OMAP3430ES2_SGX_MOD, PM_WKDEP);
+	prm_write_mod_reg(prcm_sleep_save[65], OMAP3430_DSS_MOD, PM_WKDEP);
+	prm_write_mod_reg(prcm_sleep_save[66], OMAP3430_CAM_MOD, PM_WKDEP);
+	prm_write_mod_reg(prcm_sleep_save[67], OMAP3430_PER_MOD, PM_WKDEP);
+	prm_write_mod_reg(prcm_sleep_save[68], OMAP3430_NEON_MOD, PM_WKDEP);
+	prm_write_mod_reg(prcm_sleep_save[69], OMAP3430ES2_USBHOST_MOD,
+							       PM_WKDEP);
+	prm_write_mod_reg(prcm_sleep_save[70], CORE_MOD,
+					       OMAP3430_PM_MPUGRPSEL1);
+	prm_write_mod_reg(prcm_sleep_save[71], OMAP3430_IVA2_MOD,
+					       OMAP3430_PM_IVAGRPSEL1);
+	prm_write_mod_reg(prcm_sleep_save[72], CORE_MOD,
+					       OMAP3430ES2_PM_MPUGRPSEL3);
+	prm_write_mod_reg(prcm_sleep_save[73], CORE_MOD,
+					       OMAP3430ES2_PM_IVAGRPSEL3);
+	prm_write_mod_reg(prcm_sleep_save[74], WKUP_MOD,
+					       OMAP3430_PM_MPUGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[75], WKUP_MOD,
+					       OMAP3430_PM_IVAGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[76], OMAP3430_PER_MOD,
+					       OMAP3430_PM_MPUGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[77], OMAP3430_PER_MOD,
+					       OMAP3430_PM_IVAGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[78], WKUP_MOD, PM_WKEN);
+	return;
+}
+
+static void omap_save_intc_ctx(void)
+{
+	int ind = 0;
+	intc_context.sysconfig = omap_readl(INTCPS_SYSCONFIG);
+	intc_context.protection =  omap_readl(INTCPS_PROTECTION);
+	intc_context.idle = omap_readl(INTCPS_IDLE);
+	intc_context.threshold = omap_readl(INTCPS_THRESHOLD);
+	for (ind = 0; ind < 96; ind++)
+	       intc_context.ilr[ind] =
+		       omap_readl(INTC_BASE + (0x100 + 0x4*ind));
+	/* MIRs are saved and restore with other PRCM registers */
+}
+
+static void omap_restore_intc_ctx(void)
+{
+	int ind = 0;
+	omap_writel(intc_context.sysconfig, INTCPS_SYSCONFIG);
+	omap_writel(intc_context.protection, INTCPS_PROTECTION);
+	omap_writel(intc_context.idle, INTCPS_IDLE);
+	omap_writel(intc_context.threshold, INTCPS_THRESHOLD);
+	for (ind = 0; ind < 96; ind++)
+	       omap_writel(intc_context.ilr[ind],
+		       INTC_BASE + (0x100 + 0x4*ind));
+	/* MIRs are saved and restore with other PRCM registers */
+}
+
+static void omap_save_control_ctx(void)
+{
+	control_ctx.sysconfig = omap_ctrl_readl(OMAP2_CONTROL_SYSCONFIG);
+	control_ctx.devconf0 = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
+	control_ctx.mem_dftrw0 = omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW0);
+	control_ctx.mem_dftrw1 = omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW1);
+	control_ctx.msuspendmux_0 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_0);
+	control_ctx.msuspendmux_1 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_1);
+	control_ctx.msuspendmux_2 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_2);
+	control_ctx.msuspendmux_3 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_3);
+	control_ctx.msuspendmux_4 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_4);
+	control_ctx.msuspendmux_5 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_5);
+	control_ctx.sec_ctrl = omap_ctrl_readl(OMAP2_CONTROL_SEC_CTRL);
+	control_ctx.devconf1 = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);
+	control_ctx.csirxfe = omap_ctrl_readl(OMAP343X_CONTROL_CSIRXFE);
+	control_ctx.iva2_bootaddr =
+		       omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTADDR);
+	control_ctx.iva2_bootmod =
+		       omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTMOD);
+	control_ctx.debobs_0 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_0);
+	control_ctx.debobs_1 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_1);
+	control_ctx.debobs_2 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_2);
+	control_ctx.debobs_3 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_3);
+	control_ctx.debobs_4 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_4);
+	control_ctx.debobs_5 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_5);
+	control_ctx.debobs_6 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_6);
+	control_ctx.debobs_7 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_7);
+	control_ctx.debobs_8 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_8);
+	control_ctx.prog_io0 = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO0);
+	control_ctx.prog_io1 = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO1);
+	control_ctx.dss_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_DSS_DPLL_SPREADING);
+	control_ctx.core_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_CORE_DPLL_SPREADING);
+	control_ctx.per_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_PER_DPLL_SPREADING);
+	control_ctx.usbhost_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);
+	control_ctx.pbias_lite = omap_ctrl_readl(OMAP343X_CONTROL_PBIAS_LITE);
+	control_ctx.temp_sensor = omap_ctrl_readl(OMAP343X_CONTROL_TEMP_SENSOR);
+	control_ctx.sramldo4 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO4);
+	control_ctx.sramldo5 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO5);
+	control_ctx.csi = omap_ctrl_readl(OMAP343X_CONTROL_CSI);
+	return;
+}
+
+static void omap_restore_control_ctx(void)
+{
+	omap_ctrl_writel(control_ctx.sysconfig, OMAP2_CONTROL_SYSCONFIG);
+	omap_ctrl_writel(control_ctx.devconf0, OMAP2_CONTROL_DEVCONF0);
+	omap_ctrl_writel(control_ctx.mem_dftrw0, OMAP343X_CONTROL_MEM_DFTRW0);
+	omap_ctrl_writel(control_ctx.mem_dftrw1, OMAP343X_CONTROL_MEM_DFTRW1);
+	omap_ctrl_writel(control_ctx.msuspendmux_0,
+					       OMAP2_CONTROL_MSUSPENDMUX_0);
+	omap_ctrl_writel(control_ctx.msuspendmux_1,
+					       OMAP2_CONTROL_MSUSPENDMUX_1);
+	omap_ctrl_writel(control_ctx.msuspendmux_2,
+					       OMAP2_CONTROL_MSUSPENDMUX_2);
+	omap_ctrl_writel(control_ctx.msuspendmux_3,
+					       OMAP2_CONTROL_MSUSPENDMUX_3);
+	omap_ctrl_writel(control_ctx.msuspendmux_4,
+					       OMAP2_CONTROL_MSUSPENDMUX_4);
+	omap_ctrl_writel(control_ctx.msuspendmux_5,
+					       OMAP2_CONTROL_MSUSPENDMUX_5);
+	omap_ctrl_writel(control_ctx.sec_ctrl, OMAP2_CONTROL_SEC_CTRL);
+	omap_ctrl_writel(control_ctx.devconf1, OMAP343X_CONTROL_DEVCONF1);
+	omap_ctrl_writel(control_ctx.csirxfe, OMAP343X_CONTROL_CSIRXFE);
+	omap_ctrl_writel(control_ctx.iva2_bootaddr,
+					       OMAP343X_CONTROL_IVA2_BOOTADDR);
+	omap_ctrl_writel(control_ctx.iva2_bootmod,
+					       OMAP343X_CONTROL_IVA2_BOOTMOD);
+	omap_ctrl_writel(control_ctx.debobs_0, OMAP343X_CONTROL_DEBOBS_0);
+	omap_ctrl_writel(control_ctx.debobs_1, OMAP343X_CONTROL_DEBOBS_1);
+	omap_ctrl_writel(control_ctx.debobs_2, OMAP343X_CONTROL_DEBOBS_2);
+	omap_ctrl_writel(control_ctx.debobs_3, OMAP343X_CONTROL_DEBOBS_3);
+	omap_ctrl_writel(control_ctx.debobs_4, OMAP343X_CONTROL_DEBOBS_4);
+	omap_ctrl_writel(control_ctx.debobs_5, OMAP343X_CONTROL_DEBOBS_5);
+	omap_ctrl_writel(control_ctx.debobs_6, OMAP343X_CONTROL_DEBOBS_6);
+	omap_ctrl_writel(control_ctx.debobs_7, OMAP343X_CONTROL_DEBOBS_7);
+	omap_ctrl_writel(control_ctx.debobs_8, OMAP343X_CONTROL_DEBOBS_8);
+	omap_ctrl_writel(control_ctx.prog_io0, OMAP343X_CONTROL_PROG_IO0);
+	omap_ctrl_writel(control_ctx.prog_io1, OMAP343X_CONTROL_PROG_IO1);
+	omap_ctrl_writel(control_ctx.dss_dpll_spreading,
+			       OMAP343X_CONTROL_DSS_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.core_dpll_spreading,
+			       OMAP343X_CONTROL_CORE_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.per_dpll_spreading,
+			       OMAP343X_CONTROL_PER_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.usbhost_dpll_spreading,
+			       OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.pbias_lite, OMAP343X_CONTROL_PBIAS_LITE);
+	omap_ctrl_writel(control_ctx.temp_sensor, OMAP343X_CONTROL_TEMP_SENSOR);
+	omap_ctrl_writel(control_ctx.sramldo4, OMAP343X_CONTROL_SRAMLDO4);
+	omap_ctrl_writel(control_ctx.sramldo5, OMAP343X_CONTROL_SRAMLDO5);
+	omap_ctrl_writel(control_ctx.csi, OMAP343X_CONTROL_CSI);
+	return;
+}
+
+void omap3_save_core_ctx(void)
+{
+	u32 control_padconf_off;
+
+	if (!padconf_saved) {
+	       /* Save the padconf registers */
+	       control_padconf_off = omap_readl(CONTROL_PADCONF_OFF);
+	       control_padconf_off |= 2;
+	       omap_writel(control_padconf_off, CONTROL_PADCONF_OFF);
+	       /* wait for the save to complete */
+	       while (!omap_readl(CONTROL_GENERAL_PURPOSE_STATUS) & 0x1);
+	       padconf_saved = 1;
+	}
+	/* Save the Interrupt controller context */
+	omap_save_intc_ctx();
+	/* Save the GPMC context */
+	omap_save_gpmc_ctx();
+	/* Save the system control module context, padconf already save above*/
+	omap_save_control_ctx();
+	omap_save_uart_ctx(0);
+	omap_serial_enable_clocks(0, 0);
+	omap_save_uart_ctx(1);
+	omap_serial_enable_clocks(0, 1);
+}
+
+void omap3_restore_core_ctx(void)
+{
+	/* Restore the control module context, padconf restored by h/w */
+	omap_restore_control_ctx();
+	/* Restore the GPMC context */
+	omap_restore_gpmc_ctx();
+	/* Restore the interrupt controller context */
+	omap_restore_intc_ctx();
+	omap_serial_enable_clocks(1, 0);
+	omap_restore_uart_ctx(0);
+	omap_serial_enable_clocks(1, 1);
+	omap_restore_uart_ctx(1);
+	padconf_saved = 0;
+}
+
 /* omap3_enter_idle - Programs OMAP3 to enter the specified state.
  * returns the total time during which the system was idle.
  */
@@ -60,9 +443,15 @@ static int omap3_enter_idle(struct cpuid
 		return 0;
 	}
 
+	local_irq_disable();
+	local_fiq_disable();
+
 	/* Used to keep track of the total time in idle */
 	getnstimeofday(&ts_preidle);
 
+	if (cx->type > OMAP3_STATE_C1)
+		sched_clock_idle_sleep_event(); /* about to enter deep idle */
+
 	mpu_pd = pwrdm_lookup("mpu_pwrdm");
 	core_pd = pwrdm_lookup("core_pwrdm");
 	per_pd = pwrdm_lookup("per_pwrdm");
@@ -74,12 +463,13 @@ static int omap3_enter_idle(struct cpuid
 	pwrdm_clear_all_prev_pwrst(core_pd);
 	pwrdm_clear_all_prev_pwrst(per_pd);
 
-	if (omap_irq_pending())
-		return 0;
-
 	per_pwrst = pwrdm_read_pwrst(per_pd);
 	neon_pwrst = pwrdm_read_pwrst(neon_pd);
 
+	/* Do this before any changes to PRCM registers */
+	if (cx->core_state == PWRDM_POWER_OFF)
+		omap3_save_prcm_ctx();
+
 	/* Program MPU to target state */
 	if (cx->mpu_state < PWRDM_POWER_ON) {
 		if (neon_pwrst == PWRDM_POWER_ON) {
@@ -96,15 +486,22 @@ static int omap3_enter_idle(struct cpuid
 		if (per_pwrst == PWRDM_POWER_ON) {
 			omap2_gpio_prepare_for_retention();
 			if (clocks_off_while_idle) {
+				omap3_save_per_ctx();
 				per_gpio_clk_disable();
-				omap_serial_enable_clocks(0);
+				omap_save_uart_ctx(2);
+				omap_serial_enable_clocks(0, 2);
 			}
 		}
+		if (cx->core_state == PWRDM_POWER_OFF)
+			omap3_save_core_ctx();
 		pwrdm_set_next_pwrst(core_pd, cx->core_state);
 	}
 
 	*(scratchpad_restore_addr) = restore_pointer_address;
 
+	if (omap_irq_pending())
+		goto return_sleep_time;
+
 	/* Execute ARM wfi */
 	omap_sram_idle();
 
@@ -118,25 +515,41 @@ static int omap3_enter_idle(struct cpuid
 	}
 
 	if (cx->core_state < PWRDM_POWER_ON) {
+		if ((cx->core_state == PWRDM_POWER_OFF)
+		&& (pwrdm_read_prev_pwrst(core_pd) == PWRDM_POWER_OFF)) {
+			omap3_restore_core_ctx();
+			omap3_restore_prcm_ctx();
+			omap3_restore_sram_ctx();
+		}
+		pwrdm_set_next_pwrst(core_pd, PWRDM_POWER_ON);
 		if (per_pwrst == PWRDM_POWER_ON) {
 			if (clocks_off_while_idle) {
-				omap_serial_enable_clocks(1);
+				omap_serial_enable_clocks(1, 2);
+				omap_restore_uart_ctx(2);
 				per_gpio_clk_enable();
+				omap3_restore_per_ctx();
 			}
 			omap2_gpio_resume_after_retention();
 		}
-		pwrdm_set_next_pwrst(core_pd, PWRDM_POWER_ON);
 	}
 
 	pr_debug("MPU prev st:%x,NEON prev st:%x\n",
-			       pwrdm_read_prev_pwrst(mpu_pd),
-			       pwrdm_read_prev_pwrst(neon_pd));
+				pwrdm_read_prev_pwrst(mpu_pd),
+				pwrdm_read_prev_pwrst(neon_pd));
 	pr_debug("PER prev st:%x,CORE prev st:%x\n",
-			       pwrdm_read_prev_pwrst(per_pd),
-			       pwrdm_read_prev_pwrst(core_pd));
+				pwrdm_read_prev_pwrst(per_pd),
+				pwrdm_read_prev_pwrst(core_pd));
 
+return_sleep_time:
 	getnstimeofday(&ts_postidle);
 	ts_idle = timespec_sub(ts_postidle, ts_preidle);
+
+	if (cx->type > OMAP3_STATE_C1)
+		sched_clock_idle_wakeup_event(timespec_to_ns(&ts_idle));
+
+	local_irq_enable();
+	local_fiq_disable();
+
 	return (u32)timespec_to_ns(&ts_idle)/1000;
 }
 
@@ -187,79 +600,79 @@ DEFINE_PER_CPU(struct cpuidle_device, om
 void omap_init_power_states(void)
 {
 	/* C0 . System executing code */
-	omap3_power_states[0].valid = 1;
-	omap3_power_states[0].type = OMAP3_STATE_C0;
-	omap3_power_states[0].sleep_latency = 0;
-	omap3_power_states[0].wakeup_latency = 0;
-	omap3_power_states[0].threshold = 0;
-	omap3_power_states[0].mpu_state = PWRDM_POWER_ON;
-	omap3_power_states[0].core_state = PWRDM_POWER_ON;
-	omap3_power_states[0].flags = CPUIDLE_FLAG_SHALLOW;
+	omap3_power_states[OMAP3_STATE_C0].valid = 1;
+	omap3_power_states[OMAP3_STATE_C0].type = OMAP3_STATE_C0;
+	omap3_power_states[OMAP3_STATE_C0].sleep_latency = 0;
+	omap3_power_states[OMAP3_STATE_C0].wakeup_latency = 0;
+	omap3_power_states[OMAP3_STATE_C0].threshold = 0;
+	omap3_power_states[OMAP3_STATE_C0].mpu_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C0].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C0].flags = CPUIDLE_FLAG_SHALLOW;
 
 	/* C1 . MPU WFI + Core active */
-	omap3_power_states[1].valid = 1;
-	omap3_power_states[1].type = OMAP3_STATE_C1;
-	omap3_power_states[1].sleep_latency = 10;
-	omap3_power_states[1].wakeup_latency = 10;
-	omap3_power_states[1].threshold = 30;
-	omap3_power_states[1].mpu_state = PWRDM_POWER_ON;
-	omap3_power_states[1].core_state = PWRDM_POWER_ON;
-	omap3_power_states[1].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C1].valid = 1;
+	omap3_power_states[OMAP3_STATE_C1].type = OMAP3_STATE_C1;
+	omap3_power_states[OMAP3_STATE_C1].sleep_latency = 10;
+	omap3_power_states[OMAP3_STATE_C1].wakeup_latency = 10;
+	omap3_power_states[OMAP3_STATE_C1].threshold = 30;
+	omap3_power_states[OMAP3_STATE_C1].mpu_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C1].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C1].flags = CPUIDLE_FLAG_TIME_VALID |
 						CPUIDLE_FLAG_SHALLOW;
 
 	/* C2 . MPU CSWR + Core active */
-	omap3_power_states[2].valid = 1;
-	omap3_power_states[2].type = OMAP3_STATE_C2;
-	omap3_power_states[2].sleep_latency = 50;
-	omap3_power_states[2].wakeup_latency = 50;
-	omap3_power_states[2].threshold = 300;
-	omap3_power_states[2].mpu_state = PWRDM_POWER_RET;
-	omap3_power_states[2].core_state = PWRDM_POWER_ON;
-	omap3_power_states[2].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C2].valid = 1;
+	omap3_power_states[OMAP3_STATE_C2].type = OMAP3_STATE_C2;
+	omap3_power_states[OMAP3_STATE_C2].sleep_latency = 50;
+	omap3_power_states[OMAP3_STATE_C2].wakeup_latency = 50;
+	omap3_power_states[OMAP3_STATE_C2].threshold = 300;
+	omap3_power_states[OMAP3_STATE_C2].mpu_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C2].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C2].flags = CPUIDLE_FLAG_TIME_VALID |
 						CPUIDLE_FLAG_BALANCED;
 
 	/* C3 . MPU OFF + Core active */
-	omap3_power_states[3].valid = 1;
-	omap3_power_states[3].type = OMAP3_STATE_C3;
-	omap3_power_states[3].sleep_latency = 1500;
-	omap3_power_states[3].wakeup_latency = 1800;
-	omap3_power_states[3].threshold = 4000;
-	omap3_power_states[3].mpu_state = PWRDM_POWER_OFF;
-	omap3_power_states[3].core_state = PWRDM_POWER_ON;
-	omap3_power_states[3].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C3].valid = 1;
+	omap3_power_states[OMAP3_STATE_C3].type = OMAP3_STATE_C3;
+	omap3_power_states[OMAP3_STATE_C3].sleep_latency = 1500;
+	omap3_power_states[OMAP3_STATE_C3].wakeup_latency = 1800;
+	omap3_power_states[OMAP3_STATE_C3].threshold = 4000;
+	omap3_power_states[OMAP3_STATE_C3].mpu_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C3].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C3].flags = CPUIDLE_FLAG_TIME_VALID |
 			CPUIDLE_FLAG_BALANCED | CPUIDLE_FLAG_CHECK_BM;
 
 	/* C4 . MPU CSWR + Core CSWR*/
-	omap3_power_states[4].valid = 1;
-	omap3_power_states[4].type = OMAP3_STATE_C4;
-	omap3_power_states[4].sleep_latency = 2500;
-	omap3_power_states[4].wakeup_latency = 7500;
-	omap3_power_states[4].threshold = 12000;
-	omap3_power_states[4].mpu_state = PWRDM_POWER_RET;
-	omap3_power_states[4].core_state = PWRDM_POWER_RET;
-	omap3_power_states[4].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C4].valid = 1;
+	omap3_power_states[OMAP3_STATE_C4].type = OMAP3_STATE_C4;
+	omap3_power_states[OMAP3_STATE_C4].sleep_latency = 2500;
+	omap3_power_states[OMAP3_STATE_C4].wakeup_latency = 7500;
+	omap3_power_states[OMAP3_STATE_C4].threshold = 12000;
+	omap3_power_states[OMAP3_STATE_C4].mpu_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C4].core_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C4].flags = CPUIDLE_FLAG_TIME_VALID |
 			CPUIDLE_FLAG_BALANCED | CPUIDLE_FLAG_CHECK_BM;
 
 	/* C5 . MPU OFF + Core CSWR */
-	omap3_power_states[5].valid = 1;
-	omap3_power_states[5].type = OMAP3_STATE_C5;
-	omap3_power_states[5].sleep_latency = 3000;
-	omap3_power_states[5].wakeup_latency = 8500;
-	omap3_power_states[5].threshold = 15000;
-	omap3_power_states[5].mpu_state = PWRDM_POWER_OFF;
-	omap3_power_states[5].core_state = PWRDM_POWER_RET;
-	omap3_power_states[5].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C5].valid = 1;
+	omap3_power_states[OMAP3_STATE_C5].type = OMAP3_STATE_C5;
+	omap3_power_states[OMAP3_STATE_C5].sleep_latency = 3000;
+	omap3_power_states[OMAP3_STATE_C5].wakeup_latency = 8500;
+	omap3_power_states[OMAP3_STATE_C5].threshold = 15000;
+	omap3_power_states[OMAP3_STATE_C5].mpu_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C5].core_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C5].flags = CPUIDLE_FLAG_TIME_VALID |
 			CPUIDLE_FLAG_BALANCED | CPUIDLE_FLAG_CHECK_BM;
 
 	/* C6 . MPU OFF + Core OFF */
-	omap3_power_states[6].valid = 0;
-	omap3_power_states[6].type = OMAP3_STATE_C6;
-	omap3_power_states[6].sleep_latency = 10000;
-	omap3_power_states[6].wakeup_latency = 30000;
-	omap3_power_states[6].threshold = 300000;
-	omap3_power_states[6].mpu_state = PWRDM_POWER_OFF;
-	omap3_power_states[6].core_state = PWRDM_POWER_OFF;
-	omap3_power_states[6].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C6].valid = 1;
+	omap3_power_states[OMAP3_STATE_C6].type = OMAP3_STATE_C6;
+	omap3_power_states[OMAP3_STATE_C6].sleep_latency = 10000;
+	omap3_power_states[OMAP3_STATE_C6].wakeup_latency = 30000;
+	omap3_power_states[OMAP3_STATE_C6].threshold = 300000;
+	omap3_power_states[OMAP3_STATE_C6].mpu_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C6].core_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C6].flags = CPUIDLE_FLAG_TIME_VALID |
 			CPUIDLE_FLAG_DEEP | CPUIDLE_FLAG_CHECK_BM;
 }
 
@@ -277,6 +690,7 @@ int omap3_idle_init(void)
 	struct omap3_processor_cx *cx;
 	struct cpuidle_state *state;
 	struct cpuidle_device *dev;
+	char clk_name[11];
 
 	clear_scratchpad_contents();
 	save_scratchpad_contents();
arch/arm/mach-omap2/cpuidle34xx.h +29 -3
Index: linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.h
===================================================================
@@ -30,20 +30,41 @@
 #define OMAP3_STATE_C5 5 /* C5 - MPU OFF + Core RET */
 #define OMAP3_STATE_C6 6 /* C6 - MPU OFF + Core OFF */
 
-/* Currently, we support only upto C2 */
-#define MAX_SUPPORTED_STATES 3
+/* Interrupt Controller registers */
+#define INTC_BASE	0x48200000
+#define INTC_MIR_0	0x48200084
+#define INTC_MIR_1	0x482000A4
+#define INTC_MIR_2	0x482000C4
+#define INTCPS_SYSCONFIG	0x48200010
+#define INTCPS_PROTECTION	0x4820004C
+#define INTCPS_IDLE	0x48200050
+#define INTCPS_THRESHOLD	0x48200068
+
+#define CONTROL_PADCONF_SYS_NIRQ	0x480021E0
+#define CONTROL_PADCONF_OFF	0x48002270
+#define CONTROL_GENERAL_PURPOSE_STATUS	0x480022F4
+
+#define OMAP34XX_GPIO1_IRQENABLE1	0x4831001c
+#define OMAP34XX_GPIO1_WAKEUPEN	0x48310020
+#define OMAP34XX_GPIO1_FALLINGDETECT	0x4831004c
 
 extern unsigned short clocks_off_while_idle;
 extern void omap_sram_idle(void);
 extern int omap_irq_pending(void);
 extern void per_gpio_clk_enable(void);
 extern void per_gpio_clk_disable(void);
-extern void omap_serial_enable_clocks(int enable);
+extern void omap_serial_enable_clocks(int enable, int unum);
 extern int omap3_can_sleep();
 extern void clear_scratchpad_contents(void);
 extern void save_scratchpad_contents(void);
 extern u32 *scratchpad_restore_addr;
 extern u32 restore_pointer_address;
+extern void omap3_save_per_ctx();
+extern void omap3_restore_per_ctx();
+extern void omap_save_uart_ctx(int);
+extern void omap_restore_uart_ctx(int);
+extern void omap3_restore_sram_ctx();
+extern int omap3_can_sleep();
 
 struct omap3_processor_cx {
 	u8 valid;
@@ -59,5 +80,10 @@ struct omap3_processor_cx {
 void omap_init_power_states(void);
 int omap3_idle_init(void);
 
+/* TODO fix the size:100 */
+static unsigned int prcm_sleep_save[100];
+static struct int_controller_context intc_context;
+static struct control_module_context control_ctx;
+
 #endif /* ARCH_ARM_MACH_OMAP2_CPUIDLE_34XX */
 
arch/arm/mach-omap2/pm34xx.c +35 -10

107 lines not on this page · raw message

arch/arm/mach-omap2/prm.h +2 -0
Index: linux-omap-2.6/arch/arm/mach-omap2/prm.h
===================================================================
@@ -137,9 +137,11 @@
 
 #define OMAP3430_PM_MPUGRPSEL				0x00a4
 #define OMAP3430_PM_MPUGRPSEL1				OMAP3430_PM_MPUGRPSEL
+#define OMAP3430ES2_PM_MPUGRPSEL3			0x00f8
 
 #define OMAP3430_PM_IVAGRPSEL				0x00a8
 #define OMAP3430_PM_IVAGRPSEL1				OMAP3430_PM_IVAGRPSEL
+#define OMAP3430ES2_PM_IVAGRPSEL3			0x00f4
 
 #define OMAP3430_PM_PREPWSTST				0x00e8
 
arch/arm/mach-omap2/sleep34xx.S +7 -5
Index: linux-omap-2.6/arch/arm/mach-omap2/sleep34xx.S
===================================================================
@@ -457,10 +457,12 @@ loop2:
 	mov     r9, r4
 	/* create working copy of max way size*/
 loop3:
-	/* factor way and cache number into r11 */
-	orr     r11, r10, r9, lsl r5
-	/* factor index number into r11 */
-	orr     r11, r11, r7, lsl r2
+ 	orr	r11, r10, r9, lsl r5	 @ factor way and cache number into r11
+ 	orr	r11, r11, r7, lsl r2	 @ factor index number into r11
+ 	lsl	r6, r9, r5
+ 	orr	r11, r10, r6		 @ factor way and cache number into r11
+ 	lsl	r6, r7, r2
+ 	orr	r11, r11, r6		 @ factor index number into r11
 	/*clean & invalidate by set/way */
 	mcr     p15, 0, r11, c7, c10, 2
 	/* decrement the way*/
@@ -475,7 +477,7 @@ skip:
 	cmp     r3, r10
 	bgt     loop1
 finished:
-	/*swith back to cache level 0 */
+	/*switch back to cache level 0 */
 	mov     r10, #0
 	/* select current cache level in cssr */
 	mcr     p15, 2, r10, c0, c0, 0
arch/arm/plat-omap/sram.c +10 -5
Index: linux-omap-2.6/arch/arm/plat-omap/sram.c
===================================================================
@@ -26,6 +26,7 @@
 #include <asm/arch/board.h>
 
 #include <asm/arch/control.h>
+#include <asm/arch/pm.h>
 
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 # include "../mach-omap2/prm.h"
@@ -75,6 +76,8 @@ extern unsigned long omapfb_reserve_sram
 					 unsigned long sram_size,
 					 unsigned long pstart_avail,
 					 unsigned long size_avail);
+extern void (*_omap_sram_idle)(u32 *addr, int save_state);
+extern void omap_push_sram_idle();
 
 /*
  * Depending on the target RAMFS firewall setup, the public usable amount of
@@ -108,6 +111,7 @@ static int is_sram_locked(void)
 		return 1; /* assume locked with no PPA or security driver */
 }
 
+
 /*
  * The amount of SRAM depends on the core type.
  * Note that we cannot try to test for SRAM here because writes
@@ -372,16 +376,15 @@ u32 omap2_sram_configure_core_dpll(u32 m
 }
 
 /* REVISIT: Should this be same as omap34xx_sram_init() after off-idle? */
-void restore_sram_functions(void)
+void omap3_restore_sram_ctx(void)
 {
 	omap_sram_ceil = omap_sram_base + omap_sram_size;
-
 	_omap2_sram_reprogram_gpmc = omap_sram_push(omap34xx_sram_reprogram_gpmc,
-		omap34xx_sram_reprogram_gpmc_sz);
-
+				omap34xx_sram_reprogram_gpmc_sz);
 	_omap2_sram_configure_core_dpll =
 			omap_sram_push(omap34xx_sram_configure_core_dpll,
-					omap34xx_sram_configure_core_dpll_sz);
+			omap34xx_sram_configure_core_dpll_sz);
+	omap_push_sram_idle();
 }
 
 int __init omap34xx_sram_init(void)
@@ -401,6 +404,8 @@ int __init omap34xx_sram_init(void)
 	_omap2_sram_configure_core_dpll =
 				omap_sram_push(omap34xx_sram_configure_core_dpll,
 					omap34xx_sram_configure_core_dpll_sz);
+	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
+					omap34xx_cpu_suspend_sz);
 
 	return 0;
 }
include/asm-arm/arch-omap/prcm.h +53 -5

62 lines not on this page · raw message

include/asm-arm/arch-omap/control.h +21 -1
Index: linux-omap-2.6/include/asm-arm/arch-omap/control.h
===================================================================
@@ -149,7 +149,27 @@
 #define OMAP343X_CONTROL_FUSE_SR	(OMAP2_CONTROL_GENERAL + 0x0130)
 #define OMAP343X_CONTROL_IVA2_BOOTADDR	(OMAP2_CONTROL_GENERAL + 0x0190)
 #define OMAP343X_CONTROL_IVA2_BOOTMOD	(OMAP2_CONTROL_GENERAL + 0x0194)
-#define OMAP343X_CONTROL_TEMP_SENSOR	(OMAP2_CONTROL_GENERAL + 0x02b4)
+#define OMAP343X_CONTROL_DEBOBS_0	(OMAP2_CONTROL_GENERAL + 0x01B0)
+#define OMAP343X_CONTROL_DEBOBS_1	(OMAP2_CONTROL_GENERAL + 0x01B4)
+#define OMAP343X_CONTROL_DEBOBS_2	(OMAP2_CONTROL_GENERAL + 0x01B8)
+#define OMAP343X_CONTROL_DEBOBS_3	(OMAP2_CONTROL_GENERAL + 0x01BC)
+#define OMAP343X_CONTROL_DEBOBS_4	(OMAP2_CONTROL_GENERAL + 0x01C0)
+#define OMAP343X_CONTROL_DEBOBS_5	(OMAP2_CONTROL_GENERAL + 0x01C4)
+#define OMAP343X_CONTROL_DEBOBS_6	(OMAP2_CONTROL_GENERAL + 0x01C8)
+#define OMAP343X_CONTROL_DEBOBS_7	(OMAP2_CONTROL_GENERAL + 0x01CC)
+#define OMAP343X_CONTROL_DEBOBS_8	(OMAP2_CONTROL_GENERAL + 0x01D0)
+#define OMAP343X_CONTROL_PROG_IO0	(OMAP2_CONTROL_GENERAL + 0x01D4)
+#define OMAP343X_CONTROL_PROG_IO1	(OMAP2_CONTROL_GENERAL + 0x01D8)
+#define OMAP343X_CONTROL_DSS_DPLL_SPREADING	(OMAP2_CONTROL_GENERAL + 0x01E0)
+#define OMAP343X_CONTROL_CORE_DPLL_SPREADING	(OMAP2_CONTROL_GENERAL + 0x01E4)
+#define OMAP343X_CONTROL_PER_DPLL_SPREADING	(OMAP2_CONTROL_GENERAL + 0x01E8)
+#define OMAP343X_CONTROL_USBHOST_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01EC)
+#define OMAP343X_CONTROL_PBIAS_LITE	(OMAP2_CONTROL_GENERAL + 0x02B0)
+#define OMAP343X_CONTROL_TEMP_SENSOR	(OMAP2_CONTROL_GENERAL + 0x02B4)
+#define OMAP343X_CONTROL_SRAMLDO4	(OMAP2_CONTROL_GENERAL + 0x02B8)
+#define OMAP343X_CONTROL_SRAMLDO5	(OMAP2_CONTROL_GENERAL + 0x02C0)
+#define OMAP343X_CONTROL_CSI		(OMAP2_CONTROL_GENERAL + 0x02b4)
+
 
 /*
  * REVISIT: This list of registers is not comprehensive - there are more
arch/arm/mach-omap2/serial.c +8 -11
Index: linux-omap-2.6/arch/arm/mach-omap2/serial.c
===================================================================
@@ -157,18 +157,15 @@ static void omap_serial_kick(void)
 		NSEC_PER_SEC);
 }
 
-void omap_serial_enable_clocks(int enable)
+void omap_serial_enable_clocks(int enable, int unum)
 {
-	int i;
-	for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
-		if (uart_ick[i] && uart_fck[i]) {
-			if (enable) {
-				clk_enable(uart_ick[i]);
-				clk_enable(uart_fck[i]);
-			} else {
-				clk_disable(uart_ick[i]);
-				clk_disable(uart_fck[i]);
-			}
+	if (uart_ick[unum] && uart_fck[unum]) {
+		if (enable) {
+			clk_enable(uart_ick[unum]);
+			clk_enable(uart_fck[unum]);
+		} else {
+			clk_disable(uart_ick[unum]);
+			clk_disable(uart_fck[unum]);
 		}
 	}
 }
include/asm-arm/arch-omap/common.h +1 -1
Index: linux-omap-2.6/include/asm-arm/arch-omap/common.h
===================================================================
@@ -34,7 +34,7 @@ struct sys_timer;
 extern void omap_map_common_io(void);
 extern struct sys_timer omap_timer;
 extern void omap_serial_init(void);
-extern void omap_serial_enable_clocks(int enable);
+extern void omap_serial_enable_clocks(int enable, int unum);
 extern int omap_serial_can_sleep(void);
 extern void omap_gpio_save(void);
 extern void omap_gpio_restore(void);
#1 lore raw
Quoted 396 lines · ext Rajendra Nayak

This patch adds the CORE context save/restore routines
- save/restores the following
1) PRCM registers
2) INTC context
3) System Control module context
4) Padconf

---
 arch/arm/mach-omap2/cpuidle34xx.c   |  546 +++++++++++++++++++++++++++++++-----
 arch/arm/mach-omap2/cpuidle34xx.h   |   32 +-
 arch/arm/mach-omap2/pm34xx.c        |   45 ++
 arch/arm/mach-omap2/prm.h           |    2 
 arch/arm/mach-omap2/serial.c        |   19 -
 arch/arm/mach-omap2/sleep34xx.S     |   12 
 arch/arm/plat-omap/sram.c           |   15 
 include/asm-arm/arch-omap/common.h  |    2 
 include/asm-arm/arch-omap/control.h |   22 +
 include/asm-arm/arch-omap/prcm.h    |   58 +++
 10 files changed, 646 insertions(+), 107 deletions(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.c
===================================================================

arch/arm/mach-omap2/cpuidle34xx.c +353 -0
@@ -28,12 +28,22 @@
 #include <asm/arch/powerdomain.h>
 #include <asm/arch/clockdomain.h>
 #include <asm/arch/gpio.h>
+#include <asm/arch/gpmc.h>
+#include <asm/arch/control.h>
+#include <linux/sched.h>
 #include "cpuidle34xx.h"
+#include "cm.h"
+#include "cm-regbits-34xx.h"
+#include "prm-regbits-34xx.h"
+#include "prm.h"
+#include "pm.h"
+#include "clock34xx.h"
 
 #ifdef CONFIG_CPU_IDLE
 
 struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES];
 struct omap3_processor_cx current_cx_state;
+static int padconf_saved;
 
 static int omap3_idle_bm_check(void)
 {
@@ -42,6 +52,379 @@ static int omap3_idle_bm_check(void)
 	return 0;
 }
 
+void omap3_save_prcm_ctx(void)
+{
+	prcm_sleep_save[1] = omap_readl(INTC_MIR_0);
+	prcm_sleep_save[2] = omap_readl(INTC_MIR_1);
+	prcm_sleep_save[3] = omap_readl(INTC_MIR_2);
+	prcm_sleep_save[4] = omap_readl(CONTROL_PADCONF_SYS_NIRQ);
+	prcm_sleep_save[5] = omap_readl(OMAP34XX_GPIO1_IRQENABLE1);
+	prcm_sleep_save[6] = omap_readl(OMAP34XX_GPIO1_WAKEUPEN);
+	prcm_sleep_save[7] = cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL2);
+	prcm_sleep_save[8] = __raw_readl(OMAP3430_CM_SYSCONFIG);
+	prcm_sleep_save[9] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSEL);
+	prcm_sleep_save[10] = cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
+	prcm_sleep_save[11] = cm_read_mod_reg(OMAP3430_DSS_MOD, CM_CLKSEL);
+	prcm_sleep_save[12] = cm_read_mod_reg(OMAP3430_CAM_MOD, CM_CLKSEL);
+	prcm_sleep_save[13] = cm_read_mod_reg(OMAP3430_PER_MOD, CM_CLKSEL);
+	prcm_sleep_save[14] = cm_read_mod_reg(OMAP3430_EMU_MOD, CM_CLKSEL1);
+	prcm_sleep_save[15] = cm_read_mod_reg(OMAP3430_EMU_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[16] = cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[17] = cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKSEL5);
+	prcm_sleep_save[18] = __raw_readl(OMAP3430_CM_POLCTRL);
+	prcm_sleep_save[19] = cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_FCLKEN);
+	prcm_sleep_save[20] = cm_read_mod_reg(CORE_MOD, CM_FCLKEN1);
+	prcm_sleep_save[21] = cm_read_mod_reg(CORE_MOD, OMAP3430ES2_CM_FCLKEN3);
+	prcm_sleep_save[22] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_FCLKEN);
+	prcm_sleep_save[23] = cm_read_mod_reg(WKUP_MOD, CM_FCLKEN);
+	prcm_sleep_save[24] = cm_read_mod_reg(OMAP3430_DSS_MOD, CM_FCLKEN);
+	prcm_sleep_save[25] = cm_read_mod_reg(OMAP3430_CAM_MOD, CM_FCLKEN);
+	prcm_sleep_save[26] = cm_read_mod_reg(OMAP3430_PER_MOD, CM_FCLKEN);
+	prcm_sleep_save[27] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      CM_FCLKEN);
+	prcm_sleep_save[28] = cm_read_mod_reg(CORE_MOD, CM_ICLKEN1);
+	prcm_sleep_save[29] = cm_read_mod_reg(CORE_MOD, CM_ICLKEN2);
+	prcm_sleep_save[30] = cm_read_mod_reg(CORE_MOD, CM_ICLKEN3);
+	prcm_sleep_save[31] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_ICLKEN);
+	prcm_sleep_save[32] = cm_read_mod_reg(WKUP_MOD, CM_ICLKEN);
+	prcm_sleep_save[33] = cm_read_mod_reg(OMAP3430_DSS_MOD, CM_ICLKEN);
+	prcm_sleep_save[34] = cm_read_mod_reg(OMAP3430_CAM_MOD, CM_ICLKEN);
+	prcm_sleep_save[35] = cm_read_mod_reg(OMAP3430_PER_MOD, CM_ICLKEN);
+	prcm_sleep_save[36] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      CM_ICLKEN);
+	prcm_sleep_save[37] = cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[38] = cm_read_mod_reg(MPU_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[39] = cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[40] = cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[41] = cm_read_mod_reg(MPU_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[42] = cm_read_mod_reg(CORE_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[43] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD,
+							      CM_CLKSTCTRL);
+	prcm_sleep_save[44] = cm_read_mod_reg(OMAP3430_DSS_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[45] = cm_read_mod_reg(OMAP3430_CAM_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[46] = cm_read_mod_reg(OMAP3430_PER_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[47] = cm_read_mod_reg(OMAP3430_NEON_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[48] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      CM_CLKSTCTRL);
+	prcm_sleep_save[49] = cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE1);
+	prcm_sleep_save[50] = cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[51] = cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE3);
+	prcm_sleep_save[52] = cm_read_mod_reg(WKUP_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[53] = cm_read_mod_reg(OMAP3430_DSS_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[54] = cm_read_mod_reg(OMAP3430_CAM_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[55] = cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[56] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      CM_AUTOIDLE);
+	prcm_sleep_save[57] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD,
+						      OMAP3430_CM_SLEEPDEP);
+	prcm_sleep_save[58] = cm_read_mod_reg(OMAP3430_DSS_MOD,
+						      OMAP3430_CM_SLEEPDEP);
+	prcm_sleep_save[59] = cm_read_mod_reg(OMAP3430_CAM_MOD,
+						      OMAP3430_CM_SLEEPDEP);
+	prcm_sleep_save[60] = cm_read_mod_reg(OMAP3430_PER_MOD,
+						      OMAP3430_CM_SLEEPDEP);
+	prcm_sleep_save[61] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+						      OMAP3430_CM_SLEEPDEP);
+	prcm_sleep_save[62] = __raw_readl(OMAP3430_CM_CLKOUT_CTRL);
+	prcm_sleep_save[63] = __raw_readl(OMAP3430_PRM_CLKOUT_CTRL);
+	prcm_sleep_save[64] = prm_read_mod_reg(OMAP3430ES2_SGX_MOD, PM_WKDEP);
+	prcm_sleep_save[65] = prm_read_mod_reg(OMAP3430_DSS_MOD, PM_WKDEP);
+	prcm_sleep_save[66] = prm_read_mod_reg(OMAP3430_CAM_MOD, PM_WKDEP);
+	prcm_sleep_save[67] = prm_read_mod_reg(OMAP3430_PER_MOD, PM_WKDEP);
+	prcm_sleep_save[68] = prm_read_mod_reg(OMAP3430_NEON_MOD, PM_WKDEP);
+	prcm_sleep_save[69] = prm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							       PM_WKDEP);
+	prcm_sleep_save[70] = prm_read_mod_reg(CORE_MOD,
+					      OMAP3430_PM_MPUGRPSEL1);
+	prcm_sleep_save[71] = prm_read_mod_reg(OMAP3430_IVA2_MOD,
+					      OMAP3430_PM_IVAGRPSEL1);
+	prcm_sleep_save[72] = prm_read_mod_reg(CORE_MOD,
+					      OMAP3430ES2_PM_MPUGRPSEL3);
+	prcm_sleep_save[73] = prm_read_mod_reg(CORE_MOD,
+					      OMAP3430ES2_PM_IVAGRPSEL3);
+	prcm_sleep_save[74] = prm_read_mod_reg(WKUP_MOD, OMAP3430_PM_MPUGRPSEL);
+	prcm_sleep_save[75] = prm_read_mod_reg(WKUP_MOD,
+					      OMAP3430_PM_IVAGRPSEL);
+	prcm_sleep_save[76] = prm_read_mod_reg(OMAP3430_PER_MOD,
+					      OMAP3430_PM_MPUGRPSEL);
+	prcm_sleep_save[77] = prm_read_mod_reg(OMAP3430_PER_MOD,
+					      OMAP3430_PM_IVAGRPSEL);
+	prcm_sleep_save[78] = prm_read_mod_reg(WKUP_MOD, PM_WKEN);
+	return;
+}
+
+void omap3_restore_prcm_ctx(void)
+{
+	omap_writel(prcm_sleep_save[1], INTC_MIR_0);
+	omap_writel(prcm_sleep_save[2], INTC_MIR_1);
+	omap_writel(prcm_sleep_save[3], INTC_MIR_2);
+	omap_writel(prcm_sleep_save[4], CONTROL_PADCONF_SYS_NIRQ);
+	omap_writel(prcm_sleep_save[5], OMAP34XX_GPIO1_IRQENABLE1);
+	omap_writel(prcm_sleep_save[6], OMAP34XX_GPIO1_WAKEUPEN);
+	cm_write_mod_reg(prcm_sleep_save[7], OMAP3430_IVA2_MOD, CM_CLKSEL2);
+	__raw_writel(prcm_sleep_save[8], OMAP3430_CM_SYSCONFIG);
+	cm_write_mod_reg(prcm_sleep_save[9], OMAP3430ES2_SGX_MOD, CM_CLKSEL);
+	cm_write_mod_reg(prcm_sleep_save[10], WKUP_MOD, CM_CLKSEL);
+	cm_write_mod_reg(prcm_sleep_save[11], OMAP3430_DSS_MOD, CM_CLKSEL);
+	cm_write_mod_reg(prcm_sleep_save[12], OMAP3430_CAM_MOD, CM_CLKSEL);
+	cm_write_mod_reg(prcm_sleep_save[13], OMAP3430_PER_MOD, CM_CLKSEL);
+	cm_write_mod_reg(prcm_sleep_save[14], OMAP3430_EMU_MOD, CM_CLKSEL1);
+	cm_write_mod_reg(prcm_sleep_save[15], OMAP3430_EMU_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[16], PLL_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[17], PLL_MOD, OMAP3430ES2_CM_CLKSEL5);
+	__raw_writel(prcm_sleep_save[18], OMAP3430_CM_POLCTRL);
+	cm_write_mod_reg(prcm_sleep_save[19], OMAP3430_IVA2_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[20], CORE_MOD, CM_FCLKEN1);
+	cm_write_mod_reg(prcm_sleep_save[21], CORE_MOD, OMAP3430ES2_CM_FCLKEN3);
+	cm_write_mod_reg(prcm_sleep_save[22], OMAP3430ES2_SGX_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[23], WKUP_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[24], OMAP3430_DSS_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[25], OMAP3430_CAM_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[26], OMAP3430_PER_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[27], OMAP3430ES2_USBHOST_MOD,
+							       CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[28], CORE_MOD, CM_ICLKEN1);
+	cm_write_mod_reg(prcm_sleep_save[29], CORE_MOD, CM_ICLKEN2);
+	cm_write_mod_reg(prcm_sleep_save[30], CORE_MOD, CM_ICLKEN3);
+	cm_write_mod_reg(prcm_sleep_save[31], OMAP3430ES2_SGX_MOD, CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[32], WKUP_MOD, CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[33], OMAP3430_DSS_MOD, CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[34], OMAP3430_CAM_MOD, CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[35], OMAP3430_PER_MOD, CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[36], OMAP3430ES2_USBHOST_MOD,
+								CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[37], OMAP3430_IVA2_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[38], MPU_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[39], PLL_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[40], OMAP3430_IVA2_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[41], MPU_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[42], CORE_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[43], OMAP3430ES2_SGX_MOD,
+						       CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[44], OMAP3430_DSS_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[45], OMAP3430_CAM_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[46], OMAP3430_PER_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[47], OMAP3430_NEON_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[48], OMAP3430ES2_USBHOST_MOD,
+							       CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[49], CORE_MOD, CM_AUTOIDLE1);
+	cm_write_mod_reg(prcm_sleep_save[50], CORE_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[51], CORE_MOD, CM_AUTOIDLE3);
+	cm_write_mod_reg(prcm_sleep_save[52], WKUP_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[53], OMAP3430_DSS_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[54], OMAP3430_CAM_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[55], OMAP3430_PER_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[56], OMAP3430ES2_USBHOST_MOD,
+							       CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[57], OMAP3430ES2_SGX_MOD,
+						       OMAP3430_CM_SLEEPDEP);
+	cm_write_mod_reg(prcm_sleep_save[58], OMAP3430_DSS_MOD,
+						       OMAP3430_CM_SLEEPDEP);
+	cm_write_mod_reg(prcm_sleep_save[59], OMAP3430_CAM_MOD,
+						       OMAP3430_CM_SLEEPDEP);
+	cm_write_mod_reg(prcm_sleep_save[60], OMAP3430_PER_MOD,
+						       OMAP3430_CM_SLEEPDEP);
+	cm_write_mod_reg(prcm_sleep_save[61], OMAP3430ES2_USBHOST_MOD,
+						       OMAP3430_CM_SLEEPDEP);
+	__raw_writel(prcm_sleep_save[62], OMAP3430_CM_CLKOUT_CTRL);
+	__raw_writel(prcm_sleep_save[63], OMAP3430_PRM_CLKOUT_CTRL);
+	prm_write_mod_reg(prcm_sleep_save[64], OMAP3430ES2_SGX_MOD, PM_WKDEP);
+	prm_write_mod_reg(prcm_sleep_save[65], OMAP3430_DSS_MOD, PM_WKDEP);
+	prm_write_mod_reg(prcm_sleep_save[66], OMAP3430_CAM_MOD, PM_WKDEP);
+	prm_write_mod_reg(prcm_sleep_save[67], OMAP3430_PER_MOD, PM_WKDEP);
+	prm_write_mod_reg(prcm_sleep_save[68], OMAP3430_NEON_MOD, PM_WKDEP);
+	prm_write_mod_reg(prcm_sleep_save[69], OMAP3430ES2_USBHOST_MOD,
+							       PM_WKDEP);
+	prm_write_mod_reg(prcm_sleep_save[70], CORE_MOD,
+					       OMAP3430_PM_MPUGRPSEL1);
+	prm_write_mod_reg(prcm_sleep_save[71], OMAP3430_IVA2_MOD,
+					       OMAP3430_PM_IVAGRPSEL1);
+	prm_write_mod_reg(prcm_sleep_save[72], CORE_MOD,
+					       OMAP3430ES2_PM_MPUGRPSEL3);
+	prm_write_mod_reg(prcm_sleep_save[73], CORE_MOD,
+					       OMAP3430ES2_PM_IVAGRPSEL3);
+	prm_write_mod_reg(prcm_sleep_save[74], WKUP_MOD,
+					       OMAP3430_PM_MPUGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[75], WKUP_MOD,
+					       OMAP3430_PM_IVAGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[76], OMAP3430_PER_MOD,
+					       OMAP3430_PM_MPUGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[77], OMAP3430_PER_MOD,
+					       OMAP3430_PM_IVAGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[78], WKUP_MOD, PM_WKEN);
+	return;
+}
+
+static void omap_save_intc_ctx(void)
+{
+	int ind = 0;
+	intc_context.sysconfig = omap_readl(INTCPS_SYSCONFIG);
+	intc_context.protection =  omap_readl(INTCPS_PROTECTION);
+	intc_context.idle = omap_readl(INTCPS_IDLE);
+	intc_context.threshold = omap_readl(INTCPS_THRESHOLD);
+	for (ind = 0; ind < 96; ind++)
+	       intc_context.ilr[ind] =
+		       omap_readl(INTC_BASE + (0x100 + 0x4*ind));
+	/* MIRs are saved and restore with other PRCM registers */
+}
+
+static void omap_restore_intc_ctx(void)
+{
+	int ind = 0;
+	omap_writel(intc_context.sysconfig, INTCPS_SYSCONFIG);
+	omap_writel(intc_context.protection, INTCPS_PROTECTION);
+	omap_writel(intc_context.idle, INTCPS_IDLE);
+	omap_writel(intc_context.threshold, INTCPS_THRESHOLD);
+	for (ind = 0; ind < 96; ind++)
+	       omap_writel(intc_context.ilr[ind],
+		       INTC_BASE + (0x100 + 0x4*ind));
+	/* MIRs are saved and restore with other PRCM registers */
+}
+
+static void omap_save_control_ctx(void)
+{
+	control_ctx.sysconfig = omap_ctrl_readl(OMAP2_CONTROL_SYSCONFIG);
+	control_ctx.devconf0 = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
+	control_ctx.mem_dftrw0 = omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW0);
+	control_ctx.mem_dftrw1 = omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW1);
+	control_ctx.msuspendmux_0 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_0);
+	control_ctx.msuspendmux_1 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_1);
+	control_ctx.msuspendmux_2 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_2);
+	control_ctx.msuspendmux_3 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_3);
+	control_ctx.msuspendmux_4 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_4);
+	control_ctx.msuspendmux_5 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_5);
+	control_ctx.sec_ctrl = omap_ctrl_readl(OMAP2_CONTROL_SEC_CTRL);
+	control_ctx.devconf1 = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);
+	control_ctx.csirxfe = omap_ctrl_readl(OMAP343X_CONTROL_CSIRXFE);
+	control_ctx.iva2_bootaddr =
+		       omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTADDR);
+	control_ctx.iva2_bootmod =
+		       omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTMOD);
+	control_ctx.debobs_0 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_0);
+	control_ctx.debobs_1 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_1);
+	control_ctx.debobs_2 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_2);
+	control_ctx.debobs_3 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_3);
+	control_ctx.debobs_4 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_4);
+	control_ctx.debobs_5 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_5);
+	control_ctx.debobs_6 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_6);
+	control_ctx.debobs_7 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_7);
+	control_ctx.debobs_8 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_8);
+	control_ctx.prog_io0 = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO0);
+	control_ctx.prog_io1 = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO1);
+	control_ctx.dss_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_DSS_DPLL_SPREADING);
+	control_ctx.core_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_CORE_DPLL_SPREADING);
+	control_ctx.per_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_PER_DPLL_SPREADING);
+	control_ctx.usbhost_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);
+	control_ctx.pbias_lite = omap_ctrl_readl(OMAP343X_CONTROL_PBIAS_LITE);
+	control_ctx.temp_sensor = omap_ctrl_readl(OMAP343X_CONTROL_TEMP_SENSOR);
+	control_ctx.sramldo4 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO4);
+	control_ctx.sramldo5 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO5);
+	control_ctx.csi = omap_ctrl_readl(OMAP343X_CONTROL_CSI);
+	return;
+}
+
+static void omap_restore_control_ctx(void)
+{
+	omap_ctrl_writel(control_ctx.sysconfig, OMAP2_CONTROL_SYSCONFIG);
+	omap_ctrl_writel(control_ctx.devconf0, OMAP2_CONTROL_DEVCONF0);
+	omap_ctrl_writel(control_ctx.mem_dftrw0, OMAP343X_CONTROL_MEM_DFTRW0);
+	omap_ctrl_writel(control_ctx.mem_dftrw1, OMAP343X_CONTROL_MEM_DFTRW1);
+	omap_ctrl_writel(control_ctx.msuspendmux_0,
+					       OMAP2_CONTROL_MSUSPENDMUX_0);
+	omap_ctrl_writel(control_ctx.msuspendmux_1,
+					       OMAP2_CONTROL_MSUSPENDMUX_1);
+	omap_ctrl_writel(control_ctx.msuspendmux_2,
+					       OMAP2_CONTROL_MSUSPENDMUX_2);
+	omap_ctrl_writel(control_ctx.msuspendmux_3,
+					       OMAP2_CONTROL_MSUSPENDMUX_3);
+	omap_ctrl_writel(control_ctx.msuspendmux_4,
+					       OMAP2_CONTROL_MSUSPENDMUX_4);
+	omap_ctrl_writel(control_ctx.msuspendmux_5,
+					       OMAP2_CONTROL_MSUSPENDMUX_5);
+	omap_ctrl_writel(control_ctx.sec_ctrl, OMAP2_CONTROL_SEC_CTRL);
+	omap_ctrl_writel(control_ctx.devconf1, OMAP343X_CONTROL_DEVCONF1);
+	omap_ctrl_writel(control_ctx.csirxfe, OMAP343X_CONTROL_CSIRXFE);
+	omap_ctrl_writel(control_ctx.iva2_bootaddr,
+					       OMAP343X_CONTROL_IVA2_BOOTADDR);
+	omap_ctrl_writel(control_ctx.iva2_bootmod,
+					       OMAP343X_CONTROL_IVA2_BOOTMOD);
+	omap_ctrl_writel(control_ctx.debobs_0, OMAP343X_CONTROL_DEBOBS_0);
+	omap_ctrl_writel(control_ctx.debobs_1, OMAP343X_CONTROL_DEBOBS_1);
+	omap_ctrl_writel(control_ctx.debobs_2, OMAP343X_CONTROL_DEBOBS_2);
+	omap_ctrl_writel(control_ctx.debobs_3, OMAP343X_CONTROL_DEBOBS_3);
+	omap_ctrl_writel(control_ctx.debobs_4, OMAP343X_CONTROL_DEBOBS_4);
+	omap_ctrl_writel(control_ctx.debobs_5, OMAP343X_CONTROL_DEBOBS_5);
+	omap_ctrl_writel(control_ctx.debobs_6, OMAP343X_CONTROL_DEBOBS_6);
+	omap_ctrl_writel(control_ctx.debobs_7, OMAP343X_CONTROL_DEBOBS_7);
+	omap_ctrl_writel(control_ctx.debobs_8, OMAP343X_CONTROL_DEBOBS_8);
+	omap_ctrl_writel(control_ctx.prog_io0, OMAP343X_CONTROL_PROG_IO0);
+	omap_ctrl_writel(control_ctx.prog_io1, OMAP343X_CONTROL_PROG_IO1);
+	omap_ctrl_writel(control_ctx.dss_dpll_spreading,
+			       OMAP343X_CONTROL_DSS_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.core_dpll_spreading,
+			       OMAP343X_CONTROL_CORE_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.per_dpll_spreading,
+			       OMAP343X_CONTROL_PER_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.usbhost_dpll_spreading,
+			       OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.pbias_lite, OMAP343X_CONTROL_PBIAS_LITE);
+	omap_ctrl_writel(control_ctx.temp_sensor, OMAP343X_CONTROL_TEMP_SENSOR);
+	omap_ctrl_writel(control_ctx.sramldo4, OMAP343X_CONTROL_SRAMLDO4);
+	omap_ctrl_writel(control_ctx.sramldo5, OMAP343X_CONTROL_SRAMLDO5);
+	omap_ctrl_writel(control_ctx.csi, OMAP343X_CONTROL_CSI);
+	return;
+}
+
+void omap3_save_core_ctx(void)
+{
+	u32 control_padconf_off;
+
+	if (!padconf_saved) {
+	       /* Save the padconf registers */
+	       control_padconf_off = omap_readl(CONTROL_PADCONF_OFF);
+	       control_padconf_off |= 2;
+	       omap_writel(control_padconf_off, CONTROL_PADCONF_OFF);
+	       /* wait for the save to complete */

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 407

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +10 -0
+	       while (!omap_readl(CONTROL_GENERAL_PURPOSE_STATUS) & 0x1);
+	       padconf_saved = 1;
+	}
+	/* Save the Interrupt controller context */
+	omap_save_intc_ctx();
+	/* Save the GPMC context */
+	omap_save_gpmc_ctx();
+	/* Save the system control module context, padconf already save above*/
+	omap_save_control_ctx();
+	omap_save_uart_ctx(0);

This should be done in omap_serial_enable_clocks function.

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 408

Quoted 1 line
arch/arm/mach-omap2/cpuidle34xx.c +1 -0
+	omap_serial_enable_clocks(0, 0);

Why this is here?

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 409

Quoted 1 line
arch/arm/mach-omap2/cpuidle34xx.c +1 -0
+	omap_save_uart_ctx(1);

This should be done in omap_serial_enable_clocks function.

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 410

Quoted 1 line
arch/arm/mach-omap2/cpuidle34xx.c +1 -0
+	omap_serial_enable_clocks(0, 1);

Why this is here?

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+}
+
+void omap3_restore_core_ctx(void)
+{

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 424

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +10 -0
+	/* Restore the control module context, padconf restored by h/w */
+	omap_restore_control_ctx();
+	/* Restore the GPMC context */
+	omap_restore_gpmc_ctx();
+	/* Restore the interrupt controller context */
+	omap_restore_intc_ctx();
+	omap_serial_enable_clocks(1, 0);
+	omap_restore_uart_ctx(0);
+	omap_serial_enable_clocks(1, 1);
+	omap_restore_uart_ctx(1);

Same comments as above. You could move these uart restores to omap_serial_enable_clocks and restore always after enabling clock for some specific uart. Then as we have that interface to ask wether restore is needed then add if statement there.

Quoted 40 lines
arch/arm/mach-omap2/cpuidle34xx.c +13 -3
+	padconf_saved = 0;
+}
+
 /* omap3_enter_idle - Programs OMAP3 to enter the specified state.
  * returns the total time during which the system was idle.
  */
@@ -60,9 +443,15 @@ static int omap3_enter_idle(struct cpuid
 		return 0;
 	}
 
+	local_irq_disable();
+	local_fiq_disable();
+
 	/* Used to keep track of the total time in idle */
 	getnstimeofday(&ts_preidle);
 
+	if (cx->type > OMAP3_STATE_C1)
+		sched_clock_idle_sleep_event(); /* about to enter deep idle */
+
 	mpu_pd = pwrdm_lookup("mpu_pwrdm");
 	core_pd = pwrdm_lookup("core_pwrdm");
 	per_pd = pwrdm_lookup("per_pwrdm");
@@ -74,12 +463,13 @@ static int omap3_enter_idle(struct cpuid
 	pwrdm_clear_all_prev_pwrst(core_pd);
 	pwrdm_clear_all_prev_pwrst(per_pd);
 
-	if (omap_irq_pending())
-		return 0;
-
 	per_pwrst = pwrdm_read_pwrst(per_pd);
 	neon_pwrst = pwrdm_read_pwrst(neon_pd);
 
+	/* Do this before any changes to PRCM registers */
+	if (cx->core_state == PWRDM_POWER_OFF)
+		omap3_save_prcm_ctx();
+
 	/* Program MPU to target state */
 	if (cx->mpu_state < PWRDM_POWER_ON) {
 		if (neon_pwrst == PWRDM_POWER_ON) {

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 489

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +1 -0
@@ -96,15 +486,22 @@ static int omap3_enter_idle(struct cpuid
 		if (per_pwrst == PWRDM_POWER_ON) {
 			omap2_gpio_prepare_for_retention();
 			if (clocks_off_while_idle) {
+				omap3_save_per_ctx();

Gpio saving could be moved int per_gpio_clk_disable function.

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 492

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -1
 				per_gpio_clk_disable();
-				omap_serial_enable_clocks(0);
+				omap_save_uart_ctx(2);
+				omap_serial_enable_clocks(0, 2);

Same comment as for uarts in core domain.

Quoted 23 lines
arch/arm/mach-omap2/cpuidle34xx.c +9 -0
 			}
 		}
+		if (cx->core_state == PWRDM_POWER_OFF)
+			omap3_save_core_ctx();
 		pwrdm_set_next_pwrst(core_pd, cx->core_state);
 	}
 
 	*(scratchpad_restore_addr) = restore_pointer_address;
 
+	if (omap_irq_pending())
+		goto return_sleep_time;
+
 	/* Execute ARM wfi */
 	omap_sram_idle();
 
@@ -118,25 +515,41 @@ static int omap3_enter_idle(struct cpuid
 	}
 
 	if (cx->core_state < PWRDM_POWER_ON) {
+		if ((cx->core_state == PWRDM_POWER_OFF)
+		&& (pwrdm_read_prev_pwrst(core_pd) == PWRDM_POWER_OFF)) {
+			omap3_restore_core_ctx();
+			omap3_restore_prcm_ctx();

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 530

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +6 -1
+			omap3_restore_sram_ctx();
+		}
+		pwrdm_set_next_pwrst(core_pd, PWRDM_POWER_ON);
 		if (per_pwrst == PWRDM_POWER_ON) {
 			if (clocks_off_while_idle) {
-				omap_serial_enable_clocks(1);
+				omap_serial_enable_clocks(1, 2);
+				omap_restore_uart_ctx(2);
 				per_gpio_clk_enable();
+				omap3_restore_per_ctx();

And again these could be moved to the clock enable/disable functions.

Quoted 578 lines
arch/arm/mach-omap2/cpuidle34xx.c +69 -61
 			}
 			omap2_gpio_resume_after_retention();
 		}
-		pwrdm_set_next_pwrst(core_pd, PWRDM_POWER_ON);
 	}
 
 	pr_debug("MPU prev st:%x,NEON prev st:%x\n",
-			       pwrdm_read_prev_pwrst(mpu_pd),
-			       pwrdm_read_prev_pwrst(neon_pd));
+				pwrdm_read_prev_pwrst(mpu_pd),
+				pwrdm_read_prev_pwrst(neon_pd));
 	pr_debug("PER prev st:%x,CORE prev st:%x\n",
-			       pwrdm_read_prev_pwrst(per_pd),
-			       pwrdm_read_prev_pwrst(core_pd));
+				pwrdm_read_prev_pwrst(per_pd),
+				pwrdm_read_prev_pwrst(core_pd));
 
+return_sleep_time:
 	getnstimeofday(&ts_postidle);
 	ts_idle = timespec_sub(ts_postidle, ts_preidle);
+
+	if (cx->type > OMAP3_STATE_C1)
+		sched_clock_idle_wakeup_event(timespec_to_ns(&ts_idle));
+
+	local_irq_enable();
+	local_fiq_disable();
+
 	return (u32)timespec_to_ns(&ts_idle)/1000;
 }
 
@@ -187,79 +600,79 @@ DEFINE_PER_CPU(struct cpuidle_device, om
 void omap_init_power_states(void)
 {
 	/* C0 . System executing code */
-	omap3_power_states[0].valid = 1;
-	omap3_power_states[0].type = OMAP3_STATE_C0;
-	omap3_power_states[0].sleep_latency = 0;
-	omap3_power_states[0].wakeup_latency = 0;
-	omap3_power_states[0].threshold = 0;
-	omap3_power_states[0].mpu_state = PWRDM_POWER_ON;
-	omap3_power_states[0].core_state = PWRDM_POWER_ON;
-	omap3_power_states[0].flags = CPUIDLE_FLAG_SHALLOW;
+	omap3_power_states[OMAP3_STATE_C0].valid = 1;
+	omap3_power_states[OMAP3_STATE_C0].type = OMAP3_STATE_C0;
+	omap3_power_states[OMAP3_STATE_C0].sleep_latency = 0;
+	omap3_power_states[OMAP3_STATE_C0].wakeup_latency = 0;
+	omap3_power_states[OMAP3_STATE_C0].threshold = 0;
+	omap3_power_states[OMAP3_STATE_C0].mpu_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C0].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C0].flags = CPUIDLE_FLAG_SHALLOW;
 
 	/* C1 . MPU WFI + Core active */
-	omap3_power_states[1].valid = 1;
-	omap3_power_states[1].type = OMAP3_STATE_C1;
-	omap3_power_states[1].sleep_latency = 10;
-	omap3_power_states[1].wakeup_latency = 10;
-	omap3_power_states[1].threshold = 30;
-	omap3_power_states[1].mpu_state = PWRDM_POWER_ON;
-	omap3_power_states[1].core_state = PWRDM_POWER_ON;
-	omap3_power_states[1].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C1].valid = 1;
+	omap3_power_states[OMAP3_STATE_C1].type = OMAP3_STATE_C1;
+	omap3_power_states[OMAP3_STATE_C1].sleep_latency = 10;
+	omap3_power_states[OMAP3_STATE_C1].wakeup_latency = 10;
+	omap3_power_states[OMAP3_STATE_C1].threshold = 30;
+	omap3_power_states[OMAP3_STATE_C1].mpu_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C1].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C1].flags = CPUIDLE_FLAG_TIME_VALID |
 						CPUIDLE_FLAG_SHALLOW;
 
 	/* C2 . MPU CSWR + Core active */
-	omap3_power_states[2].valid = 1;
-	omap3_power_states[2].type = OMAP3_STATE_C2;
-	omap3_power_states[2].sleep_latency = 50;
-	omap3_power_states[2].wakeup_latency = 50;
-	omap3_power_states[2].threshold = 300;
-	omap3_power_states[2].mpu_state = PWRDM_POWER_RET;
-	omap3_power_states[2].core_state = PWRDM_POWER_ON;
-	omap3_power_states[2].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C2].valid = 1;
+	omap3_power_states[OMAP3_STATE_C2].type = OMAP3_STATE_C2;
+	omap3_power_states[OMAP3_STATE_C2].sleep_latency = 50;
+	omap3_power_states[OMAP3_STATE_C2].wakeup_latency = 50;
+	omap3_power_states[OMAP3_STATE_C2].threshold = 300;
+	omap3_power_states[OMAP3_STATE_C2].mpu_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C2].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C2].flags = CPUIDLE_FLAG_TIME_VALID |
 						CPUIDLE_FLAG_BALANCED;
 
 	/* C3 . MPU OFF + Core active */
-	omap3_power_states[3].valid = 1;
-	omap3_power_states[3].type = OMAP3_STATE_C3;
-	omap3_power_states[3].sleep_latency = 1500;
-	omap3_power_states[3].wakeup_latency = 1800;
-	omap3_power_states[3].threshold = 4000;
-	omap3_power_states[3].mpu_state = PWRDM_POWER_OFF;
-	omap3_power_states[3].core_state = PWRDM_POWER_ON;
-	omap3_power_states[3].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C3].valid = 1;
+	omap3_power_states[OMAP3_STATE_C3].type = OMAP3_STATE_C3;
+	omap3_power_states[OMAP3_STATE_C3].sleep_latency = 1500;
+	omap3_power_states[OMAP3_STATE_C3].wakeup_latency = 1800;
+	omap3_power_states[OMAP3_STATE_C3].threshold = 4000;
+	omap3_power_states[OMAP3_STATE_C3].mpu_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C3].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C3].flags = CPUIDLE_FLAG_TIME_VALID |
 			CPUIDLE_FLAG_BALANCED | CPUIDLE_FLAG_CHECK_BM;
 
 	/* C4 . MPU CSWR + Core CSWR*/
-	omap3_power_states[4].valid = 1;
-	omap3_power_states[4].type = OMAP3_STATE_C4;
-	omap3_power_states[4].sleep_latency = 2500;
-	omap3_power_states[4].wakeup_latency = 7500;
-	omap3_power_states[4].threshold = 12000;
-	omap3_power_states[4].mpu_state = PWRDM_POWER_RET;
-	omap3_power_states[4].core_state = PWRDM_POWER_RET;
-	omap3_power_states[4].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C4].valid = 1;
+	omap3_power_states[OMAP3_STATE_C4].type = OMAP3_STATE_C4;
+	omap3_power_states[OMAP3_STATE_C4].sleep_latency = 2500;
+	omap3_power_states[OMAP3_STATE_C4].wakeup_latency = 7500;
+	omap3_power_states[OMAP3_STATE_C4].threshold = 12000;
+	omap3_power_states[OMAP3_STATE_C4].mpu_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C4].core_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C4].flags = CPUIDLE_FLAG_TIME_VALID |
 			CPUIDLE_FLAG_BALANCED | CPUIDLE_FLAG_CHECK_BM;
 
 	/* C5 . MPU OFF + Core CSWR */
-	omap3_power_states[5].valid = 1;
-	omap3_power_states[5].type = OMAP3_STATE_C5;
-	omap3_power_states[5].sleep_latency = 3000;
-	omap3_power_states[5].wakeup_latency = 8500;
-	omap3_power_states[5].threshold = 15000;
-	omap3_power_states[5].mpu_state = PWRDM_POWER_OFF;
-	omap3_power_states[5].core_state = PWRDM_POWER_RET;
-	omap3_power_states[5].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C5].valid = 1;
+	omap3_power_states[OMAP3_STATE_C5].type = OMAP3_STATE_C5;
+	omap3_power_states[OMAP3_STATE_C5].sleep_latency = 3000;
+	omap3_power_states[OMAP3_STATE_C5].wakeup_latency = 8500;
+	omap3_power_states[OMAP3_STATE_C5].threshold = 15000;
+	omap3_power_states[OMAP3_STATE_C5].mpu_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C5].core_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C5].flags = CPUIDLE_FLAG_TIME_VALID |
 			CPUIDLE_FLAG_BALANCED | CPUIDLE_FLAG_CHECK_BM;
 
 	/* C6 . MPU OFF + Core OFF */
-	omap3_power_states[6].valid = 0;
-	omap3_power_states[6].type = OMAP3_STATE_C6;
-	omap3_power_states[6].sleep_latency = 10000;
-	omap3_power_states[6].wakeup_latency = 30000;
-	omap3_power_states[6].threshold = 300000;
-	omap3_power_states[6].mpu_state = PWRDM_POWER_OFF;
-	omap3_power_states[6].core_state = PWRDM_POWER_OFF;
-	omap3_power_states[6].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C6].valid = 1;
+	omap3_power_states[OMAP3_STATE_C6].type = OMAP3_STATE_C6;
+	omap3_power_states[OMAP3_STATE_C6].sleep_latency = 10000;
+	omap3_power_states[OMAP3_STATE_C6].wakeup_latency = 30000;
+	omap3_power_states[OMAP3_STATE_C6].threshold = 300000;
+	omap3_power_states[OMAP3_STATE_C6].mpu_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C6].core_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C6].flags = CPUIDLE_FLAG_TIME_VALID |
 			CPUIDLE_FLAG_DEEP | CPUIDLE_FLAG_CHECK_BM;
 }
 
@@ -277,6 +690,7 @@ int omap3_idle_init(void)
 	struct omap3_processor_cx *cx;
 	struct cpuidle_state *state;
 	struct cpuidle_device *dev;
+	char clk_name[11];
 
 	clear_scratchpad_contents();
 	save_scratchpad_contents();

Index: linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.h
===================================================================

arch/arm/mach-omap2/cpuidle34xx.h +29 -3
@@ -30,20 +30,41 @@
 #define OMAP3_STATE_C5 5 /* C5 - MPU OFF + Core RET */
 #define OMAP3_STATE_C6 6 /* C6 - MPU OFF + Core OFF */
 
-/* Currently, we support only upto C2 */
-#define MAX_SUPPORTED_STATES 3
+/* Interrupt Controller registers */
+#define INTC_BASE	0x48200000
+#define INTC_MIR_0	0x48200084
+#define INTC_MIR_1	0x482000A4
+#define INTC_MIR_2	0x482000C4
+#define INTCPS_SYSCONFIG	0x48200010
+#define INTCPS_PROTECTION	0x4820004C
+#define INTCPS_IDLE	0x48200050
+#define INTCPS_THRESHOLD	0x48200068
+
+#define CONTROL_PADCONF_SYS_NIRQ	0x480021E0
+#define CONTROL_PADCONF_OFF	0x48002270
+#define CONTROL_GENERAL_PURPOSE_STATUS	0x480022F4
+
+#define OMAP34XX_GPIO1_IRQENABLE1	0x4831001c
+#define OMAP34XX_GPIO1_WAKEUPEN	0x48310020
+#define OMAP34XX_GPIO1_FALLINGDETECT	0x4831004c
 
 extern unsigned short clocks_off_while_idle;
 extern void omap_sram_idle(void);
 extern int omap_irq_pending(void);
 extern void per_gpio_clk_enable(void);
 extern void per_gpio_clk_disable(void);
-extern void omap_serial_enable_clocks(int enable);
+extern void omap_serial_enable_clocks(int enable, int unum);
 extern int omap3_can_sleep();
 extern void clear_scratchpad_contents(void);
 extern void save_scratchpad_contents(void);
 extern u32 *scratchpad_restore_addr;
 extern u32 restore_pointer_address;
+extern void omap3_save_per_ctx();
+extern void omap3_restore_per_ctx();
+extern void omap_save_uart_ctx(int);
+extern void omap_restore_uart_ctx(int);
+extern void omap3_restore_sram_ctx();
+extern int omap3_can_sleep();
 
 struct omap3_processor_cx {
 	u8 valid;
@@ -59,5 +80,10 @@ struct omap3_processor_cx {
 void omap_init_power_states(void);
 int omap3_idle_init(void);
 
+/* TODO fix the size:100 */
+static unsigned int prcm_sleep_save[100];
+static struct int_controller_context intc_context;
+static struct control_module_context control_ctx;
+
 #endif /* ARCH_ARM_MACH_OMAP2_CPUIDLE_34XX */
 

Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c
===================================================================

arch/arm/mach-omap2/pm34xx.c +35 -10
@@ -154,7 +154,6 @@ static irqreturn_t prcm_interrupt_handle
 		cm_write_mod_reg(iclk, OMAP3430_PER_MOD, CM_ICLKEN);
 		cm_write_mod_reg(fclk, OMAP3430_PER_MOD, CM_FCLKEN);
 	}
-
 	if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0)) {
 		/* USBHOST */
 		wkst = prm_read_mod_reg(OMAP3430ES2_USBHOST_MOD, PM_WKST);
@@ -361,7 +360,9 @@ static void omap3_pm_idle(void)
 	omap2_gpio_prepare_for_retention();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(0);
+		omap_serial_enable_clocks(0, 0);
+		omap_serial_enable_clocks(0, 1);
+		omap_serial_enable_clocks(0, 2);
 		/* XXX This is for gpio fclk hack. Will be removed as
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_disable();
@@ -370,7 +371,9 @@ static void omap3_pm_idle(void)
 	omap_sram_idle();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(1);
+		omap_serial_enable_clocks(1, 0);
+		omap_serial_enable_clocks(1, 1);
+		omap_serial_enable_clocks(1, 2);
 		/* XXX This is for gpio fclk hack. Will be removed as
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_enable();
@@ -412,7 +415,9 @@ static int omap3_pm_suspend(void)
 	omap2_gpio_prepare_for_retention();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(0);
+		omap_serial_enable_clocks(0, 0);
+		omap_serial_enable_clocks(0, 1);
+		omap_serial_enable_clocks(0, 2);
 		/* XXX This is for gpio fclk hack. Will be removed as
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_disable();
@@ -421,7 +426,9 @@ static int omap3_pm_suspend(void)
 	omap_sram_idle();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(1);
+		omap_serial_enable_clocks(1, 0);
+		omap_serial_enable_clocks(1, 1);
+		omap_serial_enable_clocks(1, 2);
 		/* XXX This is for gpio fclk hack. Will be removed as
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_enable();
@@ -629,6 +636,16 @@ static void __init prcm_setup_regs(void)
 			OCP_MOD, OMAP2_PRM_IRQENABLE_MPU_OFFSET);
 }
 
+void omap3_save_per_ctx(void)
+{
+	omap_gpio_save();
+}
+
+void omap3_restore_per_ctx(void)
+{
+	omap_gpio_restore();
+}
+
 static int __init pwrdms_setup(struct powerdomain *pwrdm)
 {
 	struct power_state *pwrst;
@@ -652,6 +669,12 @@ static int __init pwrdms_setup(struct po
 	return set_pwrdm_state(pwrst->pwrdm, pwrst->next_state);
 }
 
+void omap_push_sram_idle()
+{
+	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
+					omap34xx_cpu_suspend_sz);
+}
+
 int __init omap3_pm_init(void)
 {
 	struct power_state *pwrst;
@@ -663,6 +686,7 @@ int __init omap3_pm_init(void)
 	/* XXX prcm_setup_regs needs to be before enabling hw
 	 * supervised mode for powerdomains */
 	prcm_setup_regs();
+	save_scratchpad_contents();
 
 	ret = request_irq(INT_34XX_PRCM_MPU_IRQ,
 			  (irq_handler_t)prcm_interrupt_handler,
@@ -685,9 +709,7 @@ int __init omap3_pm_init(void)
 		goto err2;
 	}
 
-	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
-					omap34xx_cpu_suspend_sz);
-
+	omap_push_sram_idle();
 	suspend_set_ops(&omap_pm_ops);
 
 #ifndef CONFIG_CPU_IDLE
@@ -779,10 +801,13 @@ void save_scratchpad_contents(void)
 	*(scratchpad_address++) = __raw_readl(OMAP3430_PRM_CLKSEL);
 	*(scratchpad_address++) = cm_read_mod_reg(CORE_MOD, CM_CLKSEL);
 	*(scratchpad_address++) = cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
+	/* TODO OMAP3430_CM_CLKEN_PLL is defined 0x4 */
+	/**(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
+					OMAP3430_CM_CLKEN_PLL);*/
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
-					OMAP3430_CM_CLKEN_PLL);
+					0x0);
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
-					OMAP3430_CM_AUTOIDLE_PLL);
+					CM_AUTOIDLE);
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
 					OMAP3430_CM_CLKSEL1_PLL);
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,

Index: linux-omap-2.6/arch/arm/mach-omap2/prm.h
===================================================================

arch/arm/mach-omap2/prm.h +2 -0
@@ -137,9 +137,11 @@
 
 #define OMAP3430_PM_MPUGRPSEL				0x00a4
 #define OMAP3430_PM_MPUGRPSEL1				OMAP3430_PM_MPUGRPSEL
+#define OMAP3430ES2_PM_MPUGRPSEL3			0x00f8
 
 #define OMAP3430_PM_IVAGRPSEL				0x00a8
 #define OMAP3430_PM_IVAGRPSEL1				OMAP3430_PM_IVAGRPSEL
+#define OMAP3430ES2_PM_IVAGRPSEL3			0x00f4
 
 #define OMAP3430_PM_PREPWSTST				0x00e8
 

Index: linux-omap-2.6/arch/arm/mach-omap2/sleep34xx.S
===================================================================

arch/arm/mach-omap2/sleep34xx.S +7 -5
@@ -457,10 +457,12 @@ loop2:
 	mov     r9, r4
 	/* create working copy of max way size*/
 loop3:
-	/* factor way and cache number into r11 */
-	orr     r11, r10, r9, lsl r5
-	/* factor index number into r11 */
-	orr     r11, r11, r7, lsl r2
+ 	orr	r11, r10, r9, lsl r5	 @ factor way and cache number into r11
+ 	orr	r11, r11, r7, lsl r2	 @ factor index number into r11
+ 	lsl	r6, r9, r5
+ 	orr	r11, r10, r6		 @ factor way and cache number into r11
+ 	lsl	r6, r7, r2
+ 	orr	r11, r11, r6		 @ factor index number into r11
 	/*clean & invalidate by set/way */
 	mcr     p15, 0, r11, c7, c10, 2
 	/* decrement the way*/
@@ -475,7 +477,7 @@ skip:
 	cmp     r3, r10
 	bgt     loop1
 finished:
-	/*swith back to cache level 0 */
+	/*switch back to cache level 0 */
 	mov     r10, #0
 	/* select current cache level in cssr */
 	mcr     p15, 2, r10, c0, c0, 0

Index: linux-omap-2.6/arch/arm/plat-omap/sram.c
===================================================================

arch/arm/plat-omap/sram.c +10 -5
@@ -26,6 +26,7 @@
 #include <asm/arch/board.h>
 
 #include <asm/arch/control.h>
+#include <asm/arch/pm.h>
 
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 # include "../mach-omap2/prm.h"
@@ -75,6 +76,8 @@ extern unsigned long omapfb_reserve_sram
 					 unsigned long sram_size,
 					 unsigned long pstart_avail,
 					 unsigned long size_avail);
+extern void (*_omap_sram_idle)(u32 *addr, int save_state);
+extern void omap_push_sram_idle();
 
 /*
  * Depending on the target RAMFS firewall setup, the public usable amount of
@@ -108,6 +111,7 @@ static int is_sram_locked(void)
 		return 1; /* assume locked with no PPA or security driver */
 }
 
+
 /*
  * The amount of SRAM depends on the core type.
  * Note that we cannot try to test for SRAM here because writes
@@ -372,16 +376,15 @@ u32 omap2_sram_configure_core_dpll(u32 m
 }
 
 /* REVISIT: Should this be same as omap34xx_sram_init() after off-idle? */
-void restore_sram_functions(void)
+void omap3_restore_sram_ctx(void)
 {
 	omap_sram_ceil = omap_sram_base + omap_sram_size;
-
 	_omap2_sram_reprogram_gpmc = omap_sram_push(omap34xx_sram_reprogram_gpmc,
-		omap34xx_sram_reprogram_gpmc_sz);
-
+				omap34xx_sram_reprogram_gpmc_sz);
 	_omap2_sram_configure_core_dpll =
 			omap_sram_push(omap34xx_sram_configure_core_dpll,
-					omap34xx_sram_configure_core_dpll_sz);
+			omap34xx_sram_configure_core_dpll_sz);
+	omap_push_sram_idle();
 }
 
 int __init omap34xx_sram_init(void)
@@ -401,6 +404,8 @@ int __init omap34xx_sram_init(void)
 	_omap2_sram_configure_core_dpll =
 				omap_sram_push(omap34xx_sram_configure_core_dpll,
 					omap34xx_sram_configure_core_dpll_sz);
+	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
+					omap34xx_cpu_suspend_sz);
 
 	return 0;
 }

Index: linux-omap-2.6/include/asm-arm/arch-omap/prcm.h
===================================================================

include/asm-arm/arch-omap/prcm.h +53 -5
@@ -26,9 +26,57 @@
 u32 omap_prcm_get_reset_sources(void);
 void omap_prcm_arch_reset(char mode);
 
-#endif
-
-
-
-
+#ifdef CONFIG_ARCH_OMAP3
+/* Structure to save interrupt controller context */
+struct int_controller_context {
+	u32 sysconfig;
+	u32 protection;
+	u32 idle;
+	u32 threshold;
+	u32 ilr[96];
+	u32 mir_0;
+	u32 mir_1;
+	u32 mir_2;
+};
+
+/* Structure to save control module context */
+struct control_module_context {
+	u32 sysconfig;
+	u32 devconf0;
+	u32 mem_dftrw0;
+	u32 mem_dftrw1;
+	u32 msuspendmux_0;
+	u32 msuspendmux_1;
+	u32 msuspendmux_2;
+	u32 msuspendmux_3;
+	u32 msuspendmux_4;
+	u32 msuspendmux_5;
+	u32 sec_ctrl;
+	u32 devconf1;
+	u32 csirxfe;
+	u32 iva2_bootaddr;
+	u32 iva2_bootmod;
+	u32 debobs_0;
+	u32 debobs_1;
+	u32 debobs_2;
+	u32 debobs_3;
+	u32 debobs_4;
+	u32 debobs_5;
+	u32 debobs_6;
+	u32 debobs_7;
+	u32 debobs_8;
+	u32 prog_io0;
+	u32 prog_io1;
+	u32 dss_dpll_spreading;
+	u32 core_dpll_spreading;
+	u32 per_dpll_spreading;
+	u32 usbhost_dpll_spreading;
+	u32 pbias_lite;
+	u32 temp_sensor;
+	u32 sramldo4;
+	u32 sramldo5;
+	u32 csi;
+};
 
+#endif /* CONFIG_ARCH_OMAP3 */
+#endif /* __ASM_ARM_ARCH_OMAP_PRCM_H */

Index: linux-omap-2.6/include/asm-arm/arch-omap/control.h
===================================================================

include/asm-arm/arch-omap/control.h +21 -1
@@ -149,7 +149,27 @@
 #define OMAP343X_CONTROL_FUSE_SR	(OMAP2_CONTROL_GENERAL + 0x0130)
 #define OMAP343X_CONTROL_IVA2_BOOTADDR	(OMAP2_CONTROL_GENERAL + 0x0190)
 #define OMAP343X_CONTROL_IVA2_BOOTMOD	(OMAP2_CONTROL_GENERAL + 0x0194)
-#define OMAP343X_CONTROL_TEMP_SENSOR	(OMAP2_CONTROL_GENERAL + 0x02b4)
+#define OMAP343X_CONTROL_DEBOBS_0	(OMAP2_CONTROL_GENERAL + 0x01B0)
+#define OMAP343X_CONTROL_DEBOBS_1	(OMAP2_CONTROL_GENERAL + 0x01B4)
+#define OMAP343X_CONTROL_DEBOBS_2	(OMAP2_CONTROL_GENERAL + 0x01B8)
+#define OMAP343X_CONTROL_DEBOBS_3	(OMAP2_CONTROL_GENERAL + 0x01BC)
+#define OMAP343X_CONTROL_DEBOBS_4	(OMAP2_CONTROL_GENERAL + 0x01C0)
+#define OMAP343X_CONTROL_DEBOBS_5	(OMAP2_CONTROL_GENERAL + 0x01C4)
+#define OMAP343X_CONTROL_DEBOBS_6	(OMAP2_CONTROL_GENERAL + 0x01C8)
+#define OMAP343X_CONTROL_DEBOBS_7	(OMAP2_CONTROL_GENERAL + 0x01CC)
+#define OMAP343X_CONTROL_DEBOBS_8	(OMAP2_CONTROL_GENERAL + 0x01D0)
+#define OMAP343X_CONTROL_PROG_IO0	(OMAP2_CONTROL_GENERAL + 0x01D4)
+#define OMAP343X_CONTROL_PROG_IO1	(OMAP2_CONTROL_GENERAL + 0x01D8)
+#define OMAP343X_CONTROL_DSS_DPLL_SPREADING	(OMAP2_CONTROL_GENERAL + 0x01E0)
+#define OMAP343X_CONTROL_CORE_DPLL_SPREADING	(OMAP2_CONTROL_GENERAL + 0x01E4)
+#define OMAP343X_CONTROL_PER_DPLL_SPREADING	(OMAP2_CONTROL_GENERAL + 0x01E8)
+#define OMAP343X_CONTROL_USBHOST_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01EC)
+#define OMAP343X_CONTROL_PBIAS_LITE	(OMAP2_CONTROL_GENERAL + 0x02B0)
+#define OMAP343X_CONTROL_TEMP_SENSOR	(OMAP2_CONTROL_GENERAL + 0x02B4)
+#define OMAP343X_CONTROL_SRAMLDO4	(OMAP2_CONTROL_GENERAL + 0x02B8)
+#define OMAP343X_CONTROL_SRAMLDO5	(OMAP2_CONTROL_GENERAL + 0x02C0)
+#define OMAP343X_CONTROL_CSI		(OMAP2_CONTROL_GENERAL + 0x02b4)
+
 
 /*
  * REVISIT: This list of registers is not comprehensive - there are more

Index: linux-omap-2.6/arch/arm/mach-omap2/serial.c
===================================================================

arch/arm/mach-omap2/serial.c +1 -8
@@ -157,18 +157,15 @@ static void omap_serial_kick(void)
 		NSEC_PER_SEC);
 }
 
-void omap_serial_enable_clocks(int enable)
+void omap_serial_enable_clocks(int enable, int unum)
 {
-	int i;
-	for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
-		if (uart_ick[i] && uart_fck[i]) {
-			if (enable) {
-				clk_enable(uart_ick[i]);
-				clk_enable(uart_fck[i]);
-			} else {

arch/arm/mach-omap2/serial.c static void omap_serial_kick(void) · line 168

Quoted 10 lines
arch/arm/mach-omap2/serial.c +7 -3
-				clk_disable(uart_ick[i]);
-				clk_disable(uart_fck[i]);
-			}
+	if (uart_ick[unum] && uart_fck[unum]) {
+		if (enable) {
+			clk_enable(uart_ick[unum]);
+			clk_enable(uart_fck[unum]);
+		} else {
+			clk_disable(uart_ick[unum]);
+			clk_disable(uart_fck[unum]);

If you do save and restore as I mentioned above then there is no need to add new parameter to omap_serial_enable_clocks function. Just do uart_ctx_save before calling clk_disable and restore after clk_enable. Then as we have that interface to ask for need for restore add put restore under if statement.

Quoted 23 lines
arch/arm/mach-omap2/serial.c +0 -0
 		}
 	}
 }

Index: linux-omap-2.6/include/asm-arm/arch-omap/common.h
===================================================================

include/asm-arm/arch-omap/common.h +1 -2
@@ -34,7 +34,7 @@ struct sys_timer;
 extern void omap_map_common_io(void);
 extern struct sys_timer omap_timer;
 extern void omap_serial_init(void);
-extern void omap_serial_enable_clocks(int enable);
+extern void omap_serial_enable_clocks(int enable, int unum);
 extern int omap_serial_can_sleep(void);
 extern void omap_gpio_save(void);
 extern void omap_gpio_restore(void);
 
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 6 lines
Jouni Högander

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 565 lines

-----Original Message-----
From: "Högander" Jouni [mailto:[email protected]]
Sent: Wednesday, July 02, 2008 6:06 PM
To: ext Rajendra Nayak
Cc: [email protected]
Subject: Re: [PATCH 11/11] CORE context save/restore

Quoted 11 lines · ext Rajendra Nayak

This patch adds the CORE context save/restore routines
- save/restores the following
1) PRCM registers
2) INTC context
3) System Control module context
4) Padconf

---
 arch/arm/mach-omap2/cpuidle34xx.c   |  546 

+++++++++++++++++++++++++++++++-----

Quoted 11 lines
 arch/arm/mach-omap2/cpuidle34xx.h   |   32 +-
 arch/arm/mach-omap2/pm34xx.c        |   45 ++
 arch/arm/mach-omap2/prm.h           |    2 
 arch/arm/mach-omap2/serial.c        |   19 -
 arch/arm/mach-omap2/sleep34xx.S     |   12 
 arch/arm/plat-omap/sram.c           |   15 
 include/asm-arm/arch-omap/common.h  |    2 
 include/asm-arm/arch-omap/control.h |   22 +
 include/asm-arm/arch-omap/prcm.h    |   58 +++
 10 files changed, 646 insertions(+), 107 deletions(-)
Quoted 3 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/cpuidle34xx.c

2008-07-01 18:51:23.077236449 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.c

2008-07-01 19:15:49.844144072 +0530
Quoted 26 lines
arch/arm/mach-omap2/cpuidle34xx.c +10 -0
@@ -28,12 +28,22 @@
 #include <asm/arch/powerdomain.h>
 #include <asm/arch/clockdomain.h>
 #include <asm/arch/gpio.h>
+#include <asm/arch/gpmc.h>
+#include <asm/arch/control.h>
+#include <linux/sched.h>
 #include "cpuidle34xx.h"
+#include "cm.h"
+#include "cm-regbits-34xx.h"
+#include "prm-regbits-34xx.h"
+#include "prm.h"
+#include "pm.h"
+#include "clock34xx.h"
 
 #ifdef CONFIG_CPU_IDLE
 
 struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES];
 struct omap3_processor_cx current_cx_state;
+static int padconf_saved;
 
 static int omap3_idle_bm_check(void)
 {
@@ -42,6 +52,379 @@ static int omap3_idle_bm_check(void)
 	return 0;
 }

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 63

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +9 -0
 
+void omap3_save_prcm_ctx(void)
+{
+	prcm_sleep_save[1] = omap_readl(INTC_MIR_0);
+	prcm_sleep_save[2] = omap_readl(INTC_MIR_1);
+	prcm_sleep_save[3] = omap_readl(INTC_MIR_2);
+	prcm_sleep_save[4] = omap_readl(CONTROL_PADCONF_SYS_NIRQ);
+	prcm_sleep_save[5] = omap_readl(OMAP34XX_GPIO1_IRQENABLE1);
+	prcm_sleep_save[6] = omap_readl(OMAP34XX_GPIO1_WAKEUPEN);
+	prcm_sleep_save[7] = cm_read_mod_reg(OMAP3430_IVA2_MOD, 

CM_CLKSEL2);

Review static int omap3_idle_bm_check(void) · line 65

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[8] = __raw_readl(OMAP3430_CM_SYSCONFIG);
+	prcm_sleep_save[9] = 

cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 67

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[10] = cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
+	prcm_sleep_save[11] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 68

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[12] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 69

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[13] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 70

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[14] = cm_read_mod_reg(OMAP3430_EMU_MOD, 

CM_CLKSEL1);

Review static int omap3_idle_bm_check(void) · line 71

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[15] = cm_read_mod_reg(OMAP3430_EMU_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 73

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[16] = cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[17] = cm_read_mod_reg(PLL_MOD, 

OMAP3430ES2_CM_CLKSEL5);

Review static int omap3_idle_bm_check(void) · line 75

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[18] = __raw_readl(OMAP3430_CM_POLCTRL);
+	prcm_sleep_save[19] = 

cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 77

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[20] = cm_read_mod_reg(CORE_MOD, CM_FCLKEN1);
+	prcm_sleep_save[21] = cm_read_mod_reg(CORE_MOD, 

OMAP3430ES2_CM_FCLKEN3);

Review static int omap3_idle_bm_check(void) · line 78

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[22] = 

cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 80

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[23] = cm_read_mod_reg(WKUP_MOD, CM_FCLKEN);
+	prcm_sleep_save[24] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 81

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[25] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 82

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[26] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 84

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[27] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      

CM_FCLKEN);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+	prcm_sleep_save[28] = cm_read_mod_reg(CORE_MOD, CM_ICLKEN1);
+	prcm_sleep_save[29] = cm_read_mod_reg(CORE_MOD, CM_ICLKEN2);
+	prcm_sleep_save[30] = cm_read_mod_reg(CORE_MOD, CM_ICLKEN3);
+	prcm_sleep_save[31] = 

cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 90

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[32] = cm_read_mod_reg(WKUP_MOD, CM_ICLKEN);
+	prcm_sleep_save[33] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 91

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[34] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 92

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[35] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_ICLKEN);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[36] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 95

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[37] = 

cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_AUTOIDLE2);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -0
+	prcm_sleep_save[38] = cm_read_mod_reg(MPU_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[39] = cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[40] = 

cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSTCTRL);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+	prcm_sleep_save[41] = cm_read_mod_reg(MPU_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[42] = cm_read_mod_reg(CORE_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[43] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD,
+							      

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 103

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[44] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 104

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[45] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 105

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[46] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 106

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[47] = 

cm_read_mod_reg(OMAP3430_NEON_MOD, CM_CLKSTCTRL);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[48] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      

CM_CLKSTCTRL);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+	prcm_sleep_save[49] = cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE1);
+	prcm_sleep_save[50] = cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[51] = cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE3);
+	prcm_sleep_save[52] = cm_read_mod_reg(WKUP_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[53] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 114

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[54] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 115

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[55] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_AUTOIDLE);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[56] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      

CM_AUTOIDLE);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[57] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD,
+						      

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[58] = cm_read_mod_reg(OMAP3430_DSS_MOD,
+						      

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[59] = cm_read_mod_reg(OMAP3430_CAM_MOD,
+						      

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[60] = cm_read_mod_reg(OMAP3430_PER_MOD,
+						      

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[61] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+						      

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -0
+	prcm_sleep_save[62] = __raw_readl(OMAP3430_CM_CLKOUT_CTRL);
+	prcm_sleep_save[63] = __raw_readl(OMAP3430_PRM_CLKOUT_CTRL);
+	prcm_sleep_save[64] = 

prm_read_mod_reg(OMAP3430ES2_SGX_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 131

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[65] = 

prm_read_mod_reg(OMAP3430_DSS_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 132

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[66] = 

prm_read_mod_reg(OMAP3430_CAM_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 133

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[67] = 

prm_read_mod_reg(OMAP3430_PER_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 134

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[68] = 

prm_read_mod_reg(OMAP3430_NEON_MOD, PM_WKDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[69] = prm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							       

PM_WKDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +6 -0
+	prcm_sleep_save[70] = prm_read_mod_reg(CORE_MOD,
+					      OMAP3430_PM_MPUGRPSEL1);
+	prcm_sleep_save[71] = prm_read_mod_reg(OMAP3430_IVA2_MOD,
+					      OMAP3430_PM_IVAGRPSEL1);
+	prcm_sleep_save[72] = prm_read_mod_reg(CORE_MOD,
+					      

OMAP3430ES2_PM_MPUGRPSEL3);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[73] = prm_read_mod_reg(CORE_MOD,
+					      

OMAP3430ES2_PM_IVAGRPSEL3);

Review static int omap3_idle_bm_check(void) · line 145

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[74] = prm_read_mod_reg(WKUP_MOD, 

OMAP3430_PM_MPUGRPSEL);

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +9 -0
+	prcm_sleep_save[75] = prm_read_mod_reg(WKUP_MOD,
+					      OMAP3430_PM_IVAGRPSEL);
+	prcm_sleep_save[76] = prm_read_mod_reg(OMAP3430_PER_MOD,
+					      OMAP3430_PM_MPUGRPSEL);
+	prcm_sleep_save[77] = prm_read_mod_reg(OMAP3430_PER_MOD,
+					      OMAP3430_PM_IVAGRPSEL);
+	prcm_sleep_save[78] = prm_read_mod_reg(WKUP_MOD, PM_WKEN);
+	return;
+}

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +10 -0
+
+void omap3_restore_prcm_ctx(void)
+{
+	omap_writel(prcm_sleep_save[1], INTC_MIR_0);
+	omap_writel(prcm_sleep_save[2], INTC_MIR_1);
+	omap_writel(prcm_sleep_save[3], INTC_MIR_2);
+	omap_writel(prcm_sleep_save[4], CONTROL_PADCONF_SYS_NIRQ);
+	omap_writel(prcm_sleep_save[5], OMAP34XX_GPIO1_IRQENABLE1);
+	omap_writel(prcm_sleep_save[6], OMAP34XX_GPIO1_WAKEUPEN);
+	cm_write_mod_reg(prcm_sleep_save[7], OMAP3430_IVA2_MOD, 

CM_CLKSEL2);

Review static int omap3_idle_bm_check(void) · line 166

Quoted 2 lines
(quoted diff) +2 -0
+	__raw_writel(prcm_sleep_save[8], OMAP3430_CM_SYSCONFIG);
+	cm_write_mod_reg(prcm_sleep_save[9], 

OMAP3430ES2_SGX_MOD, CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 168

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[10], WKUP_MOD, CM_CLKSEL);
+	cm_write_mod_reg(prcm_sleep_save[11], OMAP3430_DSS_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 169

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[12], OMAP3430_CAM_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 170

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[13], OMAP3430_PER_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 171

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[14], OMAP3430_EMU_MOD, 

CM_CLKSEL1);

Review static int omap3_idle_bm_check(void) · line 172

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[15], OMAP3430_EMU_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 174

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[16], PLL_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[17], PLL_MOD, 

OMAP3430ES2_CM_CLKSEL5);

Review static int omap3_idle_bm_check(void) · line 176

Quoted 2 lines
(quoted diff) +2 -0
+	__raw_writel(prcm_sleep_save[18], OMAP3430_CM_POLCTRL);
+	cm_write_mod_reg(prcm_sleep_save[19], 

OMAP3430_IVA2_MOD, CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 178

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[20], CORE_MOD, CM_FCLKEN1);
+	cm_write_mod_reg(prcm_sleep_save[21], CORE_MOD, 

OMAP3430ES2_CM_FCLKEN3);

Review static int omap3_idle_bm_check(void) · line 179

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[22], 

OMAP3430ES2_SGX_MOD, CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 181

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[23], WKUP_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[24], OMAP3430_DSS_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 182

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[25], OMAP3430_CAM_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 183

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[26], OMAP3430_PER_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 185

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[27], OMAP3430ES2_USBHOST_MOD,
+							       

CM_FCLKEN);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+	cm_write_mod_reg(prcm_sleep_save[28], CORE_MOD, CM_ICLKEN1);
+	cm_write_mod_reg(prcm_sleep_save[29], CORE_MOD, CM_ICLKEN2);
+	cm_write_mod_reg(prcm_sleep_save[30], CORE_MOD, CM_ICLKEN3);
+	cm_write_mod_reg(prcm_sleep_save[31], 

OMAP3430ES2_SGX_MOD, CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 191

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[32], WKUP_MOD, CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[33], OMAP3430_DSS_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 192

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[34], OMAP3430_CAM_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 193

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[35], OMAP3430_PER_MOD, 

CM_ICLKEN);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 257

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	cm_write_mod_reg(prcm_sleep_save[36], OMAP3430ES2_USBHOST_MOD,
+								

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 196

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[37], 

OMAP3430_IVA2_MOD, CM_AUTOIDLE2);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -0
+	cm_write_mod_reg(prcm_sleep_save[38], MPU_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[39], PLL_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[40], 

OMAP3430_IVA2_MOD, CM_CLKSTCTRL);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+	cm_write_mod_reg(prcm_sleep_save[41], MPU_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[42], CORE_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[43], OMAP3430ES2_SGX_MOD,
+						       CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[44], OMAP3430_DSS_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 205

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[45], OMAP3430_CAM_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 206

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[46], OMAP3430_PER_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 207

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[47], 

OMAP3430_NEON_MOD, CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 209

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[48], OMAP3430ES2_USBHOST_MOD,
+							       

CM_CLKSTCTRL);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+	cm_write_mod_reg(prcm_sleep_save[49], CORE_MOD, CM_AUTOIDLE1);
+	cm_write_mod_reg(prcm_sleep_save[50], CORE_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[51], CORE_MOD, CM_AUTOIDLE3);
+	cm_write_mod_reg(prcm_sleep_save[52], WKUP_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[53], OMAP3430_DSS_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 215

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[54], OMAP3430_CAM_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 216

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[55], OMAP3430_PER_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 218

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[56], OMAP3430ES2_USBHOST_MOD,
+							       

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 220

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[57], OMAP3430ES2_SGX_MOD,
+						       

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 222

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[58], OMAP3430_DSS_MOD,
+						       

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 224

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[59], OMAP3430_CAM_MOD,
+						       

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 226

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[60], OMAP3430_PER_MOD,
+						       

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 228

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[61], OMAP3430ES2_USBHOST_MOD,
+						       

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -0
+	__raw_writel(prcm_sleep_save[62], OMAP3430_CM_CLKOUT_CTRL);
+	__raw_writel(prcm_sleep_save[63], OMAP3430_PRM_CLKOUT_CTRL);
+	prm_write_mod_reg(prcm_sleep_save[64], 

OMAP3430ES2_SGX_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 232

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[65], 

OMAP3430_DSS_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 233

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[66], 

OMAP3430_CAM_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 234

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[67], 

OMAP3430_PER_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 235

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[68], 

OMAP3430_NEON_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 237

Quoted 2 lines
(quoted diff) +2 -0
+	prm_write_mod_reg(prcm_sleep_save[69], OMAP3430ES2_USBHOST_MOD,
+							       

PM_WKDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 257

Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +6 -0
+	prm_write_mod_reg(prcm_sleep_save[70], CORE_MOD,
+					       OMAP3430_PM_MPUGRPSEL1);
+	prm_write_mod_reg(prcm_sleep_save[71], OMAP3430_IVA2_MOD,
+					       OMAP3430_PM_IVAGRPSEL1);
+	prm_write_mod_reg(prcm_sleep_save[72], CORE_MOD,
+					       

OMAP3430ES2_PM_MPUGRPSEL3);

Review static int omap3_idle_bm_check(void) · line 245

Quoted 2 lines
(quoted diff) +2 -0
+	prm_write_mod_reg(prcm_sleep_save[73], CORE_MOD,
+					       

OMAP3430ES2_PM_IVAGRPSEL3);

Quoted 31 lines
arch/arm/mach-omap2/cpuidle34xx.c +31 -0
+	prm_write_mod_reg(prcm_sleep_save[74], WKUP_MOD,
+					       OMAP3430_PM_MPUGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[75], WKUP_MOD,
+					       OMAP3430_PM_IVAGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[76], OMAP3430_PER_MOD,
+					       OMAP3430_PM_MPUGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[77], OMAP3430_PER_MOD,
+					       OMAP3430_PM_IVAGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[78], WKUP_MOD, PM_WKEN);
+	return;
+}
+
+static void omap_save_intc_ctx(void)
+{
+	int ind = 0;
+	intc_context.sysconfig = omap_readl(INTCPS_SYSCONFIG);
+	intc_context.protection =  omap_readl(INTCPS_PROTECTION);
+	intc_context.idle = omap_readl(INTCPS_IDLE);
+	intc_context.threshold = omap_readl(INTCPS_THRESHOLD);
+	for (ind = 0; ind < 96; ind++)
+	       intc_context.ilr[ind] =
+		       omap_readl(INTC_BASE + (0x100 + 0x4*ind));
+	/* MIRs are saved and restore with other PRCM registers */
+}
+
+static void omap_restore_intc_ctx(void)
+{
+	int ind = 0;
+	omap_writel(intc_context.sysconfig, INTCPS_SYSCONFIG);
+	omap_writel(intc_context.protection, INTCPS_PROTECTION);
+	omap_writel(intc_context.idle, INTCPS_IDLE);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +10 -0
+	omap_writel(intc_context.threshold, INTCPS_THRESHOLD);
+	for (ind = 0; ind < 96; ind++)
+	       omap_writel(intc_context.ilr[ind],
+		       INTC_BASE + (0x100 + 0x4*ind));
+	/* MIRs are saved and restore with other PRCM registers */
+}
+
+static void omap_save_control_ctx(void)
+{
+	control_ctx.sysconfig = 

omap_ctrl_readl(OMAP2_CONTROL_SYSCONFIG);

Review static int omap3_idle_bm_check(void) · line 288

Quoted 2 lines
(quoted diff) +2 -0
+	control_ctx.devconf0 = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
+	control_ctx.mem_dftrw0 = 

omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW0);

Review static int omap3_idle_bm_check(void) · line 289

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.mem_dftrw1 = 

omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW1);

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+	control_ctx.msuspendmux_0 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_0);
+	control_ctx.msuspendmux_1 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +10 -0
+	control_ctx.msuspendmux_2 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_2);
+	control_ctx.msuspendmux_3 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_3);
+	control_ctx.msuspendmux_4 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_4);
+	control_ctx.msuspendmux_5 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_5);
+	control_ctx.sec_ctrl = omap_ctrl_readl(OMAP2_CONTROL_SEC_CTRL);
+	control_ctx.devconf1 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +6 -0
+	control_ctx.csirxfe = omap_ctrl_readl(OMAP343X_CONTROL_CSIRXFE);
+	control_ctx.iva2_bootaddr =
+		       omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTADDR);
+	control_ctx.iva2_bootmod =
+		       omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTMOD);
+	control_ctx.debobs_0 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_0);

Review static int omap3_idle_bm_check(void) · line 310

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_1 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_1);

Review static int omap3_idle_bm_check(void) · line 311

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_2 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_2);

Review static int omap3_idle_bm_check(void) · line 312

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_3 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_3);

Review static int omap3_idle_bm_check(void) · line 313

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_4 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_4);

Review static int omap3_idle_bm_check(void) · line 314

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_5 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_5);

Review static int omap3_idle_bm_check(void) · line 315

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_6 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_6);

Review static int omap3_idle_bm_check(void) · line 316

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_7 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_7);

Review static int omap3_idle_bm_check(void) · line 317

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_8 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_8);

Review static int omap3_idle_bm_check(void) · line 318

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.prog_io0 = 

omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO0);

Review static int omap3_idle_bm_check(void) · line 319

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.prog_io1 = 

omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +9 -0
+	control_ctx.dss_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_DSS_DPLL_SPREADING);
+	control_ctx.core_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_CORE_DPLL_SPREADING);
+	control_ctx.per_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_PER_DPLL_SPREADING);
+	control_ctx.usbhost_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);
+	control_ctx.pbias_lite = 

omap_ctrl_readl(OMAP343X_CONTROL_PBIAS_LITE);

Review static int omap3_idle_bm_check(void) · line 329

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.temp_sensor = 

omap_ctrl_readl(OMAP343X_CONTROL_TEMP_SENSOR);

Review static int omap3_idle_bm_check(void) · line 330

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.sramldo4 = 

omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO4);

Review static int omap3_idle_bm_check(void) · line 331

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.sramldo5 = 

omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO5);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 7 lines
arch/arm/mach-omap2/cpuidle34xx.c +7 -0
+	control_ctx.csi = omap_ctrl_readl(OMAP343X_CONTROL_CSI);
+	return;
+}
+
+static void omap_restore_control_ctx(void)
+{
+	omap_ctrl_writel(control_ctx.sysconfig, 

OMAP2_CONTROL_SYSCONFIG);

Review static int omap3_idle_bm_check(void) · line 340

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.devconf0, OMAP2_CONTROL_DEVCONF0);
+	omap_ctrl_writel(control_ctx.mem_dftrw0, 

OMAP343X_CONTROL_MEM_DFTRW0);

Review static int omap3_idle_bm_check(void) · line 341

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.mem_dftrw1, 

OMAP343X_CONTROL_MEM_DFTRW1);

Review static int omap3_idle_bm_check(void) · line 343

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_0,
+					       

OMAP2_CONTROL_MSUSPENDMUX_0);

Review static int omap3_idle_bm_check(void) · line 345

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_1,
+					       

OMAP2_CONTROL_MSUSPENDMUX_1);

Review static int omap3_idle_bm_check(void) · line 347

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_2,
+					       

OMAP2_CONTROL_MSUSPENDMUX_2);

Review static int omap3_idle_bm_check(void) · line 349

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_3,
+					       

OMAP2_CONTROL_MSUSPENDMUX_3);

Review static int omap3_idle_bm_check(void) · line 351

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_4,
+					       

OMAP2_CONTROL_MSUSPENDMUX_4);

Review static int omap3_idle_bm_check(void) · line 353

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_5,
+					       

OMAP2_CONTROL_MSUSPENDMUX_5);

Review static int omap3_idle_bm_check(void) · line 355

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.sec_ctrl, OMAP2_CONTROL_SEC_CTRL);
+	omap_ctrl_writel(control_ctx.devconf1, 

OMAP343X_CONTROL_DEVCONF1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 387

Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -0
+	omap_ctrl_writel(control_ctx.csirxfe, OMAP343X_CONTROL_CSIRXFE);
+	omap_ctrl_writel(control_ctx.iva2_bootaddr,
+					       

OMAP343X_CONTROL_IVA2_BOOTADDR);

Review static int omap3_idle_bm_check(void) · line 360

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.iva2_bootmod,
+					       

OMAP343X_CONTROL_IVA2_BOOTMOD);

Review static int omap3_idle_bm_check(void) · line 361

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_0, 

OMAP343X_CONTROL_DEBOBS_0);

Review static int omap3_idle_bm_check(void) · line 362

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_1, 

OMAP343X_CONTROL_DEBOBS_1);

Review static int omap3_idle_bm_check(void) · line 363

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_2, 

OMAP343X_CONTROL_DEBOBS_2);

Review static int omap3_idle_bm_check(void) · line 364

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_3, 

OMAP343X_CONTROL_DEBOBS_3);

Review static int omap3_idle_bm_check(void) · line 365

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_4, 

OMAP343X_CONTROL_DEBOBS_4);

Review static int omap3_idle_bm_check(void) · line 366

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_5, 

OMAP343X_CONTROL_DEBOBS_5);

Review static int omap3_idle_bm_check(void) · line 367

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_6, 

OMAP343X_CONTROL_DEBOBS_6);

Review static int omap3_idle_bm_check(void) · line 368

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_7, 

OMAP343X_CONTROL_DEBOBS_7);

Review static int omap3_idle_bm_check(void) · line 369

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_8, 

OMAP343X_CONTROL_DEBOBS_8);

Review static int omap3_idle_bm_check(void) · line 370

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.prog_io0, 

OMAP343X_CONTROL_PROG_IO0);

Review static int omap3_idle_bm_check(void) · line 371

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.prog_io1, 

OMAP343X_CONTROL_PROG_IO1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +9 -0
+	omap_ctrl_writel(control_ctx.dss_dpll_spreading,
+			       OMAP343X_CONTROL_DSS_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.core_dpll_spreading,
+			       OMAP343X_CONTROL_CORE_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.per_dpll_spreading,
+			       OMAP343X_CONTROL_PER_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.usbhost_dpll_spreading,
+			       OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.pbias_lite, 

OMAP343X_CONTROL_PBIAS_LITE);

Review static int omap3_idle_bm_check(void) · line 381

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.temp_sensor, 

OMAP343X_CONTROL_TEMP_SENSOR);

Review static int omap3_idle_bm_check(void) · line 382

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.sramldo4, 

OMAP343X_CONTROL_SRAMLDO4);

Review static int omap3_idle_bm_check(void) · line 383

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.sramldo5, 

OMAP343X_CONTROL_SRAMLDO5);

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+	omap_ctrl_writel(control_ctx.csi, OMAP343X_CONTROL_CSI);
+	return;
+}
+
+void omap3_save_core_ctx(void)

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +10 -0
+{
+	u32 control_padconf_off;
+
+	if (!padconf_saved) {
+	       /* Save the padconf registers */
+	       control_padconf_off = omap_readl(CONTROL_PADCONF_OFF);
+	       control_padconf_off |= 2;
+	       omap_writel(control_padconf_off, CONTROL_PADCONF_OFF);
+	       /* wait for the save to complete */
+	       while 

(!omap_readl(CONTROL_GENERAL_PURPOSE_STATUS) & 0x1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 7 lines
arch/arm/mach-omap2/cpuidle34xx.c +7 -0
+	       padconf_saved = 1;
+	}
+	/* Save the Interrupt controller context */
+	omap_save_intc_ctx();
+	/* Save the GPMC context */
+	omap_save_gpmc_ctx();
+	/* Save the system control module context, padconf 

already save above*/

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 407

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	omap_save_control_ctx();
+	omap_save_uart_ctx(0);

This should be done in omap_serial_enable_clocks function.

Review static int omap3_idle_bm_check(void) · line 408

Quoted 1 line
(quoted diff) +1 -0
+	omap_serial_enable_clocks(0, 0);

Why this is here?

Quoted 7 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 409

Quoted 1 line
arch/arm/mach-omap2/cpuidle34xx.c +1 -0
+	omap_save_uart_ctx(1);

This should be done in omap_serial_enable_clocks function.

Review static int omap3_idle_bm_check(void) · line 410

Quoted 1 line
(quoted diff) +1 -0
+	omap_serial_enable_clocks(0, 1);

Why this is here?

I did'nt understand these comments completely. Are you asking why splitting of uarts? its because UART1/UART2 belong to CORE and UART3 is in PER.
If you are saying that context save/restore functions could be moved within the enable_clocks functions, yes they can be.

Quoted 746 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+}
+
+void omap3_restore_core_ctx(void)
+{
+	/* Restore the control module context, padconf restored 

by h/w */

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 424

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +9 -0
+	omap_restore_control_ctx();
+	/* Restore the GPMC context */
+	omap_restore_gpmc_ctx();
+	/* Restore the interrupt controller context */
+	omap_restore_intc_ctx();
+	omap_serial_enable_clocks(1, 0);
+	omap_restore_uart_ctx(0);
+	omap_serial_enable_clocks(1, 1);
+	omap_restore_uart_ctx(1);

Same comments as above. You could move these uart restores to omap_serial_enable_clocks and restore always after enabling clock for some specific uart. Then as we have that interface to ask wether restore is needed then add if statement there.

Quoted 8 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -0
+	padconf_saved = 0;
+}
+
 /* omap3_enter_idle - Programs OMAP3 to enter the specified state.
  * returns the total time during which the system was idle.
  */
@@ -60,9 +443,15 @@ static int omap3_enter_idle(struct cpuid
 		return 0;

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 453

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
 	}
 
+	local_irq_disable();
+	local_fiq_disable();
+
 	/* Used to keep track of the total time in idle */
 	getnstimeofday(&ts_preidle);
 
+	if (cx->type > OMAP3_STATE_C1)
+		sched_clock_idle_sleep_event(); /* about to 

enter deep idle */

Quoted 22 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -3
+
 	mpu_pd = pwrdm_lookup("mpu_pwrdm");
 	core_pd = pwrdm_lookup("core_pwrdm");
 	per_pd = pwrdm_lookup("per_pwrdm");
@@ -74,12 +463,13 @@ static int omap3_enter_idle(struct cpuid
 	pwrdm_clear_all_prev_pwrst(core_pd);
 	pwrdm_clear_all_prev_pwrst(per_pd);
 
-	if (omap_irq_pending())
-		return 0;
-
 	per_pwrst = pwrdm_read_pwrst(per_pd);
 	neon_pwrst = pwrdm_read_pwrst(neon_pd);
 
+	/* Do this before any changes to PRCM registers */
+	if (cx->core_state == PWRDM_POWER_OFF)
+		omap3_save_prcm_ctx();
+
 	/* Program MPU to target state */
 	if (cx->mpu_state < PWRDM_POWER_ON) {
 		if (neon_pwrst == PWRDM_POWER_ON) {

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 489

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +1 -0
@@ -96,15 +486,22 @@ static int omap3_enter_idle(struct cpuid
 		if (per_pwrst == PWRDM_POWER_ON) {
 			omap2_gpio_prepare_for_retention();
 			if (clocks_off_while_idle) {
+				omap3_save_per_ctx();

Gpio saving could be moved int per_gpio_clk_disable function.

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 492

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -1
 				per_gpio_clk_disable();
-				omap_serial_enable_clocks(0);
+				omap_save_uart_ctx(2);
+				omap_serial_enable_clocks(0, 2);

Same comment as for uarts in core domain.

Quoted 16 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
 			}
 		}
+		if (cx->core_state == PWRDM_POWER_OFF)
+			omap3_save_core_ctx();
 		pwrdm_set_next_pwrst(core_pd, cx->core_state);
 	}
 
 	*(scratchpad_restore_addr) = restore_pointer_address;
 
+	if (omap_irq_pending())
+		goto return_sleep_time;
+
 	/* Execute ARM wfi */
 	omap_sram_idle();
 

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 519

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
@@ -118,25 +515,41 @@ static int omap3_enter_idle(struct cpuid
 	}
 
 	if (cx->core_state < PWRDM_POWER_ON) {
+		if ((cx->core_state == PWRDM_POWER_OFF)
+		&& (pwrdm_read_prev_pwrst(core_pd) == 

PWRDM_POWER_OFF)) {

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 530

Quoted 12 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -1
+			omap3_restore_core_ctx();
+			omap3_restore_prcm_ctx();
+			omap3_restore_sram_ctx();
+		}
+		pwrdm_set_next_pwrst(core_pd, PWRDM_POWER_ON);
 		if (per_pwrst == PWRDM_POWER_ON) {
 			if (clocks_off_while_idle) {
-				omap_serial_enable_clocks(1);
+				omap_serial_enable_clocks(1, 2);
+				omap_restore_uart_ctx(2);
 				per_gpio_clk_enable();
+				omap3_restore_per_ctx();

And again these could be moved to the clock enable/disable functions.

Quoted 58 lines
arch/arm/mach-omap2/cpuidle34xx.c +20 -19
 			}
 			omap2_gpio_resume_after_retention();
 		}
-		pwrdm_set_next_pwrst(core_pd, PWRDM_POWER_ON);
 	}
 
 	pr_debug("MPU prev st:%x,NEON prev st:%x\n",
-			       pwrdm_read_prev_pwrst(mpu_pd),
-			       pwrdm_read_prev_pwrst(neon_pd));
+				pwrdm_read_prev_pwrst(mpu_pd),
+				pwrdm_read_prev_pwrst(neon_pd));
 	pr_debug("PER prev st:%x,CORE prev st:%x\n",
-			       pwrdm_read_prev_pwrst(per_pd),
-			       pwrdm_read_prev_pwrst(core_pd));
+				pwrdm_read_prev_pwrst(per_pd),
+				pwrdm_read_prev_pwrst(core_pd));
 
+return_sleep_time:
 	getnstimeofday(&ts_postidle);
 	ts_idle = timespec_sub(ts_postidle, ts_preidle);
+
+	if (cx->type > OMAP3_STATE_C1)
+		sched_clock_idle_wakeup_event(timespec_to_ns(&ts_idle));
+
+	local_irq_enable();
+	local_fiq_disable();
+
 	return (u32)timespec_to_ns(&ts_idle)/1000;
 }
 
@@ -187,79 +600,79 @@ DEFINE_PER_CPU(struct cpuidle_device, om
 void omap_init_power_states(void)
 {
 	/* C0 . System executing code */
-	omap3_power_states[0].valid = 1;
-	omap3_power_states[0].type = OMAP3_STATE_C0;
-	omap3_power_states[0].sleep_latency = 0;
-	omap3_power_states[0].wakeup_latency = 0;
-	omap3_power_states[0].threshold = 0;
-	omap3_power_states[0].mpu_state = PWRDM_POWER_ON;
-	omap3_power_states[0].core_state = PWRDM_POWER_ON;
-	omap3_power_states[0].flags = CPUIDLE_FLAG_SHALLOW;
+	omap3_power_states[OMAP3_STATE_C0].valid = 1;
+	omap3_power_states[OMAP3_STATE_C0].type = OMAP3_STATE_C0;
+	omap3_power_states[OMAP3_STATE_C0].sleep_latency = 0;
+	omap3_power_states[OMAP3_STATE_C0].wakeup_latency = 0;
+	omap3_power_states[OMAP3_STATE_C0].threshold = 0;
+	omap3_power_states[OMAP3_STATE_C0].mpu_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C0].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C0].flags = CPUIDLE_FLAG_SHALLOW;
 
 	/* C1 . MPU WFI + Core active */
-	omap3_power_states[1].valid = 1;
-	omap3_power_states[1].type = OMAP3_STATE_C1;
-	omap3_power_states[1].sleep_latency = 10;
-	omap3_power_states[1].wakeup_latency = 10;
-	omap3_power_states[1].threshold = 30;
-	omap3_power_states[1].mpu_state = PWRDM_POWER_ON;

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om · line 620

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -2
-	omap3_power_states[1].core_state = PWRDM_POWER_ON;
-	omap3_power_states[1].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C1].valid = 1;
+	omap3_power_states[OMAP3_STATE_C1].type = OMAP3_STATE_C1;
+	omap3_power_states[OMAP3_STATE_C1].sleep_latency = 10;
+	omap3_power_states[OMAP3_STATE_C1].wakeup_latency = 10;
+	omap3_power_states[OMAP3_STATE_C1].threshold = 30;
+	omap3_power_states[OMAP3_STATE_C1].mpu_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C1].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C1].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -6
 						CPUIDLE_FLAG_SHALLOW;
 
 	/* C2 . MPU CSWR + Core active */
-	omap3_power_states[2].valid = 1;
-	omap3_power_states[2].type = OMAP3_STATE_C2;
-	omap3_power_states[2].sleep_latency = 50;
-	omap3_power_states[2].wakeup_latency = 50;
-	omap3_power_states[2].threshold = 300;
-	omap3_power_states[2].mpu_state = PWRDM_POWER_RET;

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -2
-	omap3_power_states[2].core_state = PWRDM_POWER_ON;
-	omap3_power_states[2].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C2].valid = 1;
+	omap3_power_states[OMAP3_STATE_C2].type = OMAP3_STATE_C2;
+	omap3_power_states[OMAP3_STATE_C2].sleep_latency = 50;
+	omap3_power_states[OMAP3_STATE_C2].wakeup_latency = 50;
+	omap3_power_states[OMAP3_STATE_C2].threshold = 300;
+	omap3_power_states[OMAP3_STATE_C2].mpu_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C2].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C2].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -6
 						CPUIDLE_FLAG_BALANCED;
 
 	/* C3 . MPU OFF + Core active */
-	omap3_power_states[3].valid = 1;
-	omap3_power_states[3].type = OMAP3_STATE_C3;
-	omap3_power_states[3].sleep_latency = 1500;
-	omap3_power_states[3].wakeup_latency = 1800;
-	omap3_power_states[3].threshold = 4000;
-	omap3_power_states[3].mpu_state = PWRDM_POWER_OFF;

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -2
-	omap3_power_states[3].core_state = PWRDM_POWER_ON;
-	omap3_power_states[3].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C3].valid = 1;
+	omap3_power_states[OMAP3_STATE_C3].type = OMAP3_STATE_C3;
+	omap3_power_states[OMAP3_STATE_C3].sleep_latency = 1500;
+	omap3_power_states[OMAP3_STATE_C3].wakeup_latency = 1800;
+	omap3_power_states[OMAP3_STATE_C3].threshold = 4000;
+	omap3_power_states[OMAP3_STATE_C3].mpu_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C3].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C3].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -6
 			CPUIDLE_FLAG_BALANCED | CPUIDLE_FLAG_CHECK_BM;
 
 	/* C4 . MPU CSWR + Core CSWR*/
-	omap3_power_states[4].valid = 1;
-	omap3_power_states[4].type = OMAP3_STATE_C4;
-	omap3_power_states[4].sleep_latency = 2500;
-	omap3_power_states[4].wakeup_latency = 7500;
-	omap3_power_states[4].threshold = 12000;
-	omap3_power_states[4].mpu_state = PWRDM_POWER_RET;

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -2
-	omap3_power_states[4].core_state = PWRDM_POWER_RET;
-	omap3_power_states[4].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C4].valid = 1;
+	omap3_power_states[OMAP3_STATE_C4].type = OMAP3_STATE_C4;
+	omap3_power_states[OMAP3_STATE_C4].sleep_latency = 2500;
+	omap3_power_states[OMAP3_STATE_C4].wakeup_latency = 7500;
+	omap3_power_states[OMAP3_STATE_C4].threshold = 12000;
+	omap3_power_states[OMAP3_STATE_C4].mpu_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C4].core_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C4].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -6
 			CPUIDLE_FLAG_BALANCED | CPUIDLE_FLAG_CHECK_BM;
 
 	/* C5 . MPU OFF + Core CSWR */
-	omap3_power_states[5].valid = 1;
-	omap3_power_states[5].type = OMAP3_STATE_C5;
-	omap3_power_states[5].sleep_latency = 3000;
-	omap3_power_states[5].wakeup_latency = 8500;
-	omap3_power_states[5].threshold = 15000;
-	omap3_power_states[5].mpu_state = PWRDM_POWER_OFF;

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -2
-	omap3_power_states[5].core_state = PWRDM_POWER_RET;
-	omap3_power_states[5].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C5].valid = 1;
+	omap3_power_states[OMAP3_STATE_C5].type = OMAP3_STATE_C5;
+	omap3_power_states[OMAP3_STATE_C5].sleep_latency = 3000;
+	omap3_power_states[OMAP3_STATE_C5].wakeup_latency = 8500;
+	omap3_power_states[OMAP3_STATE_C5].threshold = 15000;
+	omap3_power_states[OMAP3_STATE_C5].mpu_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C5].core_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C5].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -6
 			CPUIDLE_FLAG_BALANCED | CPUIDLE_FLAG_CHECK_BM;
 
 	/* C6 . MPU OFF + Core OFF */
-	omap3_power_states[6].valid = 0;
-	omap3_power_states[6].type = OMAP3_STATE_C6;
-	omap3_power_states[6].sleep_latency = 10000;
-	omap3_power_states[6].wakeup_latency = 30000;
-	omap3_power_states[6].threshold = 300000;
-	omap3_power_states[6].mpu_state = PWRDM_POWER_OFF;

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -2
-	omap3_power_states[6].core_state = PWRDM_POWER_OFF;
-	omap3_power_states[6].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C6].valid = 1;
+	omap3_power_states[OMAP3_STATE_C6].type = OMAP3_STATE_C6;
+	omap3_power_states[OMAP3_STATE_C6].sleep_latency = 10000;
+	omap3_power_states[OMAP3_STATE_C6].wakeup_latency = 30000;
+	omap3_power_states[OMAP3_STATE_C6].threshold = 300000;
+	omap3_power_states[OMAP3_STATE_C6].mpu_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C6].core_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C6].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 11 lines
arch/arm/mach-omap2/cpuidle34xx.c +1 -0
 			CPUIDLE_FLAG_DEEP | CPUIDLE_FLAG_CHECK_BM;
 }
 
@@ -277,6 +690,7 @@ int omap3_idle_init(void)
 	struct omap3_processor_cx *cx;
 	struct cpuidle_state *state;
 	struct cpuidle_device *dev;
+	char clk_name[11];
 
 	clear_scratchpad_contents();
 	save_scratchpad_contents();
Quoted 3 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.h
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/cpuidle34xx.h

2008-07-01 18:51:23.078236417 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.h

2008-07-01 18:51:25.189168688 +0530
Quoted 56 lines
arch/arm/mach-omap2/cpuidle34xx.h +29 -3
@@ -30,20 +30,41 @@
 #define OMAP3_STATE_C5 5 /* C5 - MPU OFF + Core RET */
 #define OMAP3_STATE_C6 6 /* C6 - MPU OFF + Core OFF */
 
-/* Currently, we support only upto C2 */
-#define MAX_SUPPORTED_STATES 3
+/* Interrupt Controller registers */
+#define INTC_BASE	0x48200000
+#define INTC_MIR_0	0x48200084
+#define INTC_MIR_1	0x482000A4
+#define INTC_MIR_2	0x482000C4
+#define INTCPS_SYSCONFIG	0x48200010
+#define INTCPS_PROTECTION	0x4820004C
+#define INTCPS_IDLE	0x48200050
+#define INTCPS_THRESHOLD	0x48200068
+
+#define CONTROL_PADCONF_SYS_NIRQ	0x480021E0
+#define CONTROL_PADCONF_OFF	0x48002270
+#define CONTROL_GENERAL_PURPOSE_STATUS	0x480022F4
+
+#define OMAP34XX_GPIO1_IRQENABLE1	0x4831001c
+#define OMAP34XX_GPIO1_WAKEUPEN	0x48310020
+#define OMAP34XX_GPIO1_FALLINGDETECT	0x4831004c
 
 extern unsigned short clocks_off_while_idle;
 extern void omap_sram_idle(void);
 extern int omap_irq_pending(void);
 extern void per_gpio_clk_enable(void);
 extern void per_gpio_clk_disable(void);
-extern void omap_serial_enable_clocks(int enable);
+extern void omap_serial_enable_clocks(int enable, int unum);
 extern int omap3_can_sleep();
 extern void clear_scratchpad_contents(void);
 extern void save_scratchpad_contents(void);
 extern u32 *scratchpad_restore_addr;
 extern u32 restore_pointer_address;
+extern void omap3_save_per_ctx();
+extern void omap3_restore_per_ctx();
+extern void omap_save_uart_ctx(int);
+extern void omap_restore_uart_ctx(int);
+extern void omap3_restore_sram_ctx();
+extern int omap3_can_sleep();
 
 struct omap3_processor_cx {
 	u8 valid;
@@ -59,5 +80,10 @@ struct omap3_processor_cx {
 void omap_init_power_states(void);
 int omap3_idle_init(void);
 
+/* TODO fix the size:100 */
+static unsigned int prcm_sleep_save[100];
+static struct int_controller_context intc_context;
+static struct control_module_context control_ctx;
+
 #endif /* ARCH_ARM_MACH_OMAP2_CPUIDLE_34XX */
 
Quoted 3 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c

2008-07-01 18:51:22.662249764 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c

2008-07-01 18:51:25.189168688 +0530

arch/arm/mach-omap2/pm34xx.c static irqreturn_t prcm_interrupt_handle · line 159

Quoted 8 lines
arch/arm/mach-omap2/pm34xx.c +0 -1
@@ -154,7 +154,6 @@ static irqreturn_t prcm_interrupt_handle
 		cm_write_mod_reg(iclk, OMAP3430_PER_MOD, CM_ICLKEN);
 		cm_write_mod_reg(fclk, OMAP3430_PER_MOD, CM_FCLKEN);
 	}
-
 	if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0)) {
 		/* USBHOST */
 		wkst = 

prm_read_mod_reg(OMAP3430ES2_USBHOST_MOD, PM_WKST);

Quoted 109 lines
arch/arm/mach-omap2/pm34xx.c +35 -9
@@ -361,7 +360,9 @@ static void omap3_pm_idle(void)
 	omap2_gpio_prepare_for_retention();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(0);
+		omap_serial_enable_clocks(0, 0);
+		omap_serial_enable_clocks(0, 1);
+		omap_serial_enable_clocks(0, 2);
 		/* XXX This is for gpio fclk hack. Will be removed as
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_disable();
@@ -370,7 +371,9 @@ static void omap3_pm_idle(void)
 	omap_sram_idle();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(1);
+		omap_serial_enable_clocks(1, 0);
+		omap_serial_enable_clocks(1, 1);
+		omap_serial_enable_clocks(1, 2);
 		/* XXX This is for gpio fclk hack. Will be removed as
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_enable();
@@ -412,7 +415,9 @@ static int omap3_pm_suspend(void)
 	omap2_gpio_prepare_for_retention();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(0);
+		omap_serial_enable_clocks(0, 0);
+		omap_serial_enable_clocks(0, 1);
+		omap_serial_enable_clocks(0, 2);
 		/* XXX This is for gpio fclk hack. Will be removed as
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_disable();
@@ -421,7 +426,9 @@ static int omap3_pm_suspend(void)
 	omap_sram_idle();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(1);
+		omap_serial_enable_clocks(1, 0);
+		omap_serial_enable_clocks(1, 1);
+		omap_serial_enable_clocks(1, 2);
 		/* XXX This is for gpio fclk hack. Will be removed as
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_enable();
@@ -629,6 +636,16 @@ static void __init prcm_setup_regs(void)
 			OCP_MOD, OMAP2_PRM_IRQENABLE_MPU_OFFSET);
 }
 
+void omap3_save_per_ctx(void)
+{
+	omap_gpio_save();
+}
+
+void omap3_restore_per_ctx(void)
+{
+	omap_gpio_restore();
+}
+
 static int __init pwrdms_setup(struct powerdomain *pwrdm)
 {
 	struct power_state *pwrst;
@@ -652,6 +669,12 @@ static int __init pwrdms_setup(struct po
 	return set_pwrdm_state(pwrst->pwrdm, pwrst->next_state);
 }
 
+void omap_push_sram_idle()
+{
+	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
+					omap34xx_cpu_suspend_sz);
+}
+
 int __init omap3_pm_init(void)
 {
 	struct power_state *pwrst;
@@ -663,6 +686,7 @@ int __init omap3_pm_init(void)
 	/* XXX prcm_setup_regs needs to be before enabling hw
 	 * supervised mode for powerdomains */
 	prcm_setup_regs();
+	save_scratchpad_contents();
 
 	ret = request_irq(INT_34XX_PRCM_MPU_IRQ,
 			  (irq_handler_t)prcm_interrupt_handler,
@@ -685,9 +709,7 @@ int __init omap3_pm_init(void)
 		goto err2;
 	}
 
-	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
-					omap34xx_cpu_suspend_sz);
-
+	omap_push_sram_idle();
 	suspend_set_ops(&omap_pm_ops);
 
 #ifndef CONFIG_CPU_IDLE
@@ -779,10 +801,13 @@ void save_scratchpad_contents(void)
 	*(scratchpad_address++) = __raw_readl(OMAP3430_PRM_CLKSEL);
 	*(scratchpad_address++) = cm_read_mod_reg(CORE_MOD, CM_CLKSEL);
 	*(scratchpad_address++) = cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
+	/* TODO OMAP3430_CM_CLKEN_PLL is defined 0x4 */
+	/**(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
+					OMAP3430_CM_CLKEN_PLL);*/
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
-					OMAP3430_CM_CLKEN_PLL);
+					0x0);
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
-					OMAP3430_CM_AUTOIDLE_PLL);
+					CM_AUTOIDLE);
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
 					OMAP3430_CM_CLKSEL1_PLL);
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
Quoted 3 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/prm.h
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/prm.h

2008-07-01 18:48:04.946594134 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/prm.h

2008-07-01 18:51:25.190168656 +0530

arch/arm/mach-omap2/prm.h line 139

Quoted 4 lines
arch/arm/mach-omap2/prm.h +0 -0
@@ -137,9 +137,11 @@
 
 #define OMAP3430_PM_MPUGRPSEL				0x00a4
 #define OMAP3430_PM_MPUGRPSEL1				

OMAP3430_PM_MPUGRPSEL

arch/arm/mach-omap2/prm.h

Quoted 4 lines
arch/arm/mach-omap2/prm.h +1 -0
+#define OMAP3430ES2_PM_MPUGRPSEL3			0x00f8
 
 #define OMAP3430_PM_IVAGRPSEL				0x00a8
 #define OMAP3430_PM_IVAGRPSEL1				

OMAP3430_PM_IVAGRPSEL

Quoted 7 lines
arch/arm/mach-omap2/prm.h +1 -0
+#define OMAP3430ES2_PM_IVAGRPSEL3			0x00f4
 
 #define OMAP3430_PM_PREPWSTST				0x00e8
 

Index: linux-omap-2.6/arch/arm/mach-omap2/sleep34xx.S
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/sleep34xx.S

2008-07-01 18:51:22.662249764 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/sleep34xx.S

2008-07-01 18:51:25.190168656 +0530

arch/arm/mach-omap2/sleep34xx.S loop2: · line 460

Quoted 9 lines
arch/arm/mach-omap2/sleep34xx.S +1 -4
@@ -457,10 +457,12 @@ loop2:
 	mov     r9, r4
 	/* create working copy of max way size*/
 loop3:
-	/* factor way and cache number into r11 */
-	orr     r11, r10, r9, lsl r5
-	/* factor index number into r11 */
-	orr     r11, r11, r7, lsl r2
+ 	orr	r11, r10, r9, lsl r5	 @ factor way and cache 

number into r11

arch/arm/mach-omap2/sleep34xx.S loop2:

Quoted 3 lines
arch/arm/mach-omap2/sleep34xx.S +3 -0
+ 	orr	r11, r11, r7, lsl r2	 @ factor index number into r11
+ 	lsl	r6, r9, r5
+ 	orr	r11, r10, r6		 @ factor way and cache 

number into r11

Quoted 14 lines
arch/arm/mach-omap2/sleep34xx.S +3 -1
+ 	lsl	r6, r7, r2
+ 	orr	r11, r11, r6		 @ factor index number into r11
 	/*clean & invalidate by set/way */
 	mcr     p15, 0, r11, c7, c10, 2
 	/* decrement the way*/
@@ -475,7 +477,7 @@ skip:
 	cmp     r3, r10
 	bgt     loop1
 finished:
-	/*swith back to cache level 0 */
+	/*switch back to cache level 0 */
 	mov     r10, #0
 	/* select current cache level in cssr */
 	mcr     p15, 2, r10, c0, c0, 0
Quoted 3 lines

Index: linux-omap-2.6/arch/arm/plat-omap/sram.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/plat-omap/sram.c

2008-07-01 18:48:04.946594134 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/plat-omap/sram.c

2008-07-01 18:51:25.191168624 +0530
Quoted 9 lines
arch/arm/plat-omap/sram.c +1 -0
@@ -26,6 +26,7 @@
 #include <asm/arch/board.h>
 
 #include <asm/arch/control.h>
+#include <asm/arch/pm.h>
 
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 # include "../mach-omap2/prm.h"

arch/arm/plat-omap/sram.c extern unsigned long omapfb_reserve_sram · line 83

Quoted 8 lines
arch/arm/plat-omap/sram.c +2 -0
@@ -75,6 +76,8 @@ extern unsigned long omapfb_reserve_sram
 					 unsigned long sram_size,
 					 unsigned long pstart_avail,
 					 unsigned long size_avail);
+extern void (*_omap_sram_idle)(u32 *addr, int save_state);
+extern void omap_push_sram_idle();
 
 /*
  * Depending on the target RAMFS firewall setup, the 

public usable amount of

Review static int is_sram_locked(void) · line 111

Quoted 2 lines
(quoted diff) +0 -0
@@ -108,6 +111,7 @@ static int is_sram_locked(void)
 		return 1; /* assume locked with no PPA or 

security driver */

arch/arm/plat-omap/sram.c u32 omap2_sram_configure_core_dpll(u32 m · line 378

Quoted 10 lines
arch/arm/plat-omap/sram.c +1 -0
 }
 
+
 /*
  * The amount of SRAM depends on the core type.
  * Note that we cannot try to test for SRAM here because writes
@@ -372,16 +376,15 @@ u32 omap2_sram_configure_core_dpll(u32 m
 }
 
 /* REVISIT: Should this be same as omap34xx_sram_init() 

after off-idle? */

arch/arm/plat-omap/sram.c u32 omap2_sram_configure_core_dpll(u32 m

Quoted 6 lines
arch/arm/plat-omap/sram.c +1 -2
-void restore_sram_functions(void)
+void omap3_restore_sram_ctx(void)
 {
 	omap_sram_ceil = omap_sram_base + omap_sram_size;
-
 	_omap2_sram_reprogram_gpmc = 

omap_sram_push(omap34xx_sram_reprogram_gpmc,

arch/arm/plat-omap/sram.c u32 omap2_sram_configure_core_dpll(u32 m · line 389

Quoted 5 lines
arch/arm/plat-omap/sram.c +1 -2
-		omap34xx_sram_reprogram_gpmc_sz);
-
+				omap34xx_sram_reprogram_gpmc_sz);
 	_omap2_sram_configure_core_dpll =
 

omap_sram_push(omap34xx_sram_configure_core_dpll,

Review u32 omap2_sram_configure_core_dpll(u32 m · line 384

Quoted 1 line
(quoted diff) +0 -1
-					

omap34xx_sram_configure_core_dpll_sz);

arch/arm/plat-omap/sram.c int __init omap34xx_sram_init(void) · line 405

Quoted 8 lines
arch/arm/plat-omap/sram.c +2 -0
+			omap34xx_sram_configure_core_dpll_sz);
+	omap_push_sram_idle();
 }
 
 int __init omap34xx_sram_init(void)
@@ -401,6 +404,8 @@ int __init omap34xx_sram_init(void)
 	_omap2_sram_configure_core_dpll =
 

omap_sram_push(omap34xx_sram_configure_core_dpll,

Quoted 1 line

omap34xx_sram_configure_core_dpll_sz);

Quoted 8 lines
arch/arm/plat-omap/sram.c +2 -0
+	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
+					omap34xx_cpu_suspend_sz);
 
 	return 0;
 }

Index: linux-omap-2.6/include/asm-arm/arch-omap/prcm.h
===================================================================
--- linux-omap-2.6.orig/include/asm-arm/arch-omap/prcm.h

2008-07-01 18:48:04.947594102 +0530
Quoted 1 line

+++ linux-omap-2.6/include/asm-arm/arch-omap/prcm.h

2008-07-01 18:51:25.192168592 +0530
Quoted 63 lines
include/asm-arm/arch-omap/prcm.h +53 -5
@@ -26,9 +26,57 @@
 u32 omap_prcm_get_reset_sources(void);
 void omap_prcm_arch_reset(char mode);
 
-#endif
-
-
-
-
+#ifdef CONFIG_ARCH_OMAP3
+/* Structure to save interrupt controller context */
+struct int_controller_context {
+	u32 sysconfig;
+	u32 protection;
+	u32 idle;
+	u32 threshold;
+	u32 ilr[96];
+	u32 mir_0;
+	u32 mir_1;
+	u32 mir_2;
+};
+
+/* Structure to save control module context */
+struct control_module_context {
+	u32 sysconfig;
+	u32 devconf0;
+	u32 mem_dftrw0;
+	u32 mem_dftrw1;
+	u32 msuspendmux_0;
+	u32 msuspendmux_1;
+	u32 msuspendmux_2;
+	u32 msuspendmux_3;
+	u32 msuspendmux_4;
+	u32 msuspendmux_5;
+	u32 sec_ctrl;
+	u32 devconf1;
+	u32 csirxfe;
+	u32 iva2_bootaddr;
+	u32 iva2_bootmod;
+	u32 debobs_0;
+	u32 debobs_1;
+	u32 debobs_2;
+	u32 debobs_3;
+	u32 debobs_4;
+	u32 debobs_5;
+	u32 debobs_6;
+	u32 debobs_7;
+	u32 debobs_8;
+	u32 prog_io0;
+	u32 prog_io1;
+	u32 dss_dpll_spreading;
+	u32 core_dpll_spreading;
+	u32 per_dpll_spreading;
+	u32 usbhost_dpll_spreading;
+	u32 pbias_lite;
+	u32 temp_sensor;
+	u32 sramldo4;
+	u32 sramldo5;
+	u32 csi;
+};
 
+#endif /* CONFIG_ARCH_OMAP3 */
+#endif /* __ASM_ARM_ARCH_OMAP_PRCM_H */
Quoted 3 lines

Index: linux-omap-2.6/include/asm-arm/arch-omap/control.h
===================================================================
--- linux-omap-2.6.orig/include/asm-arm/arch-omap/control.h

2008-07-01 18:48:04.947594102 +0530
Quoted 1 line

+++ linux-omap-2.6/include/asm-arm/arch-omap/control.h

2008-07-01 18:51:25.192168592 +0530

Review line 150

Quoted 3 lines
(quoted diff) +0 -0
@@ -149,7 +149,27 @@
 #define OMAP343X_CONTROL_FUSE_SR	(OMAP2_CONTROL_GENERAL + 0x0130)
 #define OMAP343X_CONTROL_IVA2_BOOTADDR	

(OMAP2_CONTROL_GENERAL + 0x0190)

Review line 151

Quoted 1 line
(quoted diff) +0 -0
 #define OMAP343X_CONTROL_IVA2_BOOTMOD	

(OMAP2_CONTROL_GENERAL + 0x0194)

Review line 152

Quoted 1 line
(quoted diff) +0 -1
-#define OMAP343X_CONTROL_TEMP_SENSOR	

(OMAP2_CONTROL_GENERAL + 0x02b4)

include/asm-arm/arch-omap/control.h

Quoted 12 lines
include/asm-arm/arch-omap/control.h +12 -0
+#define OMAP343X_CONTROL_DEBOBS_0	(OMAP2_CONTROL_GENERAL + 0x01B0)
+#define OMAP343X_CONTROL_DEBOBS_1	(OMAP2_CONTROL_GENERAL + 0x01B4)
+#define OMAP343X_CONTROL_DEBOBS_2	(OMAP2_CONTROL_GENERAL + 0x01B8)
+#define OMAP343X_CONTROL_DEBOBS_3	(OMAP2_CONTROL_GENERAL + 0x01BC)
+#define OMAP343X_CONTROL_DEBOBS_4	(OMAP2_CONTROL_GENERAL + 0x01C0)
+#define OMAP343X_CONTROL_DEBOBS_5	(OMAP2_CONTROL_GENERAL + 0x01C4)
+#define OMAP343X_CONTROL_DEBOBS_6	(OMAP2_CONTROL_GENERAL + 0x01C8)
+#define OMAP343X_CONTROL_DEBOBS_7	(OMAP2_CONTROL_GENERAL + 0x01CC)
+#define OMAP343X_CONTROL_DEBOBS_8	(OMAP2_CONTROL_GENERAL + 0x01D0)
+#define OMAP343X_CONTROL_PROG_IO0	(OMAP2_CONTROL_GENERAL + 0x01D4)
+#define OMAP343X_CONTROL_PROG_IO1	(OMAP2_CONTROL_GENERAL + 0x01D8)
+#define OMAP343X_CONTROL_DSS_DPLL_SPREADING	

(OMAP2_CONTROL_GENERAL + 0x01E0)

Review line 164

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_CORE_DPLL_SPREADING	

(OMAP2_CONTROL_GENERAL + 0x01E4)

Review line 165

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_PER_DPLL_SPREADING	

(OMAP2_CONTROL_GENERAL + 0x01E8)

Review line 166

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_USBHOST_DPLL_SPREADING 

(OMAP2_CONTROL_GENERAL + 0x01EC)

Review line 167

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_PBIAS_LITE	

(OMAP2_CONTROL_GENERAL + 0x02B0)

Review line 168

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_TEMP_SENSOR	

(OMAP2_CONTROL_GENERAL + 0x02B4)

include/asm-arm/arch-omap/control.h

Quoted 3 lines
include/asm-arm/arch-omap/control.h +3 -0
+#define OMAP343X_CONTROL_SRAMLDO4	(OMAP2_CONTROL_GENERAL + 0x02B8)
+#define OMAP343X_CONTROL_SRAMLDO5	(OMAP2_CONTROL_GENERAL + 0x02C0)
+#define OMAP343X_CONTROL_CSI		

(OMAP2_CONTROL_GENERAL + 0x02b4)

include/asm-arm/arch-omap/control.h

Quoted 4 lines
include/asm-arm/arch-omap/control.h +1 -0
+
 
 /*
  * REVISIT: This list of registers is not comprehensive - 

there are more

Quoted 3 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/serial.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/serial.c

2008-07-01 18:51:23.908209787 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/serial.c

2008-07-01 18:51:25.192168592 +0530
Quoted 22 lines
arch/arm/mach-omap2/serial.c +6 -11
@@ -157,18 +157,15 @@ static void omap_serial_kick(void)
 		NSEC_PER_SEC);
 }
 
-void omap_serial_enable_clocks(int enable)
+void omap_serial_enable_clocks(int enable, int unum)
 {
-	int i;
-	for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
-		if (uart_ick[i] && uart_fck[i]) {
-			if (enable) {
-				clk_enable(uart_ick[i]);
-				clk_enable(uart_fck[i]);
-			} else {
-				clk_disable(uart_ick[i]);
-				clk_disable(uart_fck[i]);
-			}
+	if (uart_ick[unum] && uart_fck[unum]) {
+		if (enable) {
+			clk_enable(uart_ick[unum]);
+			clk_enable(uart_fck[unum]);
+		} else {
Quoted 8 lines

arch/arm/mach-omap2/serial.c static void omap_serial_kick(void) · line 168

Quoted 2 lines
arch/arm/mach-omap2/serial.c +2 -0
+			clk_disable(uart_ick[unum]);
+			clk_disable(uart_fck[unum]);

If you do save and restore as I mentioned above then there is no need to add new parameter to omap_serial_enable_clocks function. Just do uart_ctx_save before calling clk_disable and restore after clk_enable. Then as we have that interface to ask for need for restore add put restore under if statement.

I don't understand how the second param could be avoided here. Its used to identify the UART and do the enable/disable only for the specified UART, rather than doing it for all UART's.

Quoted 20 lines
Quoted 7 lines
(quoted diff) +0 -0
 		}
 	}
 }

Index: linux-omap-2.6/include/asm-arm/arch-omap/common.h
===================================================================
--- linux-omap-2.6.orig/include/asm-arm/arch-omap/common.h

2008-07-01 18:51:24.326196376 +0530
Quoted 1 line

+++ linux-omap-2.6/include/asm-arm/arch-omap/common.h

2008-07-01 18:51:25.193168559 +0530
Quoted 10 lines
include/asm-arm/arch-omap/common.h +1 -1
@@ -34,7 +34,7 @@ struct sys_timer;
 extern void omap_map_common_io(void);
 extern struct sys_timer omap_timer;
 extern void omap_serial_init(void);
-extern void omap_serial_enable_clocks(int enable);
+extern void omap_serial_enable_clocks(int enable, int unum);
 extern int omap_serial_can_sleep(void);
 extern void omap_gpio_save(void);
 extern void omap_gpio_restore(void);
Quoted 12 lines
Quoted 2 lines

--
To unsubscribe from this list: send the line "unsubscribe

linux-omap" in

Quoted 4 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Jouni Högander

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 569 lines · ext Rajendra Nayak
Quoted 569 lines

-----Original Message-----
From: "Högander" Jouni [mailto:[email protected]]
Sent: Wednesday, July 02, 2008 6:06 PM
To: ext Rajendra Nayak
Cc: [email protected]
Subject: Re: [PATCH 11/11] CORE context save/restore

Quoted 11 lines · ext Rajendra Nayak

This patch adds the CORE context save/restore routines
- save/restores the following
1) PRCM registers
2) INTC context
3) System Control module context
4) Padconf

---
 arch/arm/mach-omap2/cpuidle34xx.c   |  546 

+++++++++++++++++++++++++++++++-----

Quoted 11 lines
 arch/arm/mach-omap2/cpuidle34xx.h   |   32 +-
 arch/arm/mach-omap2/pm34xx.c        |   45 ++
 arch/arm/mach-omap2/prm.h           |    2 
 arch/arm/mach-omap2/serial.c        |   19 -
 arch/arm/mach-omap2/sleep34xx.S     |   12 
 arch/arm/plat-omap/sram.c           |   15 
 include/asm-arm/arch-omap/common.h  |    2 
 include/asm-arm/arch-omap/control.h |   22 +
 include/asm-arm/arch-omap/prcm.h    |   58 +++
 10 files changed, 646 insertions(+), 107 deletions(-)
Quoted 3 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/cpuidle34xx.c

2008-07-01 18:51:23.077236449 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.c

2008-07-01 19:15:49.844144072 +0530
Quoted 26 lines
arch/arm/mach-omap2/cpuidle34xx.c +10 -0
@@ -28,12 +28,22 @@
 #include <asm/arch/powerdomain.h>
 #include <asm/arch/clockdomain.h>
 #include <asm/arch/gpio.h>
+#include <asm/arch/gpmc.h>
+#include <asm/arch/control.h>
+#include <linux/sched.h>
 #include "cpuidle34xx.h"
+#include "cm.h"
+#include "cm-regbits-34xx.h"
+#include "prm-regbits-34xx.h"
+#include "prm.h"
+#include "pm.h"
+#include "clock34xx.h"
 
 #ifdef CONFIG_CPU_IDLE
 
 struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES];
 struct omap3_processor_cx current_cx_state;
+static int padconf_saved;
 
 static int omap3_idle_bm_check(void)
 {
@@ -42,6 +52,379 @@ static int omap3_idle_bm_check(void)
 	return 0;
 }

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 63

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +9 -0
 
+void omap3_save_prcm_ctx(void)
+{
+	prcm_sleep_save[1] = omap_readl(INTC_MIR_0);
+	prcm_sleep_save[2] = omap_readl(INTC_MIR_1);
+	prcm_sleep_save[3] = omap_readl(INTC_MIR_2);
+	prcm_sleep_save[4] = omap_readl(CONTROL_PADCONF_SYS_NIRQ);
+	prcm_sleep_save[5] = omap_readl(OMAP34XX_GPIO1_IRQENABLE1);
+	prcm_sleep_save[6] = omap_readl(OMAP34XX_GPIO1_WAKEUPEN);
+	prcm_sleep_save[7] = cm_read_mod_reg(OMAP3430_IVA2_MOD, 

CM_CLKSEL2);

Review static int omap3_idle_bm_check(void) · line 65

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[8] = __raw_readl(OMAP3430_CM_SYSCONFIG);
+	prcm_sleep_save[9] = 

cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 67

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[10] = cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
+	prcm_sleep_save[11] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 68

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[12] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 69

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[13] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 70

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[14] = cm_read_mod_reg(OMAP3430_EMU_MOD, 

CM_CLKSEL1);

Review static int omap3_idle_bm_check(void) · line 71

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[15] = cm_read_mod_reg(OMAP3430_EMU_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 73

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[16] = cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[17] = cm_read_mod_reg(PLL_MOD, 

OMAP3430ES2_CM_CLKSEL5);

Review static int omap3_idle_bm_check(void) · line 75

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[18] = __raw_readl(OMAP3430_CM_POLCTRL);
+	prcm_sleep_save[19] = 

cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 77

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[20] = cm_read_mod_reg(CORE_MOD, CM_FCLKEN1);
+	prcm_sleep_save[21] = cm_read_mod_reg(CORE_MOD, 

OMAP3430ES2_CM_FCLKEN3);

Review static int omap3_idle_bm_check(void) · line 78

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[22] = 

cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 80

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[23] = cm_read_mod_reg(WKUP_MOD, CM_FCLKEN);
+	prcm_sleep_save[24] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 81

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[25] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 82

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[26] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 84

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[27] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      

CM_FCLKEN);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+	prcm_sleep_save[28] = cm_read_mod_reg(CORE_MOD, CM_ICLKEN1);
+	prcm_sleep_save[29] = cm_read_mod_reg(CORE_MOD, CM_ICLKEN2);
+	prcm_sleep_save[30] = cm_read_mod_reg(CORE_MOD, CM_ICLKEN3);
+	prcm_sleep_save[31] = 

cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 90

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[32] = cm_read_mod_reg(WKUP_MOD, CM_ICLKEN);
+	prcm_sleep_save[33] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 91

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[34] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 92

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[35] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_ICLKEN);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[36] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 95

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[37] = 

cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_AUTOIDLE2);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -0
+	prcm_sleep_save[38] = cm_read_mod_reg(MPU_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[39] = cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[40] = 

cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSTCTRL);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+	prcm_sleep_save[41] = cm_read_mod_reg(MPU_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[42] = cm_read_mod_reg(CORE_MOD, CM_CLKSTCTRL);
+	prcm_sleep_save[43] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD,
+							      

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 103

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[44] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 104

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[45] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 105

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[46] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 106

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[47] = 

cm_read_mod_reg(OMAP3430_NEON_MOD, CM_CLKSTCTRL);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[48] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      

CM_CLKSTCTRL);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+	prcm_sleep_save[49] = cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE1);
+	prcm_sleep_save[50] = cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE2);
+	prcm_sleep_save[51] = cm_read_mod_reg(CORE_MOD, CM_AUTOIDLE3);
+	prcm_sleep_save[52] = cm_read_mod_reg(WKUP_MOD, CM_AUTOIDLE);
+	prcm_sleep_save[53] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 114

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[54] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 115

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[55] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_AUTOIDLE);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[56] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							      

CM_AUTOIDLE);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[57] = cm_read_mod_reg(OMAP3430ES2_SGX_MOD,
+						      

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[58] = cm_read_mod_reg(OMAP3430_DSS_MOD,
+						      

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[59] = cm_read_mod_reg(OMAP3430_CAM_MOD,
+						      

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[60] = cm_read_mod_reg(OMAP3430_PER_MOD,
+						      

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[61] = cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+						      

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -0
+	prcm_sleep_save[62] = __raw_readl(OMAP3430_CM_CLKOUT_CTRL);
+	prcm_sleep_save[63] = __raw_readl(OMAP3430_PRM_CLKOUT_CTRL);
+	prcm_sleep_save[64] = 

prm_read_mod_reg(OMAP3430ES2_SGX_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 131

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[65] = 

prm_read_mod_reg(OMAP3430_DSS_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 132

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[66] = 

prm_read_mod_reg(OMAP3430_CAM_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 133

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[67] = 

prm_read_mod_reg(OMAP3430_PER_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 134

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[68] = 

prm_read_mod_reg(OMAP3430_NEON_MOD, PM_WKDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[69] = prm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,
+							       

PM_WKDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +6 -0
+	prcm_sleep_save[70] = prm_read_mod_reg(CORE_MOD,
+					      OMAP3430_PM_MPUGRPSEL1);
+	prcm_sleep_save[71] = prm_read_mod_reg(OMAP3430_IVA2_MOD,
+					      OMAP3430_PM_IVAGRPSEL1);
+	prcm_sleep_save[72] = prm_read_mod_reg(CORE_MOD,
+					      

OMAP3430ES2_PM_MPUGRPSEL3);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[73] = prm_read_mod_reg(CORE_MOD,
+					      

OMAP3430ES2_PM_IVAGRPSEL3);

Review static int omap3_idle_bm_check(void) · line 145

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[74] = prm_read_mod_reg(WKUP_MOD, 

OMAP3430_PM_MPUGRPSEL);

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +9 -0
+	prcm_sleep_save[75] = prm_read_mod_reg(WKUP_MOD,
+					      OMAP3430_PM_IVAGRPSEL);
+	prcm_sleep_save[76] = prm_read_mod_reg(OMAP3430_PER_MOD,
+					      OMAP3430_PM_MPUGRPSEL);
+	prcm_sleep_save[77] = prm_read_mod_reg(OMAP3430_PER_MOD,
+					      OMAP3430_PM_IVAGRPSEL);
+	prcm_sleep_save[78] = prm_read_mod_reg(WKUP_MOD, PM_WKEN);
+	return;
+}

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +10 -0
+
+void omap3_restore_prcm_ctx(void)
+{
+	omap_writel(prcm_sleep_save[1], INTC_MIR_0);
+	omap_writel(prcm_sleep_save[2], INTC_MIR_1);
+	omap_writel(prcm_sleep_save[3], INTC_MIR_2);
+	omap_writel(prcm_sleep_save[4], CONTROL_PADCONF_SYS_NIRQ);
+	omap_writel(prcm_sleep_save[5], OMAP34XX_GPIO1_IRQENABLE1);
+	omap_writel(prcm_sleep_save[6], OMAP34XX_GPIO1_WAKEUPEN);
+	cm_write_mod_reg(prcm_sleep_save[7], OMAP3430_IVA2_MOD, 

CM_CLKSEL2);

Review static int omap3_idle_bm_check(void) · line 166

Quoted 2 lines
(quoted diff) +2 -0
+	__raw_writel(prcm_sleep_save[8], OMAP3430_CM_SYSCONFIG);
+	cm_write_mod_reg(prcm_sleep_save[9], 

OMAP3430ES2_SGX_MOD, CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 168

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[10], WKUP_MOD, CM_CLKSEL);
+	cm_write_mod_reg(prcm_sleep_save[11], OMAP3430_DSS_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 169

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[12], OMAP3430_CAM_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 170

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[13], OMAP3430_PER_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 171

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[14], OMAP3430_EMU_MOD, 

CM_CLKSEL1);

Review static int omap3_idle_bm_check(void) · line 172

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[15], OMAP3430_EMU_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 174

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[16], PLL_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[17], PLL_MOD, 

OMAP3430ES2_CM_CLKSEL5);

Review static int omap3_idle_bm_check(void) · line 176

Quoted 2 lines
(quoted diff) +2 -0
+	__raw_writel(prcm_sleep_save[18], OMAP3430_CM_POLCTRL);
+	cm_write_mod_reg(prcm_sleep_save[19], 

OMAP3430_IVA2_MOD, CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 178

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[20], CORE_MOD, CM_FCLKEN1);
+	cm_write_mod_reg(prcm_sleep_save[21], CORE_MOD, 

OMAP3430ES2_CM_FCLKEN3);

Review static int omap3_idle_bm_check(void) · line 179

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[22], 

OMAP3430ES2_SGX_MOD, CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 181

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[23], WKUP_MOD, CM_FCLKEN);
+	cm_write_mod_reg(prcm_sleep_save[24], OMAP3430_DSS_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 182

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[25], OMAP3430_CAM_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 183

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[26], OMAP3430_PER_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 185

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[27], OMAP3430ES2_USBHOST_MOD,
+							       

CM_FCLKEN);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+	cm_write_mod_reg(prcm_sleep_save[28], CORE_MOD, CM_ICLKEN1);
+	cm_write_mod_reg(prcm_sleep_save[29], CORE_MOD, CM_ICLKEN2);
+	cm_write_mod_reg(prcm_sleep_save[30], CORE_MOD, CM_ICLKEN3);
+	cm_write_mod_reg(prcm_sleep_save[31], 

OMAP3430ES2_SGX_MOD, CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 191

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[32], WKUP_MOD, CM_ICLKEN);
+	cm_write_mod_reg(prcm_sleep_save[33], OMAP3430_DSS_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 192

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[34], OMAP3430_CAM_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 193

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[35], OMAP3430_PER_MOD, 

CM_ICLKEN);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 257

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	cm_write_mod_reg(prcm_sleep_save[36], OMAP3430ES2_USBHOST_MOD,
+								

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 196

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[37], 

OMAP3430_IVA2_MOD, CM_AUTOIDLE2);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -0
+	cm_write_mod_reg(prcm_sleep_save[38], MPU_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[39], PLL_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[40], 

OMAP3430_IVA2_MOD, CM_CLKSTCTRL);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+	cm_write_mod_reg(prcm_sleep_save[41], MPU_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[42], CORE_MOD, CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[43], OMAP3430ES2_SGX_MOD,
+						       CM_CLKSTCTRL);
+	cm_write_mod_reg(prcm_sleep_save[44], OMAP3430_DSS_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 205

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[45], OMAP3430_CAM_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 206

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[46], OMAP3430_PER_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 207

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[47], 

OMAP3430_NEON_MOD, CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 209

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[48], OMAP3430ES2_USBHOST_MOD,
+							       

CM_CLKSTCTRL);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+	cm_write_mod_reg(prcm_sleep_save[49], CORE_MOD, CM_AUTOIDLE1);
+	cm_write_mod_reg(prcm_sleep_save[50], CORE_MOD, CM_AUTOIDLE2);
+	cm_write_mod_reg(prcm_sleep_save[51], CORE_MOD, CM_AUTOIDLE3);
+	cm_write_mod_reg(prcm_sleep_save[52], WKUP_MOD, CM_AUTOIDLE);
+	cm_write_mod_reg(prcm_sleep_save[53], OMAP3430_DSS_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 215

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[54], OMAP3430_CAM_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 216

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[55], OMAP3430_PER_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 218

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[56], OMAP3430ES2_USBHOST_MOD,
+							       

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 220

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[57], OMAP3430ES2_SGX_MOD,
+						       

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 222

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[58], OMAP3430_DSS_MOD,
+						       

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 224

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[59], OMAP3430_CAM_MOD,
+						       

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 226

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[60], OMAP3430_PER_MOD,
+						       

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 228

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[61], OMAP3430ES2_USBHOST_MOD,
+						       

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -0
+	__raw_writel(prcm_sleep_save[62], OMAP3430_CM_CLKOUT_CTRL);
+	__raw_writel(prcm_sleep_save[63], OMAP3430_PRM_CLKOUT_CTRL);
+	prm_write_mod_reg(prcm_sleep_save[64], 

OMAP3430ES2_SGX_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 232

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[65], 

OMAP3430_DSS_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 233

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[66], 

OMAP3430_CAM_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 234

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[67], 

OMAP3430_PER_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 235

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[68], 

OMAP3430_NEON_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 237

Quoted 2 lines
(quoted diff) +2 -0
+	prm_write_mod_reg(prcm_sleep_save[69], OMAP3430ES2_USBHOST_MOD,
+							       

PM_WKDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 257

Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +6 -0
+	prm_write_mod_reg(prcm_sleep_save[70], CORE_MOD,
+					       OMAP3430_PM_MPUGRPSEL1);
+	prm_write_mod_reg(prcm_sleep_save[71], OMAP3430_IVA2_MOD,
+					       OMAP3430_PM_IVAGRPSEL1);
+	prm_write_mod_reg(prcm_sleep_save[72], CORE_MOD,
+					       

OMAP3430ES2_PM_MPUGRPSEL3);

Review static int omap3_idle_bm_check(void) · line 245

Quoted 2 lines
(quoted diff) +2 -0
+	prm_write_mod_reg(prcm_sleep_save[73], CORE_MOD,
+					       

OMAP3430ES2_PM_IVAGRPSEL3);

Quoted 31 lines
arch/arm/mach-omap2/cpuidle34xx.c +31 -0
+	prm_write_mod_reg(prcm_sleep_save[74], WKUP_MOD,
+					       OMAP3430_PM_MPUGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[75], WKUP_MOD,
+					       OMAP3430_PM_IVAGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[76], OMAP3430_PER_MOD,
+					       OMAP3430_PM_MPUGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[77], OMAP3430_PER_MOD,
+					       OMAP3430_PM_IVAGRPSEL);
+	prm_write_mod_reg(prcm_sleep_save[78], WKUP_MOD, PM_WKEN);
+	return;
+}
+
+static void omap_save_intc_ctx(void)
+{
+	int ind = 0;
+	intc_context.sysconfig = omap_readl(INTCPS_SYSCONFIG);
+	intc_context.protection =  omap_readl(INTCPS_PROTECTION);
+	intc_context.idle = omap_readl(INTCPS_IDLE);
+	intc_context.threshold = omap_readl(INTCPS_THRESHOLD);
+	for (ind = 0; ind < 96; ind++)
+	       intc_context.ilr[ind] =
+		       omap_readl(INTC_BASE + (0x100 + 0x4*ind));
+	/* MIRs are saved and restore with other PRCM registers */
+}
+
+static void omap_restore_intc_ctx(void)
+{
+	int ind = 0;
+	omap_writel(intc_context.sysconfig, INTCPS_SYSCONFIG);
+	omap_writel(intc_context.protection, INTCPS_PROTECTION);
+	omap_writel(intc_context.idle, INTCPS_IDLE);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +10 -0
+	omap_writel(intc_context.threshold, INTCPS_THRESHOLD);
+	for (ind = 0; ind < 96; ind++)
+	       omap_writel(intc_context.ilr[ind],
+		       INTC_BASE + (0x100 + 0x4*ind));
+	/* MIRs are saved and restore with other PRCM registers */
+}
+
+static void omap_save_control_ctx(void)
+{
+	control_ctx.sysconfig = 

omap_ctrl_readl(OMAP2_CONTROL_SYSCONFIG);

Review static int omap3_idle_bm_check(void) · line 288

Quoted 2 lines
(quoted diff) +2 -0
+	control_ctx.devconf0 = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
+	control_ctx.mem_dftrw0 = 

omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW0);

Review static int omap3_idle_bm_check(void) · line 289

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.mem_dftrw1 = 

omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW1);

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+	control_ctx.msuspendmux_0 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_0);
+	control_ctx.msuspendmux_1 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +10 -0
+	control_ctx.msuspendmux_2 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_2);
+	control_ctx.msuspendmux_3 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_3);
+	control_ctx.msuspendmux_4 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_4);
+	control_ctx.msuspendmux_5 =
+		       omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_5);
+	control_ctx.sec_ctrl = omap_ctrl_readl(OMAP2_CONTROL_SEC_CTRL);
+	control_ctx.devconf1 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +6 -0
+	control_ctx.csirxfe = omap_ctrl_readl(OMAP343X_CONTROL_CSIRXFE);
+	control_ctx.iva2_bootaddr =
+		       omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTADDR);
+	control_ctx.iva2_bootmod =
+		       omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTMOD);
+	control_ctx.debobs_0 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_0);

Review static int omap3_idle_bm_check(void) · line 310

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_1 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_1);

Review static int omap3_idle_bm_check(void) · line 311

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_2 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_2);

Review static int omap3_idle_bm_check(void) · line 312

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_3 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_3);

Review static int omap3_idle_bm_check(void) · line 313

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_4 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_4);

Review static int omap3_idle_bm_check(void) · line 314

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_5 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_5);

Review static int omap3_idle_bm_check(void) · line 315

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_6 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_6);

Review static int omap3_idle_bm_check(void) · line 316

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_7 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_7);

Review static int omap3_idle_bm_check(void) · line 317

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_8 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_8);

Review static int omap3_idle_bm_check(void) · line 318

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.prog_io0 = 

omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO0);

Review static int omap3_idle_bm_check(void) · line 319

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.prog_io1 = 

omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +9 -0
+	control_ctx.dss_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_DSS_DPLL_SPREADING);
+	control_ctx.core_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_CORE_DPLL_SPREADING);
+	control_ctx.per_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_PER_DPLL_SPREADING);
+	control_ctx.usbhost_dpll_spreading =
+	       omap_ctrl_readl(OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);
+	control_ctx.pbias_lite = 

omap_ctrl_readl(OMAP343X_CONTROL_PBIAS_LITE);

Review static int omap3_idle_bm_check(void) · line 329

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.temp_sensor = 

omap_ctrl_readl(OMAP343X_CONTROL_TEMP_SENSOR);

Review static int omap3_idle_bm_check(void) · line 330

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.sramldo4 = 

omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO4);

Review static int omap3_idle_bm_check(void) · line 331

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.sramldo5 = 

omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO5);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 7 lines
arch/arm/mach-omap2/cpuidle34xx.c +7 -0
+	control_ctx.csi = omap_ctrl_readl(OMAP343X_CONTROL_CSI);
+	return;
+}
+
+static void omap_restore_control_ctx(void)
+{
+	omap_ctrl_writel(control_ctx.sysconfig, 

OMAP2_CONTROL_SYSCONFIG);

Review static int omap3_idle_bm_check(void) · line 340

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.devconf0, OMAP2_CONTROL_DEVCONF0);
+	omap_ctrl_writel(control_ctx.mem_dftrw0, 

OMAP343X_CONTROL_MEM_DFTRW0);

Review static int omap3_idle_bm_check(void) · line 341

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.mem_dftrw1, 

OMAP343X_CONTROL_MEM_DFTRW1);

Review static int omap3_idle_bm_check(void) · line 343

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_0,
+					       

OMAP2_CONTROL_MSUSPENDMUX_0);

Review static int omap3_idle_bm_check(void) · line 345

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_1,
+					       

OMAP2_CONTROL_MSUSPENDMUX_1);

Review static int omap3_idle_bm_check(void) · line 347

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_2,
+					       

OMAP2_CONTROL_MSUSPENDMUX_2);

Review static int omap3_idle_bm_check(void) · line 349

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_3,
+					       

OMAP2_CONTROL_MSUSPENDMUX_3);

Review static int omap3_idle_bm_check(void) · line 351

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_4,
+					       

OMAP2_CONTROL_MSUSPENDMUX_4);

Review static int omap3_idle_bm_check(void) · line 353

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_5,
+					       

OMAP2_CONTROL_MSUSPENDMUX_5);

Review static int omap3_idle_bm_check(void) · line 355

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.sec_ctrl, OMAP2_CONTROL_SEC_CTRL);
+	omap_ctrl_writel(control_ctx.devconf1, 

OMAP343X_CONTROL_DEVCONF1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 387

Quoted 3 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -0
+	omap_ctrl_writel(control_ctx.csirxfe, OMAP343X_CONTROL_CSIRXFE);
+	omap_ctrl_writel(control_ctx.iva2_bootaddr,
+					       

OMAP343X_CONTROL_IVA2_BOOTADDR);

Review static int omap3_idle_bm_check(void) · line 360

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.iva2_bootmod,
+					       

OMAP343X_CONTROL_IVA2_BOOTMOD);

Review static int omap3_idle_bm_check(void) · line 361

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_0, 

OMAP343X_CONTROL_DEBOBS_0);

Review static int omap3_idle_bm_check(void) · line 362

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_1, 

OMAP343X_CONTROL_DEBOBS_1);

Review static int omap3_idle_bm_check(void) · line 363

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_2, 

OMAP343X_CONTROL_DEBOBS_2);

Review static int omap3_idle_bm_check(void) · line 364

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_3, 

OMAP343X_CONTROL_DEBOBS_3);

Review static int omap3_idle_bm_check(void) · line 365

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_4, 

OMAP343X_CONTROL_DEBOBS_4);

Review static int omap3_idle_bm_check(void) · line 366

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_5, 

OMAP343X_CONTROL_DEBOBS_5);

Review static int omap3_idle_bm_check(void) · line 367

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_6, 

OMAP343X_CONTROL_DEBOBS_6);

Review static int omap3_idle_bm_check(void) · line 368

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_7, 

OMAP343X_CONTROL_DEBOBS_7);

Review static int omap3_idle_bm_check(void) · line 369

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_8, 

OMAP343X_CONTROL_DEBOBS_8);

Review static int omap3_idle_bm_check(void) · line 370

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.prog_io0, 

OMAP343X_CONTROL_PROG_IO0);

Review static int omap3_idle_bm_check(void) · line 371

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.prog_io1, 

OMAP343X_CONTROL_PROG_IO1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +9 -0
+	omap_ctrl_writel(control_ctx.dss_dpll_spreading,
+			       OMAP343X_CONTROL_DSS_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.core_dpll_spreading,
+			       OMAP343X_CONTROL_CORE_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.per_dpll_spreading,
+			       OMAP343X_CONTROL_PER_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.usbhost_dpll_spreading,
+			       OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);
+	omap_ctrl_writel(control_ctx.pbias_lite, 

OMAP343X_CONTROL_PBIAS_LITE);

Review static int omap3_idle_bm_check(void) · line 381

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.temp_sensor, 

OMAP343X_CONTROL_TEMP_SENSOR);

Review static int omap3_idle_bm_check(void) · line 382

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.sramldo4, 

OMAP343X_CONTROL_SRAMLDO4);

Review static int omap3_idle_bm_check(void) · line 383

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.sramldo5, 

OMAP343X_CONTROL_SRAMLDO5);

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+	omap_ctrl_writel(control_ctx.csi, OMAP343X_CONTROL_CSI);
+	return;
+}
+
+void omap3_save_core_ctx(void)

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +10 -0
+{
+	u32 control_padconf_off;
+
+	if (!padconf_saved) {
+	       /* Save the padconf registers */
+	       control_padconf_off = omap_readl(CONTROL_PADCONF_OFF);
+	       control_padconf_off |= 2;
+	       omap_writel(control_padconf_off, CONTROL_PADCONF_OFF);
+	       /* wait for the save to complete */
+	       while 

(!omap_readl(CONTROL_GENERAL_PURPOSE_STATUS) & 0x1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 7 lines
arch/arm/mach-omap2/cpuidle34xx.c +7 -0
+	       padconf_saved = 1;
+	}
+	/* Save the Interrupt controller context */
+	omap_save_intc_ctx();
+	/* Save the GPMC context */
+	omap_save_gpmc_ctx();
+	/* Save the system control module context, padconf 

already save above*/

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 407

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	omap_save_control_ctx();
+	omap_save_uart_ctx(0);

This should be done in omap_serial_enable_clocks function.

Review static int omap3_idle_bm_check(void) · line 408

Quoted 1 line
(quoted diff) +1 -0
+	omap_serial_enable_clocks(0, 0);

Why this is here?

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 409

Quoted 1 line
arch/arm/mach-omap2/cpuidle34xx.c +1 -0
+	omap_save_uart_ctx(1);

This should be done in omap_serial_enable_clocks function.

Quoted 8 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 410

Quoted 1 line
(quoted diff) +1 -0
+	omap_serial_enable_clocks(0, 1);

Why this is here?

I did'nt understand these comments completely. Are you asking why splitting of uarts? its because UART1/UART2 belong to CORE and UART3 is in PER.
If you are saying that context save/restore functions could be moved within the enable_clocks functions, yes they can be.

It just looked weird to me that clock disable is done in save ctx function. Is there own clock disable if RET is entered instead of OFF?

Quoted 756 lines
Quoted 747 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 7 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+}
+
+void omap3_restore_core_ctx(void)
+{
+	/* Restore the control module context, padconf restored 

by h/w */

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 424

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +9 -0
+	omap_restore_control_ctx();
+	/* Restore the GPMC context */
+	omap_restore_gpmc_ctx();
+	/* Restore the interrupt controller context */
+	omap_restore_intc_ctx();
+	omap_serial_enable_clocks(1, 0);
+	omap_restore_uart_ctx(0);
+	omap_serial_enable_clocks(1, 1);
+	omap_restore_uart_ctx(1);

Same comments as above. You could move these uart restores to omap_serial_enable_clocks and restore always after enabling clock for some specific uart. Then as we have that interface to ask wether restore is needed then add if statement there.

Quoted 8 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -0
+	padconf_saved = 0;
+}
+
 /* omap3_enter_idle - Programs OMAP3 to enter the specified state.
  * returns the total time during which the system was idle.
  */
@@ -60,9 +443,15 @@ static int omap3_enter_idle(struct cpuid
 		return 0;

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 453

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
 	}
 
+	local_irq_disable();
+	local_fiq_disable();
+
 	/* Used to keep track of the total time in idle */
 	getnstimeofday(&ts_preidle);
 
+	if (cx->type > OMAP3_STATE_C1)
+		sched_clock_idle_sleep_event(); /* about to 

enter deep idle */

Quoted 22 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -3
+
 	mpu_pd = pwrdm_lookup("mpu_pwrdm");
 	core_pd = pwrdm_lookup("core_pwrdm");
 	per_pd = pwrdm_lookup("per_pwrdm");
@@ -74,12 +463,13 @@ static int omap3_enter_idle(struct cpuid
 	pwrdm_clear_all_prev_pwrst(core_pd);
 	pwrdm_clear_all_prev_pwrst(per_pd);
 
-	if (omap_irq_pending())
-		return 0;
-
 	per_pwrst = pwrdm_read_pwrst(per_pd);
 	neon_pwrst = pwrdm_read_pwrst(neon_pd);
 
+	/* Do this before any changes to PRCM registers */
+	if (cx->core_state == PWRDM_POWER_OFF)
+		omap3_save_prcm_ctx();
+
 	/* Program MPU to target state */
 	if (cx->mpu_state < PWRDM_POWER_ON) {
 		if (neon_pwrst == PWRDM_POWER_ON) {

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 489

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +1 -0
@@ -96,15 +486,22 @@ static int omap3_enter_idle(struct cpuid
 		if (per_pwrst == PWRDM_POWER_ON) {
 			omap2_gpio_prepare_for_retention();
 			if (clocks_off_while_idle) {
+				omap3_save_per_ctx();

Gpio saving could be moved int per_gpio_clk_disable function.

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 492

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -1
 				per_gpio_clk_disable();
-				omap_serial_enable_clocks(0);
+				omap_save_uart_ctx(2);
+				omap_serial_enable_clocks(0, 2);

Same comment as for uarts in core domain.

Quoted 16 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
 			}
 		}
+		if (cx->core_state == PWRDM_POWER_OFF)
+			omap3_save_core_ctx();
 		pwrdm_set_next_pwrst(core_pd, cx->core_state);
 	}
 
 	*(scratchpad_restore_addr) = restore_pointer_address;
 
+	if (omap_irq_pending())
+		goto return_sleep_time;
+
 	/* Execute ARM wfi */
 	omap_sram_idle();
 

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 519

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
@@ -118,25 +515,41 @@ static int omap3_enter_idle(struct cpuid
 	}
 
 	if (cx->core_state < PWRDM_POWER_ON) {
+		if ((cx->core_state == PWRDM_POWER_OFF)
+		&& (pwrdm_read_prev_pwrst(core_pd) == 

PWRDM_POWER_OFF)) {

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 530

Quoted 12 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -1
+			omap3_restore_core_ctx();
+			omap3_restore_prcm_ctx();
+			omap3_restore_sram_ctx();
+		}
+		pwrdm_set_next_pwrst(core_pd, PWRDM_POWER_ON);
 		if (per_pwrst == PWRDM_POWER_ON) {
 			if (clocks_off_while_idle) {
-				omap_serial_enable_clocks(1);
+				omap_serial_enable_clocks(1, 2);
+				omap_restore_uart_ctx(2);
 				per_gpio_clk_enable();
+				omap3_restore_per_ctx();

And again these could be moved to the clock enable/disable functions.

Quoted 58 lines
arch/arm/mach-omap2/cpuidle34xx.c +20 -19
 			}
 			omap2_gpio_resume_after_retention();
 		}
-		pwrdm_set_next_pwrst(core_pd, PWRDM_POWER_ON);
 	}
 
 	pr_debug("MPU prev st:%x,NEON prev st:%x\n",
-			       pwrdm_read_prev_pwrst(mpu_pd),
-			       pwrdm_read_prev_pwrst(neon_pd));
+				pwrdm_read_prev_pwrst(mpu_pd),
+				pwrdm_read_prev_pwrst(neon_pd));
 	pr_debug("PER prev st:%x,CORE prev st:%x\n",
-			       pwrdm_read_prev_pwrst(per_pd),
-			       pwrdm_read_prev_pwrst(core_pd));
+				pwrdm_read_prev_pwrst(per_pd),
+				pwrdm_read_prev_pwrst(core_pd));
 
+return_sleep_time:
 	getnstimeofday(&ts_postidle);
 	ts_idle = timespec_sub(ts_postidle, ts_preidle);
+
+	if (cx->type > OMAP3_STATE_C1)
+		sched_clock_idle_wakeup_event(timespec_to_ns(&ts_idle));
+
+	local_irq_enable();
+	local_fiq_disable();
+
 	return (u32)timespec_to_ns(&ts_idle)/1000;
 }
 
@@ -187,79 +600,79 @@ DEFINE_PER_CPU(struct cpuidle_device, om
 void omap_init_power_states(void)
 {
 	/* C0 . System executing code */
-	omap3_power_states[0].valid = 1;
-	omap3_power_states[0].type = OMAP3_STATE_C0;
-	omap3_power_states[0].sleep_latency = 0;
-	omap3_power_states[0].wakeup_latency = 0;
-	omap3_power_states[0].threshold = 0;
-	omap3_power_states[0].mpu_state = PWRDM_POWER_ON;
-	omap3_power_states[0].core_state = PWRDM_POWER_ON;
-	omap3_power_states[0].flags = CPUIDLE_FLAG_SHALLOW;
+	omap3_power_states[OMAP3_STATE_C0].valid = 1;
+	omap3_power_states[OMAP3_STATE_C0].type = OMAP3_STATE_C0;
+	omap3_power_states[OMAP3_STATE_C0].sleep_latency = 0;
+	omap3_power_states[OMAP3_STATE_C0].wakeup_latency = 0;
+	omap3_power_states[OMAP3_STATE_C0].threshold = 0;
+	omap3_power_states[OMAP3_STATE_C0].mpu_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C0].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C0].flags = CPUIDLE_FLAG_SHALLOW;
 
 	/* C1 . MPU WFI + Core active */
-	omap3_power_states[1].valid = 1;
-	omap3_power_states[1].type = OMAP3_STATE_C1;
-	omap3_power_states[1].sleep_latency = 10;
-	omap3_power_states[1].wakeup_latency = 10;
-	omap3_power_states[1].threshold = 30;
-	omap3_power_states[1].mpu_state = PWRDM_POWER_ON;

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om · line 620

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -2
-	omap3_power_states[1].core_state = PWRDM_POWER_ON;
-	omap3_power_states[1].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C1].valid = 1;
+	omap3_power_states[OMAP3_STATE_C1].type = OMAP3_STATE_C1;
+	omap3_power_states[OMAP3_STATE_C1].sleep_latency = 10;
+	omap3_power_states[OMAP3_STATE_C1].wakeup_latency = 10;
+	omap3_power_states[OMAP3_STATE_C1].threshold = 30;
+	omap3_power_states[OMAP3_STATE_C1].mpu_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C1].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C1].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -6
 						CPUIDLE_FLAG_SHALLOW;
 
 	/* C2 . MPU CSWR + Core active */
-	omap3_power_states[2].valid = 1;
-	omap3_power_states[2].type = OMAP3_STATE_C2;
-	omap3_power_states[2].sleep_latency = 50;
-	omap3_power_states[2].wakeup_latency = 50;
-	omap3_power_states[2].threshold = 300;
-	omap3_power_states[2].mpu_state = PWRDM_POWER_RET;

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -2
-	omap3_power_states[2].core_state = PWRDM_POWER_ON;
-	omap3_power_states[2].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C2].valid = 1;
+	omap3_power_states[OMAP3_STATE_C2].type = OMAP3_STATE_C2;
+	omap3_power_states[OMAP3_STATE_C2].sleep_latency = 50;
+	omap3_power_states[OMAP3_STATE_C2].wakeup_latency = 50;
+	omap3_power_states[OMAP3_STATE_C2].threshold = 300;
+	omap3_power_states[OMAP3_STATE_C2].mpu_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C2].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C2].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -6
 						CPUIDLE_FLAG_BALANCED;
 
 	/* C3 . MPU OFF + Core active */
-	omap3_power_states[3].valid = 1;
-	omap3_power_states[3].type = OMAP3_STATE_C3;
-	omap3_power_states[3].sleep_latency = 1500;
-	omap3_power_states[3].wakeup_latency = 1800;
-	omap3_power_states[3].threshold = 4000;
-	omap3_power_states[3].mpu_state = PWRDM_POWER_OFF;

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -2
-	omap3_power_states[3].core_state = PWRDM_POWER_ON;
-	omap3_power_states[3].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C3].valid = 1;
+	omap3_power_states[OMAP3_STATE_C3].type = OMAP3_STATE_C3;
+	omap3_power_states[OMAP3_STATE_C3].sleep_latency = 1500;
+	omap3_power_states[OMAP3_STATE_C3].wakeup_latency = 1800;
+	omap3_power_states[OMAP3_STATE_C3].threshold = 4000;
+	omap3_power_states[OMAP3_STATE_C3].mpu_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C3].core_state = PWRDM_POWER_ON;
+	omap3_power_states[OMAP3_STATE_C3].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -6
 			CPUIDLE_FLAG_BALANCED | CPUIDLE_FLAG_CHECK_BM;
 
 	/* C4 . MPU CSWR + Core CSWR*/
-	omap3_power_states[4].valid = 1;
-	omap3_power_states[4].type = OMAP3_STATE_C4;
-	omap3_power_states[4].sleep_latency = 2500;
-	omap3_power_states[4].wakeup_latency = 7500;
-	omap3_power_states[4].threshold = 12000;
-	omap3_power_states[4].mpu_state = PWRDM_POWER_RET;

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -2
-	omap3_power_states[4].core_state = PWRDM_POWER_RET;
-	omap3_power_states[4].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C4].valid = 1;
+	omap3_power_states[OMAP3_STATE_C4].type = OMAP3_STATE_C4;
+	omap3_power_states[OMAP3_STATE_C4].sleep_latency = 2500;
+	omap3_power_states[OMAP3_STATE_C4].wakeup_latency = 7500;
+	omap3_power_states[OMAP3_STATE_C4].threshold = 12000;
+	omap3_power_states[OMAP3_STATE_C4].mpu_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C4].core_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C4].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -6
 			CPUIDLE_FLAG_BALANCED | CPUIDLE_FLAG_CHECK_BM;
 
 	/* C5 . MPU OFF + Core CSWR */
-	omap3_power_states[5].valid = 1;
-	omap3_power_states[5].type = OMAP3_STATE_C5;
-	omap3_power_states[5].sleep_latency = 3000;
-	omap3_power_states[5].wakeup_latency = 8500;
-	omap3_power_states[5].threshold = 15000;
-	omap3_power_states[5].mpu_state = PWRDM_POWER_OFF;

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -2
-	omap3_power_states[5].core_state = PWRDM_POWER_RET;
-	omap3_power_states[5].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C5].valid = 1;
+	omap3_power_states[OMAP3_STATE_C5].type = OMAP3_STATE_C5;
+	omap3_power_states[OMAP3_STATE_C5].sleep_latency = 3000;
+	omap3_power_states[OMAP3_STATE_C5].wakeup_latency = 8500;
+	omap3_power_states[OMAP3_STATE_C5].threshold = 15000;
+	omap3_power_states[OMAP3_STATE_C5].mpu_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C5].core_state = PWRDM_POWER_RET;
+	omap3_power_states[OMAP3_STATE_C5].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -6
 			CPUIDLE_FLAG_BALANCED | CPUIDLE_FLAG_CHECK_BM;
 
 	/* C6 . MPU OFF + Core OFF */
-	omap3_power_states[6].valid = 0;
-	omap3_power_states[6].type = OMAP3_STATE_C6;
-	omap3_power_states[6].sleep_latency = 10000;
-	omap3_power_states[6].wakeup_latency = 30000;
-	omap3_power_states[6].threshold = 300000;
-	omap3_power_states[6].mpu_state = PWRDM_POWER_OFF;

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -2
-	omap3_power_states[6].core_state = PWRDM_POWER_OFF;
-	omap3_power_states[6].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C6].valid = 1;
+	omap3_power_states[OMAP3_STATE_C6].type = OMAP3_STATE_C6;
+	omap3_power_states[OMAP3_STATE_C6].sleep_latency = 10000;
+	omap3_power_states[OMAP3_STATE_C6].wakeup_latency = 30000;
+	omap3_power_states[OMAP3_STATE_C6].threshold = 300000;
+	omap3_power_states[OMAP3_STATE_C6].mpu_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C6].core_state = PWRDM_POWER_OFF;
+	omap3_power_states[OMAP3_STATE_C6].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 11 lines
arch/arm/mach-omap2/cpuidle34xx.c +1 -0
 			CPUIDLE_FLAG_DEEP | CPUIDLE_FLAG_CHECK_BM;
 }
 
@@ -277,6 +690,7 @@ int omap3_idle_init(void)
 	struct omap3_processor_cx *cx;
 	struct cpuidle_state *state;
 	struct cpuidle_device *dev;
+	char clk_name[11];
 
 	clear_scratchpad_contents();
 	save_scratchpad_contents();
Quoted 3 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.h
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/cpuidle34xx.h

2008-07-01 18:51:23.078236417 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.h

2008-07-01 18:51:25.189168688 +0530
Quoted 56 lines
arch/arm/mach-omap2/cpuidle34xx.h +29 -3
@@ -30,20 +30,41 @@
 #define OMAP3_STATE_C5 5 /* C5 - MPU OFF + Core RET */
 #define OMAP3_STATE_C6 6 /* C6 - MPU OFF + Core OFF */
 
-/* Currently, we support only upto C2 */
-#define MAX_SUPPORTED_STATES 3
+/* Interrupt Controller registers */
+#define INTC_BASE	0x48200000
+#define INTC_MIR_0	0x48200084
+#define INTC_MIR_1	0x482000A4
+#define INTC_MIR_2	0x482000C4
+#define INTCPS_SYSCONFIG	0x48200010
+#define INTCPS_PROTECTION	0x4820004C
+#define INTCPS_IDLE	0x48200050
+#define INTCPS_THRESHOLD	0x48200068
+
+#define CONTROL_PADCONF_SYS_NIRQ	0x480021E0
+#define CONTROL_PADCONF_OFF	0x48002270
+#define CONTROL_GENERAL_PURPOSE_STATUS	0x480022F4
+
+#define OMAP34XX_GPIO1_IRQENABLE1	0x4831001c
+#define OMAP34XX_GPIO1_WAKEUPEN	0x48310020
+#define OMAP34XX_GPIO1_FALLINGDETECT	0x4831004c
 
 extern unsigned short clocks_off_while_idle;
 extern void omap_sram_idle(void);
 extern int omap_irq_pending(void);
 extern void per_gpio_clk_enable(void);
 extern void per_gpio_clk_disable(void);
-extern void omap_serial_enable_clocks(int enable);
+extern void omap_serial_enable_clocks(int enable, int unum);
 extern int omap3_can_sleep();
 extern void clear_scratchpad_contents(void);
 extern void save_scratchpad_contents(void);
 extern u32 *scratchpad_restore_addr;
 extern u32 restore_pointer_address;
+extern void omap3_save_per_ctx();
+extern void omap3_restore_per_ctx();
+extern void omap_save_uart_ctx(int);
+extern void omap_restore_uart_ctx(int);
+extern void omap3_restore_sram_ctx();
+extern int omap3_can_sleep();
 
 struct omap3_processor_cx {
 	u8 valid;
@@ -59,5 +80,10 @@ struct omap3_processor_cx {
 void omap_init_power_states(void);
 int omap3_idle_init(void);
 
+/* TODO fix the size:100 */
+static unsigned int prcm_sleep_save[100];
+static struct int_controller_context intc_context;
+static struct control_module_context control_ctx;
+
 #endif /* ARCH_ARM_MACH_OMAP2_CPUIDLE_34XX */
 
Quoted 3 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c

2008-07-01 18:51:22.662249764 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c

2008-07-01 18:51:25.189168688 +0530

arch/arm/mach-omap2/pm34xx.c static irqreturn_t prcm_interrupt_handle · line 159

Quoted 8 lines
arch/arm/mach-omap2/pm34xx.c +0 -1
@@ -154,7 +154,6 @@ static irqreturn_t prcm_interrupt_handle
 		cm_write_mod_reg(iclk, OMAP3430_PER_MOD, CM_ICLKEN);
 		cm_write_mod_reg(fclk, OMAP3430_PER_MOD, CM_FCLKEN);
 	}
-
 	if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0)) {
 		/* USBHOST */
 		wkst = 

prm_read_mod_reg(OMAP3430ES2_USBHOST_MOD, PM_WKST);

Quoted 109 lines
arch/arm/mach-omap2/pm34xx.c +35 -9
@@ -361,7 +360,9 @@ static void omap3_pm_idle(void)
 	omap2_gpio_prepare_for_retention();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(0);
+		omap_serial_enable_clocks(0, 0);
+		omap_serial_enable_clocks(0, 1);
+		omap_serial_enable_clocks(0, 2);
 		/* XXX This is for gpio fclk hack. Will be removed as
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_disable();
@@ -370,7 +371,9 @@ static void omap3_pm_idle(void)
 	omap_sram_idle();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(1);
+		omap_serial_enable_clocks(1, 0);
+		omap_serial_enable_clocks(1, 1);
+		omap_serial_enable_clocks(1, 2);
 		/* XXX This is for gpio fclk hack. Will be removed as
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_enable();
@@ -412,7 +415,9 @@ static int omap3_pm_suspend(void)
 	omap2_gpio_prepare_for_retention();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(0);
+		omap_serial_enable_clocks(0, 0);
+		omap_serial_enable_clocks(0, 1);
+		omap_serial_enable_clocks(0, 2);
 		/* XXX This is for gpio fclk hack. Will be removed as
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_disable();
@@ -421,7 +426,9 @@ static int omap3_pm_suspend(void)
 	omap_sram_idle();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(1);
+		omap_serial_enable_clocks(1, 0);
+		omap_serial_enable_clocks(1, 1);
+		omap_serial_enable_clocks(1, 2);
 		/* XXX This is for gpio fclk hack. Will be removed as
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_enable();
@@ -629,6 +636,16 @@ static void __init prcm_setup_regs(void)
 			OCP_MOD, OMAP2_PRM_IRQENABLE_MPU_OFFSET);
 }
 
+void omap3_save_per_ctx(void)
+{
+	omap_gpio_save();
+}
+
+void omap3_restore_per_ctx(void)
+{
+	omap_gpio_restore();
+}
+
 static int __init pwrdms_setup(struct powerdomain *pwrdm)
 {
 	struct power_state *pwrst;
@@ -652,6 +669,12 @@ static int __init pwrdms_setup(struct po
 	return set_pwrdm_state(pwrst->pwrdm, pwrst->next_state);
 }
 
+void omap_push_sram_idle()
+{
+	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
+					omap34xx_cpu_suspend_sz);
+}
+
 int __init omap3_pm_init(void)
 {
 	struct power_state *pwrst;
@@ -663,6 +686,7 @@ int __init omap3_pm_init(void)
 	/* XXX prcm_setup_regs needs to be before enabling hw
 	 * supervised mode for powerdomains */
 	prcm_setup_regs();
+	save_scratchpad_contents();
 
 	ret = request_irq(INT_34XX_PRCM_MPU_IRQ,
 			  (irq_handler_t)prcm_interrupt_handler,
@@ -685,9 +709,7 @@ int __init omap3_pm_init(void)
 		goto err2;
 	}
 
-	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
-					omap34xx_cpu_suspend_sz);
-
+	omap_push_sram_idle();
 	suspend_set_ops(&omap_pm_ops);
 
 #ifndef CONFIG_CPU_IDLE
@@ -779,10 +801,13 @@ void save_scratchpad_contents(void)
 	*(scratchpad_address++) = __raw_readl(OMAP3430_PRM_CLKSEL);
 	*(scratchpad_address++) = cm_read_mod_reg(CORE_MOD, CM_CLKSEL);
 	*(scratchpad_address++) = cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);
+	/* TODO OMAP3430_CM_CLKEN_PLL is defined 0x4 */
+	/**(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
+					OMAP3430_CM_CLKEN_PLL);*/
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
-					OMAP3430_CM_CLKEN_PLL);
+					0x0);
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
-					OMAP3430_CM_AUTOIDLE_PLL);
+					CM_AUTOIDLE);
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
 					OMAP3430_CM_CLKSEL1_PLL);
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
Quoted 3 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/prm.h
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/prm.h

2008-07-01 18:48:04.946594134 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/prm.h

2008-07-01 18:51:25.190168656 +0530

arch/arm/mach-omap2/prm.h line 139

Quoted 4 lines
arch/arm/mach-omap2/prm.h +0 -0
@@ -137,9 +137,11 @@
 
 #define OMAP3430_PM_MPUGRPSEL				0x00a4
 #define OMAP3430_PM_MPUGRPSEL1				

OMAP3430_PM_MPUGRPSEL

arch/arm/mach-omap2/prm.h

Quoted 4 lines
arch/arm/mach-omap2/prm.h +1 -0
+#define OMAP3430ES2_PM_MPUGRPSEL3			0x00f8
 
 #define OMAP3430_PM_IVAGRPSEL				0x00a8
 #define OMAP3430_PM_IVAGRPSEL1				

OMAP3430_PM_IVAGRPSEL

Quoted 7 lines
arch/arm/mach-omap2/prm.h +1 -0
+#define OMAP3430ES2_PM_IVAGRPSEL3			0x00f4
 
 #define OMAP3430_PM_PREPWSTST				0x00e8
 

Index: linux-omap-2.6/arch/arm/mach-omap2/sleep34xx.S
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/sleep34xx.S

2008-07-01 18:51:22.662249764 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/sleep34xx.S

2008-07-01 18:51:25.190168656 +0530

arch/arm/mach-omap2/sleep34xx.S loop2: · line 460

Quoted 9 lines
arch/arm/mach-omap2/sleep34xx.S +1 -4
@@ -457,10 +457,12 @@ loop2:
 	mov     r9, r4
 	/* create working copy of max way size*/
 loop3:
-	/* factor way and cache number into r11 */
-	orr     r11, r10, r9, lsl r5
-	/* factor index number into r11 */
-	orr     r11, r11, r7, lsl r2
+ 	orr	r11, r10, r9, lsl r5	 @ factor way and cache 

number into r11

arch/arm/mach-omap2/sleep34xx.S loop2:

Quoted 3 lines
arch/arm/mach-omap2/sleep34xx.S +3 -0
+ 	orr	r11, r11, r7, lsl r2	 @ factor index number into r11
+ 	lsl	r6, r9, r5
+ 	orr	r11, r10, r6		 @ factor way and cache 

number into r11

Quoted 14 lines
arch/arm/mach-omap2/sleep34xx.S +3 -1
+ 	lsl	r6, r7, r2
+ 	orr	r11, r11, r6		 @ factor index number into r11
 	/*clean & invalidate by set/way */
 	mcr     p15, 0, r11, c7, c10, 2
 	/* decrement the way*/
@@ -475,7 +477,7 @@ skip:
 	cmp     r3, r10
 	bgt     loop1
 finished:
-	/*swith back to cache level 0 */
+	/*switch back to cache level 0 */
 	mov     r10, #0
 	/* select current cache level in cssr */
 	mcr     p15, 2, r10, c0, c0, 0
Quoted 3 lines

Index: linux-omap-2.6/arch/arm/plat-omap/sram.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/plat-omap/sram.c

2008-07-01 18:48:04.946594134 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/plat-omap/sram.c

2008-07-01 18:51:25.191168624 +0530
Quoted 9 lines
arch/arm/plat-omap/sram.c +1 -0
@@ -26,6 +26,7 @@
 #include <asm/arch/board.h>
 
 #include <asm/arch/control.h>
+#include <asm/arch/pm.h>
 
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 # include "../mach-omap2/prm.h"

arch/arm/plat-omap/sram.c extern unsigned long omapfb_reserve_sram · line 83

Quoted 8 lines
arch/arm/plat-omap/sram.c +2 -0
@@ -75,6 +76,8 @@ extern unsigned long omapfb_reserve_sram
 					 unsigned long sram_size,
 					 unsigned long pstart_avail,
 					 unsigned long size_avail);
+extern void (*_omap_sram_idle)(u32 *addr, int save_state);
+extern void omap_push_sram_idle();
 
 /*
  * Depending on the target RAMFS firewall setup, the 

public usable amount of

Review static int is_sram_locked(void) · line 111

Quoted 2 lines
(quoted diff) +0 -0
@@ -108,6 +111,7 @@ static int is_sram_locked(void)
 		return 1; /* assume locked with no PPA or 

security driver */

arch/arm/plat-omap/sram.c u32 omap2_sram_configure_core_dpll(u32 m · line 378

Quoted 10 lines
arch/arm/plat-omap/sram.c +1 -0
 }
 
+
 /*
  * The amount of SRAM depends on the core type.
  * Note that we cannot try to test for SRAM here because writes
@@ -372,16 +376,15 @@ u32 omap2_sram_configure_core_dpll(u32 m
 }
 
 /* REVISIT: Should this be same as omap34xx_sram_init() 

after off-idle? */

arch/arm/plat-omap/sram.c u32 omap2_sram_configure_core_dpll(u32 m

Quoted 6 lines
arch/arm/plat-omap/sram.c +1 -2
-void restore_sram_functions(void)
+void omap3_restore_sram_ctx(void)
 {
 	omap_sram_ceil = omap_sram_base + omap_sram_size;
-
 	_omap2_sram_reprogram_gpmc = 

omap_sram_push(omap34xx_sram_reprogram_gpmc,

arch/arm/plat-omap/sram.c u32 omap2_sram_configure_core_dpll(u32 m · line 389

Quoted 5 lines
arch/arm/plat-omap/sram.c +1 -2
-		omap34xx_sram_reprogram_gpmc_sz);
-
+				omap34xx_sram_reprogram_gpmc_sz);
 	_omap2_sram_configure_core_dpll =
 

omap_sram_push(omap34xx_sram_configure_core_dpll,

Review u32 omap2_sram_configure_core_dpll(u32 m · line 384

Quoted 1 line
(quoted diff) +0 -1
-					

omap34xx_sram_configure_core_dpll_sz);

arch/arm/plat-omap/sram.c int __init omap34xx_sram_init(void) · line 405

Quoted 8 lines
arch/arm/plat-omap/sram.c +2 -0
+			omap34xx_sram_configure_core_dpll_sz);
+	omap_push_sram_idle();
 }
 
 int __init omap34xx_sram_init(void)
@@ -401,6 +404,8 @@ int __init omap34xx_sram_init(void)
 	_omap2_sram_configure_core_dpll =
 

omap_sram_push(omap34xx_sram_configure_core_dpll,

Quoted 1 line

omap34xx_sram_configure_core_dpll_sz);

Quoted 8 lines
arch/arm/plat-omap/sram.c +2 -0
+	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
+					omap34xx_cpu_suspend_sz);
 
 	return 0;
 }

Index: linux-omap-2.6/include/asm-arm/arch-omap/prcm.h
===================================================================
--- linux-omap-2.6.orig/include/asm-arm/arch-omap/prcm.h

2008-07-01 18:48:04.947594102 +0530
Quoted 1 line

+++ linux-omap-2.6/include/asm-arm/arch-omap/prcm.h

2008-07-01 18:51:25.192168592 +0530
Quoted 63 lines
include/asm-arm/arch-omap/prcm.h +53 -5
@@ -26,9 +26,57 @@
 u32 omap_prcm_get_reset_sources(void);
 void omap_prcm_arch_reset(char mode);
 
-#endif
-
-
-
-
+#ifdef CONFIG_ARCH_OMAP3
+/* Structure to save interrupt controller context */
+struct int_controller_context {
+	u32 sysconfig;
+	u32 protection;
+	u32 idle;
+	u32 threshold;
+	u32 ilr[96];
+	u32 mir_0;
+	u32 mir_1;
+	u32 mir_2;
+};
+
+/* Structure to save control module context */
+struct control_module_context {
+	u32 sysconfig;
+	u32 devconf0;
+	u32 mem_dftrw0;
+	u32 mem_dftrw1;
+	u32 msuspendmux_0;
+	u32 msuspendmux_1;
+	u32 msuspendmux_2;
+	u32 msuspendmux_3;
+	u32 msuspendmux_4;
+	u32 msuspendmux_5;
+	u32 sec_ctrl;
+	u32 devconf1;
+	u32 csirxfe;
+	u32 iva2_bootaddr;
+	u32 iva2_bootmod;
+	u32 debobs_0;
+	u32 debobs_1;
+	u32 debobs_2;
+	u32 debobs_3;
+	u32 debobs_4;
+	u32 debobs_5;
+	u32 debobs_6;
+	u32 debobs_7;
+	u32 debobs_8;
+	u32 prog_io0;
+	u32 prog_io1;
+	u32 dss_dpll_spreading;
+	u32 core_dpll_spreading;
+	u32 per_dpll_spreading;
+	u32 usbhost_dpll_spreading;
+	u32 pbias_lite;
+	u32 temp_sensor;
+	u32 sramldo4;
+	u32 sramldo5;
+	u32 csi;
+};
 
+#endif /* CONFIG_ARCH_OMAP3 */
+#endif /* __ASM_ARM_ARCH_OMAP_PRCM_H */
Quoted 3 lines

Index: linux-omap-2.6/include/asm-arm/arch-omap/control.h
===================================================================
--- linux-omap-2.6.orig/include/asm-arm/arch-omap/control.h

2008-07-01 18:48:04.947594102 +0530
Quoted 1 line

+++ linux-omap-2.6/include/asm-arm/arch-omap/control.h

2008-07-01 18:51:25.192168592 +0530

Review line 150

Quoted 3 lines
(quoted diff) +0 -0
@@ -149,7 +149,27 @@
 #define OMAP343X_CONTROL_FUSE_SR	(OMAP2_CONTROL_GENERAL + 0x0130)
 #define OMAP343X_CONTROL_IVA2_BOOTADDR	

(OMAP2_CONTROL_GENERAL + 0x0190)

Review line 151

Quoted 1 line
(quoted diff) +0 -0
 #define OMAP343X_CONTROL_IVA2_BOOTMOD	

(OMAP2_CONTROL_GENERAL + 0x0194)

Review line 152

Quoted 1 line
(quoted diff) +0 -1
-#define OMAP343X_CONTROL_TEMP_SENSOR	

(OMAP2_CONTROL_GENERAL + 0x02b4)

include/asm-arm/arch-omap/control.h

Quoted 12 lines
include/asm-arm/arch-omap/control.h +12 -0
+#define OMAP343X_CONTROL_DEBOBS_0	(OMAP2_CONTROL_GENERAL + 0x01B0)
+#define OMAP343X_CONTROL_DEBOBS_1	(OMAP2_CONTROL_GENERAL + 0x01B4)
+#define OMAP343X_CONTROL_DEBOBS_2	(OMAP2_CONTROL_GENERAL + 0x01B8)
+#define OMAP343X_CONTROL_DEBOBS_3	(OMAP2_CONTROL_GENERAL + 0x01BC)
+#define OMAP343X_CONTROL_DEBOBS_4	(OMAP2_CONTROL_GENERAL + 0x01C0)
+#define OMAP343X_CONTROL_DEBOBS_5	(OMAP2_CONTROL_GENERAL + 0x01C4)
+#define OMAP343X_CONTROL_DEBOBS_6	(OMAP2_CONTROL_GENERAL + 0x01C8)
+#define OMAP343X_CONTROL_DEBOBS_7	(OMAP2_CONTROL_GENERAL + 0x01CC)
+#define OMAP343X_CONTROL_DEBOBS_8	(OMAP2_CONTROL_GENERAL + 0x01D0)
+#define OMAP343X_CONTROL_PROG_IO0	(OMAP2_CONTROL_GENERAL + 0x01D4)
+#define OMAP343X_CONTROL_PROG_IO1	(OMAP2_CONTROL_GENERAL + 0x01D8)
+#define OMAP343X_CONTROL_DSS_DPLL_SPREADING	

(OMAP2_CONTROL_GENERAL + 0x01E0)

Review line 164

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_CORE_DPLL_SPREADING	

(OMAP2_CONTROL_GENERAL + 0x01E4)

Review line 165

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_PER_DPLL_SPREADING	

(OMAP2_CONTROL_GENERAL + 0x01E8)

Review line 166

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_USBHOST_DPLL_SPREADING 

(OMAP2_CONTROL_GENERAL + 0x01EC)

Review line 167

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_PBIAS_LITE	

(OMAP2_CONTROL_GENERAL + 0x02B0)

Review line 168

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_TEMP_SENSOR	

(OMAP2_CONTROL_GENERAL + 0x02B4)

include/asm-arm/arch-omap/control.h

Quoted 3 lines
include/asm-arm/arch-omap/control.h +3 -0
+#define OMAP343X_CONTROL_SRAMLDO4	(OMAP2_CONTROL_GENERAL + 0x02B8)
+#define OMAP343X_CONTROL_SRAMLDO5	(OMAP2_CONTROL_GENERAL + 0x02C0)
+#define OMAP343X_CONTROL_CSI		

(OMAP2_CONTROL_GENERAL + 0x02b4)

include/asm-arm/arch-omap/control.h

Quoted 4 lines
include/asm-arm/arch-omap/control.h +1 -0
+
 
 /*
  * REVISIT: This list of registers is not comprehensive - 

there are more

Quoted 3 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/serial.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/serial.c

2008-07-01 18:51:23.908209787 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/serial.c

2008-07-01 18:51:25.192168592 +0530
Quoted 22 lines
arch/arm/mach-omap2/serial.c +6 -11
@@ -157,18 +157,15 @@ static void omap_serial_kick(void)
 		NSEC_PER_SEC);
 }
 
-void omap_serial_enable_clocks(int enable)
+void omap_serial_enable_clocks(int enable, int unum)
 {
-	int i;
-	for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
-		if (uart_ick[i] && uart_fck[i]) {
-			if (enable) {
-				clk_enable(uart_ick[i]);
-				clk_enable(uart_fck[i]);
-			} else {
-				clk_disable(uart_ick[i]);
-				clk_disable(uart_fck[i]);
-			}
+	if (uart_ick[unum] && uart_fck[unum]) {
+		if (enable) {
+			clk_enable(uart_ick[unum]);
+			clk_enable(uart_fck[unum]);
+		} else {
Quoted 8 lines

arch/arm/mach-omap2/serial.c static void omap_serial_kick(void) · line 168

Quoted 2 lines
arch/arm/mach-omap2/serial.c +2 -0
+			clk_disable(uart_ick[unum]);
+			clk_disable(uart_fck[unum]);

If you do save and restore as I mentioned above then there is no need to add new parameter to omap_serial_enable_clocks function. Just do uart_ctx_save before calling clk_disable and restore after clk_enable. Then as we have that interface to ask for need for restore add put restore under if statement.

Quoted 3 lines

I don't understand how the second param could be avoided here. Its used to identify the UART and do the enable/disable only for the specified UART, rather than doing it for all UART's.

Uarts whose clocks should be handled are identified originally using enabled_uarts in ATAGS. After that uarts that needs to be controlled are identified by checking the pointers. If you call this just using omap_serial_enable_clocks(0) then those uart clocks are disabled. As you pointed core and per are always entering sleep state together, it is ok to disable/enable these clocks at same time.

Quoted 36 lines
Quoted 33 lines
Quoted 8 lines
(quoted diff) +0 -0
 		}
 	}
 }

Index: linux-omap-2.6/include/asm-arm/arch-omap/common.h
===================================================================
--- linux-omap-2.6.orig/include/asm-arm/arch-omap/common.h

2008-07-01 18:51:24.326196376 +0530
Quoted 1 line

+++ linux-omap-2.6/include/asm-arm/arch-omap/common.h

2008-07-01 18:51:25.193168559 +0530
Quoted 11 lines
include/asm-arm/arch-omap/common.h +1 -2
@@ -34,7 +34,7 @@ struct sys_timer;
 extern void omap_map_common_io(void);
 extern struct sys_timer omap_timer;
 extern void omap_serial_init(void);
-extern void omap_serial_enable_clocks(int enable);
+extern void omap_serial_enable_clocks(int enable, int unum);
 extern int omap_serial_can_sleep(void);
 extern void omap_gpio_save(void);
 extern void omap_gpio_restore(void);
 
--
Quoted 1 line

To unsubscribe from this list: send the line "unsubscribe

linux-omap" in

Quoted 4 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Jouni Högander
Signature · 6 lines
Jouni Högander

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
Quoted 688 lines

-----Original Message-----
From: "Högander" Jouni [mailto:[email protected]]
Sent: Wednesday, July 02, 2008 7:14 PM
To: ext Rajendra Nayak
Cc: [email protected]
Subject: Re: [PATCH 11/11] CORE context save/restore

Quoted 34 lines · ext Rajendra Nayak
Quoted 34 lines

-----Original Message-----
From: "Högander" Jouni [mailto:[email protected]]
Sent: Wednesday, July 02, 2008 6:06 PM
To: ext Rajendra Nayak
Cc: [email protected]
Subject: Re: [PATCH 11/11] CORE context save/restore

Quoted 11 lines · ext Rajendra Nayak

This patch adds the CORE context save/restore routines
- save/restores the following
1) PRCM registers
2) INTC context
3) System Control module context
4) Padconf

---
 arch/arm/mach-omap2/cpuidle34xx.c   |  546 

+++++++++++++++++++++++++++++++-----

Quoted 11 lines
 arch/arm/mach-omap2/cpuidle34xx.h   |   32 +-
 arch/arm/mach-omap2/pm34xx.c        |   45 ++
 arch/arm/mach-omap2/prm.h           |    2 
 arch/arm/mach-omap2/serial.c        |   19 -
 arch/arm/mach-omap2/sleep34xx.S     |   12 
 arch/arm/plat-omap/sram.c           |   15 
 include/asm-arm/arch-omap/common.h  |    2 
 include/asm-arm/arch-omap/control.h |   22 +
 include/asm-arm/arch-omap/prcm.h    |   58 +++
 10 files changed, 646 insertions(+), 107 deletions(-)
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.c

===================================================================

Quoted 31 lines
Quoted 31 lines
Quoted 1 line

--- linux-omap-2.6.orig/arch/arm/mach-omap2/cpuidle34xx.c

2008-07-01 18:51:23.077236449 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.c

2008-07-01 19:15:49.844144072 +0530
Quoted 27 lines
arch/arm/mach-omap2/cpuidle34xx.c +10 -0
@@ -28,12 +28,22 @@
 #include <asm/arch/powerdomain.h>
 #include <asm/arch/clockdomain.h>
 #include <asm/arch/gpio.h>
+#include <asm/arch/gpmc.h>
+#include <asm/arch/control.h>
+#include <linux/sched.h>
 #include "cpuidle34xx.h"
+#include "cm.h"
+#include "cm-regbits-34xx.h"
+#include "prm-regbits-34xx.h"
+#include "prm.h"
+#include "pm.h"
+#include "clock34xx.h"
 
 #ifdef CONFIG_CPU_IDLE
 
 struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES];
 struct omap3_processor_cx current_cx_state;
+static int padconf_saved;
 
 static int omap3_idle_bm_check(void)
 {
@@ -42,6 +52,379 @@ static int omap3_idle_bm_check(void)
 	return 0;
 }
 
Quoted 6 lines
Quoted 6 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +6 -0
+void omap3_save_prcm_ctx(void)
+{
+	prcm_sleep_save[1] = omap_readl(INTC_MIR_0);
+	prcm_sleep_save[2] = omap_readl(INTC_MIR_1);
+	prcm_sleep_save[3] = omap_readl(INTC_MIR_2);
+	prcm_sleep_save[4] = 

omap_readl(CONTROL_PADCONF_SYS_NIRQ);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 61

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[5] = 

omap_readl(OMAP34XX_GPIO1_IRQENABLE1);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 62

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[6] = 

omap_readl(OMAP34XX_GPIO1_WAKEUPEN);

Quoted 6 lines
Quoted 6 lines

Review static int omap3_idle_bm_check(void) · line 63

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[7] = cm_read_mod_reg(OMAP3430_IVA2_MOD, 

CM_CLKSEL2);

Review static int omap3_idle_bm_check(void) · line 65

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[8] = __raw_readl(OMAP3430_CM_SYSCONFIG);
+	prcm_sleep_save[9] = 

cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 66

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[10] = cm_read_mod_reg(WKUP_MOD, 

CM_CLKSEL);

Quoted 11 lines
Quoted 11 lines

Review static int omap3_idle_bm_check(void) · line 67

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[11] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 68

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[12] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 69

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[13] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 70

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[14] = cm_read_mod_reg(OMAP3430_EMU_MOD, 

CM_CLKSEL1);

Review static int omap3_idle_bm_check(void) · line 71

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[15] = cm_read_mod_reg(OMAP3430_EMU_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 72

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[16] = cm_read_mod_reg(PLL_MOD, 

CM_AUTOIDLE2);

Quoted 6 lines
Quoted 6 lines

Review static int omap3_idle_bm_check(void) · line 73

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[17] = cm_read_mod_reg(PLL_MOD, 

OMAP3430ES2_CM_CLKSEL5);

Review static int omap3_idle_bm_check(void) · line 75

Quoted 2 lines
(quoted diff) +2 -0
+	prcm_sleep_save[18] = __raw_readl(OMAP3430_CM_POLCTRL);
+	prcm_sleep_save[19] = 

cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 76

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[20] = cm_read_mod_reg(CORE_MOD, 

CM_FCLKEN1);

Quoted 5 lines
Quoted 5 lines

Review static int omap3_idle_bm_check(void) · line 77

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[21] = cm_read_mod_reg(CORE_MOD, 

OMAP3430ES2_CM_FCLKEN3);

Review static int omap3_idle_bm_check(void) · line 78

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[22] = 

cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 79

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[23] = cm_read_mod_reg(WKUP_MOD, 

CM_FCLKEN);

Quoted 7 lines
Quoted 7 lines

Review static int omap3_idle_bm_check(void) · line 80

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[24] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 81

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[25] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 82

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[26] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 83

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[27] = 

cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 84

Quoted 1 line
(quoted diff) +1 -0
+							      

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 85

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[28] = cm_read_mod_reg(CORE_MOD, 

CM_ICLKEN1);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 86

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[29] = cm_read_mod_reg(CORE_MOD, 

CM_ICLKEN2);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 87

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[30] = cm_read_mod_reg(CORE_MOD, 

CM_ICLKEN3);

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 88

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[31] = 

cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 89

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[32] = cm_read_mod_reg(WKUP_MOD, 

CM_ICLKEN);

Quoted 7 lines
Quoted 7 lines

Review static int omap3_idle_bm_check(void) · line 90

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[33] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 91

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[34] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 92

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[35] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 93

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[36] = 

cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,

Quoted 5 lines
Quoted 5 lines

Review static int omap3_idle_bm_check(void) · line 94

Quoted 1 line
(quoted diff) +1 -0
+							      

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 95

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[37] = 

cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_AUTOIDLE2);

Review static int omap3_idle_bm_check(void) · line 96

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[38] = cm_read_mod_reg(MPU_MOD, 

CM_AUTOIDLE2);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 97

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[39] = cm_read_mod_reg(PLL_MOD, 

CM_AUTOIDLE);

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 98

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[40] = 

cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 99

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[41] = cm_read_mod_reg(MPU_MOD, 

CM_CLKSTCTRL);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 100

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[42] = cm_read_mod_reg(CORE_MOD, 

CM_CLKSTCTRL);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 101

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[43] = 

cm_read_mod_reg(OMAP3430ES2_SGX_MOD,

Quoted 11 lines
Quoted 11 lines

Review static int omap3_idle_bm_check(void) · line 102

Quoted 1 line
(quoted diff) +1 -0
+							      

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 103

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[44] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 104

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[45] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 105

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[46] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 106

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[47] = 

cm_read_mod_reg(OMAP3430_NEON_MOD, CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 107

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[48] = 

cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 108

Quoted 1 line
(quoted diff) +1 -0
+							      

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 109

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[49] = cm_read_mod_reg(CORE_MOD, 

CM_AUTOIDLE1);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 110

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[50] = cm_read_mod_reg(CORE_MOD, 

CM_AUTOIDLE2);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 111

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[51] = cm_read_mod_reg(CORE_MOD, 

CM_AUTOIDLE3);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 112

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[52] = cm_read_mod_reg(WKUP_MOD, 

CM_AUTOIDLE);

Quoted 7 lines
Quoted 7 lines

Review static int omap3_idle_bm_check(void) · line 113

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[53] = cm_read_mod_reg(OMAP3430_DSS_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 114

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[54] = cm_read_mod_reg(OMAP3430_CAM_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 115

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[55] = cm_read_mod_reg(OMAP3430_PER_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 116

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[56] = 

cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 117

Quoted 1 line
(quoted diff) +1 -0
+							      

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 118

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[57] = 

cm_read_mod_reg(OMAP3430ES2_SGX_MOD,

Quoted 5 lines
Quoted 5 lines

Review static int omap3_idle_bm_check(void) · line 119

Quoted 1 line
(quoted diff) +1 -0
+						      

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[58] = cm_read_mod_reg(OMAP3430_DSS_MOD,
+						      

OMAP3430_CM_SLEEPDEP);

Quoted 7 lines
Quoted 7 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[59] = cm_read_mod_reg(OMAP3430_CAM_MOD,
+						      

OMAP3430_CM_SLEEPDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[60] = cm_read_mod_reg(OMAP3430_PER_MOD,
+						      

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 126

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[61] = 

cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 127

Quoted 1 line
(quoted diff) +1 -0
+						      

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 128

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[62] = 

__raw_readl(OMAP3430_CM_CLKOUT_CTRL);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 129

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[63] = 

__raw_readl(OMAP3430_PRM_CLKOUT_CTRL);

Quoted 11 lines
Quoted 11 lines

Review static int omap3_idle_bm_check(void) · line 130

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[64] = 

prm_read_mod_reg(OMAP3430ES2_SGX_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 131

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[65] = 

prm_read_mod_reg(OMAP3430_DSS_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 132

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[66] = 

prm_read_mod_reg(OMAP3430_CAM_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 133

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[67] = 

prm_read_mod_reg(OMAP3430_PER_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 134

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[68] = 

prm_read_mod_reg(OMAP3430_NEON_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 135

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[69] = 

prm_read_mod_reg(OMAP3430ES2_USBHOST_MOD,

Quoted 4 lines
Quoted 4 lines

Review static int omap3_idle_bm_check(void) · line 136

Quoted 1 line
(quoted diff) +1 -0
+							       

PM_WKDEP);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[70] = prm_read_mod_reg(CORE_MOD,
+					      

OMAP3430_PM_MPUGRPSEL1);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 139

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[71] = 

prm_read_mod_reg(OMAP3430_IVA2_MOD,

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 140

Quoted 1 line
(quoted diff) +1 -0
+					      

OMAP3430_PM_IVAGRPSEL1);

Quoted 10 lines
Quoted 10 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[72] = prm_read_mod_reg(CORE_MOD,
+					      

OMAP3430ES2_PM_MPUGRPSEL3);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[73] = prm_read_mod_reg(CORE_MOD,
+					      

OMAP3430ES2_PM_IVAGRPSEL3);

Review static int omap3_idle_bm_check(void) · line 145

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[74] = prm_read_mod_reg(WKUP_MOD, 

OMAP3430_PM_MPUGRPSEL);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[75] = prm_read_mod_reg(WKUP_MOD,
+					      

OMAP3430_PM_IVAGRPSEL);

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[76] = prm_read_mod_reg(OMAP3430_PER_MOD,
+					      

OMAP3430_PM_MPUGRPSEL);

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 155

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	prcm_sleep_save[77] = prm_read_mod_reg(OMAP3430_PER_MOD,
+					      

OMAP3430_PM_IVAGRPSEL);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 152

Quoted 1 line
(quoted diff) +1 -0
+	prcm_sleep_save[78] = 

prm_read_mod_reg(WKUP_MOD, PM_WKEN);

Quoted 9 lines
Quoted 9 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 9 lines
arch/arm/mach-omap2/cpuidle34xx.c +9 -0
+	return;
+}
+
+void omap3_restore_prcm_ctx(void)
+{
+	omap_writel(prcm_sleep_save[1], INTC_MIR_0);
+	omap_writel(prcm_sleep_save[2], INTC_MIR_1);
+	omap_writel(prcm_sleep_save[3], INTC_MIR_2);
+	omap_writel(prcm_sleep_save[4], 

CONTROL_PADCONF_SYS_NIRQ);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 162

Quoted 1 line
(quoted diff) +1 -0
+	omap_writel(prcm_sleep_save[5], 

OMAP34XX_GPIO1_IRQENABLE1);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 163

Quoted 1 line
(quoted diff) +1 -0
+	omap_writel(prcm_sleep_save[6], 

OMAP34XX_GPIO1_WAKEUPEN);

Quoted 6 lines
Quoted 6 lines

Review static int omap3_idle_bm_check(void) · line 164

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[7], OMAP3430_IVA2_MOD, 

CM_CLKSEL2);

Review static int omap3_idle_bm_check(void) · line 166

Quoted 2 lines
(quoted diff) +2 -0
+	__raw_writel(prcm_sleep_save[8], OMAP3430_CM_SYSCONFIG);
+	cm_write_mod_reg(prcm_sleep_save[9], 

OMAP3430ES2_SGX_MOD, CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 167

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[10], WKUP_MOD, 

CM_CLKSEL);

Quoted 11 lines
Quoted 11 lines

Review static int omap3_idle_bm_check(void) · line 168

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[11], OMAP3430_DSS_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 169

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[12], OMAP3430_CAM_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 170

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[13], OMAP3430_PER_MOD, 

CM_CLKSEL);

Review static int omap3_idle_bm_check(void) · line 171

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[14], OMAP3430_EMU_MOD, 

CM_CLKSEL1);

Review static int omap3_idle_bm_check(void) · line 172

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[15], OMAP3430_EMU_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 173

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[16], PLL_MOD, 

CM_AUTOIDLE2);

Quoted 6 lines
Quoted 6 lines

Review static int omap3_idle_bm_check(void) · line 174

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[17], PLL_MOD, 

OMAP3430ES2_CM_CLKSEL5);

Review static int omap3_idle_bm_check(void) · line 176

Quoted 2 lines
(quoted diff) +2 -0
+	__raw_writel(prcm_sleep_save[18], OMAP3430_CM_POLCTRL);
+	cm_write_mod_reg(prcm_sleep_save[19], 

OMAP3430_IVA2_MOD, CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 177

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[20], CORE_MOD, 

CM_FCLKEN1);

Quoted 5 lines
Quoted 5 lines

Review static int omap3_idle_bm_check(void) · line 178

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[21], CORE_MOD, 

OMAP3430ES2_CM_FCLKEN3);

Review static int omap3_idle_bm_check(void) · line 179

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[22], 

OMAP3430ES2_SGX_MOD, CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 180

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[23], WKUP_MOD, 

CM_FCLKEN);

Quoted 7 lines
Quoted 7 lines

Review static int omap3_idle_bm_check(void) · line 181

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[24], OMAP3430_DSS_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 182

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[25], OMAP3430_CAM_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 183

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[26], OMAP3430_PER_MOD, 

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 184

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[27], 

OMAP3430ES2_USBHOST_MOD,

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 185

Quoted 1 line
(quoted diff) +1 -0
+							       

CM_FCLKEN);

Review static int omap3_idle_bm_check(void) · line 186

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[28], CORE_MOD, 

CM_ICLKEN1);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 187

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[29], CORE_MOD, 

CM_ICLKEN2);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 188

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[30], CORE_MOD, 

CM_ICLKEN3);

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 189

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[31], 

OMAP3430ES2_SGX_MOD, CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 190

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[32], WKUP_MOD, 

CM_ICLKEN);

Quoted 7 lines
Quoted 7 lines

Review static int omap3_idle_bm_check(void) · line 191

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[33], OMAP3430_DSS_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 192

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[34], OMAP3430_CAM_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 193

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[35], OMAP3430_PER_MOD, 

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 194

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[36], 

OMAP3430ES2_USBHOST_MOD,

Quoted 5 lines
Quoted 5 lines

Review static int omap3_idle_bm_check(void) · line 195

Quoted 1 line
(quoted diff) +1 -0
+								

CM_ICLKEN);

Review static int omap3_idle_bm_check(void) · line 196

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[37], 

OMAP3430_IVA2_MOD, CM_AUTOIDLE2);

Review static int omap3_idle_bm_check(void) · line 197

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[38], MPU_MOD, 

CM_AUTOIDLE2);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 198

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[39], PLL_MOD, 

CM_AUTOIDLE);

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 199

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[40], 

OMAP3430_IVA2_MOD, CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 200

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[41], MPU_MOD, 

CM_CLKSTCTRL);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 201

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[42], CORE_MOD, 

CM_CLKSTCTRL);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 202

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[43], 

OMAP3430ES2_SGX_MOD,

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 203

Quoted 1 line
(quoted diff) +1 -0
+						       

CM_CLKSTCTRL);

Quoted 9 lines
Quoted 9 lines

Review static int omap3_idle_bm_check(void) · line 204

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[44], OMAP3430_DSS_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 205

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[45], OMAP3430_CAM_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 206

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[46], OMAP3430_PER_MOD, 

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 207

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[47], 

OMAP3430_NEON_MOD, CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 208

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[48], 

OMAP3430ES2_USBHOST_MOD,

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 209

Quoted 1 line
(quoted diff) +1 -0
+							       

CM_CLKSTCTRL);

Review static int omap3_idle_bm_check(void) · line 210

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[49], CORE_MOD, 

CM_AUTOIDLE1);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 211

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[50], CORE_MOD, 

CM_AUTOIDLE2);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 212

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[51], CORE_MOD, 

CM_AUTOIDLE3);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 213

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[52], WKUP_MOD, 

CM_AUTOIDLE);

Quoted 7 lines
Quoted 7 lines

Review static int omap3_idle_bm_check(void) · line 214

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[53], OMAP3430_DSS_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 215

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[54], OMAP3430_CAM_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 216

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[55], OMAP3430_PER_MOD, 

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 217

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[56], 

OMAP3430ES2_USBHOST_MOD,

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 218

Quoted 1 line
(quoted diff) +1 -0
+							       

CM_AUTOIDLE);

Review static int omap3_idle_bm_check(void) · line 219

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[57], 

OMAP3430ES2_SGX_MOD,

Quoted 5 lines
Quoted 5 lines

Review static int omap3_idle_bm_check(void) · line 220

Quoted 1 line
(quoted diff) +1 -0
+						       

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 222

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[58], OMAP3430_DSS_MOD,
+						       

OMAP3430_CM_SLEEPDEP);

Quoted 7 lines
Quoted 7 lines

Review static int omap3_idle_bm_check(void) · line 224

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[59], OMAP3430_CAM_MOD,
+						       

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 226

Quoted 2 lines
(quoted diff) +2 -0
+	cm_write_mod_reg(prcm_sleep_save[60], OMAP3430_PER_MOD,
+						       

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 227

Quoted 1 line
(quoted diff) +1 -0
+	cm_write_mod_reg(prcm_sleep_save[61], 

OMAP3430ES2_USBHOST_MOD,

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 228

Quoted 1 line
(quoted diff) +1 -0
+						       

OMAP3430_CM_SLEEPDEP);

Review static int omap3_idle_bm_check(void) · line 229

Quoted 1 line
(quoted diff) +1 -0
+	__raw_writel(prcm_sleep_save[62], 

OMAP3430_CM_CLKOUT_CTRL);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 230

Quoted 1 line
(quoted diff) +1 -0
+	__raw_writel(prcm_sleep_save[63], 

OMAP3430_PRM_CLKOUT_CTRL);

Quoted 11 lines
Quoted 11 lines

Review static int omap3_idle_bm_check(void) · line 231

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[64], 

OMAP3430ES2_SGX_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 232

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[65], 

OMAP3430_DSS_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 233

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[66], 

OMAP3430_CAM_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 234

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[67], 

OMAP3430_PER_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 235

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[68], 

OMAP3430_NEON_MOD, PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 236

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[69], 

OMAP3430ES2_USBHOST_MOD,

Quoted 4 lines
Quoted 4 lines

Review static int omap3_idle_bm_check(void) · line 237

Quoted 1 line
(quoted diff) +1 -0
+							       

PM_WKDEP);

Review static int omap3_idle_bm_check(void) · line 239

Quoted 2 lines
(quoted diff) +2 -0
+	prm_write_mod_reg(prcm_sleep_save[70], CORE_MOD,
+					       

OMAP3430_PM_MPUGRPSEL1);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 240

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[71], 

OMAP3430_IVA2_MOD,

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 241

Quoted 1 line
(quoted diff) +1 -0
+					       

OMAP3430_PM_IVAGRPSEL1);

Quoted 8 lines
Quoted 8 lines

Review static int omap3_idle_bm_check(void) · line 243

Quoted 2 lines
(quoted diff) +2 -0
+	prm_write_mod_reg(prcm_sleep_save[72], CORE_MOD,
+					       

OMAP3430ES2_PM_MPUGRPSEL3);

Review static int omap3_idle_bm_check(void) · line 245

Quoted 2 lines
(quoted diff) +2 -0
+	prm_write_mod_reg(prcm_sleep_save[73], CORE_MOD,
+					       

OMAP3430ES2_PM_IVAGRPSEL3);

Review static int omap3_idle_bm_check(void) · line 247

Quoted 2 lines
(quoted diff) +2 -0
+	prm_write_mod_reg(prcm_sleep_save[74], WKUP_MOD,
+					       

OMAP3430_PM_MPUGRPSEL);

Quoted 2 lines
Quoted 2 lines

Review static int omap3_idle_bm_check(void) · line 249

Quoted 2 lines
(quoted diff) +2 -0
+	prm_write_mod_reg(prcm_sleep_save[75], WKUP_MOD,
+					       

OMAP3430_PM_IVAGRPSEL);

Quoted 2 lines
Quoted 2 lines

Review static int omap3_idle_bm_check(void) · line 251

Quoted 2 lines
(quoted diff) +2 -0
+	prm_write_mod_reg(prcm_sleep_save[76], OMAP3430_PER_MOD,
+					       

OMAP3430_PM_MPUGRPSEL);

Quoted 2 lines
Quoted 2 lines

Review static int omap3_idle_bm_check(void) · line 253

Quoted 2 lines
(quoted diff) +2 -0
+	prm_write_mod_reg(prcm_sleep_save[77], OMAP3430_PER_MOD,
+					       

OMAP3430_PM_IVAGRPSEL);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 254

Quoted 1 line
(quoted diff) +1 -0
+	prm_write_mod_reg(prcm_sleep_save[78], 

WKUP_MOD, PM_WKEN);

Quoted 8 lines
Quoted 8 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 8 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -0
+	return;
+}
+
+static void omap_save_intc_ctx(void)
+{
+	int ind = 0;
+	intc_context.sysconfig = omap_readl(INTCPS_SYSCONFIG);
+	intc_context.protection =  

omap_readl(INTCPS_PROTECTION);

Quoted 5 lines
Quoted 5 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+	intc_context.idle = omap_readl(INTCPS_IDLE);
+	intc_context.threshold = omap_readl(INTCPS_THRESHOLD);
+	for (ind = 0; ind < 96; ind++)
+	       intc_context.ilr[ind] =
+		       omap_readl(INTC_BASE + (0x100 + 

0x4*ind));

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 268

Quoted 1 line
(quoted diff) +1 -0
+	/* MIRs are saved and restore with other PRCM 

registers */

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+}
+
+static void omap_restore_intc_ctx(void)
+{
+	int ind = 0;
Quoted 8 lines
Quoted 8 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 8 lines
arch/arm/mach-omap2/cpuidle34xx.c +8 -0
+	omap_writel(intc_context.sysconfig, INTCPS_SYSCONFIG);
+	omap_writel(intc_context.protection, INTCPS_PROTECTION);
+	omap_writel(intc_context.idle, INTCPS_IDLE);
+	omap_writel(intc_context.threshold, INTCPS_THRESHOLD);
+	for (ind = 0; ind < 96; ind++)
+	       omap_writel(intc_context.ilr[ind],
+		       INTC_BASE + (0x100 + 0x4*ind));
+	/* MIRs are saved and restore with other PRCM 

registers */

Quoted 7 lines
Quoted 7 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+}
+
+static void omap_save_control_ctx(void)
+{
+	control_ctx.sysconfig = 

omap_ctrl_readl(OMAP2_CONTROL_SYSCONFIG);

Review static int omap3_idle_bm_check(void) · line 287

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.devconf0 = 

omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);

Quoted 6 lines
Quoted 6 lines

Review static int omap3_idle_bm_check(void) · line 288

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.mem_dftrw0 = 

omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW0);

Review static int omap3_idle_bm_check(void) · line 289

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.mem_dftrw1 = 

omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 335

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	control_ctx.msuspendmux_0 =
+		       

omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_0);

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 335

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	control_ctx.msuspendmux_1 =
+		       

omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_1);

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 335

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	control_ctx.msuspendmux_2 =
+		       

omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_2);

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 335

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	control_ctx.msuspendmux_3 =
+		       

omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_3);

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 335

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	control_ctx.msuspendmux_4 =
+		       

omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_4);

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 335

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	control_ctx.msuspendmux_5 =
+		       

omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_5);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 302

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.sec_ctrl = 

omap_ctrl_readl(OMAP2_CONTROL_SEC_CTRL);

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 303

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.devconf1 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1);

Review static int omap3_idle_bm_check(void) · line 304

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.csirxfe = 

omap_ctrl_readl(OMAP343X_CONTROL_CSIRXFE);

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 335

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	control_ctx.iva2_bootaddr =
+		       

omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTADDR);

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 335

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	control_ctx.iva2_bootmod =
+		       

omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTMOD);

Quoted 16 lines
Quoted 16 lines

Review static int omap3_idle_bm_check(void) · line 309

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_0 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_0);

Review static int omap3_idle_bm_check(void) · line 310

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_1 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_1);

Review static int omap3_idle_bm_check(void) · line 311

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_2 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_2);

Review static int omap3_idle_bm_check(void) · line 312

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_3 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_3);

Review static int omap3_idle_bm_check(void) · line 313

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_4 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_4);

Review static int omap3_idle_bm_check(void) · line 314

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_5 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_5);

Review static int omap3_idle_bm_check(void) · line 315

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_6 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_6);

Review static int omap3_idle_bm_check(void) · line 316

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_7 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_7);

Quoted 8 lines
Quoted 8 lines

Review static int omap3_idle_bm_check(void) · line 317

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.debobs_8 = 

omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS_8);

Review static int omap3_idle_bm_check(void) · line 318

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.prog_io0 = 

omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO0);

Review static int omap3_idle_bm_check(void) · line 319

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.prog_io1 = 

omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 335

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	control_ctx.dss_dpll_spreading =
+	       

omap_ctrl_readl(OMAP343X_CONTROL_DSS_DPLL_SPREADING);

Quoted 2 lines
Quoted 2 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 335

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	control_ctx.core_dpll_spreading =
+	       

omap_ctrl_readl(OMAP343X_CONTROL_CORE_DPLL_SPREADING);

Quoted 2 lines
Quoted 2 lines

Review static int omap3_idle_bm_check(void) · line 325

Quoted 2 lines
(quoted diff) +2 -0
+	control_ctx.per_dpll_spreading =
+	       

omap_ctrl_readl(OMAP343X_CONTROL_PER_DPLL_SPREADING);

Quoted 2 lines
Quoted 2 lines

Review static int omap3_idle_bm_check(void) · line 327

Quoted 2 lines
(quoted diff) +2 -0
+	control_ctx.usbhost_dpll_spreading =
+	       

omap_ctrl_readl(OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);

Quoted 16 lines
Quoted 16 lines

Review static int omap3_idle_bm_check(void) · line 328

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.pbias_lite = 

omap_ctrl_readl(OMAP343X_CONTROL_PBIAS_LITE);

Review static int omap3_idle_bm_check(void) · line 329

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.temp_sensor = 

omap_ctrl_readl(OMAP343X_CONTROL_TEMP_SENSOR);

Review static int omap3_idle_bm_check(void) · line 330

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.sramldo4 = 

omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO4);

Review static int omap3_idle_bm_check(void) · line 331

Quoted 1 line
(quoted diff) +1 -0
+	control_ctx.sramldo5 = 

omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO5);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 7 lines
arch/arm/mach-omap2/cpuidle34xx.c +7 -0
+	control_ctx.csi = omap_ctrl_readl(OMAP343X_CONTROL_CSI);
+	return;
+}
+
+static void omap_restore_control_ctx(void)
+{
+	omap_ctrl_writel(control_ctx.sysconfig, 

OMAP2_CONTROL_SYSCONFIG);

Quoted 1 line
Quoted 1 line

Review static int omap3_idle_bm_check(void) · line 339

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.devconf0, 

OMAP2_CONTROL_DEVCONF0);

Quoted 16 lines
Quoted 16 lines

Review static int omap3_idle_bm_check(void) · line 340

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.mem_dftrw0, 

OMAP343X_CONTROL_MEM_DFTRW0);

Review static int omap3_idle_bm_check(void) · line 341

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.mem_dftrw1, 

OMAP343X_CONTROL_MEM_DFTRW1);

Review static int omap3_idle_bm_check(void) · line 343

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_0,
+					       

OMAP2_CONTROL_MSUSPENDMUX_0);

Review static int omap3_idle_bm_check(void) · line 345

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_1,
+					       

OMAP2_CONTROL_MSUSPENDMUX_1);

Review static int omap3_idle_bm_check(void) · line 347

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_2,
+					       

OMAP2_CONTROL_MSUSPENDMUX_2);

Review static int omap3_idle_bm_check(void) · line 349

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_3,
+					       

OMAP2_CONTROL_MSUSPENDMUX_3);

Quoted 7 lines
Quoted 7 lines

Review static int omap3_idle_bm_check(void) · line 351

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_4,
+					       

OMAP2_CONTROL_MSUSPENDMUX_4);

Review static int omap3_idle_bm_check(void) · line 353

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.msuspendmux_5,
+					       

OMAP2_CONTROL_MSUSPENDMUX_5);

Review static int omap3_idle_bm_check(void) · line 354

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.sec_ctrl, 

OMAP2_CONTROL_SEC_CTRL);

Quoted 3 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 355

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.devconf1, 

OMAP343X_CONTROL_DEVCONF1);

Review static int omap3_idle_bm_check(void) · line 356

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.csirxfe, 

OMAP343X_CONTROL_CSIRXFE);

Quoted 22 lines
Quoted 22 lines

Review static int omap3_idle_bm_check(void) · line 358

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.iva2_bootaddr,
+					       

OMAP343X_CONTROL_IVA2_BOOTADDR);

Review static int omap3_idle_bm_check(void) · line 360

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.iva2_bootmod,
+					       

OMAP343X_CONTROL_IVA2_BOOTMOD);

Review static int omap3_idle_bm_check(void) · line 361

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_0, 

OMAP343X_CONTROL_DEBOBS_0);

Review static int omap3_idle_bm_check(void) · line 362

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_1, 

OMAP343X_CONTROL_DEBOBS_1);

Review static int omap3_idle_bm_check(void) · line 363

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_2, 

OMAP343X_CONTROL_DEBOBS_2);

Review static int omap3_idle_bm_check(void) · line 364

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_3, 

OMAP343X_CONTROL_DEBOBS_3);

Review static int omap3_idle_bm_check(void) · line 365

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_4, 

OMAP343X_CONTROL_DEBOBS_4);

Review static int omap3_idle_bm_check(void) · line 366

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_5, 

OMAP343X_CONTROL_DEBOBS_5);

Review static int omap3_idle_bm_check(void) · line 367

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_6, 

OMAP343X_CONTROL_DEBOBS_6);

Review static int omap3_idle_bm_check(void) · line 368

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_7, 

OMAP343X_CONTROL_DEBOBS_7);

Quoted 8 lines
Quoted 8 lines

Review static int omap3_idle_bm_check(void) · line 369

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.debobs_8, 

OMAP343X_CONTROL_DEBOBS_8);

Review static int omap3_idle_bm_check(void) · line 370

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.prog_io0, 

OMAP343X_CONTROL_PROG_IO0);

Review static int omap3_idle_bm_check(void) · line 371

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.prog_io1, 

OMAP343X_CONTROL_PROG_IO1);

Review static int omap3_idle_bm_check(void) · line 373

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.dss_dpll_spreading,
+			       

OMAP343X_CONTROL_DSS_DPLL_SPREADING);

Quoted 2 lines
Quoted 2 lines

Review static int omap3_idle_bm_check(void) · line 375

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.core_dpll_spreading,
+			       

OMAP343X_CONTROL_CORE_DPLL_SPREADING);

Quoted 2 lines
Quoted 2 lines

Review static int omap3_idle_bm_check(void) · line 377

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.per_dpll_spreading,
+			       

OMAP343X_CONTROL_PER_DPLL_SPREADING);

Quoted 2 lines
Quoted 2 lines

Review static int omap3_idle_bm_check(void) · line 379

Quoted 2 lines
(quoted diff) +2 -0
+	omap_ctrl_writel(control_ctx.usbhost_dpll_spreading,
+			       

OMAP343X_CONTROL_USBHOST_DPLL_SPREADING);

Quoted 8 lines
Quoted 8 lines

Review static int omap3_idle_bm_check(void) · line 380

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.pbias_lite, 

OMAP343X_CONTROL_PBIAS_LITE);

Review static int omap3_idle_bm_check(void) · line 381

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.temp_sensor, 

OMAP343X_CONTROL_TEMP_SENSOR);

Review static int omap3_idle_bm_check(void) · line 382

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.sramldo4, 

OMAP343X_CONTROL_SRAMLDO4);

Review static int omap3_idle_bm_check(void) · line 383

Quoted 1 line
(quoted diff) +1 -0
+	omap_ctrl_writel(control_ctx.sramldo5, 

OMAP343X_CONTROL_SRAMLDO5);

Quoted 11 lines
Quoted 11 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 11 lines
arch/arm/mach-omap2/cpuidle34xx.c +11 -0
+	omap_ctrl_writel(control_ctx.csi, OMAP343X_CONTROL_CSI);
+	return;
+}
+
+void omap3_save_core_ctx(void)
+{
+	u32 control_padconf_off;
+
+	if (!padconf_saved) {
+	       /* Save the padconf registers */
+	       control_padconf_off = 

omap_readl(CONTROL_PADCONF_OFF);

Quoted 2 lines
Quoted 2 lines

Review static int omap3_idle_bm_check(void) · line 396

Quoted 2 lines
(quoted diff) +2 -0
+	       control_padconf_off |= 2;
+	       omap_writel(control_padconf_off, 

CONTROL_PADCONF_OFF);

Quoted 24 lines
Quoted 24 lines

Review static int omap3_idle_bm_check(void) · line 398

Quoted 2 lines
(quoted diff) +2 -0
+	       /* wait for the save to complete */
+	       while 

(!omap_readl(CONTROL_GENERAL_PURPOSE_STATUS) & 0x1);

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 7 lines
arch/arm/mach-omap2/cpuidle34xx.c +7 -0
+	       padconf_saved = 1;
+	}
+	/* Save the Interrupt controller context */
+	omap_save_intc_ctx();
+	/* Save the GPMC context */
+	omap_save_gpmc_ctx();
+	/* Save the system control module context, padconf 

already save above*/

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 407

Quoted 2 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
+	omap_save_control_ctx();
+	omap_save_uart_ctx(0);

This should be done in omap_serial_enable_clocks function.

Review static int omap3_idle_bm_check(void) · line 408

Quoted 1 line
(quoted diff) +1 -0
+	omap_serial_enable_clocks(0, 0);

Why this is here?

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 409

Quoted 1 line
arch/arm/mach-omap2/cpuidle34xx.c +1 -0
+	omap_save_uart_ctx(1);

This should be done in omap_serial_enable_clocks function.

Quoted 5 lines
Quoted 3 lines

Review static int omap3_idle_bm_check(void) · line 410

Quoted 1 line
(quoted diff) +1 -0
+	omap_serial_enable_clocks(0, 1);

Why this is here?

I did'nt understand these comments completely. Are you

Quoted 8 lines

asking why splitting of uarts? its

Quoted 2 lines

because UART1/UART2 belong to CORE and UART3 is in PER. If you are saying that context save/restore functions could

be moved within the

Quoted 1 line

enable_clocks functions, yes they can be.

It just looked weird to me that clock disable is done in save ctx function. Is there own clock disable if RET is entered instead of OFF?

Yes, you are right. I guess I need to move these outside and do them regardless of a RET/OFF transition.
Currently they seem to happen only during a OFF transition.

Quoted 884 lines
Quoted 9 lines
Quoted 9 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 8 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+}
+
+void omap3_restore_core_ctx(void)
+{
+	/* Restore the control module context, padconf restored 

by h/w */

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+	omap_restore_control_ctx();
+	/* Restore the GPMC context */
+	omap_restore_gpmc_ctx();
+	/* Restore the interrupt controller context */
Quoted 8 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void) · line 424

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+	omap_restore_intc_ctx();
+	omap_serial_enable_clocks(1, 0);
+	omap_restore_uart_ctx(0);
+	omap_serial_enable_clocks(1, 1);
+	omap_restore_uart_ctx(1);

Same comments as above. You could move these uart restores to omap_serial_enable_clocks and restore always after

enabling clock for

Quoted 7 lines
Quoted 7 lines

some specific uart. Then as we have that interface to ask wether restore is needed then add if statement there.

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_idle_bm_check(void)

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -0
+	padconf_saved = 0;
+}
+
 /* omap3_enter_idle - Programs OMAP3 to enter the 

specified state.

Quoted 73 lines
Quoted 73 lines
Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -0
  * returns the total time during which the system was idle.
  */
@@ -60,9 +443,15 @@ static int omap3_enter_idle(struct cpuid
 		return 0;

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 453

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
 	}
 
+	local_irq_disable();
+	local_fiq_disable();
+
 	/* Used to keep track of the total time in idle */
 	getnstimeofday(&ts_preidle);
 
+	if (cx->type > OMAP3_STATE_C1)
+		sched_clock_idle_sleep_event(); /* about to 

enter deep idle */

Quoted 22 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -3
+
 	mpu_pd = pwrdm_lookup("mpu_pwrdm");
 	core_pd = pwrdm_lookup("core_pwrdm");
 	per_pd = pwrdm_lookup("per_pwrdm");
@@ -74,12 +463,13 @@ static int omap3_enter_idle(struct cpuid
 	pwrdm_clear_all_prev_pwrst(core_pd);
 	pwrdm_clear_all_prev_pwrst(per_pd);
 
-	if (omap_irq_pending())
-		return 0;
-
 	per_pwrst = pwrdm_read_pwrst(per_pd);
 	neon_pwrst = pwrdm_read_pwrst(neon_pd);
 
+	/* Do this before any changes to PRCM registers */
+	if (cx->core_state == PWRDM_POWER_OFF)
+		omap3_save_prcm_ctx();
+
 	/* Program MPU to target state */
 	if (cx->mpu_state < PWRDM_POWER_ON) {
 		if (neon_pwrst == PWRDM_POWER_ON) {

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 489

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +1 -0
@@ -96,15 +486,22 @@ static int omap3_enter_idle(struct cpuid
 		if (per_pwrst == PWRDM_POWER_ON) {
 			omap2_gpio_prepare_for_retention();
 			if (clocks_off_while_idle) {
+				omap3_save_per_ctx();

Gpio saving could be moved int per_gpio_clk_disable function.

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 492

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -1
 				per_gpio_clk_disable();
-				omap_serial_enable_clocks(0);
+				omap_save_uart_ctx(2);
+				omap_serial_enable_clocks(0, 2);

Same comment as for uarts in core domain.

Quoted 16 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
 			}
 		}
+		if (cx->core_state == PWRDM_POWER_OFF)
+			omap3_save_core_ctx();
 		pwrdm_set_next_pwrst(core_pd, cx->core_state);
 	}
 
 	*(scratchpad_restore_addr) = restore_pointer_address;
 
+	if (omap_irq_pending())
+		goto return_sleep_time;
+
 	/* Execute ARM wfi */
 	omap_sram_idle();
 

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 519

Quoted 5 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -0
@@ -118,25 +515,41 @@ static int omap3_enter_idle(struct cpuid
 	}
 
 	if (cx->core_state < PWRDM_POWER_ON) {
+		if ((cx->core_state == PWRDM_POWER_OFF)
+		&& (pwrdm_read_prev_pwrst(core_pd) == 

PWRDM_POWER_OFF)) {

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +5 -0
+			omap3_restore_core_ctx();
+			omap3_restore_prcm_ctx();
+			omap3_restore_sram_ctx();
+		}
+		pwrdm_set_next_pwrst(core_pd, PWRDM_POWER_ON);
 		if (per_pwrst == PWRDM_POWER_ON) {
Quoted 8 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 530

Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +3 -1
 			if (clocks_off_while_idle) {
-				omap_serial_enable_clocks(1);
+				omap_serial_enable_clocks(1, 2);
+				omap_restore_uart_ctx(2);
 				per_gpio_clk_enable();
+				omap3_restore_per_ctx();

And again these could be moved to the clock enable/disable

functions.

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -5
 			}
 			omap2_gpio_resume_after_retention();
 		}
-		pwrdm_set_next_pwrst(core_pd, PWRDM_POWER_ON);
 	}
 
 	pr_debug("MPU prev st:%x,NEON prev st:%x\n",
-			       pwrdm_read_prev_pwrst(mpu_pd),
-			       pwrdm_read_prev_pwrst(neon_pd));
+				pwrdm_read_prev_pwrst(mpu_pd),
+				pwrdm_read_prev_pwrst(neon_pd));
 	pr_debug("PER prev st:%x,CORE prev st:%x\n",
-			       pwrdm_read_prev_pwrst(per_pd),
-			       pwrdm_read_prev_pwrst(core_pd));
+				pwrdm_read_prev_pwrst(per_pd),
+				pwrdm_read_prev_pwrst(core_pd));
 
Quoted 6 lines
Quoted 6 lines

arch/arm/mach-omap2/cpuidle34xx.c static int omap3_enter_idle(struct cpuid · line 549

Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+return_sleep_time:
 	getnstimeofday(&ts_postidle);
 	ts_idle = timespec_sub(ts_postidle, ts_preidle);
+
+	if (cx->type > OMAP3_STATE_C1)
+		

sched_clock_idle_wakeup_event(timespec_to_ns(&ts_idle));

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+
+	local_irq_enable();
+	local_fiq_disable();
+
 	return (u32)timespec_to_ns(&ts_idle)/1000;
 }
 
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -2
@@ -187,79 +600,79 @@ DEFINE_PER_CPU(struct cpuidle_device, om
 void omap_init_power_states(void)
 {
 	/* C0 . System executing code */
-	omap3_power_states[0].valid = 1;
-	omap3_power_states[0].type = OMAP3_STATE_C0;
Quoted 8 lines

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 8 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -6
-	omap3_power_states[0].sleep_latency = 0;
-	omap3_power_states[0].wakeup_latency = 0;
-	omap3_power_states[0].threshold = 0;
-	omap3_power_states[0].mpu_state = PWRDM_POWER_ON;
-	omap3_power_states[0].core_state = PWRDM_POWER_ON;
-	omap3_power_states[0].flags = CPUIDLE_FLAG_SHALLOW;
+	omap3_power_states[OMAP3_STATE_C0].valid = 1;
+	omap3_power_states[OMAP3_STATE_C0].type = 

OMAP3_STATE_C0;

Quoted 4 lines
Quoted 4 lines

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+	omap3_power_states[OMAP3_STATE_C0].sleep_latency = 0;
+	omap3_power_states[OMAP3_STATE_C0].wakeup_latency = 0;
+	omap3_power_states[OMAP3_STATE_C0].threshold = 0;
+	omap3_power_states[OMAP3_STATE_C0].mpu_state = 

PWRDM_POWER_ON;

Quoted 1 line
Quoted 1 line

Review DEFINE_PER_CPU(struct cpuidle_device, om · line 609

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C0].core_state = 

PWRDM_POWER_ON;

Quoted 1 line
Quoted 1 line

Review DEFINE_PER_CPU(struct cpuidle_device, om · line 610

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C0].flags = 

CPUIDLE_FLAG_SHALLOW;

Quoted 12 lines
Quoted 12 lines

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 12 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -8
 	/* C1 . MPU WFI + Core active */
-	omap3_power_states[1].valid = 1;
-	omap3_power_states[1].type = OMAP3_STATE_C1;
-	omap3_power_states[1].sleep_latency = 10;
-	omap3_power_states[1].wakeup_latency = 10;
-	omap3_power_states[1].threshold = 30;
-	omap3_power_states[1].mpu_state = PWRDM_POWER_ON;
-	omap3_power_states[1].core_state = PWRDM_POWER_ON;
-	omap3_power_states[1].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C1].valid = 1;
+	omap3_power_states[OMAP3_STATE_C1].type = 

OMAP3_STATE_C1;

Quoted 4 lines
Quoted 4 lines

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+	omap3_power_states[OMAP3_STATE_C1].sleep_latency = 10;
+	omap3_power_states[OMAP3_STATE_C1].wakeup_latency = 10;
+	omap3_power_states[OMAP3_STATE_C1].threshold = 30;
+	omap3_power_states[OMAP3_STATE_C1].mpu_state = 

PWRDM_POWER_ON;

Quoted 1 line
Quoted 1 line

Review DEFINE_PER_CPU(struct cpuidle_device, om · line 618

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C1].core_state = 

PWRDM_POWER_ON;

Quoted 3 lines
Quoted 3 lines

Review DEFINE_PER_CPU(struct cpuidle_device, om · line 619

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C1].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 1 line

CPUIDLE_FLAG_SHALLOW;

Quoted 12 lines
Quoted 12 lines

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 12 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -8
 	/* C2 . MPU CSWR + Core active */
-	omap3_power_states[2].valid = 1;
-	omap3_power_states[2].type = OMAP3_STATE_C2;
-	omap3_power_states[2].sleep_latency = 50;
-	omap3_power_states[2].wakeup_latency = 50;
-	omap3_power_states[2].threshold = 300;
-	omap3_power_states[2].mpu_state = PWRDM_POWER_RET;
-	omap3_power_states[2].core_state = PWRDM_POWER_ON;
-	omap3_power_states[2].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C2].valid = 1;
+	omap3_power_states[OMAP3_STATE_C2].type = 

OMAP3_STATE_C2;

Quoted 4 lines
Quoted 4 lines

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -0
+	omap3_power_states[OMAP3_STATE_C2].sleep_latency = 50;
+	omap3_power_states[OMAP3_STATE_C2].wakeup_latency = 50;
+	omap3_power_states[OMAP3_STATE_C2].threshold = 300;
+	omap3_power_states[OMAP3_STATE_C2].mpu_state = 

PWRDM_POWER_RET;

Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C2].core_state = 

PWRDM_POWER_ON;

Quoted 3 lines
Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C2].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 1 line

CPUIDLE_FLAG_BALANCED;

Quoted 12 lines
Quoted 12 lines

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 12 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -8
 	/* C3 . MPU OFF + Core active */
-	omap3_power_states[3].valid = 1;
-	omap3_power_states[3].type = OMAP3_STATE_C3;
-	omap3_power_states[3].sleep_latency = 1500;
-	omap3_power_states[3].wakeup_latency = 1800;
-	omap3_power_states[3].threshold = 4000;
-	omap3_power_states[3].mpu_state = PWRDM_POWER_OFF;
-	omap3_power_states[3].core_state = PWRDM_POWER_ON;
-	omap3_power_states[3].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C3].valid = 1;
+	omap3_power_states[OMAP3_STATE_C3].type = 

OMAP3_STATE_C3;

Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	omap3_power_states[OMAP3_STATE_C3].sleep_latency = 1500;
+	

omap3_power_states[OMAP3_STATE_C3].wakeup_latency = 1800;

Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	omap3_power_states[OMAP3_STATE_C3].threshold = 4000;
+	omap3_power_states[OMAP3_STATE_C3].mpu_state = 

PWRDM_POWER_OFF;

Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C3].core_state = 

PWRDM_POWER_ON;

Quoted 3 lines
Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C3].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 1 line

CPUIDLE_FLAG_BALANCED |

CPUIDLE_FLAG_CHECK_BM;

Quoted 12 lines
Quoted 12 lines

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 12 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -8
 	/* C4 . MPU CSWR + Core CSWR*/
-	omap3_power_states[4].valid = 1;
-	omap3_power_states[4].type = OMAP3_STATE_C4;
-	omap3_power_states[4].sleep_latency = 2500;
-	omap3_power_states[4].wakeup_latency = 7500;
-	omap3_power_states[4].threshold = 12000;
-	omap3_power_states[4].mpu_state = PWRDM_POWER_RET;
-	omap3_power_states[4].core_state = PWRDM_POWER_RET;
-	omap3_power_states[4].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C4].valid = 1;
+	omap3_power_states[OMAP3_STATE_C4].type = 

OMAP3_STATE_C4;

Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	omap3_power_states[OMAP3_STATE_C4].sleep_latency = 2500;
+	

omap3_power_states[OMAP3_STATE_C4].wakeup_latency = 7500;

Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	omap3_power_states[OMAP3_STATE_C4].threshold = 12000;
+	omap3_power_states[OMAP3_STATE_C4].mpu_state = 

PWRDM_POWER_RET;

Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C4].core_state = 

PWRDM_POWER_RET;

Quoted 3 lines
Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C4].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 1 line

CPUIDLE_FLAG_BALANCED |

CPUIDLE_FLAG_CHECK_BM;

Quoted 12 lines
Quoted 12 lines

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 12 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -8
 	/* C5 . MPU OFF + Core CSWR */
-	omap3_power_states[5].valid = 1;
-	omap3_power_states[5].type = OMAP3_STATE_C5;
-	omap3_power_states[5].sleep_latency = 3000;
-	omap3_power_states[5].wakeup_latency = 8500;
-	omap3_power_states[5].threshold = 15000;
-	omap3_power_states[5].mpu_state = PWRDM_POWER_OFF;
-	omap3_power_states[5].core_state = PWRDM_POWER_RET;
-	omap3_power_states[5].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C5].valid = 1;
+	omap3_power_states[OMAP3_STATE_C5].type = 

OMAP3_STATE_C5;

Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	omap3_power_states[OMAP3_STATE_C5].sleep_latency = 3000;
+	

omap3_power_states[OMAP3_STATE_C5].wakeup_latency = 8500;

Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	omap3_power_states[OMAP3_STATE_C5].threshold = 15000;
+	omap3_power_states[OMAP3_STATE_C5].mpu_state = 

PWRDM_POWER_OFF;

Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C5].core_state = 

PWRDM_POWER_RET;

Quoted 3 lines
Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C5].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 1 line

CPUIDLE_FLAG_BALANCED |

CPUIDLE_FLAG_CHECK_BM;

Quoted 12 lines
Quoted 12 lines

arch/arm/mach-omap2/cpuidle34xx.c DEFINE_PER_CPU(struct cpuidle_device, om

Quoted 12 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -8
 	/* C6 . MPU OFF + Core OFF */
-	omap3_power_states[6].valid = 0;
-	omap3_power_states[6].type = OMAP3_STATE_C6;
-	omap3_power_states[6].sleep_latency = 10000;
-	omap3_power_states[6].wakeup_latency = 30000;
-	omap3_power_states[6].threshold = 300000;
-	omap3_power_states[6].mpu_state = PWRDM_POWER_OFF;
-	omap3_power_states[6].core_state = PWRDM_POWER_OFF;
-	omap3_power_states[6].flags = CPUIDLE_FLAG_TIME_VALID |
+	omap3_power_states[OMAP3_STATE_C6].valid = 1;
+	omap3_power_states[OMAP3_STATE_C6].type = 

OMAP3_STATE_C6;

Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+	

omap3_power_states[OMAP3_STATE_C6].sleep_latency = 10000;

Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+	

omap3_power_states[OMAP3_STATE_C6].wakeup_latency = 30000;

Quoted 2 lines
Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+	omap3_power_states[OMAP3_STATE_C6].threshold = 300000;
+	omap3_power_states[OMAP3_STATE_C6].mpu_state = 

PWRDM_POWER_OFF;

Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C6].core_state = 

PWRDM_POWER_OFF;

Quoted 3 lines
Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	omap3_power_states[OMAP3_STATE_C6].flags = 

CPUIDLE_FLAG_TIME_VALID |

Quoted 1 line

CPUIDLE_FLAG_DEEP |

CPUIDLE_FLAG_CHECK_BM;

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

}

arch/arm/mach-omap2/cpuidle34xx.c +1 -0
@@ -277,6 +690,7 @@ int omap3_idle_init(void)
 	struct omap3_processor_cx *cx;
 	struct cpuidle_state *state;
 	struct cpuidle_device *dev;
+	char clk_name[11];
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -0
 	clear_scratchpad_contents();
 	save_scratchpad_contents();

Index: linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.h

===================================================================

Quoted 60 lines
Quoted 60 lines
Quoted 1 line

--- linux-omap-2.6.orig/arch/arm/mach-omap2/cpuidle34xx.h

2008-07-01 18:51:23.078236417 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.h

2008-07-01 18:51:25.189168688 +0530
Quoted 56 lines
arch/arm/mach-omap2/cpuidle34xx.h +29 -3
@@ -30,20 +30,41 @@
 #define OMAP3_STATE_C5 5 /* C5 - MPU OFF + Core RET */
 #define OMAP3_STATE_C6 6 /* C6 - MPU OFF + Core OFF */
 
-/* Currently, we support only upto C2 */
-#define MAX_SUPPORTED_STATES 3
+/* Interrupt Controller registers */
+#define INTC_BASE	0x48200000
+#define INTC_MIR_0	0x48200084
+#define INTC_MIR_1	0x482000A4
+#define INTC_MIR_2	0x482000C4
+#define INTCPS_SYSCONFIG	0x48200010
+#define INTCPS_PROTECTION	0x4820004C
+#define INTCPS_IDLE	0x48200050
+#define INTCPS_THRESHOLD	0x48200068
+
+#define CONTROL_PADCONF_SYS_NIRQ	0x480021E0
+#define CONTROL_PADCONF_OFF	0x48002270
+#define CONTROL_GENERAL_PURPOSE_STATUS	0x480022F4
+
+#define OMAP34XX_GPIO1_IRQENABLE1	0x4831001c
+#define OMAP34XX_GPIO1_WAKEUPEN	0x48310020
+#define OMAP34XX_GPIO1_FALLINGDETECT	0x4831004c
 
 extern unsigned short clocks_off_while_idle;
 extern void omap_sram_idle(void);
 extern int omap_irq_pending(void);
 extern void per_gpio_clk_enable(void);
 extern void per_gpio_clk_disable(void);
-extern void omap_serial_enable_clocks(int enable);
+extern void omap_serial_enable_clocks(int enable, int unum);
 extern int omap3_can_sleep();
 extern void clear_scratchpad_contents(void);
 extern void save_scratchpad_contents(void);
 extern u32 *scratchpad_restore_addr;
 extern u32 restore_pointer_address;
+extern void omap3_save_per_ctx();
+extern void omap3_restore_per_ctx();
+extern void omap_save_uart_ctx(int);
+extern void omap_restore_uart_ctx(int);
+extern void omap3_restore_sram_ctx();
+extern int omap3_can_sleep();
 
 struct omap3_processor_cx {
 	u8 valid;
@@ -59,5 +80,10 @@ struct omap3_processor_cx {
 void omap_init_power_states(void);
 int omap3_idle_init(void);
 
+/* TODO fix the size:100 */
+static unsigned int prcm_sleep_save[100];
+static struct int_controller_context intc_context;
+static struct control_module_context control_ctx;
+
 #endif /* ARCH_ARM_MACH_OMAP2_CPUIDLE_34XX */
 
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c

===================================================================

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c

2008-07-01 18:51:22.662249764 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c

2008-07-01 18:51:25.189168688 +0530

Review static irqreturn_t prcm_interrupt_handle · line 154

Quoted 2 lines
(quoted diff) +0 -0
@@ -154,7 +154,6 @@ static irqreturn_t prcm_interrupt_handle
 		cm_write_mod_reg(iclk, 

OMAP3430_PER_MOD, CM_ICLKEN);

Quoted 1 line
Quoted 1 line

Review static irqreturn_t prcm_interrupt_handle · line 155

Quoted 1 line
(quoted diff) +0 -0
 		cm_write_mod_reg(fclk, 

OMAP3430_PER_MOD, CM_FCLKEN);

Quoted 9 lines
Quoted 9 lines

arch/arm/mach-omap2/pm34xx.c static irqreturn_t prcm_interrupt_handle

Quoted 5 lines
arch/arm/mach-omap2/pm34xx.c +0 -1
 	}
-
 	if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0)) {
 		/* USBHOST */
 		wkst = 

prm_read_mod_reg(OMAP3430ES2_USBHOST_MOD, PM_WKST);

Quoted 3 lines
(quoted diff) +0 -0
@@ -361,7 +360,9 @@ static void omap3_pm_idle(void)
 	omap2_gpio_prepare_for_retention();
 
Quoted 6 lines
Quoted 6 lines

arch/arm/mach-omap2/pm34xx.c static void omap3_pm_idle(void)

Quoted 6 lines
arch/arm/mach-omap2/pm34xx.c +3 -1
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(0);
+		omap_serial_enable_clocks(0, 0);
+		omap_serial_enable_clocks(0, 1);
+		omap_serial_enable_clocks(0, 2);
 		/* XXX This is for gpio fclk hack. Will 

be removed as

Quoted 11 lines
Quoted 11 lines

arch/arm/mach-omap2/pm34xx.c static void omap3_pm_idle(void) · line 377

Quoted 11 lines
arch/arm/mach-omap2/pm34xx.c +3 -1
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_disable();
@@ -370,7 +371,9 @@ static void omap3_pm_idle(void)
 	omap_sram_idle();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(1);
+		omap_serial_enable_clocks(1, 0);
+		omap_serial_enable_clocks(1, 1);
+		omap_serial_enable_clocks(1, 2);
 		/* XXX This is for gpio fclk hack. Will 

be removed as

Quoted 11 lines
Quoted 11 lines

arch/arm/mach-omap2/pm34xx.c static int omap3_pm_suspend(void) · line 421

Quoted 11 lines
arch/arm/mach-omap2/pm34xx.c +3 -1
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_enable();
@@ -412,7 +415,9 @@ static int omap3_pm_suspend(void)
 	omap2_gpio_prepare_for_retention();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(0);
+		omap_serial_enable_clocks(0, 0);
+		omap_serial_enable_clocks(0, 1);
+		omap_serial_enable_clocks(0, 2);
 		/* XXX This is for gpio fclk hack. Will 

be removed as

Quoted 11 lines
Quoted 11 lines

arch/arm/mach-omap2/pm34xx.c static int omap3_pm_suspend(void) · line 432

Quoted 11 lines
arch/arm/mach-omap2/pm34xx.c +3 -1
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_disable();
@@ -421,7 +426,9 @@ static int omap3_pm_suspend(void)
 	omap_sram_idle();
 
 	if (clocks_off_while_idle) {
-		omap_serial_enable_clocks(1);
+		omap_serial_enable_clocks(1, 0);
+		omap_serial_enable_clocks(1, 1);
+		omap_serial_enable_clocks(1, 2);
 		/* XXX This is for gpio fclk hack. Will 

be removed as

Quoted 4 lines
Quoted 4 lines

Review static void __init prcm_setup_regs(void) · line 636

Quoted 4 lines
(quoted diff) +0 -0
 		 * gpio driver * handles fcks correctly */
 		per_gpio_clk_enable();
@@ -629,6 +636,16 @@ static void __init prcm_setup_regs(void)
 			OCP_MOD, 

OMAP2_PRM_IRQENABLE_MPU_OFFSET);

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
arch/arm/mach-omap2/pm34xx.c +10 -0
 }
 
+void omap3_save_per_ctx(void)
+{
+	omap_gpio_save();
+}
+
+void omap3_restore_per_ctx(void)
+{
+	omap_gpio_restore();
+}
+
 static int __init pwrdms_setup(struct powerdomain *pwrdm)
 {
 	struct power_state *pwrst;
@@ -652,6 +669,12 @@ static int __init pwrdms_setup(struct po
 	return set_pwrdm_state(pwrst->pwrdm, pwrst->next_state);
 }
 
Quoted 4 lines
Quoted 4 lines

arch/arm/mach-omap2/pm34xx.c static int __init pwrdms_setup(struct po · line 677

Quoted 4 lines
arch/arm/mach-omap2/pm34xx.c +4 -0
+void omap_push_sram_idle()
+{
+	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
+					

omap34xx_cpu_suspend_sz);

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
arch/arm/mach-omap2/pm34xx.c +3 -0
+}
+
 int __init omap3_pm_init(void)
 {
 	struct power_state *pwrst;
@@ -663,6 +686,7 @@ int __init omap3_pm_init(void)
 	/* XXX prcm_setup_regs needs to be before enabling hw
 	 * supervised mode for powerdomains */
 	prcm_setup_regs();
+	save_scratchpad_contents();
 
Quoted 8 lines
Quoted 8 lines

arch/arm/mach-omap2/pm34xx.c int __init omap3_pm_init(void) · line 689

Quoted 8 lines
arch/arm/mach-omap2/pm34xx.c +0 -2
 	ret = request_irq(INT_34XX_PRCM_MPU_IRQ,
 			  (irq_handler_t)prcm_interrupt_handler,
@@ -685,9 +709,7 @@ int __init omap3_pm_init(void)
 		goto err2;
 	}
 
-	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
-					

omap34xx_cpu_suspend_sz);

Quoted 7 lines
Quoted 7 lines

arch/arm/mach-omap2/pm34xx.c void save_scratchpad_contents(void) · line 801

Quoted 7 lines
arch/arm/mach-omap2/pm34xx.c +1 -1
-
+	omap_push_sram_idle();
 	suspend_set_ops(&omap_pm_ops);
 
 #ifndef CONFIG_CPU_IDLE
@@ -779,10 +801,13 @@ void save_scratchpad_contents(void)
 	*(scratchpad_address++) = 

__raw_readl(OMAP3430_PRM_CLKSEL);

Quoted 1 line
Quoted 1 line

Review void save_scratchpad_contents(void) · line 802

Quoted 1 line
(quoted diff) +0 -0
 	*(scratchpad_address++) = 

cm_read_mod_reg(CORE_MOD, CM_CLKSEL);

Quoted 1 line
Quoted 1 line

Review void save_scratchpad_contents(void) · line 803

Quoted 1 line
(quoted diff) +0 -0
 	*(scratchpad_address++) = 

cm_read_mod_reg(WKUP_MOD, CM_CLKSEL);

Quoted 3 lines
Quoted 3 lines

arch/arm/mach-omap2/pm34xx.c void save_scratchpad_contents(void)

Quoted 3 lines
arch/arm/mach-omap2/pm34xx.c +3 -0
+	/* TODO OMAP3430_CM_CLKEN_PLL is defined 0x4 */
+	/**(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
+					

OMAP3430_CM_CLKEN_PLL);*/

Quoted 5 lines
Quoted 5 lines

arch/arm/mach-omap2/pm34xx.c void save_scratchpad_contents(void)

Quoted 5 lines
arch/arm/mach-omap2/pm34xx.c +1 -2
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
-					OMAP3430_CM_CLKEN_PLL);
+					0x0);
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
-					

OMAP3430_CM_AUTOIDLE_PLL);

Quoted 3 lines
Quoted 3 lines

arch/arm/mach-omap2/pm34xx.c void save_scratchpad_contents(void)

Quoted 3 lines
arch/arm/mach-omap2/pm34xx.c +1 -0
+					CM_AUTOIDLE);
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,
 

OMAP3430_CM_CLKSEL1_PLL);

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(quoted diff) +0 -0
 	*(scratchpad_address++) = cm_read_mod_reg(PLL_MOD,

Index: linux-omap-2.6/arch/arm/mach-omap2/prm.h

===================================================================

Quoted 13 lines
Quoted 13 lines
Quoted 1 line

--- linux-omap-2.6.orig/arch/arm/mach-omap2/prm.h

2008-07-01 18:48:04.946594134 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/prm.h

2008-07-01 18:51:25.190168656 +0530

arch/arm/mach-omap2/prm.h line 139

Quoted 4 lines
arch/arm/mach-omap2/prm.h +0 -0
@@ -137,9 +137,11 @@
 
 #define OMAP3430_PM_MPUGRPSEL				0x00a4
 #define OMAP3430_PM_MPUGRPSEL1				

OMAP3430_PM_MPUGRPSEL

Quoted 4 lines
arch/arm/mach-omap2/prm.h +1 -0
+#define OMAP3430ES2_PM_MPUGRPSEL3			0x00f8
 
 #define OMAP3430_PM_IVAGRPSEL				0x00a8
 #define OMAP3430_PM_IVAGRPSEL1				
Quoted 7 lines
Quoted 7 lines

OMAP3430_PM_IVAGRPSEL

Quoted 6 lines
arch/arm/mach-omap2/prm.h +1 -0
+#define OMAP3430ES2_PM_IVAGRPSEL3			0x00f4
 
 #define OMAP3430_PM_PREPWSTST				0x00e8
 

Index: linux-omap-2.6/arch/arm/mach-omap2/sleep34xx.S

===================================================================

Quoted 14 lines
Quoted 14 lines
Quoted 1 line

--- linux-omap-2.6.orig/arch/arm/mach-omap2/sleep34xx.S

2008-07-01 18:51:22.662249764 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/sleep34xx.S

2008-07-01 18:51:25.190168656 +0530

arch/arm/mach-omap2/sleep34xx.S loop2: · line 460

Quoted 9 lines
arch/arm/mach-omap2/sleep34xx.S +1 -4
@@ -457,10 +457,12 @@ loop2:
 	mov     r9, r4
 	/* create working copy of max way size*/
 loop3:
-	/* factor way and cache number into r11 */
-	orr     r11, r10, r9, lsl r5
-	/* factor index number into r11 */
-	orr     r11, r11, r7, lsl r2
+ 	orr	r11, r10, r9, lsl r5	 @ factor way and cache 

number into r11

Quoted 1 line
Quoted 1 line

Review loop2: · line 461

Quoted 1 line
(quoted diff) +1 -0
+ 	orr	r11, r11, r7, lsl r2	 @ factor index 

number into r11

Quoted 5 lines
Quoted 5 lines

Review loop2: · line 463

Quoted 2 lines
(quoted diff) +2 -0
+ 	lsl	r6, r9, r5
+ 	orr	r11, r10, r6		 @ factor way and cache 

number into r11

Quoted 2 lines
(quoted diff) +2 -0
+ 	lsl	r6, r7, r2
+ 	orr	r11, r11, r6		 @ factor index 

number into r11

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-omap2/sleep34xx.S +0 -0
 	/*clean & invalidate by set/way */
 	mcr     p15, 0, r11, c7, c10, 2
 	/* decrement the way*/
@@ -475,7 +477,7 @@ skip:
 	cmp     r3, r10
 	bgt     loop1
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-omap2/sleep34xx.S +1 -1
 finished:
-	/*swith back to cache level 0 */
+	/*switch back to cache level 0 */
 	mov     r10, #0
 	/* select current cache level in cssr */
 	mcr     p15, 2, r10, c0, c0, 0

Index: linux-omap-2.6/arch/arm/plat-omap/sram.c

===================================================================

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

--- linux-omap-2.6.orig/arch/arm/plat-omap/sram.c

2008-07-01 18:48:04.946594134 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/plat-omap/sram.c

2008-07-01 18:51:25.191168624 +0530
Quoted 3 lines
arch/arm/plat-omap/sram.c +0 -0
@@ -26,6 +26,7 @@
 #include <asm/arch/board.h>
 
Quoted 7 lines
Quoted 7 lines

arch/arm/plat-omap/sram.c extern unsigned long omapfb_reserve_sram · line 76

Quoted 7 lines
arch/arm/plat-omap/sram.c +1 -0
 #include <asm/arch/control.h>
+#include <asm/arch/pm.h>
 
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 # include "../mach-omap2/prm.h"
@@ -75,6 +76,8 @@ extern unsigned long omapfb_reserve_sram
 					 unsigned long 

sram_size,

Quoted 1 line
Quoted 1 line

Review extern unsigned long omapfb_reserve_sram · line 77

Quoted 1 line
(quoted diff) +0 -0
 					 unsigned long 

pstart_avail,

Quoted 1 line
Quoted 1 line

Review extern unsigned long omapfb_reserve_sram · line 78

Quoted 1 line
(quoted diff) +0 -0
 					 unsigned long 

size_avail);

Quoted 27 lines
Quoted 27 lines

arch/arm/plat-omap/sram.c extern unsigned long omapfb_reserve_sram

Quoted 5 lines
arch/arm/plat-omap/sram.c +2 -0
+extern void (*_omap_sram_idle)(u32 *addr, int save_state);
+extern void omap_push_sram_idle();
 
 /*
  * Depending on the target RAMFS firewall setup, the 

public usable amount of

Review static int is_sram_locked(void) · line 111

Quoted 2 lines
(quoted diff) +0 -0
@@ -108,6 +111,7 @@ static int is_sram_locked(void)
 		return 1; /* assume locked with no PPA or 

security driver */

arch/arm/plat-omap/sram.c u32 omap2_sram_configure_core_dpll(u32 m · line 378

Quoted 10 lines
arch/arm/plat-omap/sram.c +1 -0
 }
 
+
 /*
  * The amount of SRAM depends on the core type.
  * Note that we cannot try to test for SRAM here because writes
@@ -372,16 +376,15 @@ u32 omap2_sram_configure_core_dpll(u32 m
 }
 
 /* REVISIT: Should this be same as omap34xx_sram_init() 

after off-idle? */

arch/arm/plat-omap/sram.c u32 omap2_sram_configure_core_dpll(u32 m

Quoted 6 lines
arch/arm/plat-omap/sram.c +1 -2
-void restore_sram_functions(void)
+void omap3_restore_sram_ctx(void)
 {
 	omap_sram_ceil = omap_sram_base + omap_sram_size;
-
 	_omap2_sram_reprogram_gpmc = 

omap_sram_push(omap34xx_sram_reprogram_gpmc,

Quoted 3 lines
Quoted 3 lines

arch/arm/plat-omap/sram.c u32 omap2_sram_configure_core_dpll(u32 m

Quoted 3 lines
arch/arm/plat-omap/sram.c +1 -2
-		omap34xx_sram_reprogram_gpmc_sz);
-
+				

omap34xx_sram_reprogram_gpmc_sz);

Quoted 15 lines
Quoted 15 lines

Review u32 omap2_sram_configure_core_dpll(u32 m · line 385

Quoted 2 lines
(quoted diff) +0 -0
 	_omap2_sram_configure_core_dpll =
 

omap_sram_push(omap34xx_sram_configure_core_dpll,

Review u32 omap2_sram_configure_core_dpll(u32 m · line 384

Quoted 1 line
(quoted diff) +0 -1
-					

omap34xx_sram_configure_core_dpll_sz);

arch/arm/plat-omap/sram.c int __init omap34xx_sram_init(void) · line 405

Quoted 8 lines
arch/arm/plat-omap/sram.c +2 -0
+			omap34xx_sram_configure_core_dpll_sz);
+	omap_push_sram_idle();
 }
 
 int __init omap34xx_sram_init(void)
@@ -401,6 +404,8 @@ int __init omap34xx_sram_init(void)
 	_omap2_sram_configure_core_dpll =
 

omap_sram_push(omap34xx_sram_configure_core_dpll,

Quoted 1 line
Quoted 3 lines
Quoted 3 lines

omap34xx_sram_configure_core_dpll_sz);

arch/arm/mach-omap2/pm34xx.c static int __init pwrdms_setup(struct po · line 677

Quoted 2 lines
arch/arm/mach-omap2/pm34xx.c +2 -0
+	_omap_sram_idle = omap_sram_push(omap34xx_cpu_suspend,
+					

omap34xx_cpu_suspend_sz);

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

return 0;
}
Index: linux-omap-2.6/include/asm-arm/arch-omap/prcm.h

===================================================================

Quoted 65 lines
Quoted 65 lines
Quoted 1 line

--- linux-omap-2.6.orig/include/asm-arm/arch-omap/prcm.h

2008-07-01 18:48:04.947594102 +0530
Quoted 1 line

+++ linux-omap-2.6/include/asm-arm/arch-omap/prcm.h

2008-07-01 18:51:25.192168592 +0530
Quoted 61 lines
include/asm-arm/arch-omap/prcm.h +51 -5
@@ -26,9 +26,57 @@
 u32 omap_prcm_get_reset_sources(void);
 void omap_prcm_arch_reset(char mode);
 
-#endif
-
-
-
-
+#ifdef CONFIG_ARCH_OMAP3
+/* Structure to save interrupt controller context */
+struct int_controller_context {
+	u32 sysconfig;
+	u32 protection;
+	u32 idle;
+	u32 threshold;
+	u32 ilr[96];
+	u32 mir_0;
+	u32 mir_1;
+	u32 mir_2;
+};
+
+/* Structure to save control module context */
+struct control_module_context {
+	u32 sysconfig;
+	u32 devconf0;
+	u32 mem_dftrw0;
+	u32 mem_dftrw1;
+	u32 msuspendmux_0;
+	u32 msuspendmux_1;
+	u32 msuspendmux_2;
+	u32 msuspendmux_3;
+	u32 msuspendmux_4;
+	u32 msuspendmux_5;
+	u32 sec_ctrl;
+	u32 devconf1;
+	u32 csirxfe;
+	u32 iva2_bootaddr;
+	u32 iva2_bootmod;
+	u32 debobs_0;
+	u32 debobs_1;
+	u32 debobs_2;
+	u32 debobs_3;
+	u32 debobs_4;
+	u32 debobs_5;
+	u32 debobs_6;
+	u32 debobs_7;
+	u32 debobs_8;
+	u32 prog_io0;
+	u32 prog_io1;
+	u32 dss_dpll_spreading;
+	u32 core_dpll_spreading;
+	u32 per_dpll_spreading;
+	u32 usbhost_dpll_spreading;
+	u32 pbias_lite;
+	u32 temp_sensor;
+	u32 sramldo4;
+	u32 sramldo5;
+	u32 csi;
+};
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
include/asm-arm/arch-omap/prcm.h +2 -0
+#endif /* CONFIG_ARCH_OMAP3 */
+#endif /* __ASM_ARM_ARCH_OMAP_PRCM_H */

Index: linux-omap-2.6/include/asm-arm/arch-omap/control.h

===================================================================

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

--- linux-omap-2.6.orig/include/asm-arm/arch-omap/control.h

2008-07-01 18:48:04.947594102 +0530
Quoted 1 line

+++ linux-omap-2.6/include/asm-arm/arch-omap/control.h

2008-07-01 18:51:25.192168592 +0530

Review line 149

Quoted 2 lines
(quoted diff) +0 -0
@@ -149,7 +149,27 @@
 #define OMAP343X_CONTROL_FUSE_SR	

(OMAP2_CONTROL_GENERAL + 0x0130)

Quoted 7 lines
Quoted 7 lines

Review line 150

Quoted 1 line
(quoted diff) +0 -0
 #define OMAP343X_CONTROL_IVA2_BOOTADDR	

(OMAP2_CONTROL_GENERAL + 0x0190)

Review line 151

Quoted 1 line
(quoted diff) +0 -0
 #define OMAP343X_CONTROL_IVA2_BOOTMOD	

(OMAP2_CONTROL_GENERAL + 0x0194)

Review line 152

Quoted 1 line
(quoted diff) +0 -1
-#define OMAP343X_CONTROL_TEMP_SENSOR	

(OMAP2_CONTROL_GENERAL + 0x02b4)

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_DEBOBS_0	

(OMAP2_CONTROL_GENERAL + 0x01B0)

Quoted 1 line
Quoted 1 line

Review line 153

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_DEBOBS_1	

(OMAP2_CONTROL_GENERAL + 0x01B4)

Quoted 1 line
Quoted 1 line

Review line 154

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_DEBOBS_2	

(OMAP2_CONTROL_GENERAL + 0x01B8)

Quoted 1 line
Quoted 1 line

Review line 155

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_DEBOBS_3	

(OMAP2_CONTROL_GENERAL + 0x01BC)

Quoted 1 line
Quoted 1 line

Review line 156

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_DEBOBS_4	

(OMAP2_CONTROL_GENERAL + 0x01C0)

Quoted 1 line
Quoted 1 line

Review line 157

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_DEBOBS_5	

(OMAP2_CONTROL_GENERAL + 0x01C4)

Quoted 1 line
Quoted 1 line

Review line 158

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_DEBOBS_6	

(OMAP2_CONTROL_GENERAL + 0x01C8)

Quoted 1 line
Quoted 1 line

Review line 159

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_DEBOBS_7	

(OMAP2_CONTROL_GENERAL + 0x01CC)

Quoted 1 line
Quoted 1 line

Review line 160

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_DEBOBS_8	

(OMAP2_CONTROL_GENERAL + 0x01D0)

Quoted 1 line
Quoted 1 line

Review line 161

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_PROG_IO0	

(OMAP2_CONTROL_GENERAL + 0x01D4)

Quoted 1 line
Quoted 1 line

Review line 162

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_PROG_IO1	

(OMAP2_CONTROL_GENERAL + 0x01D8)

Quoted 5 lines
Quoted 5 lines

Review line 163

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_DSS_DPLL_SPREADING	

(OMAP2_CONTROL_GENERAL + 0x01E0)

Review line 164

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_CORE_DPLL_SPREADING	

(OMAP2_CONTROL_GENERAL + 0x01E4)

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_PER_DPLL_SPREADING	
Quoted 8 lines
Quoted 8 lines

(OMAP2_CONTROL_GENERAL + 0x01E8)

Review line 166

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_USBHOST_DPLL_SPREADING 

(OMAP2_CONTROL_GENERAL + 0x01EC)

Review line 167

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_PBIAS_LITE	

(OMAP2_CONTROL_GENERAL + 0x02B0)

Review line 168

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_TEMP_SENSOR	

(OMAP2_CONTROL_GENERAL + 0x02B4)

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_SRAMLDO4	

(OMAP2_CONTROL_GENERAL + 0x02B8)

Quoted 1 line
Quoted 1 line

Review line 170

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_SRAMLDO5	

(OMAP2_CONTROL_GENERAL + 0x02C0)

Quoted 9 lines
Quoted 9 lines

Review line 171

Quoted 1 line
(quoted diff) +1 -0
+#define OMAP343X_CONTROL_CSI		

(OMAP2_CONTROL_GENERAL + 0x02b4)

include/asm-arm/arch-omap/control.h

Quoted 4 lines
include/asm-arm/arch-omap/control.h +1 -0
+
 
 /*
  * REVISIT: This list of registers is not comprehensive - 

there are more

Quoted 2 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/serial.c

===================================================================

Quoted 22 lines
Quoted 22 lines
Quoted 1 line

--- linux-omap-2.6.orig/arch/arm/mach-omap2/serial.c

2008-07-01 18:51:23.908209787 +0530
Quoted 1 line

+++ linux-omap-2.6/arch/arm/mach-omap2/serial.c

2008-07-01 18:51:25.192168592 +0530
Quoted 18 lines
arch/arm/mach-omap2/serial.c +2 -11
@@ -157,18 +157,15 @@ static void omap_serial_kick(void)
 		NSEC_PER_SEC);
 }
 
-void omap_serial_enable_clocks(int enable)
+void omap_serial_enable_clocks(int enable, int unum)
 {
-	int i;
-	for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
-		if (uart_ick[i] && uart_fck[i]) {
-			if (enable) {
-				clk_enable(uart_ick[i]);
-				clk_enable(uart_fck[i]);
-			} else {
-				clk_disable(uart_ick[i]);
-				clk_disable(uart_fck[i]);
-			}
+	if (uart_ick[unum] && uart_fck[unum]) {
Quoted 8 lines
Quoted 8 lines

arch/arm/mach-omap2/serial.c static void omap_serial_kick(void) · line 168

Quoted 6 lines
arch/arm/mach-omap2/serial.c +6 -0
+		if (enable) {
+			clk_enable(uart_ick[unum]);
+			clk_enable(uart_fck[unum]);
+		} else {
+			clk_disable(uart_ick[unum]);
+			clk_disable(uart_fck[unum]);

If you do save and restore as I mentioned above then there

is no need

Quoted 3 lines
Quoted 3 lines

to add new parameter to omap_serial_enable_clocks function. Just do uart_ctx_save before calling clk_disable and restore after clk_enable. Then as we have that interface to ask for need

for restore

Quoted 3 lines
Quoted 1 line

add put restore under if statement.

I don't understand how the second param could be avoided

here. Its used

Quoted 1 line

to identify the UART and do the enable/disable only for the

specified UART,

Quoted 1 line

rather than doing it for all UART's.

Uarts whose clocks should be handled are identified originally using enabled_uarts in ATAGS. After that uarts that needs to be controlled are identified by checking the pointers. If you call this just using omap_serial_enable_clocks(0) then those uart clocks are disabled. As you pointed core and per are always entering sleep state together, it is ok to disable/enable these clocks at same time.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
(quoted diff) +0 -0
 		}
 	}
 }

Index: linux-omap-2.6/include/asm-arm/arch-omap/common.h

===================================================================

Quoted 14 lines
Quoted 14 lines
Quoted 1 line

--- linux-omap-2.6.orig/include/asm-arm/arch-omap/common.h

2008-07-01 18:51:24.326196376 +0530
Quoted 1 line

+++ linux-omap-2.6/include/asm-arm/arch-omap/common.h

2008-07-01 18:51:25.193168559 +0530
Quoted 10 lines
include/asm-arm/arch-omap/common.h +1 -1
@@ -34,7 +34,7 @@ struct sys_timer;
 extern void omap_map_common_io(void);
 extern struct sys_timer omap_timer;
 extern void omap_serial_init(void);
-extern void omap_serial_enable_clocks(int enable);
+extern void omap_serial_enable_clocks(int enable, int unum);
 extern int omap_serial_can_sleep(void);
 extern void omap_gpio_save(void);
 extern void omap_gpio_restore(void);
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

--
To unsubscribe from this list: send the line "unsubscribe

linux-omap" in

Quoted 2 lines

the body of a message to [email protected] More majordomo info at

http://vger.kernel.org/majordomo-info.html

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 12 lines
Quoted 7 lines
Quoted 4 lines
Signature · 1 line
Jouni Högander
Signature · 1 line
Jouni Högander

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html