Manuel, Lesly Arackal had written, on 01/19/2010 11:35 AM, the following:
From: Lesly A M <[email protected]>

omap3: pm: Update Triton2 scripts

Updated the sleep, wakeup & warm_reset sequence as recommended by David Derrick.
Used broadcast command, modified the resource type association and remap 
sleep_state.
Added the new script changes for zoom[2,3] boards.

VDD1, VDD2 and VPLL1 are remapped to turn off during sleep state.
Changed RES_TYPE2 of VPLL1, VDD1, VDD2, REGEN, NRESPWRON & SYSEN to '1'
and VINTANA1, VINTANA2, VINTDIG, VIO, CLKEN & HFCLKOUT to '2'.
How about VMMC,VAUX and other resources?


HFCLKOUT is attached to P3, to disable HFCLK when clk_req signal is toggled.

Signed-off-by: Lesly A M <[email protected]>
Cc: Nishanth Menon <[email protected]>
Cc: David Derrick <[email protected]>
Cc: Samuel Ortiz <[email protected]>

---
 arch/arm/mach-omap2/board-3430sdp.c          |   83 ++++++++++++--------
 arch/arm/mach-omap2/board-zoom-peripherals.c |  107 +++++++++++++++++++++++++++
 include/linux/i2c/twl.h                      |    4 +
 3 files changed, 161 insertions(+), 33 deletions(-)

Index: linux-omap-pm/arch/arm/mach-omap2/board-3430sdp.c
===================================================================
--- linux-omap-pm.orig/arch/arm/mach-omap2/board-3430sdp.c      2010-01-19 
21:34:57.000000000 +0530
+++ linux-omap-pm/arch/arm/mach-omap2/board-3430sdp.c   2010-01-19 
21:41:26.000000000 +0530
@@ -448,14 +448,11 @@
static struct twl4030_ins __initdata sleep_on_seq[] = {
-       /* Turn off HFCLKOUT */
-       {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_OFF), 2},
-       /* Turn OFF VDD1 */
-       {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_OFF), 2},
-       /* Turn OFF VDD2 */
-       {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_OFF), 2},
-       /* Turn OFF VPLL1 */
-       {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_OFF), 2},
+       /* Broadcast message to put res to sleep */
+       {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+                                                       RES_STATE_SLEEP), 2},
+       {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 __initdata = {
@@ -465,14 +462,9 @@
 };
static struct twl4030_ins wakeup_p12_seq[] __initdata = {
-       /* Turn on HFCLKOUT */
-       {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 2},
-       /* Turn ON VDD1 */
-       {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_ACTIVE), 2},
-       /* Turn ON VDD2 */
-       {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_ACTIVE), 2},
-       /* Turn ON VPLL1 */
-       {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_ACTIVE), 2},
+       /* Broadcast message to put res to active */
+       {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+                                                       RES_STATE_ACTIVE), 2},
 };
static struct twl4030_script wakeup_p12_script __initdata = {
@@ -482,7 +474,9 @@
 };
static struct twl4030_ins wakeup_p3_seq[] __initdata = {
-       {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 2},
+       /* Broadcast message to put res to active */
+       {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+                                                       RES_STATE_ACTIVE), 2},
 };
static struct twl4030_script wakeup_p3_script __initdata = {
@@ -494,18 +488,23 @@
 static struct twl4030_ins wrst_seq[] __initdata = {
 /*
  * Reset twl4030.
- * Reset VDD1 regulator.
- * Reset VDD2 regulator.
- * Reset VPLL1 regulator.
- * Enable sysclk output.
+ * Reset Main_Ref.
+ * Reset All type2_group2.
+ * Reset VUSB_3v1.
+ * Reset All type2_group1.
+ * Reset RC.
  * Reenable twl4030.
  */
-       {MSG_SINGULAR(DEV_GRP_NULL, 0x1b, RES_STATE_OFF), 2},
-       {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_WRST), 15},
-       {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_WRST), 15},
-       {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_WRST), 0x60},
-       {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 2},
-       {MSG_SINGULAR(DEV_GRP_NULL, 0x1b, RES_STATE_ACTIVE), 2},
+       {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
+       {MSG_SINGULAR(DEV_GRP_NULL, RES_Main_Ref, RES_STATE_WRST), 2},
+       {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+                                                       RES_STATE_WRST), 2},
+       {MSG_SINGULAR(DEV_GRP_NULL, RES_VUSB_3V1, RES_STATE_WRST), 2},
+       {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+                                                       RES_STATE_WRST), 2},
+       {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_RC, RES_TYPE_ALL, RES_TYPE2_R0,
+                                                       RES_STATE_WRST), 2},
+       {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
 };
 static struct twl4030_script wrst_script __initdata = {
        .script = wrst_seq,
@@ -521,12 +520,30 @@
 };
