Skip to contentSkip to conversation

OMAP3 CPUidle patches - fixes

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

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

PATCH 1/1 OMAP3 CPUidle patches - fixes

This patch fixes few of the comments posted on the patch set till now.

One major fix is the moving of uart clock enable/disable out of the context save path as pointed out by Jouni. This would leave the UART clcoks disabled in case a CORE OFF was attempted and not achieved.

---
 arch/arm/mach-omap2/cpuidle34xx.c |   56 ++++++++++++++------------------------
 1 files changed, 22 insertions(+), 34 deletions(-)
arch/arm/mach-omap2/cpuidle34xx.c +22 -34
Index: linux-omap-2.6/arch/arm/mach-omap2/cpuidle34xx.c
===================================================================
@@ -405,9 +405,7 @@ void omap3_save_core_ctx(void)
 	/* 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)
@@ -418,9 +416,7 @@ void omap3_restore_core_ctx(void)
 	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;
 }
@@ -472,28 +468,27 @@ static int omap3_enter_idle(struct cpuid
 
 	/* Program MPU to target state */
 	if (cx->mpu_state < PWRDM_POWER_ON) {
-		if (neon_pwrst == PWRDM_POWER_ON) {
-			if (cx->mpu_state == PWRDM_POWER_RET)
-				pwrdm_set_next_pwrst(neon_pd, PWRDM_POWER_RET);
-			else if (cx->mpu_state == PWRDM_POWER_OFF)
-				pwrdm_set_next_pwrst(neon_pd, PWRDM_POWER_OFF);
-		}
+		pwrdm_set_next_pwrst(neon_pd, cx->mpu_state);
 		pwrdm_set_next_pwrst(mpu_pd, cx->mpu_state);
 	}
 
 	/* Program CORE and PER to target state */
 	if (cx->core_state < PWRDM_POWER_ON) {
-		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_save_uart_ctx(2);
-				omap_serial_enable_clocks(0, 2);
-			}
+		omap2_gpio_prepare_for_retention();
+		if (clocks_off_while_idle) {
+			omap3_save_per_ctx();
+			per_gpio_clk_disable();
+			omap_save_uart_ctx(2);
+			omap_serial_enable_clocks(0, 2);
 		}
 		if (cx->core_state == PWRDM_POWER_OFF)
 			omap3_save_core_ctx();
+		/* Disable UART1/UART2 clocks here. Done using direct register
+		* writes as using clock f/w calls results in a hang in prcm_
+		* interrupt_handler trying to clear WKST for CORE
+		*/
+		cm_clear_mod_reg_bits(0x6000, CORE_MOD, CM_ICLKEN1);
+		cm_clear_mod_reg_bits(0x6000, CORE_MOD, CM_FCLKEN1);
 		pwrdm_set_next_pwrst(core_pd, cx->core_state);
 	}
 
