Skip to contentSkip to conversation

omap3: pm: Fixes for low power code

PATCH New Santosh Shilimkar 2 participants 10 messages Feb 21, 2011 – Mar 8, 2011

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

cover omap3: pm: Fixes for low power code

The series does below fixes to the omap3 low power code.
1. Use supported ARMv7 instructions instead of the legacy ones
2. Fix the MMU on sequence
3. Fix the cache flush scenario when only L1 lost.
4. Remove all un-necessary context save registers
5. Disable C-bit before cache clean
6. Use set_cr() exported API instead of custom one.

It's generated against mainline and tested with OMAP3630 ZOOM3.
1. Renetion and off-mode mode in suspend - ok.
2. Retention in idle - ok

The following changes since commit 85e2efbb1db9a18d218006706d6e4fbeb0216213:
Linus Torvalds (1):

        Linux 2.6.38-rc5

Santosh Shilimkar (6):
omap3: pm: Use amrv7 supported instructions instead of legacy cp15
ones
omap3: pm: Fix the mmu on sequence in the asm code
omap3: pm: Allow the cache clean when L1 is lost.
omap3: pm: Remove un-necessary cp15 registers form low power cpu
context
omap3: pm: Clear the SCTLR C bit in asm code to prevent data cache
allocation
omap3: pm: Use exported set_cr() instead of a custom one.

 arch/arm/mach-omap2/pm34xx.c    |    7 +-
 arch/arm/mach-omap2/sleep34xx.S |  223 ++++++++++++++-------------------------
 2 files changed, 78 insertions(+), 152 deletions(-)
#1 lore raw

PATCH 1/6 omap3: pm: Use amrv7 supported instructions instead of legacy cp15 ones

On ARMv7 dsb, dmb instructions are supported and can be used directly instead of their cp15 equivalnet. Also remove the opcodes for smc and use the available instruction directly in OMAP3 low power asm code

---
 arch/arm/mach-omap2/sleep34xx.S |   35 +++++++++++++++++------------------
 1 files changed, 17 insertions(+), 18 deletions(-)
arch/arm/mach-omap2/sleep34xx.S +17 -18
index 98d8232..db4cc57 100644
@@ -131,9 +131,9 @@ ENTRY(save_secure_ram_context)
 	mov	r1, #0			@ set task id for ROM code in r1
 	mov	r2, #4			@ set some flags in r2, r6
 	mov	r6, #0xff
