linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] OMAP3: PM: disable twl4030 sleep sequence before reboot
@ 2010-02-03 19:43 Mike Turquette
  2010-02-03 19:43 ` [PATCH 1/2] MFD: TWL4030: introduce remove_script function Mike Turquette
  0 siblings, 1 reply; 18+ messages in thread
From: Mike Turquette @ 2010-02-03 19:43 UTC (permalink / raw)
  To: linux-omap

When TWL4030 power scripts are enabled, the sleep script must be
disabled before rebooting, if using DPLL3 reset.  DPLL3 reset drives
SYS_OFFMODE low, causing TWL4030 to initiate the sleep script.  This
script collapses VDD1 and VDD2 voltages, usually after the warm reset
has happened but while ROM code is executing.  In this situation MPU
watchdog typically saves the day.  This happens for every single reboot.
It has also been observed that when VDD1 and VDD2 voltages collapse the
WDT does not kick in and the system becomes irrecoverable.

[PATCH 1/2] MFD: TWL4030: introduce remove_script function 
Introduces new function to twl4030-power.c for disabling any script.
This is done by programming the start address for the specified script
to 0x3f, the END_OF_SCRIPT value.

[PATCH 2/2] OMAP3: PM: remove TWL4030 A2S script before reboot 
Calls new function introduced above from omap2_clk_prepare_for_reboot in
clock34xx.c.  So far this issue is only known to affect 3430 and 3630.
No word yet if OMAP4 and Phoenix have a similar integration issue.

 arch/arm/mach-omap2/clock34xx.c |   15 +++++++++++
 drivers/mfd/twl4030-power.c     |   50 +++++++++++++++++++++++++++++++++++++++
 include/linux/i2c/twl.h         |    1 +
 3 files changed, 66 insertions(+), 0 deletions(-)

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

* [PATCH 1/2] MFD: TWL4030: introduce remove_script function
  2010-02-03 19:43 [RFC] OMAP3: PM: disable twl4030 sleep sequence before reboot Mike Turquette
@ 2010-02-03 19:43 ` Mike Turquette
  2010-02-03 19:43   ` [PATCH 2/2] OMAP3: PM: remove TWL4030 A2S script before reboot Mike Turquette
  0 siblings, 1 reply; 18+ messages in thread
From: Mike Turquette @ 2010-02-03 19:43 UTC (permalink / raw)
  To: linux-omap; +Cc: Mike Turquette

New function twl4030_remove_script(u8 flags) takes a script type as
defined in twl.h and prevents any script already loaded in that position
from running.  This is accomplished by programming SEQ_ADD_* to 0x3f,
the END_OF_SCRIPT value, where SEQ_ADD_* is determined by flags.

Signed-off-by: Mike Turquette <mturquette@ti.com>
---
 drivers/mfd/twl4030-power.c |   50 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/i2c/twl.h     |    1 +
 2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index af6f60c..cf1042e 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -477,6 +477,56 @@ out:
 	return err;
 }
 
+int twl4030_remove_script(u8 flags)
+{
+	int err = 0;
+
+	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_1,
+			R_PROTECT_KEY);
+	if (err) {
+		pr_err("twl4030: unable to unlock PROTECT_KEY\n");
+		return err;
+	}
+
+	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_2,
+			R_PROTECT_KEY);
+	if (err) {
+		pr_err("twl4030: unable to unlock PROTECT_KEY\n");
+		return err;
+	}
+
+	if (flags & TWL4030_WRST_SCRIPT) {
+		err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, END_OF_SCRIPT,
+				R_SEQ_ADD_WARM);
+		if (err)
+			return err;
+	}
+	if (flags & TWL4030_WAKEUP12_SCRIPT) {
+		if (err)
+		err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, END_OF_SCRIPT,
+				R_SEQ_ADD_S2A12);
+			return err;
+	}
+	if (flags & TWL4030_WAKEUP3_SCRIPT) {
+		err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, END_OF_SCRIPT,
+				R_SEQ_ADD_S2A3);
+		if (err)
+			return err;
+	}
+	if (flags & TWL4030_SLEEP_SCRIPT) {
+		err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, END_OF_SCRIPT,
+				R_SEQ_ADD_A2S);
+		if (err)
+			return err;
+	}
+
+	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY);
+	if (err)
+		pr_err("TWL4030 Unable to relock registers\n");
+
+	return err;
+}
+
 void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts)
 {
 	int err = 0;
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index f9202ad..fbe8554 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -534,6 +534,7 @@ struct twl4030_power_data {
 };
 
 extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
+extern int twl4030_remove_script(u8 flags);
 
 struct twl4030_codec_audio_data {
 	unsigned int	audio_mclk;
-- 
1.6.3.2


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

* [PATCH 2/2] OMAP3: PM: remove TWL4030 A2S script before reboot
  2010-02-03 19:43 ` [PATCH 1/2] MFD: TWL4030: introduce remove_script function Mike Turquette
@ 2010-02-03 19:43   ` Mike Turquette
  2010-02-09 22:35     ` Tony Lindgren
  2010-07-28  9:41     ` [PATCH] twl4030 reboot workaround Mikko Rapeli
  0 siblings, 2 replies; 18+ messages in thread
From: Mike Turquette @ 2010-02-03 19:43 UTC (permalink / raw)
  To: linux-omap; +Cc: Mike Turquette

Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
in the sleep script being executed on TWL4030. This usually results in
VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
MPU Watch Dog reset or worse, an irrecoverable hang.

Signed-off-by: Mike Turquette <mturquette@ti.com>
---
 arch/arm/mach-omap2/clock34xx.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 0d30e53..0d6d1d6 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -28,6 +28,7 @@
 #include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/cpufreq.h>
+#include <linux/i2c/twl.h>
 
 #include <plat/cpu.h>
 #include <plat/clock.h>
@@ -311,6 +312,8 @@ struct clk_functions omap2_clk_functions = {
  */
 void omap2_clk_prepare_for_reboot(void)
 {
+	int err = 0;
+
 	/* REVISIT: Not ready for 343x */
 #if 0
 	u32 rate;
@@ -321,6 +324,18 @@ void omap2_clk_prepare_for_reboot(void)
 	rate = clk_get_rate(sclk);
 	clk_set_rate(vclk, rate);
 #endif
+
+	/*
+	 * PRCM on OMAP3 will drive SYS_OFFMODE low during DPLL3 warm reset.
+	 * This causes Gaia sleep script to execute, usually killing VDD1 and
+	 * VDD2 while code is running.  WA is to disable the sleep script
+	 * before warm reset.
+	 */
+#ifdef CONFIG_TWL4030_POWER
+	err = twl4030_remove_script(TWL4030_SLEEP_SCRIPT);
+	if (err)
+		pr_err("twl4030: error trying to disable sleep script!\n");
+#endif
 }
 
 void omap3_clk_lock_dpll5(void)
-- 
1.6.3.2


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

* Re: [PATCH 2/2] OMAP3: PM: remove TWL4030 A2S script before reboot
  2010-02-03 19:43   ` [PATCH 2/2] OMAP3: PM: remove TWL4030 A2S script before reboot Mike Turquette
