From patchwork Tue May 18 12:35:29 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: 100448 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.3) with ESMTP id o4ICZt6O000468 for ; Tue, 18 May 2010 12:35:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757462Ab0ERMfy (ORCPT ); Tue, 18 May 2010 08:35:54 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:54168 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756206Ab0ERMfx (ORCPT ); Tue, 18 May 2010 08:35:53 -0400 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o4ICZnUY016671 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 May 2010 07:35:52 -0500 Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o4ICZkjT010387; Tue, 18 May 2010 18:05:46 +0530 (IST) From: Lesly A M To: linux-omap@vger.kernel.org Cc: Lesly A M , Nishanth Menon , David Derrick , Samuel Ortiz Subject: [PATCH v6 3/7] omap3: pm: re-programing the setup time based on CORE_DOMAIN target state Date: Tue, 18 May 2010 18:05:29 +0530 Message-Id: <1274186129-23928-1-git-send-email-leslyam@ti.com> X-Mailer: git-send-email 1.7.0.4 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 18 May 2010 12:35:55 +0000 (UTC) diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 5039b35..1ff6293 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -439,20 +439,12 @@ void omap_sram_idle(void) if (core_next_state < PWRDM_POWER_ON) { omap_uart_prepare_idle(0); omap_uart_prepare_idle(1); - if (core_next_state == PWRDM_POWER_OFF) { - u32 voltctrl = OMAP3430_AUTO_OFF; + /* Update the voltsetup time for RET/OFF */ + omap_voltage_vc_update(core_next_state); - if (voltage_off_while_idle) - voltctrl |= OMAP3430_SEL_OFF; - prm_set_mod_reg_bits(voltctrl, - OMAP3430_GR_MOD, - OMAP3_PRM_VOLTCTRL_OFFSET); + if (core_next_state == PWRDM_POWER_OFF) { omap3_core_save_context(); omap3_prcm_save_context(); - } else if (core_next_state == PWRDM_POWER_RET) { - prm_set_mod_reg_bits(OMAP3430_AUTO_RET, - OMAP3430_GR_MOD, - OMAP3_PRM_VOLTCTRL_OFFSET); } } @@ -510,18 +502,6 @@ void omap_sram_idle(void) } omap_uart_resume_idle(0); omap_uart_resume_idle(1); - if (core_next_state == PWRDM_POWER_OFF) { - u32 voltctrl = OMAP3430_AUTO_OFF; - - if (voltage_off_while_idle) - voltctrl |= OMAP3430_SEL_OFF; - prm_clear_mod_reg_bits(voltctrl, - OMAP3430_GR_MOD, - OMAP3_PRM_VOLTCTRL_OFFSET); - } else if (core_next_state == PWRDM_POWER_RET) - prm_clear_mod_reg_bits(OMAP3430_AUTO_RET, - OMAP3430_GR_MOD, - OMAP3_PRM_VOLTCTRL_OFFSET); } omap3_intc_resume_idle(); diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c index efa16d4..f4069db 100644 --- a/arch/arm/mach-omap2/voltage.c +++ b/arch/arm/mach-omap2/voltage.c @@ -943,6 +943,47 @@ void __init omap_voltage_init_vc(struct prm_setup_vc *setup_vc) vc_config.off.clksetup = setup_vc->off.clksetup; } +void omap_voltage_vc_update(int core_next_state) +{ + u32 voltctrl = 0; + + /* update voltsetup time */ + if (core_next_state == PWRDM_POWER_OFF) { + voltctrl = OMAP3430_AUTO_OFF; + prm_write_mod_reg(vc_config.off.clksetup, OMAP3430_GR_MOD, + OMAP3_PRM_CLKSETUP_OFFSET); + prm_write_mod_reg((vc_config.off.voltsetup1_vdd2 << + OMAP3430_SETUP_TIME2_SHIFT) | + (vc_config.off.voltsetup1_vdd1 << + OMAP3430_SETUP_TIME1_SHIFT), + OMAP3430_GR_MOD, OMAP3_PRM_VOLTSETUP1_OFFSET); + + if (voltage_off_while_idle) { + voltctrl |= OMAP3430_SEL_OFF; + prm_write_mod_reg(vc_config.off.voltsetup2, + OMAP3430_GR_MOD, + OMAP3_PRM_VOLTSETUP2_OFFSET); + } + + } else if (core_next_state == PWRDM_POWER_RET) { + voltctrl = OMAP3430_AUTO_RET; + prm_write_mod_reg(vc_config.ret.clksetup, OMAP3430_GR_MOD, + OMAP3_PRM_CLKSETUP_OFFSET); + prm_write_mod_reg((vc_config.ret.voltsetup1_vdd2 << + OMAP3430_SETUP_TIME2_SHIFT) | + (vc_config.ret.voltsetup1_vdd1 << + OMAP3430_SETUP_TIME1_SHIFT), + OMAP3430_GR_MOD, OMAP3_PRM_VOLTSETUP1_OFFSET); + + /* clear voltsetup2_reg if sys_off not enabled */ + prm_write_mod_reg(vc_config.ret.voltsetup2, OMAP3430_GR_MOD, + OMAP3_PRM_VOLTSETUP2_OFFSET); + } + + prm_set_mod_reg_bits(voltctrl, OMAP3430_GR_MOD, + OMAP3_PRM_VOLTCTRL_OFFSET); +} + /** * omap_get_voltage_table : API to get the voltage table associated with a * particular voltage domain. diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h index cc2b355..f8462c3 100644 --- a/arch/arm/mach-omap2/voltage.h +++ b/arch/arm/mach-omap2/voltage.h @@ -126,6 +126,7 @@ struct omap_volt_data { void omap_voltageprocessor_enable(int vp_id); void omap_voltageprocessor_disable(int vp_id); void omap_voltage_init_vc(struct prm_setup_vc *setup_vc); +void omap_voltage_vc_update(int core_next_state); void omap_voltage_init(void); int omap_voltage_scale(int vdd, unsigned long target_volt, unsigned long current_volt);