-	mcr	p15, 0, r0, c7, c10, 4	@ data write barrier
-	mcr	p15, 0, r0, c7, c10, 5	@ data memory barrier
-	.word	0xE1600071		@ call SMI monitor (smi #1)
+	dsb				@ data write barrier
+	dmb				@ data memory barrier
+	smc	#1			@ call SMI monitor (smi #1)
 	nop
 	nop
 	nop
@@ -289,9 +289,8 @@ omap3_do_wfi:
 	str	r5, [r4]		@ write back to SDRC_POWER register
 
 	/* Data memory barrier and Data sync barrier */
-	mov	r1, #0
-	mcr	p15, 0, r1, c7, c10, 4
-	mcr	p15, 0, r1, c7, c10, 5
+	dsb
+	dmb
 
 /*
  * ===================================
@@ -406,9 +405,9 @@ skipl2dis:
 	mov	r2, #4			@ set some flags in r2, r6
 	mov	r6, #0xff
 	adr	r3, l2_inv_api_params	@ r3 points to dummy parameters
-	mcr	p15, 0, r0, c7, c10, 4	@ data write barrier
-	mcr	p15, 0, r0, c7, c10, 5	@ data memory barrier
-	.word	0xE1600071		@ call SMI monitor (smi #1)
+	dsb				@ data write barrier
+	dmb				@ data memory barrier
+	smc	#1			@ call SMI monitor (smi #1)
 	/* Write to Aux control register to set some bits */
 	mov	r0, #42			@ set service ID for PPA
 	mov	r12, r0			@ copy secure Service ID in r12
@@ -417,9 +416,9 @@ skipl2dis:
 	mov	r6, #0xff
 	ldr	r4, scratchpad_base
 	ldr	r3, [r4, #0xBC]		@ r3 points to parameters
-	mcr	p15, 0, r0, c7, c10, 4	@ data write barrier
-	mcr	p15, 0, r0, c7, c10, 5	@ data memory barrier
-	.word	0xE1600071		@ call SMI monitor (smi #1)
+	dsb				@ data write barrier
+	dmb				@ data memory barrier
+	smc	#1			@ call SMI monitor (smi #1)
 
 #ifdef CONFIG_OMAP3_L2_AUX_SECURE_SAVE_RESTORE
 	/* Restore L2 aux control register */
@@ -432,9 +431,9 @@ skipl2dis:
 	ldr	r4, scratchpad_base
 	ldr	r3, [r4, #0xBC]
 	adds	r3, r3, #8		@ r3 points to parameters
-	mcr	p15, 0, r0, c7, c10, 4	@ data write barrier
-	mcr	p15, 0, r0, c7, c10, 5	@ data memory barrier
-	.word	0xE1600071		@ call SMI monitor (smi #1)
+	dsb				@ data write barrier
+	dmb				@ data memory barrier
+	smc	#1			@ call SMI monitor (smi #1)
 #endif
 	b	logic_l1_restore
 
@@ -443,18 +442,18 @@ l2_inv_api_params:
 l2_inv_gp:
 	/* Execute smi to invalidate L2 cache */
 	mov r12, #0x1			@ set up to invalidate L2
-	.word 0xE1600070		@ Call SMI monitor (smieq)
+	smc	#0			@ Call SMI monitor
 	/* Write to Aux control register to set some bits */
 	ldr	r4, scratchpad_base
 	ldr	r3, [r4,#0xBC]
 	ldr	r0, [r3,#4]
 	mov	r12, #0x3
-	.word	0xE1600070		@ Call SMI monitor (smieq)
+	smc	#0			@ Call SMI monitor
 	ldr	r4, scratchpad_base
 	ldr	r3, [r4,#0xBC]
 	ldr	r0, [r3,#12]
 	mov	r12, #0x2
-	.word	0xE1600070		@ Call SMI monitor (smieq)
+	smc	#0			@ Call SMI monitor
 logic_l1_restore:
 	ldr	r1, l2dis_3630
 	cmp	r1, #0x1		@ Test if L2 re-enable needed on 3630
Signature · 1 line
1.6.0.4
#2 lore raw

PATCH 2/6 omap3: pm: Fix the mmu on sequence in the asm code

In reply to Santosh Shilimkar

Add necessary barriers after enabling MMU. Also use the sane way to load pc and jump to it instead of executing ldma first up.

---
 arch/arm/mach-omap2/sleep34xx.S |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/sleep34xx.S +5 -0
index db4cc57..4478379 100644
@@ -591,12 +591,17 @@ usettbr0:
 	ldr	r2, cache_pred_disable_mask
 	and	r4, r2
 	mcr	p15, 0, r4, c1, c0, 0
+	dsb
+	isb
+	ldr     r0, =restoremmu_on
+	bx      r0
 
 /*
  * ==============================
  * == Exit point from OFF mode ==
  * ==============================
  */
+restoremmu_on:
 	ldmfd	sp!, {r0-r12, pc}	@ restore regs and return
 
 
Signature · 1 line
1.6.0.4
#3 lore raw

PATCH 3/6 omap3: pm: Allow the cache clean when L1 is lost.

In reply to Santosh Shilimkar

When L1 cache is suppose to be lost, it needs to be cleaned before entrering to the low power mode.

While at this, also fix few comments and remove un-necessary clean_l2 lable.

---
 arch/arm/mach-omap2/sleep34xx.S |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)
arch/arm/mach-omap2/sleep34xx.S +3 -12
index 4478379..7442431 100644
@@ -173,12 +173,12 @@ ENTRY(omap34xx_cpu_suspend)
 	stmfd	sp!, {r0-r12, lr}	@ save registers on stack
 
 	/*
-	 * r0 contains restore pointer in sdram
+	 * r0 contains CPU context save/restore pointer in sdram
 	 * r1 contains information about saving context:
 	 *   0 - No context lost
 	 *   1 - Only L1 and logic lost
-	 *   2 - Only L2 lost
-	 *   3 - Both L1 and L2 lost
+	 *   2 - Only L2 lost (Even L1 is retained we clean it along with L2)
+	 *   3 - Both L1 and L2 lost and logic lost
 	 */
 
 	/* Directly jump to WFI is the context save is not required */
@@ -263,15 +263,6 @@ l1_logic_lost:
 
 clean_caches:
 	/*
-	 * Clean Data or unified cache to POU
-	 * How to invalidate only L1 cache???? - #FIX_ME#
-	 * mcr	p15, 0, r11, c7, c11, 1
-	 */
-	cmp	r1, #0x1 		@ Check whether L2 inval is required
-	beq	omap3_do_wfi
-
-clean_l2:
-	/*
 	 * jump out to kernel flush routine
 	 *  - reuse that code is better
 	 *  - it executes in a cached space so is faster than refetch per-block
Signature · 1 line
1.6.0.4
#4 lore raw

PATCH 4/6 omap3: pm: Remove un-necessary cp15 registers form low power cpu context

In reply to Santosh Shilimkar

The current code saves few un-necessary registers which are read-only or write-only, unused CP15 registers.

Remove them and keep only necessary CP15 registers part of low power context save/restore.

---
 arch/arm/mach-omap2/sleep34xx.S |  156 ++++++++++-----------------------------
 1 files changed, 40 insertions(+), 116 deletions(-)
arch/arm/mach-omap2/sleep34xx.S +40 -116
index 7442431..28baeb2 100644
@@ -199,66 +199,29 @@ save_context_wfi:
 	beq	clean_caches
 
 l1_logic_lost:
-	/* Store sp and spsr to SDRAM */
-	mov	r4, sp
-	mrs	r5, spsr
-	mov	r6, lr
+	mov	r4, sp			@ Store sp
+	mrs	r5, spsr		@ Store spsr
+	mov	r6, lr			@ Store lr
 	stmia	r8!, {r4-r6}
-	/* Save all ARM registers */
-	/* Coprocessor access control register */
-	mrc	p15, 0, r6, c1, c0, 2
-	stmia	r8!, {r6}
-	/* TTBR0, TTBR1 and Translation table base control */
-	mrc	p15, 0, r4, c2, c0, 0
-	mrc	p15, 0, r5, c2, c0, 1
-	mrc	p15, 0, r6, c2, c0, 2
-	stmia	r8!, {r4-r6}
-	/*
-	 * Domain access control register, data fault status register,
-	 * and instruction fault status register
-	 */
-	mrc	p15, 0, r4, c3, c0, 0
-	mrc	p15, 0, r5, c5, c0, 0
-	mrc	p15, 0, r6, c5, c0, 1
-	stmia	r8!, {r4-r6}
-	/*
-	 * Data aux fault status register, instruction aux fault status,
-	 * data fault address register and instruction fault address register
-	 */
-	mrc	p15, 0, r4, c5, c1, 0
-	mrc	p15, 0, r5, c5, c1, 1
-	mrc	p15, 0, r6, c6, c0, 0
-	mrc	p15, 0, r7, c6, c0, 2
-	stmia	r8!, {r4-r7}
-	/*
-	 * user r/w thread and process ID, user r/o thread and process ID,
-	 * priv only thread and process ID, cache size selection
-	 */
-	mrc	p15, 0, r4, c13, c0, 2
-	mrc	p15, 0, r5, c13, c0, 3
-	mrc	p15, 0, r6, c13, c0, 4
-	mrc	p15, 2, r7, c0, c0, 0
+
+	mrc	p15, 0, r4, c1, c0, 2	@ Coprocessor access control register
+	mrc	p15, 0, r5, c2, c0, 0	@ TTBR0
+	mrc	p15, 0, r6, c2, c0, 1	@ TTBR1
+	mrc	p15, 0, r7, c2, c0, 2	@ TTBCR
 	stmia	r8!, {r4-r7}
-	/* Data TLB lockdown, instruction TLB lockdown registers */
-	mrc	p15, 0, r5, c10, c0, 0
-	mrc	p15, 0, r6, c10, c0, 1
-	stmia	r8!, {r5-r6}
-	/* Secure or non secure vector base address, FCSE PID, Context PID*/
-	mrc	p15, 0, r4, c12, c0, 0
-	mrc	p15, 0, r5, c13, c0, 0
-	mrc	p15, 0, r6, c13, c0, 1
-	stmia	r8!, {r4-r6}
-	/* Primary remap, normal remap registers */
-	mrc	p15, 0, r4, c10, c2, 0
-	mrc	p15, 0, r5, c10, c2, 1
-	stmia	r8!,{r4-r5}
 
-	/* Store current cpsr*/
-	mrs	r2, cpsr
-	stmia	r8!, {r2}
+	mrc	p15, 0, r4, c3, c0, 0	@ Domain access Control Register
+	mrc	p15, 0, r5, c10, c2, 0	@ PRRR
+	mrc	p15, 0, r6, c10, c2, 1	@ NMRR
+	stmia	r8!,{r4-r6}
+
+	mrc	p15, 0, r4, c13, c0, 1	@ Context ID
+	mrc	p15, 0, r5, c13, c0, 2	@ User r/w thread and process ID
+	mrc	p15, 0, r6, c12, c0, 0	@ Secure or NS vector base address
+	mrs	r7, cpsr		@ Store current cpsr
+	stmia	r8!, {r4-r7}
 
-	mrc	p15, 0, r4, c1, c0, 0
-	/* save control register */
+	mrc	p15, 0, r4, c1, c0, 0	@ save control register
 	stmia	r8!, {r4}
 
 clean_caches:
@@ -463,68 +426,29 @@ skipl2reen:
 	ldr	r4, scratchpad_base
 	ldr	r3, [r4,#0xBC]
 	adds	r3, r3, #16
+
 	ldmia	r3!, {r4-r6}
-	mov	sp, r4
-	msr	spsr_cxsf, r5
-	mov	lr, r6
-
-	ldmia	r3!, {r4-r9}
-	/* Coprocessor access Control Register */
-	mcr p15, 0, r4, c1, c0, 2
-
-	/* TTBR0 */
-	MCR p15, 0, r5, c2, c0, 0
-	/* TTBR1 */
-	MCR p15, 0, r6, c2, c0, 1
-	/* Translation table base control register */
-	MCR p15, 0, r7, c2, c0, 2
-	/* Domain access Control Register */
-	MCR p15, 0, r8, c3, c0, 0
-	/* Data fault status Register */
-	MCR p15, 0, r9, c5, c0, 0
-
-	ldmia	r3!,{r4-r8}
-	/* Instruction fault status Register */
-	MCR p15, 0, r4, c5, c0, 1
-	/* Data Auxiliary Fault Status Register */
-	MCR p15, 0, r5, c5, c1, 0
-	/* Instruction Auxiliary Fault Status Register*/
-	MCR p15, 0, r6, c5, c1, 1
-	/* Data Fault Address Register */
-	MCR p15, 0, r7, c6, c0, 0
-	/* Instruction Fault Address Register*/
-	MCR p15, 0, r8, c6, c0, 2
-	ldmia	r3!,{r4-r7}
+	mov	sp, r4			@ Restore sp
+	msr	spsr_cxsf, r5		@ Restore spsr
+	mov	lr, r6			@ Restore lr
 
-	/* User r/w thread and process ID */
-	MCR p15, 0, r4, c13, c0, 2
-	/* User ro thread and process ID */
-	MCR p15, 0, r5, c13, c0, 3
-	/* Privileged only thread and process ID */
-	MCR p15, 0, r6, c13, c0, 4
-	/* Cache size selection */
-	MCR p15, 2, r7, c0, c0, 0
-	ldmia	r3!,{r4-r8}
-	/* Data TLB lockdown registers */
-	MCR p15, 0, r4, c10, c0, 0
-	/* Instruction TLB lockdown registers */
-	MCR p15, 0, r5, c10, c0, 1
-	/* Secure or Nonsecure Vector Base Address */
-	MCR p15, 0, r6, c12, c0, 0
-	/* FCSE PID */
-	MCR p15, 0, r7, c13, c0, 0
-	/* Context PID */
-	MCR p15, 0, r8, c13, c0, 1
-
-	ldmia	r3!,{r4-r5}
-	/* Primary memory remap register */
-	MCR p15, 0, r4, c10, c2, 0
-	/* Normal memory remap register */
-	MCR p15, 0, r5, c10, c2, 1
-
-	/* Restore cpsr */
-	ldmia	r3!,{r4}		@ load CPSR from SDRAM
-	msr	cpsr, r4		@ store cpsr
+	ldmia	r3!, {r4-r7}
+	mcr	p15, 0, r4, c1, c0, 2	@ Coprocessor access Control Register
+	mcr	p15, 0, r5, c2, c0, 0	@ TTBR0
+	mcr	p15, 0, r6, c2, c0, 1	@ TTBR1
+	mcr	p15, 0, r7, c2, c0, 2	@ TTBCR
+
+	ldmia	r3!,{r4-r6}
+	mcr	p15, 0, r4, c3, c0, 0	@ Domain access Control Register
+	mcr	p15, 0, r5, c10, c2, 0	@ PRRR
+	mcr	p15, 0, r6, c10, c2, 1	@ NMRR
+
+
+	ldmia	r3!,{r4-r7}
+	mcr	p15, 0, r4, c13, c0, 1	@ Context ID
+	mrc	p15, 0, r5, c12, c0, 0	@ Secure or NS vector base address
+	msr	cpsr, r6		@ store cpsr
+	mcr	p15, 0, r7, c13, c0, 2	@ User r/w thread and process ID
 
 	/* Enabling MMU here */
 	mrc	p15, 0, r7, c2, c0, 2 	@ Read TTBRControl
Signature · 1 line
1.6.0.4
#5 lore raw

PATCH 5/6 omap3: pm: Clear the SCTLR C bit in asm code to prevent data cache allocation

In reply to Santosh Shilimkar

On the newer ARM processors like CortexA8, CortexA9, the caches can be speculatively loaded while they are getting flushed.

Clear the SCTLR C bit to prevent further data cache allocation as part of cache clean routine

---
 arch/arm/mach-omap2/sleep34xx.S |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/sleep34xx.S +12 -0
index 28baeb2..1e723bb 100644
@@ -224,6 +224,12 @@ l1_logic_lost:
 	mrc	p15, 0, r4, c1, c0, 0	@ save control register
 	stmia	r8!, {r4}
 
+	/* Clear the SCTLR C bit to prevent further data cache allocation */
+	mrc	p15, 0, r0, c1, c0, 0
+	bic	r0, r0, #(1 << 2)	@ Disable the C bit
+	mcr	p15, 0, r0, c1, c0, 0
+	isb
+
 clean_caches:
 	/*
 	 * jump out to kernel flush routine
@@ -270,6 +276,12 @@ omap3_do_wfi:
 	nop
 	bl wait_sdrc_ok
 
+	mrc	p15, 0, r0, c1, c0, 0
+	tst	r0, #(1 << 2)		@ Check C bit enabled?
+	orreq	r0, r0, #(1 << 2)	@ Enable the C bit if cleared
+	mcreq	p15, 0, r0, c1, c0, 0
+	isb
+
 /*
  * ===================================
  * == Exit point from non-OFF modes ==
Signature · 1 line
1.6.0.4
#6 lore raw

PATCH 6/6 omap3: pm: Use exported set_cr() instead of a custom one.

In reply to Santosh Shilimkar

Remove the custom restore_control_register() and use the exported set_cr() instead to set the system control register(SCTRL) value.

No functional change.

---
 arch/arm/mach-omap2/pm34xx.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/pm34xx.c +1 -6
index 2f864e4..63a3e1d 100644
@@ -311,11 +311,6 @@ static irqreturn_t prcm_interrupt_handler (int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void restore_control_register(u32 val)
-{
-	__asm__ __volatile__ ("mcr p15, 0, %0, c1, c0, 0" : : "r" (val));
-}
-
 /* Function to restore the table entry that was modified for enabling MMU */
 static void restore_table_entry(void)
 {
@@ -337,7 +332,7 @@ static void restore_table_entry(void)
 	control_reg_value = __raw_readl(scratchpad_address
 					+ OMAP343X_CONTROL_REG_VALUE_OFFSET);
 	/* This will enable caches and prediction */
-	restore_control_register(control_reg_value);
+	set_cr(control_reg_value);
 }
 
 void omap_sram_idle(void)
Signature · 1 line
1.6.0.4
#7 lore raw

cover omap3: pm: Fixes for low power code

In reply to Santosh Shilimkar

Hi Santosh,

Quoted 7 lines · Santosh Shilimkar

The series does below fixes to the omap3 low power code.
1. Use supported ARMv7 instructions instead of the legacy ones
2. Fix the MMU on sequence
3. Fix the cache flush scenario when only L1 lost.
4. Remove all un-necessary context save registers
5. Disable C-bit before cache clean
6. Use set_cr() exported API instead of custom one.

Look like good cleanups, thanks.

Quoted 3 lines

It's generated against mainline and tested with OMAP3630 ZOOM3.
1. Renetion and off-mode mode in suspend - ok.
2. Retention in idle - ok

Testing this series along with other PM changes queued up for mainline (my pm-core branch), this doesn't work for me on 3630/Zoom3 (but works fine on 3430/n900.)

Here's what I did using omap2plus_defconfig + enabling CPUidle

First tested suspend:

echo 4 > /debug/pm_debug/wakeup_timer_seconds
echo mem > /sys/power/state

then, setup UART idle/wakeup:

echo 5 > /sys/devices/platform/omap/omap_uart.0/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.1/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.2/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.3/sleep_timeout echo enabled > /sys/devices/platform/serial8250.0/tty/ttyS0/power/wakeup

then enabled idle:

echo 1 > /debug/pm_debug/sleep_while_idle

As soon as I do this, it hangs.

Without your series, it's working fine for me. Only after merging your series it hangs.

Kevin

Quoted 18 lines

The following changes since commit 85e2efbb1db9a18d218006706d6e4fbeb0216213:
Linus Torvalds (1):

        Linux 2.6.38-rc5

Santosh Shilimkar (6):
omap3: pm: Use amrv7 supported instructions instead of legacy cp15
ones
omap3: pm: Fix the mmu on sequence in the asm code
omap3: pm: Allow the cache clean when L1 is lost.
omap3: pm: Remove un-necessary cp15 registers form low power cpu
context
omap3: pm: Clear the SCTLR C bit in asm code to prevent data cache
allocation
omap3: pm: Use exported set_cr() instead of a custom one.

 arch/arm/mach-omap2/pm34xx.c    |    7 +-
 arch/arm/mach-omap2/sleep34xx.S |  223 ++++++++++++++-------------------------
 2 files changed, 78 insertions(+), 152 deletions(-)
#8 lore raw

cover omap3: pm: Fixes for low power code

Quoted 46 lines

-----Original Message-----
From: Kevin Hilman [mailto:khilman at ti.com]
Sent: Thursday, March 03, 2011 6:53 AM
To: Santosh Shilimkar
Cc: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 0/6] omap3: pm: Fixes for low power code

Hi Santosh,

Quoted 7 lines · Santosh Shilimkar

The series does below fixes to the omap3 low power code.
1. Use supported ARMv7 instructions instead of the legacy ones
2. Fix the MMU on sequence
3. Fix the cache flush scenario when only L1 lost.
4. Remove all un-necessary context save registers
5. Disable C-bit before cache clean
6. Use set_cr() exported API instead of custom one.

Look like good cleanups, thanks.

Quoted 3 lines

It's generated against mainline and tested with OMAP3630 ZOOM3.
1. Renetion and off-mode mode in suspend - ok.
2. Retention in idle - ok

Testing this series along with other PM changes queued up for mainline
(my pm-core branch), this doesn't work for me on 3630/Zoom3 (but works fine on 3430/n900.)

Here's what I did using omap2plus_defconfig + enabling CPUidle

First tested suspend:

echo 4 > /debug/pm_debug/wakeup_timer_seconds
echo mem > /sys/power/state

then, setup UART idle/wakeup:

echo 5 > /sys/devices/platform/omap/omap_uart.0/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.1/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.2/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.3/sleep_timeout echo enabled > /sys/devices/platform/serial8250.0/tty/ttyS0/power/wakeup

Quoted 9 lines

then enabled idle:

echo 1 > /debug/pm_debug/sleep_while_idle

As soon as I do this, it hangs.

Without your series, it's working fine for me. Only after merging your series it hangs.

Interesting. I was seeing cpuidle hang on my 3630 without this Series when tested on mainline.
Will rebase this series on your pm-core branch and look at the issue further.

Regards,
Santosh

#9 lore raw

cover omap3: pm: Fixes for low power code

In reply to Kevin Hilman

Kevin,

Quoted 47 lines

-----Original Message-----
From: Kevin Hilman [mailto:khilman at ti.com]
Sent: Thursday, March 03, 2011 6:53 AM
To: Santosh Shilimkar
Cc: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 0/6] omap3: pm: Fixes for low power code

Hi Santosh,

Quoted 7 lines · Santosh Shilimkar

The series does below fixes to the omap3 low power code.
1. Use supported ARMv7 instructions instead of the legacy ones
2. Fix the MMU on sequence
3. Fix the cache flush scenario when only L1 lost.
4. Remove all un-necessary context save registers
5. Disable C-bit before cache clean
6. Use set_cr() exported API instead of custom one.

Look like good cleanups, thanks.

Quoted 3 lines

It's generated against mainline and tested with OMAP3630 ZOOM3.
1. Renetion and off-mode mode in suspend - ok.
2. Retention in idle - ok

Testing this series along with other PM changes queued up for mainline
(my pm-core branch), this doesn't work for me on 3630/Zoom3 (but works
fine on 3430/n900.)

Here's what I did using omap2plus_defconfig + enabling CPUidle

First tested suspend:

echo 4 > /debug/pm_debug/wakeup_timer_seconds
echo mem > /sys/power/state

then, setup UART idle/wakeup:

echo 5 > /sys/devices/platform/omap/omap_uart.0/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.1/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.2/sleep_timeout echo 5 > /sys/devices/platform/omap/omap_uart.3/sleep_timeout echo enabled > /sys/devices/platform/serial8250.0/tty/ttyS0/power/wakeup

Quoted 9 lines

then enabled idle:

echo 1 > /debug/pm_debug/sleep_while_idle

As soon as I do this, it hangs.

Without your series, it's working fine for me. Only after merging your series it hangs.

I rebased this series against latest pm-core branch which also has Dave's THUMB2 series merged.

After few trials I managed to reproduce the issue. With above steps it was still working for me but with off mode enabled, I saw a lock-up in suspend. Further debugging, I found that one CP15 register save/restore position was swapped which lead to this. I fixed that.

I have pushed the rebased series on below branch.

git://dev.omapzoom.org/pub/scm/santosh/kernel-omap4-base.git
pm-core-omap3-asm

Regards,
Santosh