linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 04/11] ARM: OMAP3: Fix voltage control for deeper idle states
Date: Fri, 11 Apr 2014 08:14:45 -0700	[thread overview]
Message-ID: <20140411151445.GA5350@atomide.com> (raw)
In-Reply-To: <1397173639-29587-5-git-send-email-tony@atomide.com>

* Tony Lindgren <tony@atomide.com> [140410 16:52]:
> @@ -220,8 +220,18 @@ static inline u32 omap_usec_to_32k(u32 usec)
>  	return DIV_ROUND_UP_ULL(32768ULL * (u64)usec, 1000000ULL);
>  }
>  
> +struct omap3_vc_config {
> +	u32 clksetup;
> +	u32 voltsetup1;
> +	u32 voltsetup2;
> +	u32 voltctrl;
> +};

It seems we can keep just voltsetup1 and voltsetup2 here. The
others need to be initialized just once it seems.

>  static void omap3_set_off_timings(struct voltagedomain *voltdm)
>  {
> +	struct omap3_vc_config *c = omap3_vc_timings;
> +	u32 tstart, tshut, voltoffset;
> +
> +	if (c->clksetup)
> +		return;
> +
> +	omap_pm_get_oscillator(&tstart, &tshut);
> +	if (tstart == ULONG_MAX) {
> +		pr_debug("PM: oscillator start-up time not initialized, using 10ms\n");
> +		c->clksetup = omap_usec_to_32k(10000);
> +	} else {
> +		c->clksetup = omap_usec_to_32k(tstart);
> +	}
> +
> +	/*
> +	 * For twl4030 errata 27, we need to allow minimum ~488.32 us wait to
> +	 * switch from HFCLKIN to internal oscillator. That means timings
> +	 * have voltoffset fixed to 0xa in rounded up 32 KiHz cycles. And
> +	 * that means we can calculate the value based on the oscillator
> +	 * start-up time since voltoffset2 = clksetup - voltoffset.
> +	 */
> +	voltoffset = omap_usec_to_32k(488);
> +	c->voltsetup2 = c->clksetup - voltoffset;
> +	voltdm->write(voltoffset, OMAP3_PRM_VOLTOFFSET_OFFSET);

And here we're missing a write to clksetup, without that the off idle
timings are not correct.. Below is an incremental diff on top of this
patch.

Regards,

Tony

8< -------------------------------
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -221,10 +221,8 @@ static inline u32 omap_usec_to_32k(u32 usec)
 }
 
 struct omap3_vc_config {
-	u32 clksetup;
 	u32 voltsetup1;
 	u32 voltsetup2;
-	u32 voltctrl;
 };
 
 static struct omap3_vc_config omap3_vc_timings[2];
