All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 0/5] Misc fixes [for PM branch]
@ 2009-11-12 10:07 Tero Kristo
  2009-11-12 10:07 ` [PATCH 1/5] OMAP3: Fixed ARM aux ctrl register save/restore Tero Kristo
  0 siblings, 1 reply; 18+ messages in thread
From: Tero Kristo @ 2009-11-12 10:07 UTC (permalink / raw)
  To: linux-omap

From: Tero Kristo <tero.kristo@nokia.com>

This set contains following changes compared to previous one:

1) Removed accepted patches
2) ARM aux ctrl and L2 aux ctrl register save/restore uses now arm_context
   as save area
3) Added more detail to I2C4 repeated start disable fix description
4) Refreshed patches against PM branch



^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/5] OMAP3: Fixed ARM aux ctrl register save/restore
  2009-11-12 10:07 [PATCHv3 0/5] Misc fixes [for PM branch] Tero Kristo
@ 2009-11-12 10:07 ` Tero Kristo
  2009-11-12 10:07   ` [PATCH 2/5] OMAP3: PM: Disabled I2C4 repeated start operation mode Tero Kristo
  2009-11-26 11:18   ` [PATCH 1/5] OMAP3: Fixed ARM aux ctrl register save/restore Gopinath, Thara
  0 siblings, 2 replies; 18+ messages in thread
From: Tero Kristo @ 2009-11-12 10:07 UTC (permalink / raw)
  To: linux-omap

From: Tero Kristo <tero.kristo@nokia.com>

Current value is stored on SDRAM and it is written back during wakeup.
Previously a static value of 0x72 was written there.

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
---
 arch/arm/mach-omap2/sleep34xx.S |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index 4707ba8..8bd5fc5 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -278,7 +278,8 @@ restore:
 	mov	r1, #0		@ set task id for ROM code in r1
 	mov	r2, #4		@ set some flags in r2, r6
 	mov	r6, #0xff
-	adr	r3, write_aux_control_params	@ r3 points to parameters
+	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)
@@ -286,14 +287,14 @@ restore:
 	b	logic_l1_restore
 l2_inv_api_params:
 	.word   0x1, 0x00
-write_aux_control_params:
-	.word   0x1, 0x72
 l2_inv_gp:
 	/* Execute smi to invalidate L2 cache */
 	mov r12, #0x1                         @ set up to invalide L2
 smi:    .word 0xE1600070		@ Call SMI monitor (smieq)
 	/* Write to Aux control register to set some bits */