@ 2010-02-09 22:35     ` Tony Lindgren
  2010-07-28  9:41     ` [PATCH] twl4030 reboot workaround Mikko Rapeli
  1 sibling, 0 replies; 18+ messages in thread
From: Tony Lindgren @ 2010-02-09 22:35 UTC (permalink / raw)
  To: Mike Turquette; +Cc: linux-omap, Mike Turquette, Paul Walmsley

Hi,

* Mike Turquette <mturquette@gmail.com> [100203 11:42]:
> Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
> necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
> in the sleep script being executed on TWL4030. This usually results in
> VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
> MPU Watch Dog reset or worse, an irrecoverable hang.

The first patch is OK is for Samuel, but this needs to be updated
against Paul's clock changes. One comment below too.
 
> Signed-off-by: Mike Turquette <mturquette@ti.com>
> ---
>  arch/arm/mach-omap2/clock34xx.c |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
> index 0d30e53..0d6d1d6 100644
> --- a/arch/arm/mach-omap2/clock34xx.c
> +++ b/arch/arm/mach-omap2/clock34xx.c
> @@ -28,6 +28,7 @@
>  #include <linux/bitops.h>
>  #include <linux/err.h>
>  #include <linux/cpufreq.h>
> +#include <linux/i2c/twl.h>
>  
>  #include <plat/cpu.h>
>  #include <plat/clock.h>
> @@ -311,6 +312,8 @@ struct clk_functions omap2_clk_functions = {
>   */
>  void omap2_clk_prepare_for_reboot(void)
>  {
> +	int err = 0;
> +
>  	/* REVISIT: Not ready for 343x */
>  #if 0
>  	u32 rate;
> @@ -321,6 +324,18 @@ void omap2_clk_prepare_for_reboot(void)
>  	rate = clk_get_rate(sclk);
>  	clk_set_rate(vclk, rate);
>  #endif
> +
> +	/*
> +	 * PRCM on OMAP3 will drive SYS_OFFMODE low during DPLL3 warm reset.
> +	 * This causes Gaia sleep script to execute, usually killing VDD1 and
> +	 * VDD2 while code is running.  WA is to disable the sleep script
> +	 * before warm reset.
> +	 */
> +#ifdef CONFIG_TWL4030_POWER
> +	err = twl4030_remove_script(TWL4030_SLEEP_SCRIPT);
> +	if (err)
> +		pr_err("twl4030: error trying to disable sleep script!\n");
> +#endif

This needs to work in cases where we have multiple companion chips
compiled in. You may have twl4030 support compiled in, but no twl4030
hardware on the board. It needs to be based on I2C detected chips during
init somehow.

In the omap for-next branch we already support booting 2420, 34xx, 36xx
and 4430 with the same kernel binary. So please update accordingly.

Regards,

Tony

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

* [PATCH] twl4030 reboot workaround
  2010-02-03 19:43   ` [PATCH 2/2] OMAP3: PM: remove TWL4030 A2S script before reboot Mike Turquette
  2010-02-09 22:35     ` Tony Lindgren
@ 2010-07-28  9:41     ` Mikko Rapeli
  2010-07-28 10:07       ` Gopinath, Thara
                         ` (2 more replies)
  1 sibling, 3 replies; 18+ messages in thread
From: Mikko Rapeli @ 2010-07-28  9:41 UTC (permalink / raw)
  To: linux-omap; +Cc: mturquette, sameo

From: Mikko Rapeli <ext-mikko.rapeli@nokia.com>

Original patch: http://marc.info/?l=linux-omap&m=126522625032441&w=2

"Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
in the sleep script being executed on TWL4030. This usually results in
VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
MPU Watch Dog reset or worse, an irrecoverable hang."

Original patch resulted in a crash due to sleeping i2c calls late in the
reboot sequence. Here's how to trigger the crash:

	# cat /dev/urandom > /foo &
	sync();
        reboot(LINUX_REBOOT_CMD_RESTART2);

Kernel trace from 2.6.32:

Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 805 [#2] PREEMPT
...
[<c00b3210>] (exit_mmap+0x1d4/0x1f8) from [<c006069c>] (mmput+0x34/0x110)
[<c006069c>] (mmput+0x34/0x110) from [<c0064a90>] (exit_mm+0x140/0x180)
[<c0064a90>] (exit_mm+0x140/0x180) from [<c00668ec>] (do_exit+0x5d8/0x6ac)
[<c00668ec>] (do_exit+0x5d8/0x6ac) from [<c0035858>] (die+0x2d4/0x2e0)
[<c0035858>] (die+0x2d4/0x2e0) from [<c0035904>] (baddataabort+0x0/0x50)
[<c0035904>] (baddataabort+0x0/0x50) from [<c0274ff4>] (i2c_transfer+0xec/0x104)
[<c0274ff4>] (i2c_transfer+0xec/0x104) from [<00000001>] (0x1)

Fix is to move reboot preparations into a reboot notifier.

Signed-off-by: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
---
 drivers/mfd/twl4030-power.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 7efa878..5d46768 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -28,6 +28,7 @@
 #include <linux/pm.h>
 #include <linux/i2c/twl.h>
 #include <linux/platform_device.h>
+#include <linux/reboot.h>
 
 #include <asm/mach-types.h>
 
@@ -127,6 +128,29 @@ static u8 res_config_addrs[] = {
 	[RES_Main_Ref]	= 0x94,
 };
 
+/*
+ * PRCM on OMAP3 will drive SYS_OFFMODE low during DPLL3 warm reset.
+ * This causes Gaia sleep script to execute, usually killing VDD1 and
+ * VDD2 while code is running.  WA is to disable the sleep script
+ * before warm reset.
+ */
+static int twl4030_prepare_for_reboot(struct notifier_block *this,
+		unsigned long cmd, void *p)
+{
+	int err;
+	err = twl4030_remove_script(TWL4030_SLEEP_SCRIPT);
+	if (err)
+		pr_err("TWL4030: error trying to disable sleep script!\n");
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block twl4030_reboot_notifier = {
+		.notifier_call = twl4030_prepare_for_reboot,
+		.next = NULL,
+		.priority = 0
+};
+
 static int __init twl4030_write_script_byte(u8 address, u8 byte)
 {
 	int err;
@@ -549,6 +573,11 @@ void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts)
 	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY);
 	if (err)
 		pr_err("TWL4030 Unable to relock registers\n");
+
+	err = register_reboot_notifier(&twl4030_reboot_notifier);
+	if (err)
+		pr_err("TWL4030 Failed to register reboot notifier\n");
+
 	return;
 
 unlock:
-- 
1.5.6.5


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

* RE: [PATCH] twl4030 reboot workaround
  2010-07-28  9:41     ` [PATCH] twl4030 reboot workaround Mikko Rapeli
@ 2010-07-28 10:07       ` Gopinath, Thara
  2010-07-29  6:07         ` Mikko Rapeli
  2010-07-28 10:18       ` Peter 'p2' De Schrijver
  2010-07-28 15:47       ` Mike Turquette
  2 siblings, 1 reply; 18+ messages in thread
From: Gopinath, Thara @ 2010-07-28 10:07 UTC (permalink / raw)
  To: Mikko Rapeli, linux-omap; +Cc: Turquette, Mike, sameo



>>-----Original Message-----
>>From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Mikko
>>Rapeli
>>Sent: Wednesday, July 28, 2010 3:12 PM
>>To: linux-omap@vger.kernel.org
>>Cc: Turquette, Mike; sameo@linux.intel.com
>>Subject: [PATCH] twl4030 reboot workaround
>>
>>From: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
>>
>>Original patch: http://marc.info/?l=linux-omap&m=126522625032441&w=2
>>
>>"Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
>>necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
>>in the sleep script being executed on TWL4030. This usually results in
>>VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
>>MPU Watch Dog reset or worse, an irrecoverable hang."
>>
>>Original patch resulted in a crash due to sleeping i2c calls late in the
>>reboot sequence. Here's how to trigger the crash:
>>
>>	# cat /dev/urandom > /foo &
>>	sync();
>>        reboot(LINUX_REBOOT_CMD_RESTART2);
>>
>>Kernel trace from 2.6.32:
>>
>>Unable to handle kernel NULL pointer dereference at virtual address 00000000
>>pgd = c0004000
>>[00000000] *pgd=00000000
>>Internal error: Oops: 805 [#2] PREEMPT
>>...
>>[<c00b3210>] (exit_mmap+0x1d4/0x1f8) from [<c006069c>] (mmput+0x34/0x110)
>>[<c006069c>] (mmput+0x34/0x110) from [<c0064a90>] (exit_mm+0x140/0x180)
>>[<c0064a90>] (exit_mm+0x140/0x180) from [<c00668ec>] (do_exit+0x5d8/0x6ac)
>>[<c00668ec>] (do_exit+0x5d8/0x6ac) from [<c0035858>] (die+0x2d4/0x2e0)
>>[<c0035858>] (die+0x2d4/0x2e0) from [<c0035904>] (baddataabort+0x0/0x50)
>>[<c0035904>] (baddataabort+0x0/0x50) from [<c0274ff4>] (i2c_transfer+0xec/0x104)
>>[<c0274ff4>] (i2c_transfer+0xec/0x104) from [<00000001>] (0x1)
>>
>>Fix is to move reboot preparations into a reboot notifier.
>>
>>Signed-off-by: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
>>---
>> drivers/mfd/twl4030-power.c |   29 +++++++++++++++++++++++++++++
>> 1 files changed, 29 insertions(+), 0 deletions(-)
>>
>>diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
>>index 7efa878..5d46768 100644
>>--- a/drivers/mfd/twl4030-power.c
>>+++ b/drivers/mfd/twl4030-power.c
>>@@ -28,6 +28,7 @@
>> #include <linux/pm.h>
>> #include <linux/i2c/twl.h>
>> #include <linux/platform_device.h>
>>+#include <linux/reboot.h>
>>
>> #include <asm/mach-types.h>
>>
>>@@ -127,6 +128,29 @@ static u8 res_config_addrs[] = {
>> 	[RES_Main_Ref]	= 0x94,
>> };
>>
>>+/*
>>+ * PRCM on OMAP3 will drive SYS_OFFMODE low during DPLL3 warm reset.
>>+ * This causes Gaia sleep script to execute, usually killing VDD1 and
>>+ * VDD2 while code is running.  WA is to disable the sleep script
>>+ * before warm reset.
>>+ */
>>+static int twl4030_prepare_for_reboot(struct notifier_block *this,
>>+		unsigned long cmd, void *p)
>>+{
>>+	int err;

Minor nit. Insert a blank line.

Regards
Thara

>>+	err = twl4030_remove_script(TWL4030_SLEEP_SCRIPT);
>>+	if (err)
>>+		pr_err("TWL4030: error trying to disable sleep script!\n");
>>+
>>+	return NOTIFY_DONE;
>>+}
>>+
>>+static struct notifier_block twl4030_reboot_notifier = {
>>+		.notifier_call = twl4030_prepare_for_reboot,
>>+		.next = NULL,
>>+		.priority = 0
>>+};
>>+
>> static int __init twl4030_write_script_byte(u8 address, u8 byte)
>> {
>> 	int err;
>>@@ -549,6 +573,11 @@ void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts)
>> 	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY);
>> 	if (err)
>> 		pr_err("TWL4030 Unable to relock registers\n");
>>+
>>+	err = register_reboot_notifier(&twl4030_reboot_notifier);
>>+	if (err)
>>+		pr_err("TWL4030 Failed to register reboot notifier\n");
>>+
>> 	return;
>>
>> unlock:
>>--
>>1.5.6.5
>>
>>--
>>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] twl4030 reboot workaround
  2010-07-28  9:41     ` [PATCH] twl4030 reboot workaround Mikko Rapeli
  2010-07-28 10:07       ` Gopinath, Thara
@ 2010-07-28 10:18       ` Peter 'p2' De Schrijver
  2010-07-29  6:06         ` Mikko Rapeli
  2010-07-28 15:47       ` Mike Turquette
  2 siblings, 1 reply; 18+ messages in thread
From: Peter 'p2' De Schrijver @ 2010-07-28 10:18 UTC (permalink / raw)
  To: Rapeli Mikko (EXT-Ixonos/Oulu); +Cc: linux-omap, mturquette, sameo

On Wed, Jul 28, 2010 at 11:41:32AM +0200, Rapeli Mikko (EXT-Ixonos/Oulu) wrote:
> From: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
> 
> Original patch: http://marc.info/?l=linux-omap&m=126522625032441&w=2
> 
> "Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
> necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
> in the sleep script being executed on TWL4030. This usually results in
> VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
> MPU Watch Dog reset or worse, an irrecoverable hang."
> 
> Original patch resulted in a crash due to sleeping i2c calls late in the
> reboot sequence. Here's how to trigger the crash:
> 
> 	# cat /dev/urandom > /foo &
> 	sync();
>         reboot(LINUX_REBOOT_CMD_RESTART2);
> 
> Kernel trace from 2.6.32:
> 
> Unable to handle kernel NULL pointer dereference at virtual address 00000000
> pgd = c0004000
> [00000000] *pgd=00000000
> Internal error: Oops: 805 [#2] PREEMPT
> ...
> [<c00b3210>] (exit_mmap+0x1d4/0x1f8) from [<c006069c>] (mmput+0x34/0x110)
> [<c006069c>] (mmput+0x34/0x110) from [<c0064a90>] (exit_mm+0x140/0x180)
> [<c0064a90>] (exit_mm+0x140/0x180) from [<c00668ec>] (do_exit+0x5d8/0x6ac)
> [<c00668ec>] (do_exit+0x5d8/0x6ac) from [<c0035858>] (die+0x2d4/0x2e0)
> [<c0035858>] (die+0x2d4/0x2e0) from [<c0035904>] (baddataabort+0x0/0x50)
> [<c0035904>] (baddataabort+0x0/0x50) from [<c0274ff4>] (i2c_transfer+0xec/0x104)
> [<c0274ff4>] (i2c_transfer+0xec/0x104) from [<00000001>] (0x1)
> 
> Fix is to move reboot preparations into a reboot notifier.
> 

And what if we get an OMAP3 watchdog reset ? In this case there is no
software to remove the script...

Cheers,

Peter.

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

* Re: [PATCH] twl4030 reboot workaround
  2010-07-28  9:41     ` [PATCH] twl4030 reboot workaround Mikko Rapeli
  2010-07-28 10:07       ` Gopinath, Thara
  2010-07-28 10:18       ` Peter 'p2' De Schrijver
@ 2010-07-28 15:47       ` Mike Turquette
  2010-07-29  6:16         ` Mikko Rapeli
  2 siblings, 1 reply; 18+ messages in thread
From: Mike Turquette @ 2010-07-28 15:47 UTC (permalink / raw)
  To: Mikko Rapeli; +Cc: linux-omap, sameo

Mikko Rapeli wrote:
> From: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
> 
> Original patch: http://marc.info/?l=linux-omap&m=126522625032441&w=2

I forgot about this one...

> "Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
> necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
> in the sleep script being executed on TWL4030. This usually results in
> VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
> MPU Watch Dog reset or worse, an irrecoverable hang."
> 
> Original patch resulted in a crash due to sleeping i2c calls late in the
> reboot sequence. Here's how to trigger the crash:
> 
> 	# cat /dev/urandom > /foo &
> 	sync();
>         reboot(LINUX_REBOOT_CMD_RESTART2);
> 
> Kernel trace from 2.6.32:
> 
> Unable to handle kernel NULL pointer dereference at virtual address 00000000
> pgd = c0004000
> [00000000] *pgd=00000000
> Internal error: Oops: 805 [#2] PREEMPT
> ...
> [<c00b3210>] (exit_mmap+0x1d4/0x1f8) from [<c006069c>] (mmput+0x34/0x110)
> [<c006069c>] (mmput+0x34/0x110) from [<c0064a90>] (exit_mm+0x140/0x180)
> [<c0064a90>] (exit_mm+0x140/0x180) from [<c00668ec>] (do_exit+0x5d8/0x6ac)
> [<c00668ec>] (do_exit+0x5d8/0x6ac) from [<c0035858>] (die+0x2d4/0x2e0)
> [<c0035858>] (die+0x2d4/0x2e0) from [<c0035904>] (baddataabort+0x0/0x50)
> [<c0035904>] (baddataabort+0x0/0x50) from [<c0274ff4>] (i2c_transfer+0xec/0x104)
> [<c0274ff4>] (i2c_transfer+0xec/0x104) from [<00000001>] (0x1)
> 
> Fix is to move reboot preparations into a reboot notifier.
> 
> Signed-off-by: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
> ---
>  drivers/mfd/twl4030-power.c |   29 +++++++++++++++++++++++++++++
>  1 files changed, 29 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
> index 7efa878..5d46768 100644
> --- a/drivers/mfd/twl4030-power.c
> +++ b/drivers/mfd/twl4030-power.c
> @@ -28,6 +28,7 @@
>  #include <linux/pm.h>
>  #include <linux/i2c/twl.h>
>  #include <linux/platform_device.h>
> +#include <linux/reboot.h>
>  
>  #include <asm/mach-types.h>
>  
> @@ -127,6 +128,29 @@ static u8 res_config_addrs[] = {
>  	[RES_Main_Ref]	= 0x94,
>  };
>  
> +/*
> + * PRCM on OMAP3 will drive SYS_OFFMODE low during DPLL3 warm reset.
> + * This causes Gaia sleep script to execute, usually killing VDD1 and
> + * VDD2 while code is running.  WA is to disable the sleep script
> + * before warm reset.
> + */
> +static int twl4030_prepare_for_reboot(struct notifier_block *this,
> +		unsigned long cmd, void *p)
> +{
> +	int err;
> +	err = twl4030_remove_script(TWL4030_SLEEP_SCRIPT);
> +	if (err)
> +		pr_err("TWL4030: error trying to disable sleep script!\n");
> +
> +	return NOTIFY_DONE;
> +}
> +
> +static struct notifier_block twl4030_reboot_notifier = {
> +		.notifier_call = twl4030_prepare_for_reboot,
> +		.next = NULL,
> +		.priority = 0
> +};
> +
>  static int __init twl4030_write_script_byte(u8 address, u8 byte)
>  {
>  	int err;
> @@ -549,6 +573,11 @@ void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts)
>  	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY);
>  	if (err)
>  		pr_err("TWL4030 Unable to relock registers\n");
> +
> +	err = register_reboot_notifier(&twl4030_reboot_notifier);

This method is much better than the method I proposed before.  Taking 
into account the comments from others, ACK.

Mike

> +	if (err)
> +		pr_err("TWL4030 Failed to register reboot notifier\n");
> +
>  	return;
>  
>  unlock:


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

* Re: [PATCH] twl4030 reboot workaround
  2010-07-28 10:18       ` Peter 'p2' De Schrijver
@ 2010-07-29  6:06         ` Mikko Rapeli
  0 siblings, 0 replies; 18+ messages in thread
From: Mikko Rapeli @ 2010-07-29  6:06 UTC (permalink / raw)
  To: De-Schrijver Peter (Nokia-MS/Helsinki); +Cc: linux-omap, mturquette, sameo

On Wed, Jul 28, 2010 at 12:18:11PM +0200, De-Schrijver Peter
(Nokia-MS/Helsinki) wrote:
> On Wed, Jul 28, 2010 at 11:41:32AM +0200, Rapeli Mikko (EXT-Ixonos/Oulu)
> wrote:
> > From: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
> > 
> > Original patch: http://marc.info/?l=linux-omap&m=126522625032441&w=2
> > 
> > "Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
> > necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
> > in the sleep script being executed on TWL4030. This usually results in
> > VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
> > MPU Watch Dog reset or worse, an irrecoverable hang."
> > 
> > Original patch resulted in a crash due to sleeping i2c calls late in the
> > reboot sequence. Here's how to trigger the crash:
> > 
> > 	# cat /dev/urandom > /foo &
> > 	sync();
> >         reboot(LINUX_REBOOT_CMD_RESTART2);
> > 
> > Kernel trace from 2.6.32:
> > 
> > Unable to handle kernel NULL pointer dereference at virtual address 00000000
> > pgd = c0004000
> > [00000000] *pgd=00000000
> > Internal error: Oops: 805 [#2] PREEMPT
> > ...
> > [<c00b3210>] (exit_mmap+0x1d4/0x1f8) from [<c006069c>] (mmput+0x34/0x110)
> > [<c006069c>] (mmput+0x34/0x110) from [<c0064a90>] (exit_mm+0x140/0x180)
> > [<c0064a90>] (exit_mm+0x140/0x180) from [<c00668ec>] (do_exit+0x5d8/0x6ac)
> > [<c00668ec>] (do_exit+0x5d8/0x6ac) from [<c0035858>] (die+0x2d4/0x2e0)
> > [<c0035858>] (die+0x2d4/0x2e0) from [<c0035904>] (baddataabort+0x0/0x50)
> > [<c0035904>] (baddataabort+0x0/0x50) from [<c0274ff4>] (i2c_transfer+0xec/0x104)
> > [<c0274ff4>] (i2c_transfer+0xec/0x104) from [<00000001>] (0x1)
> > 
> > Fix is to move reboot preparations into a reboot notifier.
> > 
> 
> And what if we get an OMAP3 watchdog reset ? In this case there is no
> software to remove the script...

Well, I don't know. We have seen boot and reboot failures and this
remove script patch set has helped to reduce those failures.

-Mikko

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

* Re: [PATCH] twl4030 reboot workaround
  2010-07-28 10:07       ` Gopinath, Thara
@ 2010-07-29  6:07         ` Mikko Rapeli
  0 siblings, 0 replies; 18+ messages in thread
From: Mikko Rapeli @ 2010-07-29  6:07 UTC (permalink / raw)
  To: ext Gopinath, Thara; +Cc: linux-omap, Turquette, Mike, sameo

On Wed, Jul 28, 2010 at 12:07:32PM +0200, ext Gopinath, Thara wrote:
> Minor nit. Insert a blank line.

Thanks, will send a new version.

-Mikko

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

* Re: [PATCH] twl4030 reboot workaround
  2010-07-28 15:47       ` Mike Turquette
@ 2010-07-29  6:16         ` Mikko Rapeli
  2010-07-29  6:41           ` [PATCH v2] " Mikko Rapeli
  0 siblings, 1 reply; 18+ messages in thread
From: Mikko Rapeli @ 2010-07-29  6:16 UTC (permalink / raw)
  To: ext Mike Turquette; +Cc: linux-omap, sameo

On Wed, Jul 28, 2010 at 05:47:36PM +0200, ext Mike Turquette wrote:
> This method is much better than the method I proposed before.  Taking 
> into account the comments from others, ACK.

Thanks, I'll send an updated version with that one new line. Do you have
an idea how the watchdog reset case should be handled? Can the boot loader do
something about this or must the script removal be done before reboot?

-Mikko

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

* [PATCH v2] twl4030 reboot workaround
  2010-07-29  6:16         ` Mikko Rapeli
@ 2010-07-29  6:41           ` Mikko Rapeli
  2010-07-29 19:10             ` Mike Rapoport
  0 siblings, 1 reply; 18+ messages in thread
From: Mikko Rapeli @ 2010-07-29  6:41 UTC (permalink / raw)
  To: linux-omap; +Cc: mturquette, sameo

From: Mikko Rapeli <ext-mikko.rapeli@nokia.com>

Original patch: http://marc.info/?l=linux-omap&m=126522625032441&w=2

"Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
in the sleep script being executed on TWL4030. This usually results in
VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
MPU Watch Dog reset or worse, an irrecoverable hang."

Original patch resulted in a crash due to sleeping i2c calls late in the
reboot sequence. Here's how to trigger the crash:

	# cat /dev/urandom > /foo &
	sync();
	reboot(LINUX_REBOOT_CMD_RESTART2);

Kernel trace from 2.6.32:

Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 805 [#2] PREEMPT
...
[<c00b3210>] (exit_mmap+0x1d4/0x1f8) from [<c006069c>] (mmput+0x34/0x110)
[<c006069c>] (mmput+0x34/0x110) from [<c0064a90>] (exit_mm+0x140/0x180)
[<c0064a90>] (exit_mm+0x140/0x180) from [<c00668ec>] (do_exit+0x5d8/0x6ac)
[<c00668ec>] (do_exit+0x5d8/0x6ac) from [<c0035858>] (die+0x2d4/0x2e0)
[<c0035858>] (die+0x2d4/0x2e0) from [<c0035904>] (baddataabort+0x0/0x50)
[<c0035904>] (baddataabort+0x0/0x50) from [<c0274ff4>] (i2c_transfer+0xec/0x104)
[<c0274ff4>] (i2c_transfer+0xec/0x104) from [<00000001>] (0x1)

Fix is to move reboot preparations into a reboot notifier.

Signed-off-by: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
Acked-by: Mike Turquette <mturquette@ti.com>
---

v2: added a new line after variable declarations

v1: http://marc.info/?l=linux-omap&m=128031011323970&w=2

 drivers/mfd/twl4030-power.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 7efa878..5c6da1e 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -28,6 +28,7 @@
 #include <linux/pm.h>
 #include <linux/i2c/twl.h>
 #include <linux/platform_device.h>
+#include <linux/reboot.h>
 
 #include <asm/mach-types.h>
 
@@ -127,6 +128,30 @@ static u8 res_config_addrs[] = {
 	[RES_Main_Ref]	= 0x94,
 };
 
+/*
+ * PRCM on OMAP3 will drive SYS_OFFMODE low during DPLL3 warm reset.
+ * This causes Gaia sleep script to execute, usually killing VDD1 and
+ * VDD2 while code is running.  WA is to disable the sleep script
+ * before warm reset.
+ */
+static int twl4030_prepare_for_reboot(struct notifier_block *this,
+		unsigned long cmd, void *p)
+{
+	int err;
+
+	err = twl4030_remove_script(TWL4030_SLEEP_SCRIPT);
+	if (err)
+		pr_err("TWL4030: error trying to disable sleep script!\n");
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block twl4030_reboot_notifier = {
+		.notifier_call = twl4030_prepare_for_reboot,
+		.next = NULL,
+		.priority = 0
+};
+
 static int __init twl4030_write_script_byte(u8 address, u8 byte)
 {
 	int err;
@@ -549,6 +574,11 @@ void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts)
 	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY);
 	if (err)
 		pr_err("TWL4030 Unable to relock registers\n");
+
+	err = register_reboot_notifier(&twl4030_reboot_notifier);
+	if (err)
+		pr_err("TWL4030 Failed to register reboot notifier\n");
+
 	return;
 
 unlock:
-- 
1.5.6.5


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

* Re: [PATCH v2] twl4030 reboot workaround
  2010-07-29  6:41           ` [PATCH v2] " Mikko Rapeli
@ 2010-07-29 19:10             ` Mike Rapoport
  2010-07-30  5:48               ` Mikko Rapeli
  2010-07-30  6:35               ` Gopinath, Thara
  0 siblings, 2 replies; 18+ messages in thread
From: Mike Rapoport @ 2010-07-29 19:10 UTC (permalink / raw)
  To: Mikko Rapeli; +Cc: linux-omap, mturquette, sameo

Hi

On Thu, Jul 29, 2010 at 9:41 AM, Mikko Rapeli
<ext-mikko.rapeli@nokia.com> wrote:
> From: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
>
> Original patch: http://marc.info/?l=linux-omap&m=126522625032441&w=2
>
> "Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
> necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
> in the sleep script being executed on TWL4030. This usually results in
> VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
> MPU Watch Dog reset or worse, an irrecoverable hang."

I had a similar issue when my system hanged on hard reset when there
was a TWL sleep script installed.
The workaround I've found was to install the sleep script immediately
before entering the suspend state and remove the script on the resume
path.
If you think that such approach is appropriate I can send a patch.

> Original patch resulted in a crash due to sleeping i2c calls late in the
> reboot sequence. Here's how to trigger the crash:
>
>        # cat /dev/urandom > /foo &
>        sync();
>        reboot(LINUX_REBOOT_CMD_RESTART2);
>
> Kernel trace from 2.6.32:
>
> Unable to handle kernel NULL pointer dereference at virtual address 00000000
> pgd = c0004000
> [00000000] *pgd=00000000
> Internal error: Oops: 805 [#2] PREEMPT
> ...
> [<c00b3210>] (exit_mmap+0x1d4/0x1f8) from [<c006069c>] (mmput+0x34/0x110)
> [<c006069c>] (mmput+0x34/0x110) from [<c0064a90>] (exit_mm+0x140/0x180)
> [<c0064a90>] (exit_mm+0x140/0x180) from [<c00668ec>] (do_exit+0x5d8/0x6ac)
> [<c00668ec>] (do_exit+0x5d8/0x6ac) from [<c0035858>] (die+0x2d4/0x2e0)
> [<c0035858>] (die+0x2d4/0x2e0) from [<c0035904>] (baddataabort+0x0/0x50)
> [<c0035904>] (baddataabort+0x0/0x50) from [<c0274ff4>] (i2c_transfer+0xec/0x104)
> [<c0274ff4>] (i2c_transfer+0xec/0x104) from [<00000001>] (0x1)
>
> Fix is to move reboot preparations into a reboot notifier.
>
> Signed-off-by: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
> Acked-by: Mike Turquette <mturquette@ti.com>
> ---
>
> v2: added a new line after variable declarations
>
> v1: http://marc.info/?l=linux-omap&m=128031011323970&w=2
>
>  drivers/mfd/twl4030-power.c |   30 ++++++++++++++++++++++++++++++
>  1 files changed, 30 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
> index 7efa878..5c6da1e 100644
> --- a/drivers/mfd/twl4030-power.c
> +++ b/drivers/mfd/twl4030-power.c
> @@ -28,6 +28,7 @@
>  #include <linux/pm.h>
>  #include <linux/i2c/twl.h>
>  #include <linux/platform_device.h>
> +#include <linux/reboot.h>
>
>  #include <asm/mach-types.h>
>
> @@ -127,6 +128,30 @@ static u8 res_config_addrs[] = {
>        [RES_Main_Ref]  = 0x94,
>  };
>
> +/*
> + * PRCM on OMAP3 will drive SYS_OFFMODE low during DPLL3 warm reset.
> + * This causes Gaia sleep script to execute, usually killing VDD1 and
> + * VDD2 while code is running.  WA is to disable the sleep script
> + * before warm reset.
> + */
> +static int twl4030_prepare_for_reboot(struct notifier_block *this,
> +               unsigned long cmd, void *p)
> +{
> +       int err;
> +
> +       err = twl4030_remove_script(TWL4030_SLEEP_SCRIPT);
> +       if (err)
> +               pr_err("TWL4030: error trying to disable sleep script!\n");
> +
> +       return NOTIFY_DONE;
> +}
> +
> +static struct notifier_block twl4030_reboot_notifier = {
> +               .notifier_call = twl4030_prepare_for_reboot,
> +               .next = NULL,
> +               .priority = 0
> +};
> +
>  static int __init twl4030_write_script_byte(u8 address, u8 byte)
>  {
>        int err;
> @@ -549,6 +574,11 @@ void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts)
>        err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY);
>        if (err)
>                pr_err("TWL4030 Unable to relock registers\n");
> +
> +       err = register_reboot_notifier(&twl4030_reboot_notifier);
> +       if (err)
> +               pr_err("TWL4030 Failed to register reboot notifier\n");
> +
>        return;
>
>  unlock:
> --
> 1.5.6.5
>
> --
> 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
>



-- 
    Sincerely Yours,
        Mike.
--
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 v2] twl4030 reboot workaround
  2010-07-29 19:10             ` Mike Rapoport
@ 2010-07-30  5:48               ` Mikko Rapeli
  2010-07-30  6:35               ` Gopinath, Thara
  1 sibling, 0 replies; 18+ messages in thread
From: Mikko Rapeli @ 2010-07-30  5:48 UTC (permalink / raw)
  To: ext Mike Rapoport; +Cc: linux-omap, mturquette, sameo

On Thu, Jul 29, 2010 at 09:10:43PM +0200, ext Mike Rapoport wrote:
> On Thu, Jul 29, 2010 at 9:41 AM, Mikko Rapeli
> <ext-mikko.rapeli@nokia.com> wrote:
> > From: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
> >
> > Original patch: http://marc.info/?l=linux-omap&m=126522625032441&w=2
> >
> > "Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
> > necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
> > in the sleep script being executed on TWL4030. This usually results in
> > VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
> > MPU Watch Dog reset or worse, an irrecoverable hang."
> 
> I had a similar issue when my system hanged on hard reset when there
> was a TWL sleep script installed.
> The workaround I've found was to install the sleep script immediately
> before entering the suspend state and remove the script on the resume
> path.
> If you think that such approach is appropriate I can send a patch.

Yes, I think this patch would be a good idea too since it fixes a real
issue.

-Mikko

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

* RE: [PATCH v2] twl4030 reboot workaround
  2010-07-29 19:10             ` Mike Rapoport
  2010-07-30  5:48               ` Mikko Rapeli
@ 2010-07-30  6:35               ` Gopinath, Thara
  2010-07-30 18:39                 ` Mike Turquette
  1 sibling, 1 reply; 18+ messages in thread
From: Gopinath, Thara @ 2010-07-30  6:35 UTC (permalink / raw)
  To: Mike Rapoport, Mikko Rapeli; +Cc: linux-omap, Turquette, Mike, sameo



>>-----Original Message-----
>>From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Mike
>>Rapoport
>>Sent: Friday, July 30, 2010 12:41 AM
>>To: Mikko Rapeli
>>Cc: linux-omap@vger.kernel.org; Turquette, Mike; sameo@linux.intel.com
>>Subject: Re: [PATCH v2] twl4030 reboot workaround
>>
>>Hi
>>
>>On Thu, Jul 29, 2010 at 9:41 AM, Mikko Rapeli
>><ext-mikko.rapeli@nokia.com> wrote:
>>> From: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
>>>
>>> Original patch: http://marc.info/?l=linux-omap&m=126522625032441&w=2
>>>
>>> "Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
>>> necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
>>> in the sleep script being executed on TWL4030. This usually results in
>>> VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
>>> MPU Watch Dog reset or worse, an irrecoverable hang."
>>
>>I had a similar issue when my system hanged on hard reset when there
>>was a TWL sleep script installed.
>>The workaround I've found was to install the sleep script immediately
>>before entering the suspend state and remove the script on the resume
>>path.
>>If you think that such approach is appropriate I can send a patch.

How do you hit the off state(Vdd's at 0 V) in the idle path then? Or do you do this every
time in the idle thread also?

Regards
Thara

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

* Re: [PATCH v2] twl4030 reboot workaround
  2010-07-30  6:35               ` Gopinath, Thara
@ 2010-07-30 18:39                 ` Mike Turquette
  2010-07-30 19:11                   ` Gopinath, Thara
  0 siblings, 1 reply; 18+ messages in thread
From: Mike Turquette @ 2010-07-30 18:39 UTC (permalink / raw)
  To: Gopinath, Thara; +Cc: Mike Rapoport, Mikko Rapeli, linux-omap, sameo

Gopinath, Thara wrote:
> 
>>> -----Original Message-----
>>> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Mike
>>> Rapoport
>>> Sent: Friday, July 30, 2010 12:41 AM
>>> To: Mikko Rapeli
>>> Cc: linux-omap@vger.kernel.org; Turquette, Mike; sameo@linux.intel.com
>>> Subject: Re: [PATCH v2] twl4030 reboot workaround
>>>
>>> Hi
>>>
>>> On Thu, Jul 29, 2010 at 9:41 AM, Mikko Rapeli
>>> <ext-mikko.rapeli@nokia.com> wrote:
>>>> From: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
>>>>
>>>> Original patch: http://marc.info/?l=linux-omap&m=126522625032441&w=2
>>>>
>>>> "Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
>>>> necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
>>>> in the sleep script being executed on TWL4030. This usually results in
>>>> VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
>>>> MPU Watch Dog reset or worse, an irrecoverable hang."
>>> I had a similar issue when my system hanged on hard reset when there
>>> was a TWL sleep script installed.
>>> The workaround I've found was to install the sleep script immediately
>>> before entering the suspend state and remove the script on the resume
>>> path.
>>> If you think that such approach is appropriate I can send a patch.
> 
> How do you hit the off state(Vdd's at 0 V) in the idle path then? Or do you do this every
> time in the idle thread also?

I do not think it is appropriate to add/remove the sleep script 
before/after every OFF mode case.  The script should be programmed once 
and left alone EXCEPT in the case of warm reset.

If there are other corner cases where SYS_OFFMODE goes low, then we 
should cover those with similar fixes to the warm reset fix, but in 
general I think the policy should be to leave the scripts alone once 
programmed

Dynamically programming/removing the scripts around OFF transitions 
increases software overhead for those transitions even more which is 
very undesirable.

Mike

> Regards
> Thara


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

* RE: [PATCH v2] twl4030 reboot workaround
  2010-07-30 18:39                 ` Mike Turquette
@ 2010-07-30 19:11                   ` Gopinath, Thara
  2010-08-01  6:31                     ` Mike Rapoport
  0 siblings, 1 reply; 18+ messages in thread
From: Gopinath, Thara @ 2010-07-30 19:11 UTC (permalink / raw)
  To: Turquette, Mike; +Cc: Mike Rapoport, Mikko Rapeli, linux-omap, sameo



>>-----Original Message-----
>>From: Turquette, Mike
>>Sent: Saturday, July 31, 2010 12:09 AM
>>To: Gopinath, Thara
>>Cc: Mike Rapoport; Mikko Rapeli; linux-omap@vger.kernel.org; sameo@linux.intel.com
>>Subject: Re: [PATCH v2] twl4030 reboot workaround
>>
>>Gopinath, Thara wrote:
>>>
>>>>> -----Original Message-----
>>>>> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of
>>Mike
>>>>> Rapoport
>>>>> Sent: Friday, July 30, 2010 12:41 AM
>>>>> To: Mikko Rapeli
>>>>> Cc: linux-omap@vger.kernel.org; Turquette, Mike; sameo@linux.intel.com
>>>>> Subject: Re: [PATCH v2] twl4030 reboot workaround
>>>>>
>>>>> Hi
>>>>>
>>>>> On Thu, Jul 29, 2010 at 9:41 AM, Mikko Rapeli
>>>>> <ext-mikko.rapeli@nokia.com> wrote:
>>>>>> From: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
>>>>>>
>>>>>> Original patch: http://marc.info/?l=linux-omap&m=126522625032441&w=2
>>>>>>
>>>>>> "Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
>>>>>> necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
>>>>>> in the sleep script being executed on TWL4030. This usually results in
>>>>>> VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
>>>>>> MPU Watch Dog reset or worse, an irrecoverable hang."
>>>>> I had a similar issue when my system hanged on hard reset when there
>>>>> was a TWL sleep script installed.
>>>>> The workaround I've found was to install the sleep script immediately
>>>>> before entering the suspend state and remove the script on the resume
>>>>> path.
>>>>> If you think that such approach is appropriate I can send a patch.
>>>
>>> How do you hit the off state(Vdd's at 0 V) in the idle path then? Or do you do this every
>>> time in the idle thread also?
>>
>>I do not think it is appropriate to add/remove the sleep script
>>before/after every OFF mode case.  The script should be programmed once
>>and left alone EXCEPT in the case of warm reset.
>>
>>If there are other corner cases where SYS_OFFMODE goes low, then we
>>should cover those with similar fixes to the warm reset fix, but in
>>general I think the policy should be to leave the scripts alone once
>>programmed
>>
>>Dynamically programming/removing the scripts around OFF transitions
>>increases software overhead for those transitions even more which is
>>very undesirable.

This was exactly my concern. The latency increase due to the dynamic addition and
removal of sleep scripts around off transitions might not be justifiable. Maybe Mike
does not want to hit 0V for Vdd's in the idle thread in which case it can be acceptable to
dynamically add the script in the system suspend path and remove it in the resume path.
Else I also do not think this approach is acceptable.

Regards
Thara


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

* Re: [PATCH v2] twl4030 reboot workaround
  2010-07-30 19:11                   ` Gopinath, Thara
@ 2010-08-01  6:31                     ` Mike Rapoport
  0 siblings, 0 replies; 18+ messages in thread
From: Mike Rapoport @ 2010-08-01  6:31 UTC (permalink / raw)
  To: Gopinath, Thara
  Cc: Turquette, Mike, Mikko Rapeli, linux-omap, sameo, Mike Rapoport

Gopinath, Thara wrote:
> 
>>> -----Original Message-----
>>> From: Turquette, Mike
>>> Sent: Saturday, July 31, 2010 12:09 AM
>>> To: Gopinath, Thara
>>> Cc: Mike Rapoport; Mikko Rapeli; linux-omap@vger.kernel.org; sameo@linux.intel.com
>>> Subject: Re: [PATCH v2] twl4030 reboot workaround
>>>
>>> Gopinath, Thara wrote:
>>>>>> -----Original Message-----
>>>>>> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of
>>> Mike
>>>>>> Rapoport
>>>>>> Sent: Friday, July 30, 2010 12:41 AM
>>>>>> To: Mikko Rapeli
>>>>>> Cc: linux-omap@vger.kernel.org; Turquette, Mike; sameo@linux.intel.com
>>>>>> Subject: Re: [PATCH v2] twl4030 reboot workaround
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> On Thu, Jul 29, 2010 at 9:41 AM, Mikko Rapeli
>>>>>> <ext-mikko.rapeli@nokia.com> wrote:
>>>>>>> From: Mikko Rapeli <ext-mikko.rapeli@nokia.com>
>>>>>>>
>>>>>>> Original patch: http://marc.info/?l=linux-omap&m=126522625032441&w=2
>>>>>>>
>>>>>>> "Removes TWL4030 sleep script prior to rebooting, only on OMAP3. This is
>>>>>>> necessary since DPLL3 reset causes SYS_OFFMODE pin to go low, resulting
>>>>>>> in the sleep script being executed on TWL4030. This usually results in
>>>>>>> VDD1 & VDD2 voltage collapse while ROM code is executing, followed by an
>>>>>>> MPU Watch Dog reset or worse, an irrecoverable hang."
>>>>>> I had a similar issue when my system hanged on hard reset when there
>>>>>> was a TWL sleep script installed.
>>>>>> The workaround I've found was to install the sleep script immediately
>>>>>> before entering the suspend state and remove the script on the resume
>>>>>> path.
>>>>>> If you think that such approach is appropriate I can send a patch.
>>>> How do you hit the off state(Vdd's at 0 V) in the idle path then? Or do you do this every
>>>> time in the idle thread also?
>>> I do not think it is appropriate to add/remove the sleep script
>>> before/after every OFF mode case.  The script should be programmed once
>>> and left alone EXCEPT in the case of warm reset.
>>>
>>> If there are other corner cases where SYS_OFFMODE goes low, then we
>>> should cover those with similar fixes to the warm reset fix, but in
>>> general I think the policy should be to leave the scripts alone once
>>> programmed
>>>
>>> Dynamically programming/removing the scripts around OFF transitions
>>> increases software overhead for those transitions even more which is
>>> very undesirable.
> 
> This was exactly my concern. The latency increase due to the dynamic addition and
> removal of sleep scripts around off transitions might not be justifiable. Maybe Mike
> does not want to hit 0V for Vdd's in the idle thread in which case it can be acceptable to
> dynamically add the script in the system suspend path and remove it in the resume path.
> Else I also do not think this approach is acceptable.

I've missed the idle case indeed and I agree that dynamic addition and removal 
of sleep scripts is not an acceptable solution.

> Regards
> Thara
> 
> --
> 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


-- 
Sincerely yours,
Mike.

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

end of thread, other threads:[~2010-08-01  6:32 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-03 19:43 [RFC] OMAP3: PM: disable twl4030 sleep sequence before reboot Mike Turquette
2010-02-03 19:43 ` [PATCH 1/2] MFD: TWL4030: introduce remove_script function Mike Turquette
2010-02-03 19:43   ` [PATCH 2/2] OMAP3: PM: remove TWL4030 A2S script before reboot Mike Turquette
2010-02-09 22:35     ` Tony Lindgren
2010-07-28  9:41     ` [PATCH] twl4030 reboot workaround Mikko Rapeli
2010-07-28 10:07       ` Gopinath, Thara
2010-07-29  6:07         ` Mikko Rapeli
2010-07-28 10:18       ` Peter 'p2' De Schrijver
2010-07-29  6:06         ` Mikko Rapeli
2010-07-28 15:47       ` Mike Turquette
2010-07-29  6:16         ` Mikko Rapeli
2010-07-29  6:41           ` [PATCH v2] " Mikko Rapeli
2010-07-29 19:10             ` Mike Rapoport
2010-07-30  5:48               ` Mikko Rapeli
2010-07-30  6:35               ` Gopinath, Thara
2010-07-30 18:39                 ` Mike Turquette
2010-07-30 19:11                   ` Gopinath, Thara
2010-08-01  6:31                     ` Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).