Re: [PATCH v8 5/7] mfd: TWL4030: changes for TRITON Errata 27 workaround

2011-03-07 Thread Kevin Hilman
Hi Lesly,

Lesly A M lesl...@ti.com writes:

 Workaround for TWL5030 Silicon Errata 27  28:
   27 - VDD1, VDD2, may have glitches when their output value is updated.
   28 - VDD1 and / or VDD2 DCDC clock may stop working when internal clock
   is switched from internal to external.

 Errata 27:
   If the DCDC regulators is running on their internal oscillator,
   negative glitches may occur on VDD1, VDD2 output when voltage is 
 changed.
   The OMAP device may reboot if the VDD1 or VDD2 go below the
   core minimum operating voltage.

   WORKAROUND
   Set up the TWL5030 DC-DC power supplies to use the HFCLKIN instead of
   the internal oscillator.

 Errata 28:
   VDD1/VDD2 clock system may hang during switching the clock source from
   internal oscillator to external. VDD1/VDD2 output voltages may collapse
   if clock stops.

   WORKAROUND
   If HFCLK is disabled in OFFMODE, modify the sleep/wakeup sequence and
   setuptimes to make sure the switching will happen only when HFCLKIN is 
 stable.
   Also use the TWL5030 watchdog to safeguard the first switching from
   internal oscillator to HFCLKIN during the TWL5030 init.

   IMPACT
   power sequence is changed.
   sleep/wakeup time values will be changed.

 The workaround changes are called from twl4030_power_init(), since we have to
 make some i2c_read calls to check the TRITON version  the i2c will not be
 initialized in the early stage.

 This workaround is required for TWL5030 Silicon version less than ES1.2
 The power script  setup time changes are recommended by TI HW team.

 http://omapedia.org/wiki/TWL4030_power_scripts

 Changes taken from TRITON Errata27 workaround patch by Nishanth Menon.

 Signed-off-by: Lesly A M lesl...@ti.com
 Cc: Nishanth Menon n...@ti.com
 Cc: David Derrick dderr...@ti.com
 Cc: Samuel Ortiz sa...@linux.intel.com