@@ -507,14 +502,9 @@ static int omap3_enter_idle(struct cpuid
 
 	*(scratchpad_restore_addr) = 0x0;
 
-	/* Program MPU/NEON to ON */
-	if (cx->mpu_state < PWRDM_POWER_ON) {
-		if (neon_pwrst == PWRDM_POWER_ON)
-			pwrdm_set_next_pwrst(neon_pd, PWRDM_POWER_ON);
-		pwrdm_set_next_pwrst(mpu_pd, PWRDM_POWER_ON);
-	}
-
 	if (cx->core_state < PWRDM_POWER_ON) {
+		cm_set_mod_reg_bits(0x6000, CORE_MOD, CM_ICLKEN1);
+		cm_set_mod_reg_bits(0x6000, CORE_MOD, CM_FCLKEN1);
 		if ((cx->core_state == PWRDM_POWER_OFF)
 		&& (pwrdm_read_prev_pwrst(core_pd) == PWRDM_POWER_OFF)) {
 			omap3_restore_core_ctx();
@@ -522,15 +512,13 @@ static int omap3_enter_idle(struct cpuid
 			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, 2);
-				omap_restore_uart_ctx(2);
-				per_gpio_clk_enable();
-				omap3_restore_per_ctx();
-			}
-			omap2_gpio_resume_after_retention();
+		if (clocks_off_while_idle) {
+			omap_serial_enable_clocks(1, 2);
+			omap_restore_uart_ctx(2);
+			per_gpio_clk_enable();
+			omap3_restore_per_ctx();
 		}
+		omap2_gpio_resume_after_retention();
 	}
 
 	pr_debug("MPU prev st:%x,NEON prev st:%x\n",
@@ -548,7 +536,7 @@ return_sleep_time:
 		sched_clock_idle_wakeup_event(timespec_to_ns(&ts_idle));
 
 	local_irq_enable();
-	local_fiq_disable();
+	local_fiq_enable();
 
 	return (u32)timespec_to_ns(&ts_idle)/1000;
 }
maintainer
#1 lore raw
Quoted 4 lines · Rajendra Nayak

This patch fixes few of the comments posted on the patch set till now.

One major fix is the moving of uart clock enable/disable out of the context save path as pointed out by Jouni. This would leave the UART clcoks disabled in case a CORE OFF was attempted and not achieved.

What kernel or patch series this is against? If it's for some patch series that's not applied yet to linux-omap tree, let's merge the fix to the original patch.

Tony

Quoted 124 lines
---
 arch/arm/mach-omap2/cpuidle34xx.c |   56 ++++++++++++++------------------------
 1 files changed, 22 insertions(+), 34 deletions(-)

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

arch/arm/mach-omap2/cpuidle34xx.c +22 -35
@@ -405,9 +405,7 @@ void omap3_save_core_ctx(void)
 	/* 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)
@@ -418,9 +416,7 @@ void omap3_restore_core_ctx(void)
 	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;
 }
@@ -472,28 +468,27 @@ static int omap3_enter_idle(struct cpuid
 
 	/* Program MPU to target state */
 	if (cx->mpu_state < PWRDM_POWER_ON) {
-		if (neon_pwrst == PWRDM_POWER_ON) {
-			if (cx->mpu_state == PWRDM_POWER_RET)
-				pwrdm_set_next_pwrst(neon_pd, PWRDM_POWER_RET);
-			else if (cx->mpu_state == PWRDM_POWER_OFF)
-				pwrdm_set_next_pwrst(neon_pd, PWRDM_POWER_OFF);
-		}
+		pwrdm_set_next_pwrst(neon_pd, cx->mpu_state);
 		pwrdm_set_next_pwrst(mpu_pd, cx->mpu_state);
 	}
 
 	/* Program CORE and PER to target state */
 	if (cx->core_state < PWRDM_POWER_ON) {
-		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_save_uart_ctx(2);
-				omap_serial_enable_clocks(0, 2);
-			}
+		omap2_gpio_prepare_for_retention();
+		if (clocks_off_while_idle) {
+			omap3_save_per_ctx();
+			per_gpio_clk_disable();
+			omap_save_uart_ctx(2);
+			omap_serial_enable_clocks(0, 2);
 		}
 		if (cx->core_state == PWRDM_POWER_OFF)
 			omap3_save_core_ctx();
+		/* Disable UART1/UART2 clocks here. Done using direct register
+		* writes as using clock f/w calls results in a hang in prcm_
+		* interrupt_handler trying to clear WKST for CORE
+		*/
+		cm_clear_mod_reg_bits(0x6000, CORE_MOD, CM_ICLKEN1);
+		cm_clear_mod_reg_bits(0x6000, CORE_MOD, CM_FCLKEN1);
 		pwrdm_set_next_pwrst(core_pd, cx->core_state);
 	}
 
@@ -507,14 +502,9 @@ static int omap3_enter_idle(struct cpuid
 
 	*(scratchpad_restore_addr) = 0x0;
 
-	/* Program MPU/NEON to ON */
-	if (cx->mpu_state < PWRDM_POWER_ON) {
-		if (neon_pwrst == PWRDM_POWER_ON)
-			pwrdm_set_next_pwrst(neon_pd, PWRDM_POWER_ON);
-		pwrdm_set_next_pwrst(mpu_pd, PWRDM_POWER_ON);
-	}
-
 	if (cx->core_state < PWRDM_POWER_ON) {
+		cm_set_mod_reg_bits(0x6000, CORE_MOD, CM_ICLKEN1);
+		cm_set_mod_reg_bits(0x6000, CORE_MOD, CM_FCLKEN1);
 		if ((cx->core_state == PWRDM_POWER_OFF)
 		&& (pwrdm_read_prev_pwrst(core_pd) == PWRDM_POWER_OFF)) {
 			omap3_restore_core_ctx();
@@ -522,15 +512,13 @@ static int omap3_enter_idle(struct cpuid
 			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, 2);
-				omap_restore_uart_ctx(2);
-				per_gpio_clk_enable();
-				omap3_restore_per_ctx();
-			}
-			omap2_gpio_resume_after_retention();
+		if (clocks_off_while_idle) {
+			omap_serial_enable_clocks(1, 2);
+			omap_restore_uart_ctx(2);
+			per_gpio_clk_enable();
+			omap3_restore_per_ctx();
 		}
+		omap2_gpio_resume_after_retention();
 	}
 
 	pr_debug("MPU prev st:%x,NEON prev st:%x\n",
@@ -548,7 +536,7 @@ return_sleep_time:
 		sched_clock_idle_wakeup_event(timespec_to_ns(&ts_idle));
 
 	local_irq_enable();
-	local_fiq_disable();
+	local_fiq_enable();
 
 	return (u32)timespec_to_ns(&ts_idle)/1000;
 }
 
--

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 12 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, August 04, 2008 8:03 PM
To: Rajendra Nayak
Cc: [email protected]
Subject: Re: [PATCH] OMAP3 CPUidle patches - fixes

Quoted 1 line · Rajendra Nayak

This patch fixes few of the comments posted on the patch

set till now.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

One major fix is the moving of uart clock enable/disable

out of the context save path as pointed out by Jouni.

Quoted 1 line

This would leave the UART clcoks disabled in case a CORE

OFF was attempted and not achieved.

What kernel or patch series this is against? If it's for some patch series that's not applied yet to linux-omap tree, let's merge the fix to the original patch.

I sent another patch set later to the list (dated 18/07/2008) "[PATCH 00/11] OMAP3 CPUidle patches - ver 2"
which is the final patch set for CPUidle which can be merged. This patch and all the previous patches on CPUidle can be ignored.

Quoted 140 lines

Tony

Quoted 3 lines
---
 arch/arm/mach-omap2/cpuidle34xx.c |   56 

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

Quoted 5 lines
 1 files changed, 22 insertions(+), 34 deletions(-)

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

2008-07-03 10:50:04.000000000 +0530
Quoted 1 line

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

2008-07-03 13:11:13.435048828 +0530

Review void omap3_save_core_ctx(void) · line 405

Quoted 2 lines
(quoted diff) +0 -0
@@ -405,9 +405,7 @@ void omap3_save_core_ctx(void)
 	/* Save the system control module context, padconf 

already save above*/

Quoted 19 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -4
 	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)