static struct twl4030_resconfig twl4030_rconfig[] = {
-       { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3, .type = -1,
-               .type2 = -1 },
-       { .resource = RES_VDD1, .devgroup = DEV_GRP_P1, .type = -1,
-               .type2 = -1 },
-       { .resource = RES_VDD2, .devgroup = DEV_GRP_P1, .type = -1,
-               .type2 = -1 },
+       { .resource = RES_VPLL1, .devgroup = DEV_GRP_P1, .type = 3,
+               .type2 = 1, .remap_sleep = RES_STATE_OFF },
+       { .resource = RES_VINTANA1, .devgroup = DEV_GRP_ALL, .type = 1,
+               .type2 = 2, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_VINTANA2, .devgroup = DEV_GRP_ALL, .type = 0,
+               .type2 = 2, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_VINTDIG, .devgroup = DEV_GRP_ALL, .type = 1,
+               .type2 = 2, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_VIO, .devgroup = DEV_GRP_ALL, .type = 2,
+               .type2 = 2, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_VDD1, .devgroup = DEV_GRP_P1,
+               .type = 4, .type2 = 1, .remap_sleep = RES_STATE_OFF },
+       { .resource = RES_VDD2, .devgroup = DEV_GRP_P1,
+               .type = 3, .type2 = 1, .remap_sleep = RES_STATE_OFF },
+       { .resource = RES_REGEN, .devgroup = DEV_GRP_ALL, .type = 2,
+               .type2 = 1, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_ALL, .type = 0,
+               .type2 = 1, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_CLKEN, .devgroup = DEV_GRP_ALL, .type = 3,
+               .type2 = 2, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_SYSEN, .devgroup = DEV_GRP_ALL, .type = 6,
+               .type2 = 1, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
+               .type = 0, .type2 = 2, .remap_sleep = RES_STATE_SLEEP },
        { 0, 0},
 };
Index: linux-omap-pm/arch/arm/mach-omap2/board-zoom-peripherals.c
===================================================================
--- linux-omap-pm.orig/arch/arm/mach-omap2/board-zoom-peripherals.c     
2010-01-19 21:34:57.000000000 +0530
+++ linux-omap-pm/arch/arm/mach-omap2/board-zoom-peripherals.c  2010-01-19 
21:40:29.000000000 +0530
@@ -95,6 +95,112 @@
        .rep            = 1,
 };