@@ -368,17 +366,17 @@ static void omap3_set_i2c_timings(struct voltagedomain *voltdm)
 static void omap3_set_off_timings(struct voltagedomain *voltdm)
 {
 	struct omap3_vc_config *c = omap3_vc_timings;
-	u32 tstart, tshut, voltoffset;
+	u32 tstart, tshut, clksetup, voltoffset;
 
-	if (c->clksetup)
+	if (c->voltsetup2)
 		return;
 
 	omap_pm_get_oscillator(&tstart, &tshut);
 	if (tstart == ULONG_MAX) {
 		pr_debug("PM: oscillator start-up time not initialized, using 10ms\n");
-		c->clksetup = omap_usec_to_32k(10000);
+		clksetup = omap_usec_to_32k(10000);
 	} else {
-		c->clksetup = omap_usec_to_32k(tstart);
+		clksetup = omap_usec_to_32k(tstart);
 	}
 
 	/*
@@ -389,7 +387,8 @@ static void omap3_set_off_timings(struct voltagedomain *voltdm)
 	 * start-up time since voltoffset2 = clksetup - voltoffset.
 	 */
 	voltoffset = omap_usec_to_32k(488);
-	c->voltsetup2 = c->clksetup - voltoffset;
+	c->voltsetup2 = clksetup - voltoffset;
+	voltdm->write(clksetup, OMAP3_PRM_CLKSETUP_OFFSET);
 	voltdm->write(voltoffset, OMAP3_PRM_VOLTOFFSET_OFFSET);
 }
 

  reply	other threads:[~2014-04-11 15:14 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-10 23:47 [PATCH 00/11] Fixes for omap PM for making omap3 DT only Tony Lindgren
2014-04-10 23:47 ` [PATCH 01/11] ARM: OMAP3: PM: remove access to PRM_VOLTCTRL register Tony Lindgren
2014-04-10 23:47 ` [PATCH 02/11] ARM: OMAP3: Fix idle mode signaling for sys_clkreq and sys_off_mode Tony Lindgren
2014-04-12  8:57   ` Tero Kristo
2014-04-12 15:02     ` Tony Lindgren
2014-04-23  7:51       ` Tero Kristo
2014-04-23 20:49         ` Tony Lindgren
2014-05-07 16:34           ` Tony Lindgren
2014-04-14 22:51   ` Grazvydas Ignotas
2014-04-15 22:56     ` Tony Lindgren
2014-04-16 13:58       ` Grazvydas Ignotas
2014-04-18 17:48         ` Tony Lindgren
2014-04-10 23:47 ` [PATCH 03/11] ARM: OMAP3: Disable broken omap3_set_off_timings function Tony Lindgren
2014-04-10 23:47 ` [PATCH 04/11] ARM: OMAP3: Fix voltage control for deeper idle states Tony Lindgren
2014-04-11 15:14   ` Tony Lindgren [this message]
2014-05-07 16:38     ` Tony Lindgren
2014-04-10 23:47 ` [PATCH 05/11] ARM: dts: Configure omap3 twl4030 I2C4 pins by default Tony Lindgren
2014-04-10 23:47 ` [PATCH 06/11] ARM: OMAP2+: Fix voltage scaling init for device tree Tony Lindgren
2014-05-19 17:50   ` Joachim Eastwood
2014-05-19 18:01     ` Tony Lindgren
2014-05-19 18:32       ` Nishanth Menon
2014-05-19 18:48         ` Joachim Eastwood
2014-05-19 18:52           ` Nishanth Menon
2014-05-19 20:23         ` Tony Lindgren
2014-04-10 23:47 ` [PATCH 07/11] ARM: dts: Enable N900 keybaord sleep leds by default Tony Lindgren
2014-04-11  0:23   ` Tony Lindgren
2014-04-11 23:31   ` Aaro Koskinen
2014-04-23 21:07     ` Tony Lindgren
2014-04-10 23:47 ` [PATCH 08/11] ARM: dts: Fix omap serial wake-up when booted with device tree Tony Lindgren
2014-04-10 23:47 ` [PATCH 09/11] ARM: OMAP2+: Enable CPUidle in omap2plus_defconfig Tony Lindgren
2014-04-10 23:47 ` [PATCH 10/11] mfd: twl-core: Fix idle mode signaling for omaps when booted with device tree Tony Lindgren
2014-04-17  8:00   ` Lee Jones
2014-04-17 15:37     ` Tony Lindgren
2014-04-23 14:46       ` [GIT PULL] arm: omap: Immutable branch between MFD and ARM OMAP due for the v3.16 merge-window Lee Jones
2014-04-23 20:41         ` Tony Lindgren
2014-04-10 23:47 ` [PATCH 11/11] pinctrl: single: Clear pin interrupts enabled by bootloader Tony Lindgren
2014-04-22 11:54   ` Linus Walleij
2014-04-22 16:10     ` Tony Lindgren
2014-04-23 13:57       ` Linus Walleij
2014-04-11 20:47 ` [PATCH 00/11] Fixes for omap PM for making omap3 DT only Sebastian Reichel
2014-04-11 21:04   ` Tony Lindgren

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=20140411151445.GA5350@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).