-	mov	r0, #0x72
+	ldr	r4, scratchpad_base
+	ldr	r3, [r4,#0xBC]
+	ldr	r0, [r3,#4]
 	mov	r12, #0x3
 	.word 0xE1600070	@ Call SMI monitor (smieq)
 logic_l1_restore:
@@ -304,6 +305,7 @@ logic_l1_restore:
 
 	ldr	r4, scratchpad_base
 	ldr	r3, [r4,#0xBC]
+	adds	r3, r3, #8
 	ldmia	r3!, {r4-r6}
 	mov	sp, r4
 	msr	spsr_cxsf, r5
@@ -420,6 +422,9 @@ usettbr0:
 save_context_wfi:
 	/*b	save_context_wfi*/	@ enable to debug save code
 	mov	r8, r0 /* Store SDRAM address in r8 */
+	mrc	p15, 0, r5, c1, c0, 1	@ Read Auxiliary Control Register
+	mov	r4, #0x1		@ Number of parameters for restore call
+	stmia	r8!, {r4-r5}
         /* Check what that target sleep state is:stored in r1*/
         /* 1 - Only L1 and logic lost */
         /* 2 - Only L2 lost */
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/5] OMAP3: PM: Disabled I2C4 repeated start operation mode
  2009-11-12 10:07 ` [PATCH 1/5] OMAP3: Fixed ARM aux ctrl register save/restore Tero Kristo
@ 2009-11-12 10:07   ` Tero Kristo
  2009-11-12 10:07     ` [PATCH 3/5] OMAP3: PM: Added support for L2 aux ctrl register save and restore Tero Kristo
  2009-11-12 15:32     ` [PATCH 2/5] OMAP3: PM: Disabled I2C4 repeated start operation mode Kevin Hilman
  2009-11-26 11:18   ` [PATCH 1/5] OMAP3: Fixed ARM aux ctrl register save/restore Gopinath, Thara
  1 sibling, 2 replies; 18+ messages in thread
From: Tero Kristo @ 2009-11-12 10:07 UTC (permalink / raw)
  To: linux-omap

From: Tero Kristo <tero.kristo@nokia.com>

Repeated start forces I2C4 pads low during idle, which increases power
consumption through external pull-ups. On the other hand, this change
increases I2C4 command latencies somewhat due to additional master code
sent in the beginning of each I2C4 command (8 bits data + start + ack bits
in fast/standard mode => increases total command duration from 25us to 50us.)

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
---
 arch/arm/mach-omap2/pm34xx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index b97f7d8..796d726 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -1221,7 +1221,7 @@ static void __init configure_vc(void)
 	prm_write_mod_reg(OMAP3430_CMD1 | OMAP3430_RAV1, OMAP3430_GR_MOD,
 			  OMAP3_PRM_VC_CH_CONF_OFFSET);
 
-	prm_write_mod_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN | OMAP3430_SREN,
+	prm_write_mod_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN,
 			  OMAP3430_GR_MOD,
 			  OMAP3_PRM_VC_I2C_CFG_OFFSET);
 
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/5] OMAP3: PM: Added support for L2 aux ctrl register save and restore
  2009-11-12 10:07   ` [PATCH 2/5] OMAP3: PM: Disabled I2C4 repeated start operation mode Tero Kristo
@ 2009-11-12 10:07     ` Tero Kristo
  2009-11-12 10:07       ` [PATCH 4/5] OMAP3: PM: Write voltage and clock setup times dynamically in idle loop Tero Kristo
  2009-11-12 15:32     ` [PATCH 2/5] OMAP3: PM: Disabled I2C4 repeated start operation mode Kevin Hilman
  1 sibling, 1 reply; 18+ messages in thread
From: Tero Kristo @ 2009-11-12 10:07 UTC (permalink / raw)
  To: linux-omap

From: Tero Kristo <tero.kristo@nokia.com>

This patch adds a save and restore mechanism for ARM L2 auxiliary control
register. The feature is enabled by default for GP devices, but for HS/EMU
devices the user must enable the service and define the PPA service ID to
be used for setting L2 aux ctrl, as this is not currently supported by the
bootloader. If nobody alters the contents of L2 aux ctrl from its reset
value, this feature is not needed.

Kconfig option to enable HS/EMU L2 aux save and restore:
- OMAP3_L2_AUX_SECURE_SAVE_RESTORE
Kconfig option to select HS/EMU PPA service for setting L2 aux ctrl:
- OMAP3_L2_AUX_SECURE_SERVICE_SET_ID

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
---
 arch/arm/mach-omap2/sleep34xx.S |   26 ++++++++++++++++++++++++--
 arch/arm/plat-omap/Kconfig      |   17 +++++++++++++++++
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index 8bd5fc5..69521be 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -284,6 +284,21 @@ restore:
 	mcr	p15, 0, r0, c7, c10, 5	@ data memory barrier
 	.word	0xE1600071		@ call SMI monitor (smi #1)
 
+#ifdef CONFIG_OMAP3_L2_AUX_SECURE_SAVE_RESTORE
+	/* Restore L2 aux control register */
+	@ set service ID for PPA
+	mov	r0, #CONFIG_OMAP3_L2_AUX_SECURE_SERVICE_SET_ID
+	mov	r12, r0		@ copy service ID in r12
+	mov	r1, #0		@ set task ID for ROM code in r1
+	mov	r2, #4		@ set some flags in r2, r6
+	mov	r6, #0xff
+	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)
+#endif
 	b	logic_l1_restore
 l2_inv_api_params:
 	.word   0x1, 0x00
@@ -297,6 +312,11 @@ smi:    .word 0xE1600070		@ Call SMI monitor (smieq)
 	ldr	r0, [r3,#4]
 	mov	r12, #0x3
 	.word 0xE1600070	@ Call SMI monitor (smieq)
+	ldr	r4, scratchpad_base
+	ldr	r3, [r4,#0xBC]
+	ldr	r0, [r3,#12]
+	mov	r12, #0x2
+	.word 0xE1600070	@ Call SMI monitor (smieq)
 logic_l1_restore:
 	mov	r1, #0
 	/* Invalidate all instruction caches to PoU
@@ -305,7 +325,7 @@ logic_l1_restore:
 
 	ldr	r4, scratchpad_base
 	ldr	r3, [r4,#0xBC]
-	adds	r3, r3, #8
+	adds	r3, r3, #16
 	ldmia	r3!, {r4-r6}
 	mov	sp, r4
 	msr	spsr_cxsf, r5
@@ -424,7 +444,9 @@ save_context_wfi:
 	mov	r8, r0 /* Store SDRAM address in r8 */
 	mrc	p15, 0, r5, c1, c0, 1	@ Read Auxiliary Control Register
 	mov	r4, #0x1		@ Number of parameters for restore call
-	stmia	r8!, {r4-r5}
+	stmia	r8!, {r4-r5}		@ Push parameters for restore call
+	mrc	p15, 1, r5, c9, c0, 2	@ Read L2 AUX ctrl register
+	stmia	r8!, {r4-r5}		@ Push parameters for restore call
         /* Check what that target sleep state is:stored in r1*/
         /* 1 - Only L1 and logic lost */
         /* 2 - Only L2 lost */
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 2143db5..3ff1a5f 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -185,6 +185,23 @@ config OMAP3_DEBOBS
 	help
 	  Use ETK pads for debug observability
 
+config OMAP3_L2_AUX_SECURE_SAVE_RESTORE
+	bool "OMAP3 HS/EMU save and restore for L2 AUX control register"
+	depends on ARCH_OMAP3 && PM
+	default n
+	help
+	  Without this option, L2 Auxiliary control register contents are
+	  lost during off-mode entry on HS/EMU devices. This feature
+	  requires support from PPA / boot-loader in HS/EMU devices, which
+	  currently does not exist by default.
+
+config OMAP3_L2_AUX_SECURE_SERVICE_SET_ID
+	int "Service ID for the support routine to set L2 AUX control"
+	depends on OMAP3_L2_AUX_SECURE_SAVE_RESTORE
+	default 43
+	help
+	  PPA routine service ID for setting L2 auxiliary control register.
+
 config OMAP_32K_TIMER_HZ
        int "Kernel internal timer frequency for 32KHz timer"
        range 32 1024
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 4/5] OMAP3: PM: Write voltage and clock setup times dynamically in idle loop
  2009-11-12 10:07     ` [PATCH 3/5] OMAP3: PM: Added support for L2 aux ctrl register save and restore Tero Kristo
@ 2009-11-12 10:07       ` Tero Kristo
  2009-11-12 10:07         ` [PATCH 5/5] OMAP3: PM: Disable OTG autoidle when waking up from off-mode Tero Kristo
  2009-11-12 15:31         ` [PATCH 4/5] OMAP3: PM: Write voltage and clock setup times dynamically in idle loop Kevin Hilman
  0 siblings, 2 replies; 18+ messages in thread
From: Tero Kristo @ 2009-11-12 10:07 UTC (permalink / raw)
  To: linux-omap

From: Tero Kristo <tero.kristo@nokia.com>

It is suggested by TI (SWPA152 February 2009) to write clksetup,
voltsetup_time1, voltsetup_time2, voltsetup2 dynamically in idle loop.

This allows us to optimize the voltage + clock setup times according to the
used power save mode.

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
---
 arch/arm/mach-omap2/pm.h     |   10 ++++-
 arch/arm/mach-omap2/pm34xx.c |   87 +++++++++++++++++++++++------------------
 2 files changed, 57 insertions(+), 40 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index b576424..d10e0c1 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -24,12 +24,18 @@ extern int omap3_can_sleep(void);
 extern int set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
 extern int omap3_idle_init(void);
 
-struct prm_setup_vc {
+struct prm_setup_times_vc {
 	u16 clksetup;
 	u16 voltsetup_time1;
 	u16 voltsetup_time2;
-	u16 voltoffset;
 	u16 voltsetup2;
+	u16 voltsetup1;
+};
+
+struct prm_setup_vc {
+	struct prm_setup_times_vc *setup_times;
+	struct prm_setup_times_vc *setup_times_off;
+	u16 voltoffset;
 /* PRM_VC_CMD_VAL_0 specific bits */
 	u16 vdd0_on;
 	u16 vdd0_onlp;
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 796d726..2f9f4a0 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -82,12 +82,17 @@ static struct powerdomain *mpu_pwrdm, *neon_pwrdm;
 static struct powerdomain *core_pwrdm, *per_pwrdm;
 static struct powerdomain *cam_pwrdm;
 
-static struct prm_setup_vc prm_setup = {
+static struct prm_setup_times_vc prm_setup_times_default = {
 	.clksetup = 0xff,
 	.voltsetup_time1 = 0xfff,
 	.voltsetup_time2 = 0xfff,
-	.voltoffset = 0xff,
 	.voltsetup2 = 0xff,
+};
+
+static struct prm_setup_vc prm_setup_default = {
+	.setup_times = &prm_setup_times_default,
+	.setup_times_off = NULL,
+	.voltoffset = 0xff,
 	.vdd0_on = 0x30,	/* 1.2v */
 	.vdd0_onlp = 0x20,	/* 1.0v */
 	.vdd0_ret = 0x1e,	/* 0.975v */
@@ -98,6 +103,8 @@ static struct prm_setup_vc prm_setup = {
 	.vdd1_off = 0x00,	/* 0.6v */
 };
 
+static struct prm_setup_vc *prm_setup = &prm_setup_default;
+
 static inline void omap3_per_save_context(void)
 {
 	omap_gpio_save_context();
@@ -338,6 +345,16 @@ static void restore_table_entry(void)
 	restore_control_register(control_reg_value);
 }
 
+static void prm_program_setup_times(struct prm_setup_times_vc *times)
+{
+	prm_write_mod_reg(times->voltsetup1, OMAP3430_GR_MOD,
+			OMAP3_PRM_VOLTSETUP1_OFFSET);
+	prm_write_mod_reg(times->voltsetup2, OMAP3430_GR_MOD,
+			OMAP3_PRM_VOLTSETUP2_OFFSET);
+	prm_write_mod_reg(times->clksetup, OMAP3430_GR_MOD,
+			OMAP3_PRM_CLKSETUP_OFFSET);
+}
+
 void omap_sram_idle(void)
 {
 	/* Variable to tell what needs to be saved and restored
@@ -422,6 +439,9 @@ void omap_sram_idle(void)
 					     OMAP3_PRM_VOLTCTRL_OFFSET);
 			omap3_core_save_context();
 			omap3_prcm_save_context();
+			if (prm_setup->setup_times_off != NULL)
+				prm_program_setup_times(prm_setup->
+					setup_times_off);
 		} else if (core_next_state == PWRDM_POWER_RET) {
 			prm_set_mod_reg_bits(OMAP3430_AUTO_RET,
 						OMAP3430_GR_MOD,
@@ -479,11 +499,13 @@ void omap_sram_idle(void)
 		}
 		omap_uart_resume_idle(0);
 		omap_uart_resume_idle(1);
-		if (core_next_state == PWRDM_POWER_OFF)
+		if (core_next_state == PWRDM_POWER_OFF) {
 			prm_clear_mod_reg_bits(OMAP3430_AUTO_OFF,
 					       OMAP3430_GR_MOD,
 					       OMAP3_PRM_VOLTCTRL_OFFSET);
-		else if (core_next_state == PWRDM_POWER_RET)
+			if (prm_setup->setup_times_off != NULL)
+				prm_program_setup_times(prm_setup->setup_times);
+		} else if (core_next_state == PWRDM_POWER_RET)
 			prm_clear_mod_reg_bits(OMAP3430_AUTO_RET,
 						OMAP3430_GR_MOD,
 						OMAP3_PRM_VOLTCTRL_OFFSET);
@@ -1043,24 +1065,21 @@ int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state)
 	return -EINVAL;
 }
 
+static void omap3_init_prm_setup_times(struct prm_setup_times_vc *conf)
+{
+	if (!conf)
+		return;
+
+	conf->voltsetup1 =
+		(conf->voltsetup_time2 << OMAP3430_SETUP_TIME2_SHIFT) |
+		(conf->voltsetup_time1 << OMAP3430_SETUP_TIME1_SHIFT);
+}
+
 void omap3_pm_init_vc(struct prm_setup_vc *setup_vc)
 {
 	if (!setup_vc)
 		return;
-
-	prm_setup.clksetup = setup_vc->clksetup;
-	prm_setup.voltsetup_time1 = setup_vc->voltsetup_time1;
-	prm_setup.voltsetup_time2 = setup_vc->voltsetup_time2;
-	prm_setup.voltoffset = setup_vc->voltoffset;
-	prm_setup.voltsetup2 = setup_vc->voltsetup2;
-	prm_setup.vdd0_on = setup_vc->vdd0_on;
-	prm_setup.vdd0_onlp = setup_vc->vdd0_onlp;
-	prm_setup.vdd0_ret = setup_vc->vdd0_ret;
-	prm_setup.vdd0_off = setup_vc->vdd0_off;
-	prm_setup.vdd1_on = setup_vc->vdd1_on;
-	prm_setup.vdd1_onlp = setup_vc->vdd1_onlp;
-	prm_setup.vdd1_ret = setup_vc->vdd1_ret;
-	prm_setup.vdd1_off = setup_vc->vdd1_off;
+	prm_setup = setup_vc;
 }
 
 static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
@@ -1206,16 +1225,16 @@ static void __init configure_vc(void)
 			  (R_VDD1_SR_CONTROL << OMAP3430_VOLRA0_SHIFT),
 			  OMAP3430_GR_MOD, OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET);
 
-	prm_write_mod_reg((prm_setup.vdd0_on << OMAP3430_VC_CMD_ON_SHIFT) |
-		(prm_setup.vdd0_onlp << OMAP3430_VC_CMD_ONLP_SHIFT) |
-		(prm_setup.vdd0_ret << OMAP3430_VC_CMD_RET_SHIFT) |
-		(prm_setup.vdd0_off << OMAP3430_VC_CMD_OFF_SHIFT),
+	prm_write_mod_reg((prm_setup->vdd0_on << OMAP3430_VC_CMD_ON_SHIFT) |
+		(prm_setup->vdd0_onlp << OMAP3430_VC_CMD_ONLP_SHIFT) |
+		(prm_setup->vdd0_ret << OMAP3430_VC_CMD_RET_SHIFT) |
+		(prm_setup->vdd0_off << OMAP3430_VC_CMD_OFF_SHIFT),
 		OMAP3430_GR_MOD, OMAP3_PRM_VC_CMD_VAL_0_OFFSET);
 
-	prm_write_mod_reg((prm_setup.vdd1_on << OMAP3430_VC_CMD_ON_SHIFT) |
-		(prm_setup.vdd1_onlp << OMAP3430_VC_CMD_ONLP_SHIFT) |
-		(prm_setup.vdd1_ret << OMAP3430_VC_CMD_RET_SHIFT) |
-		(prm_setup.vdd1_off << OMAP3430_VC_CMD_OFF_SHIFT),
+	prm_write_mod_reg((prm_setup->vdd1_on << OMAP3430_VC_CMD_ON_SHIFT) |
+		(prm_setup->vdd1_onlp << OMAP3430_VC_CMD_ONLP_SHIFT) |
+		(prm_setup->vdd1_ret << OMAP3430_VC_CMD_RET_SHIFT) |
+		(prm_setup->vdd1_off << OMAP3430_VC_CMD_OFF_SHIFT),
 		OMAP3430_GR_MOD, OMAP3_PRM_VC_CMD_VAL_1_OFFSET);
 
 	prm_write_mod_reg(OMAP3430_CMD1 | OMAP3430_RAV1, OMAP3430_GR_MOD,
@@ -1226,19 +1245,11 @@ static void __init configure_vc(void)
 			  OMAP3_PRM_VC_I2C_CFG_OFFSET);
 
 	/* Write setup times */
-	prm_write_mod_reg(prm_setup.clksetup, OMAP3430_GR_MOD,
-			OMAP3_PRM_CLKSETUP_OFFSET);
-	prm_write_mod_reg((prm_setup.voltsetup_time2 <<
-			OMAP3430_SETUP_TIME2_SHIFT) |
-			(prm_setup.voltsetup_time1 <<
-			OMAP3430_SETUP_TIME1_SHIFT),
-			OMAP3430_GR_MOD, OMAP3_PRM_VOLTSETUP1_OFFSET);
-
-	prm_write_mod_reg(prm_setup.voltoffset, OMAP3430_GR_MOD,
+	omap3_init_prm_setup_times(prm_setup->setup_times);
+	omap3_init_prm_setup_times(prm_setup->setup_times_off);
+	prm_program_setup_times(prm_setup->setup_times);
+	prm_write_mod_reg(prm_setup->voltoffset, OMAP3430_GR_MOD,
 			OMAP3_PRM_VOLTOFFSET_OFFSET);
-	prm_write_mod_reg(prm_setup.voltsetup2, OMAP3430_GR_MOD,
-			OMAP3_PRM_VOLTSETUP2_OFFSET);
-
 	pm_dbg_regset_init(1);
 	pm_dbg_regset_init(2);
 }
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 5/5] OMAP3: PM: Disable OTG autoidle when waking up from off-mode
  2009-11-12 10:07       ` [PATCH 4/5] OMAP3: PM: Write voltage and clock setup times dynamically in idle loop Tero Kristo
@ 2009-11-12 10:07         ` Tero Kristo
  2009-11-12 15:37           ` Kevin Hilman
  2009-11-12 15:31         ` [PATCH 4/5] OMAP3: PM: Write voltage and clock setup times dynamically in idle loop Kevin Hilman
  1 sibling, 1 reply; 18+ messages in thread
From: Tero Kristo @ 2009-11-12 10:07 UTC (permalink / raw)
  To: linux-omap

From: Tero Kristo <tero.kristo@nokia.com>

OMAP3 sleep can be prevented in some cases where OTG autoidle is enabled.
This patch force disables autoidle during wakeup from off-mode. See omap
errata 1.164.

This fix can't be done in driver level, as off-mode entry resets and enables
the autoidle bit, and driver does not access the register after each off-mode
entry even if it is loaded.

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
---
 arch/arm/mach-omap2/pm34xx.c          |    6 ++++++
 arch/arm/mach-omap2/usb-musb.c        |   14 ++++++++------
 arch/arm/plat-omap/include/plat/usb.h |    3 +++
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 2f9f4a0..ab7b30f 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -37,6 +37,7 @@
 #include <plat/gpmc.h>
 #include <plat/dma.h>
 #include <plat/dmtimer.h>
+#include <plat/usb.h>
 
 #include <plat/resource.h>
 
@@ -496,6 +497,11 @@ void omap_sram_idle(void)
 			omap3_prcm_restore_context();
 			omap3_sram_restore_context();
 			omap2_sms_restore_context();
+			/*
+			 * Errata 1.164 fix : OTG autoidle can prevent
+			 * sleep
+			 */
+			usb_musb_disable_autoidle();
 		}
 		omap_uart_resume_idle(0);
 		omap_uart_resume_idle(1);
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index f5364b8..bb3cee4 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -44,10 +44,11 @@ static struct platform_device dummy_pdev = {
 	},
 };
 
+static void __iomem *otg_base;
+static struct clk *otg_clk;
+
 static void __init usb_musb_pm_init(void)
 {
-	void __iomem *otg_base;
-	struct clk *otg_clk;
 	struct device *dev = &dummy_pdev.dev;
 
 	if (!cpu_is_omap34xx())
@@ -74,12 +75,13 @@ static void __init usb_musb_pm_init(void)
 			cpu_relax();
 	}
 
-	if (otg_clk) {
+	if (otg_clk)
 		clk_disable(otg_clk);
-		clk_put(otg_clk);
-	}
+}
 
-	iounmap(otg_base);
+void usb_musb_disable_autoidle(void)
+{
+	__raw_writel(0, otg_base + OTG_SYSCONFIG);
 }
 
 #ifdef CONFIG_USB_MUSB_SOC
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
index 33a500e..31b13bc 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -46,6 +46,9 @@ extern void usb_musb_init(void);
 
 extern void usb_ehci_init(struct ehci_hcd_omap_platform_data *pdata);
 
+/* This is needed for OMAP3 errata 1.164: enabled autoidle can prevent sleep */
+extern void usb_musb_disable_autoidle(void);
+
 #endif
 
 void omap_usb_init(struct omap_usb_config *pdata);
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/5] OMAP3: PM: Write voltage and clock setup times dynamically in idle loop
  2009-11-12 10:07       ` [PATCH 4/5] OMAP3: PM: Write voltage and clock setup times dynamically in idle loop Tero Kristo
  2009-11-12 10:07         ` [PATCH 5/5] OMAP3: PM: Disable OTG autoidle when waking up from off-mode Tero Kristo
@ 2009-11-12 15:31         ` Kevin Hilman
  1 sibling, 0 replies; 18+ messages in thread
From: Kevin Hilman @ 2009-11-12 15:31 UTC (permalink / raw)
  To: Tero Kristo; +Cc: linux-omap

Tero Kristo <tero.kristo@nokia.com> writes:

> From: Tero Kristo <tero.kristo@nokia.com>
>
> It is suggested by TI (SWPA152 February 2009) to write clksetup,
> voltsetup_time1, voltsetup_time2, voltsetup2 dynamically in idle loop.
>
> This allows us to optimize the voltage + clock setup times according to the
> used power save mode.
>
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>

You also need to fixup the current users of this, currently only
board-3430sdp.c I think.

Kevin

> ---
>  arch/arm/mach-omap2/pm.h     |   10 ++++-
>  arch/arm/mach-omap2/pm34xx.c |   87 +++++++++++++++++++++++------------------
>  2 files changed, 57 insertions(+), 40 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> index b576424..d10e0c1 100644
> --- a/arch/arm/mach-omap2/pm.h
> +++ b/arch/arm/mach-omap2/pm.h
> @@ -24,12 +24,18 @@ extern int omap3_can_sleep(void);
>  extern int set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
>  extern int omap3_idle_init(void);
>  
> -struct prm_setup_vc {
> +struct prm_setup_times_vc {
>  	u16 clksetup;
>  	u16 voltsetup_time1;
>  	u16 voltsetup_time2;
> -	u16 voltoffset;
>  	u16 voltsetup2;
> +	u16 voltsetup1;
> +};
> +
> +struct prm_setup_vc {
> +	struct prm_setup_times_vc *setup_times;
> +	struct prm_setup_times_vc *setup_times_off;
> +	u16 voltoffset;
>  /* PRM_VC_CMD_VAL_0 specific bits */
>  	u16 vdd0_on;
>  	u16 vdd0_onlp;
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 796d726..2f9f4a0 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -82,12 +82,17 @@ static struct powerdomain *mpu_pwrdm, *neon_pwrdm;
>  static struct powerdomain *core_pwrdm, *per_pwrdm;
>  static struct powerdomain *cam_pwrdm;
>  
> -static struct prm_setup_vc prm_setup = {
> +static struct prm_setup_times_vc prm_setup_times_default = {
>  	.clksetup = 0xff,
>  	.voltsetup_time1 = 0xfff,
>  	.voltsetup_time2 = 0xfff,
> -	.voltoffset = 0xff,
>  	.voltsetup2 = 0xff,
> +};
> +
> +static struct prm_setup_vc prm_setup_default = {
> +	.setup_times = &prm_setup_times_default,
> +	.setup_times_off = NULL,
> +	.voltoffset = 0xff,
>  	.vdd0_on = 0x30,	/* 1.2v */
>  	.vdd0_onlp = 0x20,	/* 1.0v */
>  	.vdd0_ret = 0x1e,	/* 0.975v */
> @@ -98,6 +103,8 @@ static struct prm_setup_vc prm_setup = {
>  	.vdd1_off = 0x00,	/* 0.6v */
>  };
>  
> +static struct prm_setup_vc *prm_setup = &prm_setup_default;
> +
>  static inline void omap3_per_save_context(void)
>  {
>  	omap_gpio_save_context();
> @@ -338,6 +345,16 @@ static void restore_table_entry(void)
>  	restore_control_register(control_reg_value);
>  }
>  
> +static void prm_program_setup_times(struct prm_setup_times_vc *times)
> +{
> +	prm_write_mod_reg(times->voltsetup1, OMAP3430_GR_MOD,
> +			OMAP3_PRM_VOLTSETUP1_OFFSET);
> +	prm_write_mod_reg(times->voltsetup2, OMAP3430_GR_MOD,
> +			OMAP3_PRM_VOLTSETUP2_OFFSET);
> +	prm_write_mod_reg(times->clksetup, OMAP3430_GR_MOD,
> +			OMAP3_PRM_CLKSETUP_OFFSET);
> +}
> +
>  void omap_sram_idle(void)
>  {
>  	/* Variable to tell what needs to be saved and restored
> @@ -422,6 +439,9 @@ void omap_sram_idle(void)
>  					     OMAP3_PRM_VOLTCTRL_OFFSET);
>  			omap3_core_save_context();
>  			omap3_prcm_save_context();
> +			if (prm_setup->setup_times_off != NULL)
> +				prm_program_setup_times(prm_setup->
> +					setup_times_off);
>  		} else if (core_next_state == PWRDM_POWER_RET) {
>  			prm_set_mod_reg_bits(OMAP3430_AUTO_RET,
>  						OMAP3430_GR_MOD,
> @@ -479,11 +499,13 @@ void omap_sram_idle(void)
>  		}
>  		omap_uart_resume_idle(0);
>  		omap_uart_resume_idle(1);
> -		if (core_next_state == PWRDM_POWER_OFF)
> +		if (core_next_state == PWRDM_POWER_OFF) {
>  			prm_clear_mod_reg_bits(OMAP3430_AUTO_OFF,
>  					       OMAP3430_GR_MOD,
>  					       OMAP3_PRM_VOLTCTRL_OFFSET);
> -		else if (core_next_state == PWRDM_POWER_RET)
> +			if (prm_setup->setup_times_off != NULL)
> +				prm_program_setup_times(prm_setup->setup_times);
> +		} else if (core_next_state == PWRDM_POWER_RET)
>  			prm_clear_mod_reg_bits(OMAP3430_AUTO_RET,
>  						OMAP3430_GR_MOD,
>  						OMAP3_PRM_VOLTCTRL_OFFSET);
> @@ -1043,24 +1065,21 @@ int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state)
>  	return -EINVAL;
>  }
>  
> +static void omap3_init_prm_setup_times(struct prm_setup_times_vc *conf)
> +{
> +	if (!conf)
> +		return;
> +
> +	conf->voltsetup1 =
> +		(conf->voltsetup_time2 << OMAP3430_SETUP_TIME2_SHIFT) |
> +		(conf->voltsetup_time1 << OMAP3430_SETUP_TIME1_SHIFT);
> +}
> +
>  void omap3_pm_init_vc(struct prm_setup_vc *setup_vc)
>  {
>  	if (!setup_vc)
>  		return;
> -
> -	prm_setup.clksetup = setup_vc->clksetup;
> -	prm_setup.voltsetup_time1 = setup_vc->voltsetup_time1;
> -	prm_setup.voltsetup_time2 = setup_vc->voltsetup_time2;
> -	prm_setup.voltoffset = setup_vc->voltoffset;
> -	prm_setup.voltsetup2 = setup_vc->voltsetup2;
> -	prm_setup.vdd0_on = setup_vc->vdd0_on;
> -	prm_setup.vdd0_onlp = setup_vc->vdd0_onlp;
> -	prm_setup.vdd0_ret = setup_vc->vdd0_ret;
> -	prm_setup.vdd0_off = setup_vc->vdd0_off;
> -	prm_setup.vdd1_on = setup_vc->vdd1_on;
> -	prm_setup.vdd1_onlp = setup_vc->vdd1_onlp;
> -	prm_setup.vdd1_ret = setup_vc->vdd1_ret;
> -	prm_setup.vdd1_off = setup_vc->vdd1_off;
> +	prm_setup = setup_vc;
>  }
>  
>  static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
> @@ -1206,16 +1225,16 @@ static void __init configure_vc(void)
>  			  (R_VDD1_SR_CONTROL << OMAP3430_VOLRA0_SHIFT),
>  			  OMAP3430_GR_MOD, OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET);
>  
> -	prm_write_mod_reg((prm_setup.vdd0_on << OMAP3430_VC_CMD_ON_SHIFT) |
> -		(prm_setup.vdd0_onlp << OMAP3430_VC_CMD_ONLP_SHIFT) |
> -		(prm_setup.vdd0_ret << OMAP3430_VC_CMD_RET_SHIFT) |
> -		(prm_setup.vdd0_off << OMAP3430_VC_CMD_OFF_SHIFT),
> +	prm_write_mod_reg((prm_setup->vdd0_on << OMAP3430_VC_CMD_ON_SHIFT) |
> +		(prm_setup->vdd0_onlp << OMAP3430_VC_CMD_ONLP_SHIFT) |
> +		(prm_setup->vdd0_ret << OMAP3430_VC_CMD_RET_SHIFT) |
> +		(prm_setup->vdd0_off << OMAP3430_VC_CMD_OFF_SHIFT),
>  		OMAP3430_GR_MOD, OMAP3_PRM_VC_CMD_VAL_0_OFFSET);
>  
> -	prm_write_mod_reg((prm_setup.vdd1_on << OMAP3430_VC_CMD_ON_SHIFT) |
> -		(prm_setup.vdd1_onlp << OMAP3430_VC_CMD_ONLP_SHIFT) |
> -		(prm_setup.vdd1_ret << OMAP3430_VC_CMD_RET_SHIFT) |
> -		(prm_setup.vdd1_off << OMAP3430_VC_CMD_OFF_SHIFT),
> +	prm_write_mod_reg((prm_setup->vdd1_on << OMAP3430_VC_CMD_ON_SHIFT) |
> +		(prm_setup->vdd1_onlp << OMAP3430_VC_CMD_ONLP_SHIFT) |
> +		(prm_setup->vdd1_ret << OMAP3430_VC_CMD_RET_SHIFT) |
> +		(prm_setup->vdd1_off << OMAP3430_VC_CMD_OFF_SHIFT),
>  		OMAP3430_GR_MOD, OMAP3_PRM_VC_CMD_VAL_1_OFFSET);
>  
>  	prm_write_mod_reg(OMAP3430_CMD1 | OMAP3430_RAV1, OMAP3430_GR_MOD,
> @@ -1226,19 +1245,11 @@ static void __init configure_vc(void)
>  			  OMAP3_PRM_VC_I2C_CFG_OFFSET);
>  
>  	/* Write setup times */
> -	prm_write_mod_reg(prm_setup.clksetup, OMAP3430_GR_MOD,
> -			OMAP3_PRM_CLKSETUP_OFFSET);
> -	prm_write_mod_reg((prm_setup.voltsetup_time2 <<
> -			OMAP3430_SETUP_TIME2_SHIFT) |
> -			(prm_setup.voltsetup_time1 <<
> -			OMAP3430_SETUP_TIME1_SHIFT),
> -			OMAP3430_GR_MOD, OMAP3_PRM_VOLTSETUP1_OFFSET);
> -
> -	prm_write_mod_reg(prm_setup.voltoffset, OMAP3430_GR_MOD,
> +	omap3_init_prm_setup_times(prm_setup->setup_times);
> +	omap3_init_prm_setup_times(prm_setup->setup_times_off);
> +	prm_program_setup_times(prm_setup->setup_times);
> +	prm_write_mod_reg(prm_setup->voltoffset, OMAP3430_GR_MOD,
>  			OMAP3_PRM_VOLTOFFSET_OFFSET);
> -	prm_write_mod_reg(prm_setup.voltsetup2, OMAP3430_GR_MOD,
> -			OMAP3_PRM_VOLTSETUP2_OFFSET);
> -
>  	pm_dbg_regset_init(1);
>  	pm_dbg_regset_init(2);
>  }
> -- 
> 1.5.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/5] OMAP3: PM: Disabled I2C4 repeated start operation mode
  2009-11-12 10:07   ` [PATCH 2/5] OMAP3: PM: Disabled I2C4 repeated start operation mode Tero Kristo
  2009-11-12 10:07     ` [PATCH 3/5] OMAP3: PM: Added support for L2 aux ctrl register save and restore Tero Kristo
@ 2009-11-12 15:32     ` Kevin Hilman
  1 sibling, 0 replies; 18+ messages in thread
From: Kevin Hilman @ 2009-11-12 15:32 UTC (permalink / raw)
  To: Tero Kristo; +Cc: linux-omap

Tero Kristo <tero.kristo@nokia.com> writes:

> From: Tero Kristo <tero.kristo@nokia.com>
>
> Repeated start forces I2C4 pads low during idle, which increases power
> consumption through external pull-ups. On the other hand, this change
> increases I2C4 command latencies somewhat due to additional master code
> sent in the beginning of each I2C4 command (8 bits data + start + ack bits
> in fast/standard mode => increases total command duration from 25us to 50us.)
>
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>

Thanks, applying this version to PM branch.

Kevin

> ---
>  arch/arm/mach-omap2/pm34xx.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index b97f7d8..796d726 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -1221,7 +1221,7 @@ static void __init configure_vc(void)
>  	prm_write_mod_reg(OMAP3430_CMD1 | OMAP3430_RAV1, OMAP3430_GR_MOD,
>  			  OMAP3_PRM_VC_CH_CONF_OFFSET);
>  
> -	prm_write_mod_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN | OMAP3430_SREN,
> +	prm_write_mod_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN,
>  			  OMAP3430_GR_MOD,
>  			  OMAP3_PRM_VC_I2C_CFG_OFFSET);
>  
> -- 
> 1.5.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 5/5] OMAP3: PM: Disable OTG autoidle when waking up from off-mode
  2009-11-12 10:07         ` [PATCH 5/5] OMAP3: PM: Disable OTG autoidle when waking up from off-mode Tero Kristo
@ 2009-11-12 15:37           ` Kevin Hilman
  2009-11-12 15:40             ` Gadiyar, Anand
  0 siblings, 1 reply; 18+ messages in thread
From: Kevin Hilman @ 2009-11-12 15:37 UTC (permalink / raw)
  To: Tero Kristo; +Cc: linux-omap

Tero Kristo <tero.kristo@nokia.com> writes:

> From: Tero Kristo <tero.kristo@nokia.com>
>
> OMAP3 sleep can be prevented in some cases where OTG autoidle is enabled.
> This patch force disables autoidle during wakeup from off-mode. See omap
> errata 1.164.
>
> This fix can't be done in driver level, as off-mode entry resets and enables
> the autoidle bit, and driver does not access the register after each off-mode
> entry even if it is loaded.
>
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>

Thanks Tero for the updated changelog.

Applying to PM branch reluctantly and with grumbles.  I sure hope
someone in TI is reporting all these ROM code issues to the ROM code
team so they get appropriate fixes.

Kevin

> ---
>  arch/arm/mach-omap2/pm34xx.c          |    6 ++++++
>  arch/arm/mach-omap2/usb-musb.c        |   14 ++++++++------
>  arch/arm/plat-omap/include/plat/usb.h |    3 +++
>  3 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 2f9f4a0..ab7b30f 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -37,6 +37,7 @@
>  #include <plat/gpmc.h>
>  #include <plat/dma.h>
>  #include <plat/dmtimer.h>
> +#include <plat/usb.h>
>  
>  #include <plat/resource.h>
>  
> @@ -496,6 +497,11 @@ void omap_sram_idle(void)
>  			omap3_prcm_restore_context();
>  			omap3_sram_restore_context();
>  			omap2_sms_restore_context();
> +			/*
> +			 * Errata 1.164 fix : OTG autoidle can prevent
> +			 * sleep
> +			 */
> +			usb_musb_disable_autoidle();
>  		}
>  		omap_uart_resume_idle(0);
>  		omap_uart_resume_idle(1);
> diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
> index f5364b8..bb3cee4 100644
> --- a/arch/arm/mach-omap2/usb-musb.c
> +++ b/arch/arm/mach-omap2/usb-musb.c
> @@ -44,10 +44,11 @@ static struct platform_device dummy_pdev = {
>  	},
>  };
>  
> +static void __iomem *otg_base;
> +static struct clk *otg_clk;
> +
>  static void __init usb_musb_pm_init(void)
>  {
> -	void __iomem *otg_base;
> -	struct clk *otg_clk;
>  	struct device *dev = &dummy_pdev.dev;
>  
>  	if (!cpu_is_omap34xx())
> @@ -74,12 +75,13 @@ static void __init usb_musb_pm_init(void)
>  			cpu_relax();
>  	}
>  
> -	if (otg_clk) {
> +	if (otg_clk)
>  		clk_disable(otg_clk);
> -		clk_put(otg_clk);
> -	}
> +}
>  
> -	iounmap(otg_base);
> +void usb_musb_disable_autoidle(void)
> +{
> +	__raw_writel(0, otg_base + OTG_SYSCONFIG);
>  }
>  
>  #ifdef CONFIG_USB_MUSB_SOC
> diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
> index 33a500e..31b13bc 100644
> --- a/arch/arm/plat-omap/include/plat/usb.h
> +++ b/arch/arm/plat-omap/include/plat/usb.h
> @@ -46,6 +46,9 @@ extern void usb_musb_init(void);
>  
>  extern void usb_ehci_init(struct ehci_hcd_omap_platform_data *pdata);
>  
> +/* This is needed for OMAP3 errata 1.164: enabled autoidle can prevent sleep */
> +extern void usb_musb_disable_autoidle(void);
> +
>  #endif
>  
>  void omap_usb_init(struct omap_usb_config *pdata);
> -- 
> 1.5.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH 5/5] OMAP3: PM: Disable OTG autoidle when waking up from off-mode
  2009-11-12 15:37           ` Kevin Hilman
@ 2009-11-12 15:40             ` Gadiyar, Anand
  2009-12-18  8:08               ` Eduardo Valentin
  0 siblings, 1 reply; 18+ messages in thread
From: Gadiyar, Anand @ 2009-11-12 15:40 UTC (permalink / raw)
  To: Kevin Hilman, Tero Kristo; +Cc: linux-omap

> Tero Kristo <tero.kristo@nokia.com> writes:
> 
> > From: Tero Kristo <tero.kristo@nokia.com>
> >
> > OMAP3 sleep can be prevented in some cases where OTG autoidle is enabled.
> > This patch force disables autoidle during wakeup from off-mode. See omap
> > errata 1.164.
> >
> > This fix can't be done in driver level, as off-mode entry resets and enables
> > the autoidle bit, and driver does not access the register after each off-mode
> > entry even if it is loaded.
> >
> > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> 
> Thanks Tero for the updated changelog.
> 
> Applying to PM branch reluctantly and with grumbles.  I sure hope
> someone in TI is reporting all these ROM code issues to the ROM code
> team so they get appropriate fixes.
> 
> Kevin

Yes, rest assured we're following these up with the HW teams.

This particular one should not matter on 3630, we can keep autoidle
enabled all the time, I think.

- Anand

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH 1/5] OMAP3: Fixed ARM aux ctrl register save/restore
  2009-11-12 10:07 ` [PATCH 1/5] OMAP3: Fixed ARM aux ctrl register save/restore Tero Kristo
  2009-11-12 10:07   ` [PATCH 2/5] OMAP3: PM: Disabled I2C4 repeated start operation mode Tero Kristo
@ 2009-11-26 11:18   ` Gopinath, Thara
  1 sibling, 0 replies; 18+ messages in thread
From: Gopinath, Thara @ 2009-11-26 11:18 UTC (permalink / raw)
  To: Tero Kristo, linux-omap; +Cc: Kevin Hilman



>>-----Original Message-----
>>From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Tero
>>Kristo
>>Sent: Thursday, November 12, 2009 3:37 PM
>>To: linux-omap@vger.kernel.org
>>Subject: [PATCH 1/5] OMAP3: Fixed ARM aux ctrl register save/restore
>>
>>From: Tero Kristo <tero.kristo@nokia.com>
>>
>>Current value is stored on SDRAM and it is written back during wakeup.
>>Previously a static value of 0x72 was written there.
>>
>>Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
>>---
>> arch/arm/mach-omap2/sleep34xx.S |   13 +++++++++----
>> 1 files changed, 9 insertions(+), 4 deletions(-)
>>
>>diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
>>index 4707ba8..8bd5fc5 100644
>>--- a/arch/arm/mach-omap2/sleep34xx.S
>>+++ b/arch/arm/mach-omap2/sleep34xx.S
>>@@ -278,7 +278,8 @@ restore:
>> 	mov	r1, #0		@ set task id for ROM code in r1
>> 	mov	r2, #4		@ set some flags in r2, r6
>> 	mov	r6, #0xff
>>-	adr	r3, write_aux_control_params	@ r3 points to parameters
>>+	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)
>>@@ -286,14 +287,14 @@ restore:
>> 	b	logic_l1_restore
>> l2_inv_api_params:
>> 	.word   0x1, 0x00
>>-write_aux_control_params:
>>-	.word   0x1, 0x72
>> l2_inv_gp:
>> 	/* Execute smi to invalidate L2 cache */
>> 	mov r12, #0x1                         @ set up to invalide L2
>> smi:    .word 0xE1600070		@ Call SMI monitor (smieq)
>> 	/* Write to Aux control register to set some bits */
>>-	mov	r0, #0x72
>>+	ldr	r4, scratchpad_base
>>+	ldr	r3, [r4,#0xBC]
>>+	ldr	r0, [r3,#4]
>> 	mov	r12, #0x3
>> 	.word 0xE1600070	@ Call SMI monitor (smieq)
>> logic_l1_restore:
>>@@ -304,6 +305,7 @@ logic_l1_restore:
>>
>> 	ldr	r4, scratchpad_base
>> 	ldr	r3, [r4,#0xBC]
>>+	adds	r3, r3, #8
>> 	ldmia	r3!, {r4-r6}
>> 	mov	sp, r4
>> 	msr	spsr_cxsf, r5
>>@@ -420,6 +422,9 @@ usettbr0:
>> save_context_wfi:
>> 	/*b	save_context_wfi*/	@ enable to debug save code
>> 	mov	r8, r0 /* Store SDRAM address in r8 */
>>+	mrc	p15, 0, r5, c1, c0, 1	@ Read Auxiliary Control Register
>>+	mov	r4, #0x1		@ Number of parameters for restore call
>>+	stmia	r8!, {r4-r5}
>>         /* Check what that target sleep state is:stored in r1*/
>>         /* 1 - Only L1 and logic lost */
>>         /* 2 - Only L2 lost */

Looks Ok to me. Acked.
>>--
>>1.5.4.3
>>
>>--
>>To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>>the body of a message to majordomo@vger.kernel.org
>>More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 5/5] OMAP3: PM: Disable OTG autoidle when waking up from off-mode
  2009-11-12 15:40             ` Gadiyar, Anand
@ 2009-12-18  8:08               ` Eduardo Valentin
  2009-12-18  8:58                 ` [PATCH 1/1] OMAP3: PM: Fix OTG autoidle workaround Eduardo Valentin
  0 siblings, 1 reply; 18+ messages in thread
From: Eduardo Valentin @ 2009-12-18  8:08 UTC (permalink / raw)
  To: ext Gadiyar, Anand
  Cc: Kevin Hilman, Kristo Tero (Nokia-D/Tampere), linux-omap, felipe.balbi

Hello All,

On Thu, Nov 12, 2009 at 04:40:56PM +0100, ext Gadiyar, Anand wrote:
> > Tero Kristo <tero.kristo@nokia.com> writes:
> > 
> > > From: Tero Kristo <tero.kristo@nokia.com>
> > >
> > > OMAP3 sleep can be prevented in some cases where OTG autoidle is enabled.
> > > This patch force disables autoidle during wakeup from off-mode. See omap
> > > errata 1.164.
> > >
> > > This fix can't be done in driver level, as off-mode entry resets and enables
> > > the autoidle bit, and driver does not access the register after each off-mode
> > > entry even if it is loaded.
> > >
> > > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> > 
> > Thanks Tero for the updated changelog.
> > 
> > Applying to PM branch reluctantly and with grumbles.  I sure hope
> > someone in TI is reporting all these ROM code issues to the ROM code
> > team so they get appropriate fixes.
> > 
> > Kevin
> 
> Yes, rest assured we're following these up with the HW teams.
> 
> This particular one should not matter on 3630, we can keep autoidle
> enabled all the time, I think.


I've made a few tests with pm branch + rx51. Currently at:
commit 1f1d16a8164d63459c1a5e155bcb9fc8a15b859e
Merge: 46e0bec 5660cac
Author: Kevin Hilman <khilman@deeprootsystems.com>
Date:   Wed Dec 16 16:09:47 2009 -0800

    manual merge for branch pm-debug

And this patch
"OMAP3: PM: Disable OTG autoidle when waking up from off-mode"

Seams to be not complete at least. It causes:

# modprobe g_zero
[   28.073944] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[   28.080932] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   28.088317] usb usb1: Product: MUSB HDRC host driver
[   28.093414] usb usb1: Manufacturer: Linux 2.6.32-14504-g1f1d16a musb-hcd
[   28.100250] usb usb1: SerialNumber: musb_hdrc
[   28.110565] hub 1-0:1.0: USB hub found
[   28.114715] hub 1-0:1.0: 1 port detected
[   28.119506] Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0ab060
[   28.127288] Internal error: : 1028 [#1]
[   28.131164] last sysfs file: /sys/devices/platform/serial8250.2/sleep_timeout
[   28.138366] Modules linked in: g_zero(+)
[   28.142364] CPU: 0    Not tainted  (2.6.32-14504-g1f1d16a #10)
[   28.148284] PC is at musb_start+0x18/0xdc
[   28.152343] LR is at musb_hub_control+0x33c/0x454
[   28.157104] pc : [<c01b85a8>]    lr : [<c01bc3ec>]    psr: 800000d3
[   28.157135] sp : cf3fbac8  ip : 001c20a8  fp : cf3fbb80
[   28.168731] r10: cf824000  r9 : 80000053  r8 : 00000001
[   28.174011] r7 : 00000008  r6 : cf3fbb80  r5 : fa0ab000  r4 : cf824168
[   28.180603] r3 : 00000000  r2 : cf3923c0  r1 : 00000001  r0 : cf824168
[   28.187194] Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment user
[   28.194580] Control: 10c5387d  Table: 8fea4019  DAC: 00000015
[   28.200408] Process modprobe (pid: 405, stack limit = 0xcf3fa2e8)
[   28.206573] Stack: (0xcf3fbac8 to 0xcf3fc000)
[   28.210968] bac0:                   00002303 cf824168 cf3fbb80 c01bc3ec 00002303 00000000
[   28.219238] bae0: 00000008 ce8544c0 00000001 00000000 cf824000 c01a8280 cf3fbb80 00000000
[   28.227539] bb00: cf3923c0 c026ef98 842b0152 00000000 00000001 00000000 c04f1f34 00000004
[   28.235809] bb20: 00000000 c026ef98 00000001 cf3923c0 00000006 00000007 cf3fbbf4 00000000
[   28.244079] bb40: 00000024 c0071598 cf3923c0 c0071a20 cf3fbbd0 20000053 cf3fbbf4 c00718d0
[   28.252349] bb60: cf3923c0 cf3923f0 c051e63c c00701b8 cf3fbbe0 cf3fbbd0 c0a6b1b0 c00701b8
[   28.260620] bb80: cf3fbbe0 cf3fbbd0 c0a6b1b0 000003e8 ce8544c0 cf3fbbcc 00000000 000003e8
[   28.268890] bba0: ce8544c0 00000001 00000000 cf3fbc2c cf3a0c00 c01a9d30 00000001 cf3923c0
[   28.277160] bbc0: 00000006 00000007 00000001 00000000 00000001 dead4ead ffffffff ffffffff
[   28.285430] bbe0: c0a6b1b0 00000000 c030a3fb 00000000 ce8544c0 cf3fbbf4 cf3fbbf4 c00a7f60
[   28.293731] bc00: 00000000 00000000 cfeb6340 00000008 00000023 00000001 00000003 c01a9fcc
[   28.302001] bc20: c036e25c 80000100 c036e25c c004f0a8 00000000 00000002 cfeaf400 00000005
[   28.310272] bc40: 00000000 00000000 00000010 cfeaf200 ce852f80 c01a1104 00000008 00000001
[   28.318542] bc60: 00000000 00000000 000003e8 cfeaf400 00000005 c01a1668 40408180 cfeaf400
[   28.326812] bc80: cfeaf400 cfeaf220 00000000 c01a21cc cf800140 000000d0 cf3a0c00 cf3a0c00
[   28.335083] bca0: ce854540 60000053 cf800140 40408180 00000004 cfeaf400 cfeaf220 cf3a0c00
[   28.343353] bcc0: 00000010 cfeaf200 ce852f80 c01a4de0 c0312a3e 00000000 cfeb63c0 0000000f
[   28.351623] bce0: 00001388 c0071598 cf3923c0 c026cd88 60000053 cf3a0f3c c04f1da0 c00718d0
[   28.359924] bd00: cf3a0f64 cf3a0f3c 60000053 00000000 cf3a0c00 cfeaf220 cfeaf200 00000000
[   28.368194] bd20: cf3a0c00 c04f1da0 c04f1e84 c04f1d4c cfeaf228 c01ac620 00000000 cfeaf220
[   28.376464] bd40: c04f1da0 00000000 cfeaf000 00000000 c04f2004 c0178838 00000000 c0178968
[   28.384735] bd60: cfeaf220 00000000 cfeaf000 c0177e30 cf8b5690 cf8b8c18 cfeaf220 cfeaf254
[   28.393005] bd80: 00000000 c0178a1c cfeaf200 cfeaf220 00000000 c0177c80 cfeaf200 c01768c4
[   28.401275] bda0: cfeaf220 cf3a0c68 cf3a0c00 cfeaf000 ce852f48 00000001 ce852f40 cfeaf200
[   28.409545] bdc0: cfeaf220 00000000 cf3a0c00 cfeaf000 ce852f48 00000001 ce852f40 c01aaf14
[   28.417816] bde0: 00000001 00000000 00000000 00000000 00001388 c04f1c64 00000001 cf3a0c04
[   28.426116] be00: 00000000 cfeb6640 00000001 cf3a0c68 cfeaf000 cfeaf004 cfeb6980 cf3a0c00
[   28.434387] be20: 00000001 c04f278c 00000000 cf824000 00000000 c04f1c64 cf3a0c70 c01b27b8
[   28.442657] be40: cf3a0c00 c031ec77 c04f2778 cf3a0c00 c04f278c c01ab7a8 00000000 cf3a0c68
[   28.450927] be60: c04f278c c0178838 00000000 c0178968 cf3a0c68 00000000 cf824000 c0177e30
[   28.459197] be80: cf8b5690 cf8b8b98 cf3a0c68 cf3a0c9c cf801cc0 c0178a1c cf3fbeb9 cf3a0c68
[   28.467468] bea0: cf801cc0 c0177c80 cf3fbeb9 c01768c4 000d1158 c036c290 39383117 cf00303a
[   28.475738] bec0: cfeb6980 c01a1090 c031e917 00000001 00000001 cf3a0c00 cf3a0c68 cf824000
[   28.484039] bee0: ffffffff cf3a0c00 000d1158 c01a4064 00000002 00000001 00000012 cf3a0c00
[   28.492309] bf00: c036c290 00000012 00000000 c01a7818 cf824000 ffffffff 00000000 00000000
[   28.500579] bf20: 60000053 cf824168 00000000 cf824e38 c002aae4 cf3fa000 00000000 c01ba920
[   28.508880] bf40: bf00291c bf0024c4 bf002730 00000000 bf0029e4 bf006f9c 00000000 c002a344
[   28.517150] bf60: 00000000 bf0029e4 000d11a8 000d18e0 c002aae4 00000000 bf0029e4 000d11a8
[   28.525421] bf80: 000d18e0 c007cff0 000d18e0 0000803c 000d11a8 0000803c 000d1018 000d11a8
[   28.533691] bfa0: 00000080 c002a940 0000803c 000d1018 000d18e0 0000803c 000d11a8 000d1158
[   28.541961] bfc0: 0000803c 000d1018 000d11a8 00000080 000d13e0 000d1048 00000000 000d1158
[   28.550231] bfe0: bebbeb38 bebbeb28 0001f2a8 4014b620 60000050 000d18e0 00000000 00000000
[   28.558532] [<c01b85a8>] (musb_start+0x18/0xdc) from [<c01bc3ec>] (musb_hub_control+0x33c/0x45)
[   28.567413] [<c01bc3ec>] (musb_hub_control+0x33c/0x454) from [<c01a8280>] (usb_hcd_submit_urb+)
[   28.577178] [<c01a8280>] (usb_hcd_submit_urb+0x7b4/0x9e0) from [<c01a9d30>] (usb_start_wait_ur)
[   28.587036] [<c01a9d30>] (usb_start_wait_urb+0x40/0x120) from [<c01a9fcc>] (usb_control_msg+0x)
[   28.596466] [<c01a9fcc>] (usb_control_msg+0xbc/0xe0) from [<c01a1104>] (set_port_feature+0x40/)
[   28.605621] [<c01a1104>] (set_port_feature+0x40/0x48) from [<c01a1668>] (hub_power_on+0x68/0xb)
[   28.614501] [<c01a1668>] (hub_power_on+0x68/0xb0) from [<c01a21cc>] (hub_activate+0x3c/0x32c)
[   28.623138] [<c01a21cc>] (hub_activate+0x3c/0x32c) from [<c01a4de0>] (hub_probe+0x954/0xa74)
[   28.631683] [<c01a4de0>] (hub_probe+0x954/0xa74) from [<c01ac620>] (usb_probe_interface+0x138/)
[   28.640930] [<c01ac620>] (usb_probe_interface+0x138/0x194) from [<c0178838>] (driver_probe_dev)
[   28.650970] [<c0178838>] (driver_probe_device+0xa0/0x14c) from [<c0177e30>] (bus_for_each_drv+)
[   28.660583] [<c0177e30>] (bus_for_each_drv+0x44/0x80) from [<c0178a1c>] (device_attach+0x50/0x)
[   28.669555] [<c0178a1c>] (device_attach+0x50/0x68) from [<c0177c80>] (bus_probe_device+0x24/0x)
[   28.678527] [<c0177c80>] (bus_probe_device+0x24/0x40) from [<c01768c4>] (device_add+0x3dc/0x53)
[   28.687438] [<c01768c4>] (device_add+0x3dc/0x538) from [<c01aaf14>] (usb_set_configuration+0x5)
[   28.696929] [<c01aaf14>] (usb_set_configuration+0x56c/0x614) from [<c01b27b8>] (generic_probe+)
[   28.706542] [<c01b27b8>] (generic_probe+0x58/0x98) from [<c01ab7a8>] (usb_probe_device+0x48/0x)
[   28.715515] [<c01ab7a8>] (usb_probe_device+0x48/0x54) from [<c0178838>] (driver_probe_device+0)
[   28.725128] [<c0178838>] (driver_probe_device+0xa0/0x14c) from [<c0177e30>] (bus_for_each_drv+)
[   28.734710] [<c0177e30>] (bus_for_each_drv+0x44/0x80) from [<c0178a1c>] (device_attach+0x50/0x)
[   28.743682] [<c0178a1c>] (device_attach+0x50/0x68) from [<c0177c80>] (bus_probe_device+0x24/0x)
[   28.752655] [<c0177c80>] (bus_probe_device+0x24/0x40) from [<c01768c4>] (device_add+0x3dc/0x53)
[   28.761566] [<c01768c4>] (device_add+0x3dc/0x538) from [<c01a4064>] (usb_new_device+0x11c/0x19)
[   28.770446] [<c01a4064>] (usb_new_device+0x11c/0x190) from [<c01a7818>] (usb_add_hcd+0x45c/0x5)
[   28.779449] [<c01a7818>] (usb_add_hcd+0x45c/0x5dc) from [<c01ba920>] (usb_gadget_register_driv)
[   28.789489] [<c01ba920>] (usb_gadget_register_driver+0x1fc/0x298) from [<c002a344>] (do_one_in)
[   28.799774] [<c002a344>] (do_one_initcall+0x5c/0x1b8) from [<c007cff0>] (sys_init_module+0xb0/)
[   28.809020] [<c007cff0>] (sys_init_module+0xb0/0x1e4) from [<c002a940>] (ret_fast_syscall+0x0/)
[   28.818176] Code: e59050d0 e5933000 e1a04000 e3530001 (e5d52060) 
[   28.824432] ---[ end trace 4adc03808bb20271 ]---
Segmentation fault[   28.831024] mtdoops: Ready 49, 114 (no erase)


Are you guys also able to reproduce this? After reverting this patch I can
properly load the module, and pm features keep in one piece as well.

I will investigate to see what is missing.

BR,

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

-- 
Eduardo Valentin

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/1] OMAP3: PM: Fix OTG autoidle workaround
  2009-12-18  8:08               ` Eduardo Valentin
@ 2009-12-18  8:58                 ` Eduardo Valentin
  2009-12-18  9:40                   ` Gadiyar, Anand
  0 siblings, 1 reply; 18+ messages in thread
From: Eduardo Valentin @ 2009-12-18  8:58 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Kristo Tero, Balbi Felipe, Gadiyar Anand, linux-omap, Eduardo Valentin

From: Eduardo Valentin <eduardo.valentin@nokia.com>

This patch fix the OTG autoidle workaround so now
usb gadget modules can be properly loaded.

Besides it also adds a cpu check, because this hardware
but is present only in OMAP34xx chips.

Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
 arch/arm/mach-omap2/pm34xx.c   |    3 ++-
 arch/arm/mach-omap2/usb-musb.c |    9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index c301261..db75975 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -505,7 +505,8 @@ void omap_sram_idle(void)
 			 * Errata 1.164 fix : OTG autoidle can prevent
 			 * sleep
 			 */
-			usb_musb_disable_autoidle();
+			if (cpu_is_omap34xx())
+				usb_musb_disable_autoidle();
 		}
 		omap_uart_resume_idle(0);
 		omap_uart_resume_idle(1);
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index bb3cee4..cbd4e45 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -81,7 +81,14 @@ static void __init usb_musb_pm_init(void)
 
 void usb_musb_disable_autoidle(void)
 {
-	__raw_writel(0, otg_base + OTG_SYSCONFIG);
+	if (otg_clk) {
+		unsigned long reg;
+
+		clk_enable(otg_clk);
+		reg = __raw_readl(otg_base + OTG_SYSCONFIG);
+		__raw_writel(reg & ~1, otg_base + OTG_SYSCONFIG);
+		clk_disable(otg_clk);
+	}
 }
 
 #ifdef CONFIG_USB_MUSB_SOC
-- 
1.6.5.7.g9ecb2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* RE: [PATCH 1/1] OMAP3: PM: Fix OTG autoidle workaround
  2009-12-18  8:58                 ` [PATCH 1/1] OMAP3: PM: Fix OTG autoidle workaround Eduardo Valentin
@ 2009-12-18  9:40                   ` Gadiyar, Anand
  2009-12-18 10:39                     ` [PATCHv2 " Eduardo Valentin
  0 siblings, 1 reply; 18+ messages in thread
From: Gadiyar, Anand @ 2009-12-18  9:40 UTC (permalink / raw)
  To: Eduardo Valentin, Kevin Hilman; +Cc: Kristo Tero, Balbi Felipe, linux-omap

> From: Eduardo Valentin <eduardo.valentin@nokia.com>
> 
> This patch fix the OTG autoidle workaround so now
> usb gadget modules can be properly loaded.
> 
> Besides it also adds a cpu check, because this hardware
> but is present only in OMAP34xx chips.
> 
> Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> ---
>  arch/arm/mach-omap2/pm34xx.c   |    3 ++-
>  arch/arm/mach-omap2/usb-musb.c |    9 ++++++++-
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index c301261..db75975 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -505,7 +505,8 @@ void omap_sram_idle(void)
>                          * Errata 1.164 fix : OTG autoidle can prevent
>                          * sleep
>                          */
> -                       usb_musb_disable_autoidle();
> +                       if (cpu_is_omap34xx())

If you're doing this, could you please make it cpu_is_omap3430() only?

3630 is not affected. But cpu_is_omap34xx() will return true on 3630
as well.

- Anand

> +                               usb_musb_disable_autoidle();
>                 }
>                 omap_uart_resume_idle(0);
>                 omap_uart_resume_idle(1);
> diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
> index bb3cee4..cbd4e45 100644
> --- a/arch/arm/mach-omap2/usb-musb.c
> +++ b/arch/arm/mach-omap2/usb-musb.c
> @@ -81,7 +81,14 @@ static void __init usb_musb_pm_init(void)
> 
>  void usb_musb_disable_autoidle(void)
>  {
> -       __raw_writel(0, otg_base + OTG_SYSCONFIG);
> +       if (otg_clk) {
> +               unsigned long reg;
> +
> +               clk_enable(otg_clk);
> +               reg = __raw_readl(otg_base + OTG_SYSCONFIG);
> +               __raw_writel(reg & ~1, otg_base + OTG_SYSCONFIG);
> +               clk_disable(otg_clk);
> +       }
>  }
> 
>  #ifdef CONFIG_USB_MUSB_SOC
> --
> 1.6.5.7.g9ecb2
> 
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCHv2 1/1] OMAP3: PM: Fix OTG autoidle workaround
  2009-12-18  9:40                   ` Gadiyar, Anand
@ 2009-12-18 10:39                     ` Eduardo Valentin
  2009-12-18 11:12                       ` Felipe Balbi
  2010-01-12 19:49                       ` Kevin Hilman
  0 siblings, 2 replies; 18+ messages in thread
From: Eduardo Valentin @ 2009-12-18 10:39 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: Kristo Tero, Balbi Felipe, Gadiyar Anand, linux-omap, Eduardo Valentin

From: Eduardo Valentin <eduardo.valentin@nokia.com>

This patch fix the OTG autoidle workaround so now
usb gadget modules can be properly loaded.

Besides it also adds a cpu check, because this hardware
but is present only in OMAP34xx chips.

Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
 arch/arm/mach-omap2/pm34xx.c   |    3 ++-
 arch/arm/mach-omap2/usb-musb.c |    9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index c301261..db75975 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -505,7 +505,8 @@ void omap_sram_idle(void)
 			 * Errata 1.164 fix : OTG autoidle can prevent
 			 * sleep
 			 */
-			usb_musb_disable_autoidle();
+			if (cpu_is_omap3430())
+				usb_musb_disable_autoidle();
 		}
 		omap_uart_resume_idle(0);
 		omap_uart_resume_idle(1);
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index bb3cee4..cbd4e45 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -81,7 +81,14 @@ static void __init usb_musb_pm_init(void)
 
 void usb_musb_disable_autoidle(void)
 {
-	__raw_writel(0, otg_base + OTG_SYSCONFIG);
+	if (otg_clk) {
+		unsigned long reg;
+
+		clk_enable(otg_clk);
+		reg = __raw_readl(otg_base + OTG_SYSCONFIG);
+		__raw_writel(reg & ~1, otg_base + OTG_SYSCONFIG);
+		clk_disable(otg_clk);
+	}
 }
 
 #ifdef CONFIG_USB_MUSB_SOC
-- 
1.6.5.7.g9ecb2


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCHv2 1/1] OMAP3: PM: Fix OTG autoidle workaround
  2009-12-18 10:39                     ` [PATCHv2 " Eduardo Valentin
@ 2009-12-18 11:12                       ` Felipe Balbi
  2010-01-05 23:47                         ` Tony Lindgren
  2010-01-12 19:49                       ` Kevin Hilman
  1 sibling, 1 reply; 18+ messages in thread
From: Felipe Balbi @ 2009-12-18 11:12 UTC (permalink / raw)
  To: Valentin Eduardo (Nokia-D/Helsinki)
  Cc: Kevin Hilman, Kristo Tero (Nokia-D/Tampere),
	Balbi Felipe (Nokia-D/Helsinki),
	Gadiyar Anand, linux-omap

Hi,

On Fri, Dec 18, 2009 at 11:39:23AM +0100, Valentin Eduardo (Nokia-D/Helsinki) wrote:
>From: Eduardo Valentin <eduardo.valentin@nokia.com>
>
>This patch fix the OTG autoidle workaround so now
>usb gadget modules can be properly loaded.
>
>Besides it also adds a cpu check, because this hardware
>but is present only in OMAP34xx chips.
>
>Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>

looks like after this patch we can drop the workaround from omap2430.c 
and use whatever platform code configured.

Thanks

-- 
balbi

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCHv2 1/1] OMAP3: PM: Fix OTG autoidle workaround
  2009-12-18 11:12                       ` Felipe Balbi
@ 2010-01-05 23:47                         ` Tony Lindgren
  0 siblings, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2010-01-05 23:47 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Valentin Eduardo (Nokia-D/Helsinki),
	Kevin Hilman, Kristo Tero (Nokia-D/Tampere),
	Gadiyar Anand, linux-omap

* Felipe Balbi <felipe.balbi@nokia.com> [091218 03:12]:
> Hi,
> 
> On Fri, Dec 18, 2009 at 11:39:23AM +0100, Valentin Eduardo (Nokia-D/Helsinki) wrote:
> >From: Eduardo Valentin <eduardo.valentin@nokia.com>
> >
> >This patch fix the OTG autoidle workaround so now
> >usb gadget modules can be properly loaded.
> >
> >Besides it also adds a cpu check, because this hardware
> >but is present only in OMAP34xx chips.
> >
> >Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> 
> looks like after this patch we can drop the workaround from
> omap2430.c and use whatever platform code configured.

FYI, tagging this for Kevin in patchwork as it's PM related.

Regards,

Tony

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCHv2 1/1] OMAP3: PM: Fix OTG autoidle workaround
  2009-12-18 10:39                     ` [PATCHv2 " Eduardo Valentin
  2009-12-18 11:12                       ` Felipe Balbi
@ 2010-01-12 19:49                       ` Kevin Hilman
  1 sibling, 0 replies; 18+ messages in thread
From: Kevin Hilman @ 2010-01-12 19:49 UTC (permalink / raw)
  To: Eduardo Valentin; +Cc: Kristo Tero, Balbi Felipe, Gadiyar Anand, linux-omap

Eduardo Valentin <eduardo.valentin@nokia.com> writes:

> From: Eduardo Valentin <eduardo.valentin@nokia.com>
>
> This patch fix the OTG autoidle workaround so now
> usb gadget modules can be properly loaded.
>
> Besides it also adds a cpu check, because this hardware
> but is present only in OMAP34xx chips.

s/but/bug/

> Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>

Thanks, adding to PM branch with above typo fix.

Kevin

>  arch/arm/mach-omap2/pm34xx.c   |    3 ++-
>  arch/arm/mach-omap2/usb-musb.c |    9 ++++++++-
>  2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index c301261..db75975 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -505,7 +505,8 @@ void omap_sram_idle(void)
>  			 * Errata 1.164 fix : OTG autoidle can prevent
>  			 * sleep
>  			 */
> -			usb_musb_disable_autoidle();
> +			if (cpu_is_omap3430())
> +				usb_musb_disable_autoidle();
>  		}
>  		omap_uart_resume_idle(0);
>  		omap_uart_resume_idle(1);
> diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
> index bb3cee4..cbd4e45 100644
> --- a/arch/arm/mach-omap2/usb-musb.c
> +++ b/arch/arm/mach-omap2/usb-musb.c
> @@ -81,7 +81,14 @@ static void __init usb_musb_pm_init(void)
>  
>  void usb_musb_disable_autoidle(void)
>  {
> -	__raw_writel(0, otg_base + OTG_SYSCONFIG);
> +	if (otg_clk) {
> +		unsigned long reg;
> +
> +		clk_enable(otg_clk);
> +		reg = __raw_readl(otg_base + OTG_SYSCONFIG);
> +		__raw_writel(reg & ~1, otg_base + OTG_SYSCONFIG);
> +		clk_disable(otg_clk);
> +	}
>  }
>  
>  #ifdef CONFIG_USB_MUSB_SOC
> -- 
> 1.6.5.7.g9ecb2

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2010-01-12 19:49 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-12 10:07 [PATCHv3 0/5] Misc fixes [for PM branch] Tero Kristo
2009-11-12 10:07 ` [PATCH 1/5] OMAP3: Fixed ARM aux ctrl register save/restore Tero Kristo
2009-11-12 10:07   ` [PATCH 2/5] OMAP3: PM: Disabled I2C4 repeated start operation mode Tero Kristo
2009-11-12 10:07     ` [PATCH 3/5] OMAP3: PM: Added support for L2 aux ctrl register save and restore Tero Kristo
2009-11-12 10:07       ` [PATCH 4/5] OMAP3: PM: Write voltage and clock setup times dynamically in idle loop Tero Kristo
2009-11-12 10:07         ` [PATCH 5/5] OMAP3: PM: Disable OTG autoidle when waking up from off-mode Tero Kristo
2009-11-12 15:37           ` Kevin Hilman
2009-11-12 15:40             ` Gadiyar, Anand
2009-12-18  8:08               ` Eduardo Valentin
2009-12-18  8:58                 ` [PATCH 1/1] OMAP3: PM: Fix OTG autoidle workaround Eduardo Valentin
2009-12-18  9:40                   ` Gadiyar, Anand
2009-12-18 10:39                     ` [PATCHv2 " Eduardo Valentin
2009-12-18 11:12                       ` Felipe Balbi
2010-01-05 23:47                         ` Tony Lindgren
2010-01-12 19:49                       ` Kevin Hilman
2009-11-12 15:31         ` [PATCH 4/5] OMAP3: PM: Write voltage and clock setup times dynamically in idle loop Kevin Hilman
2009-11-12 15:32     ` [PATCH 2/5] OMAP3: PM: Disabled I2C4 repeated start operation mode Kevin Hilman
2009-11-26 11:18   ` [PATCH 1/5] OMAP3: Fixed ARM aux ctrl register save/restore Gopinath, Thara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.