+static struct twl4030_ins __initdata sleep_on_seq[] = {
+       /* Broadcast message to put res to sleep */
+       {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+                                                       RES_STATE_SLEEP), 2},
+       {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 __initdata = {
+       .script = sleep_on_seq,
+       .size   = ARRAY_SIZE(sleep_on_seq),
+       .flags  = TWL4030_SLEEP_SCRIPT,
+};
+
+static struct twl4030_ins wakeup_p12_seq[] __initdata = {
+       /* Broadcast message to put res to active */
+       {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+                                                       RES_STATE_ACTIVE), 2},
+};
+
+static struct twl4030_script wakeup_p12_script __initdata = {
+       .script = wakeup_p12_seq,
+       .size   = ARRAY_SIZE(wakeup_p12_seq),
+       .flags  = TWL4030_WAKEUP12_SCRIPT,
+};
+
+static struct twl4030_ins wakeup_p3_seq[] __initdata = {
+       /* Broadcast message to put res to active */
+       {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+                                                       RES_STATE_ACTIVE), 2},
+};
+
+static struct twl4030_script wakeup_p3_script __initdata = {
+       .script = wakeup_p3_seq,
+       .size   = ARRAY_SIZE(wakeup_p3_seq),
+       .flags  = TWL4030_WAKEUP3_SCRIPT,
+};
+
+static struct twl4030_ins wrst_seq[] __initdata = {
+/*
+ * Reset twl4030.
+ * Reset Main_Ref.
+ * Reset All type2_group2.
+ * Reset VUSB_3v1.
+ * Reset All type2_group1.
+ * Reset RC.
+ * Reenable twl4030.
+ */
+       {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
+       {MSG_SINGULAR(DEV_GRP_NULL, RES_Main_Ref, RES_STATE_WRST), 2},
+       {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R2,
+                                                       RES_STATE_WRST), 2},
+       {MSG_SINGULAR(DEV_GRP_NULL, RES_VUSB_3V1, RES_STATE_WRST), 2},
+       {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_R0, RES_TYPE2_R1,
+                                                       RES_STATE_WRST), 2},
+       {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_RC, RES_TYPE_ALL, RES_TYPE2_R0,
+                                                       RES_STATE_WRST), 2},
+       {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
+};
+static struct twl4030_script wrst_script __initdata = {
+       .script = wrst_seq,
+       .size   = ARRAY_SIZE(wrst_seq),
+       .flags  = TWL4030_WRST_SCRIPT,
+};
+
+static struct twl4030_script *twl4030_scripts[] __initdata = {
+       &sleep_on_script,
+       &wakeup_p12_script,
+       &wakeup_p3_script,
+       &wrst_script,
+};
+
+static struct twl4030_resconfig twl4030_rconfig[] = {
+       { .resource = RES_VPLL1, .devgroup = DEV_GRP_P1, .type = 3,
+               .type2 = 1, .remap_sleep = RES_STATE_OFF },
+       { .resource = RES_VINTANA1, .devgroup = DEV_GRP_ALL, .type = 1,
+               .type2 = 2, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_VINTANA2, .devgroup = DEV_GRP_ALL, .type = 0,
+               .type2 = 2, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_VINTDIG, .devgroup = DEV_GRP_ALL, .type = 1,
+               .type2 = 2, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_VIO, .devgroup = DEV_GRP_ALL, .type = 2,
+               .type2 = 2, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_VDD1, .devgroup = DEV_GRP_P1,
+               .type = 4, .type2 = 1, .remap_sleep = RES_STATE_OFF },
+       { .resource = RES_VDD2, .devgroup = DEV_GRP_P1,
+               .type = 3, .type2 = 1, .remap_sleep = RES_STATE_OFF },
+       { .resource = RES_REGEN, .devgroup = DEV_GRP_ALL, .type = 2,
+               .type2 = 1, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_ALL, .type = 0,
+               .type2 = 1, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_CLKEN, .devgroup = DEV_GRP_ALL, .type = 3,
+               .type2 = 2, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_SYSEN, .devgroup = DEV_GRP_ALL, .type = 6,
+               .type2 = 1, .remap_sleep = RES_STATE_SLEEP },
+       { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
+               .type = 0, .type2 = 2, .remap_sleep = RES_STATE_SLEEP },
+       { 0, 0},
+};
+
+static struct twl4030_power_data zoom_t2scripts_data __initdata = {
+       .scripts        = twl4030_scripts,
+       .num            = ARRAY_SIZE(twl4030_scripts),
+       .resource_config = twl4030_rconfig,
+};
+
 static struct regulator_consumer_supply zoom_vmmc1_supply = {
        .supply         = "vmmc",
 };
@@ -240,6 +346,7 @@
        .usb            = &zoom_usb_data,
        .gpio           = &zoom_gpio_data,
        .keypad         = &zoom_kp_twl4030_data,
+       .power          = &zoom_t2scripts_data,
        .codec          = &zoom_codec_data,
        .vmmc1          = &zoom_vmmc1,
        .vmmc2          = &zoom_vmmc2,
Index: linux-omap-pm/include/linux/i2c/twl.h
===================================================================
--- linux-omap-pm.orig/include/linux/i2c/twl.h  2010-01-19 21:34:43.000000000 
+0530
+++ linux-omap-pm/include/linux/i2c/twl.h       2010-01-19 21:35:02.000000000 
+0530
@@ -351,6 +351,7 @@
 #define DEV_GRP_P1             0x1     /* P1: all OMAP devices */
 #define DEV_GRP_P2             0x2     /* P2: all Modem devices */
 #define DEV_GRP_P3             0x4     /* P3: all peripheral devices */
+#define DEV_GRP_ALL            0x7     /* P1/P2/P3: all devices */
/* Resource groups */
 #define RES_GRP_RES            0x0     /* Reserved */
@@ -363,7 +364,10 @@
 #define RES_GRP_ALL            0x7     /* All resource groups */
#define RES_TYPE2_R0 0x0
+#define RES_TYPE2_R1           0x1
+#define RES_TYPE2_R2           0x2
+#define RES_TYPE_R0 0x0
 #define RES_TYPE_ALL           0x7
/* Resource states */


--
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to