@@ -418,9 +416,7 @@ void omap3_restore_core_ctx(void)
 	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;
 }

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

Quoted 6 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -3
@@ -472,28 +468,27 @@ static int omap3_enter_idle(struct cpuid
 
 	/* Program MPU to target state */
 	if (cx->mpu_state < PWRDM_POWER_ON) {
-		if (neon_pwrst == PWRDM_POWER_ON) {
-			if (cx->mpu_state == PWRDM_POWER_RET)
-				pwrdm_set_next_pwrst(neon_pd, 

PWRDM_POWER_RET);

Review static int omap3_enter_idle(struct cpuid · line 479

Quoted 2 lines
(quoted diff) +0 -2
-			else if (cx->mpu_state == PWRDM_POWER_OFF)
-				pwrdm_set_next_pwrst(neon_pd, 

PWRDM_POWER_OFF);

Quoted 15 lines
arch/arm/mach-omap2/cpuidle34xx.c +1 -9
-		}
+		pwrdm_set_next_pwrst(neon_pd, cx->mpu_state);
 		pwrdm_set_next_pwrst(mpu_pd, cx->mpu_state);
 	}
 
 	/* Program CORE and PER to target state */
 	if (cx->core_state < PWRDM_POWER_ON) {
-		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_save_uart_ctx(2);
-				omap_serial_enable_clocks(0, 2);
-			}

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

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +7 -0
+		omap2_gpio_prepare_for_retention();
+		if (clocks_off_while_idle) {
+			omap3_save_per_ctx();
+			per_gpio_clk_disable();
+			omap_save_uart_ctx(2);
+			omap_serial_enable_clocks(0, 2);
 		}
 		if (cx->core_state == PWRDM_POWER_OFF)
 			omap3_save_core_ctx();
+		/* Disable UART1/UART2 clocks here. Done using 

direct register

Review static int omap3_enter_idle(struct cpuid · line 487

Quoted 1 line
(quoted diff) +1 -0
+		* writes as using clock f/w calls results in a 

hang in prcm_

Quoted 13 lines
arch/arm/mach-omap2/cpuidle34xx.c +4 -2
+		* interrupt_handler trying to clear WKST for CORE
+		*/
+		cm_clear_mod_reg_bits(0x6000, CORE_MOD, CM_ICLKEN1);
+		cm_clear_mod_reg_bits(0x6000, CORE_MOD, CM_FCLKEN1);
 		pwrdm_set_next_pwrst(core_pd, cx->core_state);
 	}
 
@@ -507,14 +502,9 @@ static int omap3_enter_idle(struct cpuid
 
 	*(scratchpad_restore_addr) = 0x0;
 
-	/* Program MPU/NEON to ON */
-	if (cx->mpu_state < PWRDM_POWER_ON) {

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

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +2 -5
-		if (neon_pwrst == PWRDM_POWER_ON)
-			pwrdm_set_next_pwrst(neon_pd, PWRDM_POWER_ON);
-		pwrdm_set_next_pwrst(mpu_pd, PWRDM_POWER_ON);
-	}
-
 	if (cx->core_state < PWRDM_POWER_ON) {
+		cm_set_mod_reg_bits(0x6000, CORE_MOD, CM_ICLKEN1);
+		cm_set_mod_reg_bits(0x6000, CORE_MOD, CM_FCLKEN1);
 		if ((cx->core_state == PWRDM_POWER_OFF)
 		&& (pwrdm_read_prev_pwrst(core_pd) == 

PWRDM_POWER_OFF)) {

Quoted 13 lines
arch/arm/mach-omap2/cpuidle34xx.c +0 -8
 			omap3_restore_core_ctx();
@@ -522,15 +512,13 @@ static int omap3_enter_idle(struct cpuid
 			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, 2);
-				omap_restore_uart_ctx(2);
-				per_gpio_clk_enable();
-				omap3_restore_per_ctx();
-			}
-			omap2_gpio_resume_after_retention();

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

Quoted 10 lines
arch/arm/mach-omap2/cpuidle34xx.c +6 -0
+		if (clocks_off_while_idle) {
+			omap_serial_enable_clocks(1, 2);
+			omap_restore_uart_ctx(2);
+			per_gpio_clk_enable();
+			omap3_restore_per_ctx();
 		}
+		omap2_gpio_resume_after_retention();
 	}
 
 	pr_debug("MPU prev st:%x,NEON prev st:%x\n", @@ -548,7 

+536,7 @@

Quoted 11 lines

return_sleep_time:

arch/arm/mach-omap2/cpuidle34xx.c +1 -2
 		sched_clock_idle_wakeup_event(timespec_to_ns(&ts_idle));
 
 	local_irq_enable();
-	local_fiq_disable();
+	local_fiq_enable();
 
 	return (u32)timespec_to_ns(&ts_idle)/1000;
 }
 
--
Quoted 1 line

To unsubscribe from this list: send the line "unsubscribe

linux-omap"

Quoted 1 line

in the body of a message to [email protected] More

majordomo

Quoted 1 line

info at http://vger.kernel.org/majordomo-info.html

maintainer
#3 lore raw
Quoted 17 lines · Rajendra Nayak
Quoted 17 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, August 04, 2008 8:03 PM
To: Rajendra Nayak
Cc: [email protected]
Subject: Re: [PATCH] OMAP3 CPUidle patches - fixes

Quoted 1 line · Rajendra Nayak

This patch fixes few of the comments posted on the patch

set till now.

Quoted 2 lines

One major fix is the moving of uart clock enable/disable

out of the context save path as pointed out by Jouni.

Quoted 1 line

This would leave the UART clcoks disabled in case a CORE

OFF was attempted and not achieved.

Quoted 8 lines
Quoted 3 lines

What kernel or patch series this is against? If it's for some patch series that's not applied yet to linux-omap tree, let's merge the fix to the original patch.

I sent another patch set later to the list (dated 18/07/2008) "[PATCH 00/11] OMAP3 CPUidle patches - ver 2"
which is the final patch set for CPUidle which can be merged. This patch and all the previous patches on CPUidle can be ignored.

Can you please integrate all the fixes to CPUidle and repost the whole series one more time?

Thanks,

Tony

#4 lore raw
Quoted 30 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Tuesday, August 05, 2008 2:04 PM
To: Rajendra Nayak
Cc: [email protected]
Subject: Re: [PATCH] OMAP3 CPUidle patches - fixes

Quoted 10 lines · Rajendra Nayak
Quoted 10 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Monday, August 04, 2008 8:03 PM
To: Rajendra Nayak
Cc: [email protected]
Subject: Re: [PATCH] OMAP3 CPUidle patches - fixes

Quoted 1 line · Rajendra Nayak

This patch fixes few of the comments posted on the patch

Quoted 8 lines
Quoted 8 lines

set till now.

Quoted 2 lines

One major fix is the moving of uart clock enable/disable

out of the context save path as pointed out by Jouni.

Quoted 1 line

This would leave the UART clcoks disabled in case a CORE

OFF was attempted and not achieved.

What kernel or patch series this is against? If it's for

some patch

Quoted 3 lines
Quoted 2 lines

series that's not applied yet to linux-omap tree, let's merge the fix to the original patch.

Quoted 8 lines
Quoted 1 line

I sent another patch set later to the list (dated

18/07/2008) "[PATCH

Quoted 3 lines

00/11] OMAP3 CPUidle patches - ver 2"
which is the final patch set for CPUidle which can be merged. This patch and all the previous patches on CPUidle can be ignored.

Can you please integrate all the fixes to CPUidle and repost the whole series one more time?

Ok. Will repost it today.

Quoted 5 lines

Thanks,

Tony