All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: Tero Kristo <tero.kristo@nokia.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH 10/11] OMAP3: PM: Write voltage and clock setup times dynamically in idle loop
Date: Wed, 11 Nov 2009 15:47:19 -0800	[thread overview]
Message-ID: <87tyx0wrnc.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1256313835-2391-11-git-send-email-tero.kristo@nokia.com> (Tero Kristo's message of "Fri\, 23 Oct 2009 19\:03\:54 +0300")

Tero Kristo <tero.kristo@nokia.com> writes:

> From: Tero Kristo <tero.kristo@nokia.com>
>
> It is suggested by TI (SWPA152 February 2009) to write clksetup,
> voltsetup_time1, voltsetup_time2, voltsetup2 dynamically in idle loop.
>
> This allows us to optimize the voltage + clock setup times according to the
> used power save mode.
>
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>

This one needs a refresh against current PM branch, in particular, Rajendra's
changes to the PRM setup code were merged and conflict with this.

Kevin



> ---
>  arch/arm/mach-omap2/pm.h     |   10 ++++-
>  arch/arm/mach-omap2/pm34xx.c |   86 ++++++++++++++++++++++++------------------
>  2 files changed, 57 insertions(+), 39 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> index f8d11a2..b384eb1 100644
> --- a/arch/arm/mach-omap2/pm.h
> +++ b/arch/arm/mach-omap2/pm.h
> @@ -24,12 +24,18 @@ extern int omap3_can_sleep(void);
>  extern int set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
>  extern int omap3_idle_init(void);
>  
> -struct prm_setup_vc {
> +struct prm_setup_times_vc {
>  	u16 clksetup;
>  	u16 voltsetup_time1;
>  	u16 voltsetup_time2;
> -	u16 voltoffset;
>  	u16 voltsetup2;
> +	u16 voltsetup1;
> +};
> +
> +struct prm_setup_vc {
> +	struct prm_setup_times_vc *setup_times;
> +	struct prm_setup_times_vc *setup_times_off;
> +	u16 voltoffset;
>  /* PRM_VC_CMD_VAL_0 specific bits */
>  	u16 vdd0_on;
>  	u16 vdd0_onlp;
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 154cd31..5eb7321 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -82,12 +82,17 @@ static struct powerdomain *mpu_pwrdm, *neon_pwrdm;
>  static struct powerdomain *core_pwrdm, *per_pwrdm;
>  static struct powerdomain *cam_pwrdm;
>  
> -static struct prm_setup_vc prm_setup = {
> +static struct prm_setup_times_vc prm_setup_times_default = {
>  	.clksetup = 0xff,
>  	.voltsetup_time1 = 0xfff,
>  	.voltsetup_time2 = 0xfff,
> -	.voltoffset = 0xff,
>  	.voltsetup2 = 0xff,
> +};
> +
> +static struct prm_setup_vc prm_setup_default = {
> +	.setup_times = &prm_setup_times_default,
> +	.setup_times_off = NULL,
> +	.voltoffset = 0xff,
>  	.vdd0_on = 0x30,	/* 1.2v */
>  	.vdd0_onlp = 0x20,	/* 1.0v */
>  	.vdd0_ret = 0x1e,	/* 0.975v */
> @@ -98,6 +103,8 @@ static struct prm_setup_vc prm_setup = {
>  	.vdd1_off = 0x00,	/* 0.6v */
>  };
>  
> +static struct prm_setup_vc *prm_setup = &prm_setup_default;
> +
>  static inline void omap3_per_save_context(void)
>  {
>  	omap3_gpio_save_context();
> @@ -338,6 +345,16 @@ static void restore_table_entry(void)
>  	restore_control_register(control_reg_value);
>  }
>  
> +static void prm_program_setup_times(struct prm_setup_times_vc *times)
> +{
> +	prm_write_mod_reg(times->voltsetup1, OMAP3430_GR_MOD,
> +			OMAP3_PRM_VOLTSETUP1_OFFSET);
> +	prm_write_mod_reg(times->voltsetup2, OMAP3430_GR_MOD,
> +			OMAP3_PRM_VOLTSETUP2_OFFSET);
> +	prm_write_mod_reg(times->clksetup, OMAP3430_GR_MOD,
> +			OMAP3_PRM_CLKSETUP_OFFSET);
> +}
> +
>  void omap_sram_idle(void)
>  {
>  	/* Variable to tell what needs to be saved and restored
> @@ -422,6 +439,9 @@ void omap_sram_idle(void)
>  					     OMAP3_PRM_VOLTCTRL_OFFSET);
>  			omap3_core_save_context();
>  			omap3_prcm_save_context();
> +			if (prm_setup->setup_times_off != NULL)
> +				prm_program_setup_times(prm_setup->
> +					setup_times_off);
>  		} else if (core_next_state == PWRDM_POWER_RET) {
>  			prm_set_mod_reg_bits(OMAP3430_AUTO_RET,
>  						OMAP3430_GR_MOD,
> @@ -479,11 +499,13 @@ void omap_sram_idle(void)
>  		}
>  		omap_uart_resume_idle(0);
>  		omap_uart_resume_idle(1);
> -		if (core_next_state == PWRDM_POWER_OFF)
> +		if (core_next_state == PWRDM_POWER_OFF) {
>  			prm_clear_mod_reg_bits(OMAP3430_AUTO_OFF,
>  					       OMAP3430_GR_MOD,
>  					       OMAP3_PRM_VOLTCTRL_OFFSET);
> -		else if (core_next_state == PWRDM_POWER_RET)
> +			if (prm_setup->setup_times_off != NULL)
> +				prm_program_setup_times(prm_setup->setup_times);
> +		} else if (core_next_state == PWRDM_POWER_RET)
>  			prm_clear_mod_reg_bits(OMAP3430_AUTO_RET,
>  						OMAP3430_GR_MOD,
>  						OMAP3_PRM_VOLTCTRL_OFFSET);
> @@ -1043,21 +1065,19 @@ int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state)
>  	return -EINVAL;
>  }
>  
> +static void omap3_init_prm_setup_times(struct prm_setup_times_vc *conf)
> +{
> +	if (conf == NULL)
> +		return;
> +
> +	conf->voltsetup1 =
> +		(conf->voltsetup_time2 << OMAP3430_SETUP_TIME2_SHIFT) |
> +		(conf->voltsetup_time1 << OMAP3430_SETUP_TIME1_SHIFT);
> +}
> +
>  void omap3_set_prm_setup_vc(struct prm_setup_vc *setup_vc)
>  {
> -	prm_setup.clksetup = setup_vc->clksetup;
> -	prm_setup.voltsetup_time1 = setup_vc->voltsetup_time1;
> -	prm_setup.voltsetup_time2 = setup_vc->voltsetup_time2;
> -	prm_setup.voltoffset = setup_vc->voltoffset;
> -	prm_setup.voltsetup2 = setup_vc->voltsetup2;
> -	prm_setup.vdd0_on = setup_vc->vdd0_on;
> -	prm_setup.vdd0_onlp = setup_vc->vdd0_onlp;
> -	prm_setup.vdd0_ret = setup_vc->vdd0_ret;
> -	prm_setup.vdd0_off = setup_vc->vdd0_off;
> -	prm_setup.vdd1_on = setup_vc->vdd1_on;
> -	prm_setup.vdd1_onlp = setup_vc->vdd1_onlp;
> -	prm_setup.vdd1_ret = setup_vc->vdd1_ret;
> -	prm_setup.vdd1_off = setup_vc->vdd1_off;
> +	prm_setup = setup_vc;
>  }
>  
>  static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
> @@ -1204,16 +1224,16 @@ static void __init configure_vc(void)
>  			  (R_VDD1_SR_CONTROL << OMAP3430_VOLRA0_SHIFT),
>  			  OMAP3430_GR_MOD, OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET);
>  
> -	prm_write_mod_reg((prm_setup.vdd0_on << OMAP3430_VC_CMD_ON_SHIFT) |
> -		(prm_setup.vdd0_onlp << OMAP3430_VC_CMD_ONLP_SHIFT) |
> -		(prm_setup.vdd0_ret << OMAP3430_VC_CMD_RET_SHIFT) |
> -		(prm_setup.vdd0_off << OMAP3430_VC_CMD_OFF_SHIFT),
> +	prm_write_mod_reg((prm_setup->vdd0_on << OMAP3430_VC_CMD_ON_SHIFT) |
> +		(prm_setup->vdd0_onlp << OMAP3430_VC_CMD_ONLP_SHIFT) |
> +		(prm_setup->vdd0_ret << OMAP3430_VC_CMD_RET_SHIFT) |
> +		(prm_setup->vdd0_off << OMAP3430_VC_CMD_OFF_SHIFT),
>  		OMAP3430_GR_MOD, OMAP3_PRM_VC_CMD_VAL_0_OFFSET);
>  
> -	prm_write_mod_reg((prm_setup.vdd1_on << OMAP3430_VC_CMD_ON_SHIFT) |
> -		(prm_setup.vdd1_onlp << OMAP3430_VC_CMD_ONLP_SHIFT) |
> -		(prm_setup.vdd1_ret << OMAP3430_VC_CMD_RET_SHIFT) |
> -		(prm_setup.vdd1_off << OMAP3430_VC_CMD_OFF_SHIFT),
> +	prm_write_mod_reg((prm_setup->vdd1_on << OMAP3430_VC_CMD_ON_SHIFT) |
> +		(prm_setup->vdd1_onlp << OMAP3430_VC_CMD_ONLP_SHIFT) |
> +		(prm_setup->vdd1_ret << OMAP3430_VC_CMD_RET_SHIFT) |
> +		(prm_setup->vdd1_off << OMAP3430_VC_CMD_OFF_SHIFT),
>  		OMAP3430_GR_MOD, OMAP3_PRM_VC_CMD_VAL_1_OFFSET);
>  
>  	prm_write_mod_reg(OMAP3430_CMD1 | OMAP3430_RAV1, OMAP3430_GR_MOD,
> @@ -1224,19 +1244,11 @@ static void __init configure_vc(void)
>  			  OMAP3_PRM_VC_I2C_CFG_OFFSET);
>  
>  	/* Write setup times */
> -	prm_write_mod_reg(prm_setup.clksetup, OMAP3430_GR_MOD,
> -			OMAP3_PRM_CLKSETUP_OFFSET);
> -	prm_write_mod_reg((prm_setup.voltsetup_time2 <<
> -			OMAP3430_SETUP_TIME2_SHIFT) |
> -			(prm_setup.voltsetup_time1 <<
> -			OMAP3430_SETUP_TIME1_SHIFT),
> -			OMAP3430_GR_MOD, OMAP3_PRM_VOLTSETUP1_OFFSET);
> -
> -	prm_write_mod_reg(prm_setup.voltoffset, OMAP3430_GR_MOD,
> +	omap3_init_prm_setup_times(prm_setup->setup_times);
> +	omap3_init_prm_setup_times(prm_setup->setup_times_off);
> +	prm_program_setup_times(prm_setup->setup_times);
> +	prm_write_mod_reg(prm_setup->voltoffset, OMAP3430_GR_MOD,
>  			OMAP3_PRM_VOLTOFFSET_OFFSET);
> -	prm_write_mod_reg(prm_setup.voltsetup2, OMAP3430_GR_MOD,
> -			OMAP3_PRM_VOLTSETUP2_OFFSET);
> -
>  	pm_dbg_regset_init(1);
>  	pm_dbg_regset_init(2);
>  }
> -- 
> 1.5.4.3
>
> --
> 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

  parent reply	other threads:[~2009-11-11 23:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-23 16:03 [PATCHv2 0/11] Misc fixes [for PM branch] Tero Kristo
2009-10-23 16:03 ` [PATCH 01/11] OMAP3: PM: Fixed padconf save done check Tero Kristo
2009-10-23 16:03   ` [PATCH 02/11] OMAP3: Disable Smartreflex before pwrdm enters RET Tero Kristo
2009-10-23 16:03     ` [PATCH 03/11] OMAP2/3: DMTIMER: Clear pending interrupts when stopping a timer Tero Kristo
2009-10-23 16:03       ` [PATCH 04/11] OMAP3: PM: Ack pending interrupts before entering suspend Tero Kristo
2009-10-23 16:03         ` [PATCH 05/11] OMAP3: PM: Enable system control module autoidle Tero Kristo
2009-10-23 16:03           ` [PATCH 06/11] OMAP3: PM: Disable interrupt controller AUTOIDLE before WFI Tero Kristo
2009-10-23 16:03             ` [PATCH 07/11] OMAP3: Fixed ARM aux ctrl register save/restore Tero Kristo
2009-10-23 16:03               ` [PATCH 08/11] OMAP3: PM: Disabled I2C4 repeated start operation mode Tero Kristo
2009-10-23 16:03                 ` [PATCH 09/11] OMAP3: PM: Added support for L2 aux ctrl register save and restore Tero Kristo
2009-10-23 16:03                   ` [PATCH 10/11] OMAP3: PM: Write voltage and clock setup times dynamically in idle loop Tero Kristo
2009-10-23 16:03                     ` [PATCH 11/11] OMAP3: PM: Disable OTG autoidle when waking up from off-mode Tero Kristo
2009-11-11 23:42                       ` Kevin Hilman
2009-11-12  6:24                         ` Gadiyar, Anand
2009-11-12  7:43                           ` Gadiyar, Anand
2009-11-12  9:42                           ` Tero.Kristo
2009-11-12 15:10                           ` Kevin Hilman
2009-11-11 23:47                     ` Kevin Hilman [this message]
2009-11-11 23:44                   ` [PATCH 09/11] OMAP3: PM: Added support for L2 aux ctrl register save and restore Kevin Hilman
2009-11-12  8:40                     ` Tero.Kristo
2009-11-11 23:30                 ` [PATCH 08/11] OMAP3: PM: Disabled I2C4 repeated start operation mode Kevin Hilman
2009-11-12  9:40                   ` Tero.Kristo
2009-10-28  9:31               ` [PATCH 07/11] OMAP3: Fixed ARM aux ctrl register save/restore Gopinath, Thara
2009-10-28 10:54                 ` Tero.Kristo
2009-10-28 11:02                   ` Gopinath, Thara
2009-11-11 23:27               ` Kevin Hilman
2009-11-12  8:39                 ` Tero.Kristo
2009-11-12  9:49                 ` Gopinath, Thara
2009-11-12 15:20                   ` Kevin Hilman
2009-11-11 23:23             ` [PATCH 06/11] OMAP3: PM: Disable interrupt controller AUTOIDLE before WFI Kevin Hilman
2009-11-11 23:19         ` [PATCH 04/11] OMAP3: PM: Ack pending interrupts before entering suspend Kevin Hilman
2009-11-11 23:18       ` [PATCH 03/11] OMAP2/3: DMTIMER: Clear pending interrupts when stopping a timer Kevin Hilman
2009-11-11 23:17     ` [PATCH 02/11] OMAP3: Disable Smartreflex before pwrdm enters RET Kevin Hilman
2009-11-11 23:16   ` [PATCH 01/11] OMAP3: PM: Fixed padconf save done check Kevin Hilman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tyx0wrnc.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=tero.kristo@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.