Some minor comments below,

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

 diff --git a/arch/arm/mach-omap2/twl4030.c b/arch/arm/mach-omap2/twl4030.c
 index ff344b3..87de049 100644
 --- a/arch/arm/mach-omap2/twl4030.c
 +++ b/arch/arm/mach-omap2/twl4030.c
 @@ -137,9 +137,123 @@ static struct twl4030_resconfig twl4030_rconfig[] = {
   { 0, 0},
  };
  
 +/*
 + * Active to Sleep sequence, which is executed upon P1/P2/P3
 + * transition for sleep.
 + *
 + * The sleep sequence is adjusted to do the switching of VDD1/VDD2/VIO OSC 
 from
 + * HFCLKIN to internal oscillator when the HFCLKIN is stable.
 + */
 +static struct twl4030_ins __initdata sleep_on_seq_errata27[] = {
 + /*
 +  * Singular message to disable HCLKOUT.
 +  * Wait for ~488.32 uS to do the switching of VDD1/VDD2/VIO OSC from
 +  * HFCLKIN to internal oscillator before disabling HFCLKIN.
 +  */
 + {MSG_SINGULAR(DEV_GRP_NULL, RES_HFCLKOUT, RES_STATE_SLEEP), 20},
 + /* Broadcast message to put res(TYPE2 = 1) to sleep */
 + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
 + RES_STATE_SLEEP), 2},
 + /* Broadcast message to put res(TYPE2 = 2) to sleep, disable HFCLKIN */
 + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
 + RES_STATE_SLEEP), 2},
 +};
 +
 +static struct twl4030_script sleep_on_script_errata27 __initdata = {
 + .script = sleep_on_seq_errata27,
 + .size   = ARRAY_SIZE(sleep_on_seq_errata27),
 + .flags  = TWL4030_SLEEP_SCRIPT,
 +};
 +
 +/*
 + * Sleep to Active sequence, which is executed upon P1/P2/P3
 + * transition for wakeup.
 + *
 + * The wakeup sequence is adjusted to do the VDD1/VDD2 voltage rampup
 + * only after HFCLKIN is stabilized and the HFCLKOUT is enabled.
 + */
 +static struct twl4030_ins wakeup_seq_errata27[] __initdata = {
 + /*
 +  * Broadcast message to put res(TYPE2 = 2) to active.
 +  * Wait for ~10 mS (rampup time for OSC on the board)
 +  * after HFCLKIN is enabled
 +  */
 + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
 + RES_STATE_ACTIVE), 55},
 + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
 + RES_STATE_ACTIVE), 55},
 + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
 + RES_STATE_ACTIVE), 54},
 + {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
 + RES_STATE_ACTIVE), 1},
 + /* Singular message to enable HCLKOUT after HFCLKIN is stabilized */
 + {MSG_SINGULAR(DEV_GRP_NULL, RES_HFCLKOUT, RES_STATE_ACTIVE), 

Re: [PATCH v8 5/7] mfd: TWL4030: changes for TRITON Errata 27 workaround

2011-03-07 Thread Manuel, Lesly Arackal
Hi Kevin,

On Tue, Mar 8, 2011 at 2:44 AM, Kevin Hilman khil...@ti.com wrote:
 Hi Lesly,

 Lesly A M lesl...@ti.com writes:

 Workaround for TWL5030 Silicon Errata 27  28:
       27 - VDD1, VDD2, may have glitches when their output value is updated.
       28 - VDD1 and / or VDD2 DCDC clock may stop working when internal clock
               is switched from internal to external.

 Errata 27:
       If the DCDC regulators is running on their internal oscillator,
       negative glitches may occur on VDD1, VDD2 output when voltage is 
 changed.
       The OMAP device may reboot if the VDD1 or VDD2 go below the
       core minimum operating voltage.

       WORKAROUND
       Set up the TWL5030 DC-DC power supplies to use the HFCLKIN instead of
       the internal oscillator.

 Errata 28:
       VDD1/VDD2 clock system may hang during switching the clock source from
       internal oscillator to external. VDD1/VDD2 output voltages may collapse
       if clock stops.

       WORKAROUND
       If HFCLK is disabled in OFFMODE, modify the sleep/wakeup sequence and
       setuptimes to make sure the switching will happen only when HFCLKIN is 
 stable.
       Also use the TWL5030 watchdog to safeguard the first switching from
       internal oscillator to HFCLKIN during the TWL5030 init.

       IMPACT
       power sequence is changed.
       sleep/wakeup time values will be changed.

 The workaround changes are called from twl4030_power_init(), since we have to
 make some i2c_read calls to check the TRITON version  the i2c will not be
 initialized in the early stage.

 This workaround is required for TWL5030 Silicon version less than ES1.2
 The power script  setup time changes are recommended by TI HW team.

 http://omapedia.org/wiki/TWL4030_power_scripts

 Changes taken from TRITON Errata27 workaround patch by Nishanth Menon.

 Signed-off-by: Lesly A M lesl...@ti.com
 Cc: Nishanth Menon n...@ti.com
 Cc: David Derrick dderr...@ti.com
 Cc: Samuel Ortiz sa...@linux.intel.com

 Some minor comments below,

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

 diff --git a/arch/arm/mach-omap2/twl4030.c b/arch/arm/mach-omap2/twl4030.c
 index ff344b3..87de049 100644
 --- a/arch/arm/mach-omap2/twl4030.c
 +++ b/arch/arm/mach-omap2/twl4030.c
 @@ -137,9 +137,123 @@ static struct twl4030_resconfig twl4030_rconfig[] = {
       { 0, 0},
  };

 +/*
 + * Active to Sleep sequence, which is executed upon P1/P2/P3
 + * transition for sleep.
 + *
 + * The sleep sequence is adjusted to do the switching of VDD1/VDD2/VIO OSC 
 from
 + * HFCLKIN to internal oscillator when the HFCLKIN is stable.
 + */
 +static struct twl4030_ins __initdata sleep_on_seq_errata27[] = {
 +     /*
 +      * Singular message to disable HCLKOUT.
 +      * Wait for ~488.32 uS to do the switching of VDD1/VDD2/VIO OSC from
 +      * HFCLKIN to internal oscillator before disabling HFCLKIN.
 +      */
 +     {MSG_SINGULAR(DEV_GRP_NULL, RES_HFCLKOUT, RES_STATE_SLEEP), 20},
 +     /* Broadcast message to put res(TYPE2 = 1) to sleep */
 +     {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
 +                                                     RES_STATE_SLEEP), 2},
 +     /* Broadcast message to put res(TYPE2 = 2) to sleep, disable HFCLKIN */
 +     {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
 +                                                     RES_STATE_SLEEP), 2},
 +};
 +
 +static struct twl4030_script sleep_on_script_errata27 __initdata = {
 +     .script = sleep_on_seq_errata27,
 +     .size   = ARRAY_SIZE(sleep_on_seq_errata27),
 +     .flags  = TWL4030_SLEEP_SCRIPT,
 +};
 +
 +/*
 + * Sleep to Active sequence, which is executed upon P1/P2/P3
 + * transition for wakeup.
 + *
 + * The wakeup sequence is adjusted to do the VDD1/VDD2 voltage rampup
 + * only after HFCLKIN is stabilized and the HFCLKOUT is enabled.
 + */
 +static struct twl4030_ins wakeup_seq_errata27[] __initdata = {
 +     /*
 +      * Broadcast message to put res(TYPE2 = 2) to active.
 +      * Wait for ~10 mS (rampup time for OSC on the board)
 +      * after HFCLKIN is enabled
 +      */
 +     {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
 +                                                     RES_STATE_ACTIVE), 55},
 +     {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
 +                                                     RES_STATE_ACTIVE), 55},
 +     {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
 +                                                     RES_STATE_ACTIVE), 54},
 +     {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
 +                                                     RES_STATE_ACTIVE), 1},
 +     /* Singular message to enable HCLKOUT after HFCLKIN is 

[PATCH v8 5/7] mfd: TWL4030: changes for TRITON Errata 27 workaround

2011-03-02 Thread Lesly A M
Workaround for TWL5030 Silicon Errata 27  28:
27 - VDD1, VDD2, may have glitches when their output value is updated.
28 - VDD1 and / or VDD2 DCDC clock may stop working when internal clock
is switched from internal to external.

Errata 27:
If the DCDC regulators is running on their internal oscillator,
negative glitches may occur on VDD1, VDD2 output when voltage is 
changed.
The OMAP device may reboot if the VDD1 or VDD2 go below the
core minimum operating voltage.

WORKAROUND
Set up the TWL5030 DC-DC power supplies to use the HFCLKIN instead of
the internal oscillator.

Errata 28:
VDD1/VDD2 clock system may hang during switching the clock source from
internal oscillator to external. VDD1/VDD2 output voltages may collapse
if clock stops.

WORKAROUND
If HFCLK is disabled in OFFMODE, modify the sleep/wakeup sequence and
setuptimes to make sure the switching will happen only when HFCLKIN is 
stable.
Also use the TWL5030 watchdog to safeguard the first switching from
internal oscillator to HFCLKIN during the TWL5030 init.

IMPACT
power sequence is changed.
sleep/wakeup time values will be changed.

The workaround changes are called from twl4030_power_init(), since we have to
make some i2c_read calls to check the TRITON version  the i2c will not be
initialized in the early stage.

This workaround is required for TWL5030 Silicon version less than ES1.2
The power script  setup time changes are recommended by TI HW team.

http://omapedia.org/wiki/TWL4030_power_scripts

Changes taken from TRITON Errata27 workaround patch by Nishanth Menon.

Signed-off-by: Lesly A M lesl...@ti.com
Cc: Nishanth Menon n...@ti.com
Cc: David Derrick dderr...@ti.com
Cc: Samuel Ortiz sa...@linux.intel.com
---
 arch/arm/mach-omap2/twl4030.c |  114 +
 drivers/mfd/twl4030-power.c   |   64 +++
 include/linux/i2c/twl.h   |1 +
 3 files changed, 179 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/twl4030.c b/arch/arm/mach-omap2/twl4030.c
index ff344b3..87de049 100644
--- a/arch/arm/mach-omap2/twl4030.c
+++ b/arch/arm/mach-omap2/twl4030.c
@@ -137,9 +137,123 @@ static struct twl4030_resconfig twl4030_rconfig[] = {
{ 0, 0},
 };
 
+/*
+ * Active to Sleep sequence, which is executed upon P1/P2/P3
+ * transition for sleep.
+ *
+ * The sleep sequence is adjusted to do the switching of VDD1/VDD2/VIO OSC from
+ * HFCLKIN to internal oscillator when the HFCLKIN is stable.
+ */
+static struct twl4030_ins __initdata sleep_on_seq_errata27[] = {
+   /*
+* Singular message to disable HCLKOUT.
+* Wait for ~488.32 uS to do the switching of VDD1/VDD2/VIO OSC from
+* HFCLKIN to internal oscillator before disabling HFCLKIN.
+*/
+   {MSG_SINGULAR(DEV_GRP_NULL, RES_HFCLKOUT, RES_STATE_SLEEP), 20},
+   /* Broadcast message to put res(TYPE2 = 1) to sleep */
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+   RES_STATE_SLEEP), 2},
+   /* Broadcast message to put res(TYPE2 = 2) to sleep, disable HFCLKIN */
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+   RES_STATE_SLEEP), 2},
+};
+
+static struct twl4030_script sleep_on_script_errata27 __initdata = {
+   .script = sleep_on_seq_errata27,
+   .size   = ARRAY_SIZE(sleep_on_seq_errata27),
+   .flags  = TWL4030_SLEEP_SCRIPT,
+};
+
+/*
+ * Sleep to Active sequence, which is executed upon P1/P2/P3
+ * transition for wakeup.
+ *
+ * The wakeup sequence is adjusted to do the VDD1/VDD2 voltage rampup
+ * only after HFCLKIN is stabilized and the HFCLKOUT is enabled.
+ */
+static struct twl4030_ins wakeup_seq_errata27[] __initdata = {
+   /*
+* Broadcast message to put res(TYPE2 = 2) to active.
+* Wait for ~10 mS (rampup time for OSC on the board)
+* after HFCLKIN is enabled
+*/
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+   RES_STATE_ACTIVE), 55},
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+   RES_STATE_ACTIVE), 55},
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+   RES_STATE_ACTIVE), 54},
+   {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+   RES_STATE_ACTIVE), 1},
+   /* Singular message to enable HCLKOUT after HFCLKIN is stabilized */
+   {MSG_SINGULAR(DEV_GRP_NULL, RES_HFCLKOUT, RES_STATE_ACTIVE), 1},
+   /*
+* Broadcast message to put res(TYPE2 = 1) to active.