From patchwork Tue Jan 19 17:35:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lesly A M X-Patchwork-Id: 73903 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0JHOEmw020515 for ; Tue, 19 Jan 2010 17:24:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752920Ab0ASRXx (ORCPT ); Tue, 19 Jan 2010 12:23:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752855Ab0ASRXw (ORCPT ); Tue, 19 Jan 2010 12:23:52 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:54786 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752759Ab0ASRXp (ORCPT ); Tue, 19 Jan 2010 12:23:45 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id o0JHNfHg019065 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 19 Jan 2010 11:23:43 -0600 Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o0JHNcH1026740; Tue, 19 Jan 2010 22:53:38 +0530 (IST) From: x0080970@ti.com To: linux-omap@vger.kernel.org Cc: Lesly A M , Nishanth Menon , David Derrick , Samuel Ortiz Subject: [PATCH v2 3/6] omap3: pm: Update Triton2 scripts Date: Tue, 19 Jan 2010 23:05:56 +0530 Message-Id: <1263922556-13806-1-git-send-email-x0080970@ti.com> X-Mailer: git-send-email 1.6.0.4 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org 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 */