ARM: tegra: cpu: enable VDD_CPU rail before LP to G transition
Joseph Lo [Fri, 8 Jun 2012 10:38:53 +0000 (15:38 +0530)]
When doing LP to G transition, it had a power up latency on VDD_CPU
rail. To reduce the latency, CPU_LP can trun on the VDD_CPU rail
before the LP to G transition.

Bug 930985

Change-Id: I087e185ea5aa90f309b8cafba9bc4bb7d3fc950c
Signed-off-by: Joseph Lo <josephl@nvidia.com>
Reviewed-on: http://git-master/r/93141
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Antti Miettinen <amiettinen@nvidia.com>
Tested-by: Antti Miettinen <amiettinen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>

Conflicts:

arch/arm/mach-tegra/pm.c

Rebase-Id: R52e24482c4bf9542ce3669d9ddeddf6445b04c85

arch/arm/mach-tegra/pm.c

index 2721ec9..021f03f 100644 (file)
@@ -139,6 +139,11 @@ struct suspend_context tegra_sctx;
 #define PMC_CPUPWROFF_TIMER    0xcc
 #define PMC_COREPWROFF_TIMER   PMC_WAKE_DELAY
 
+#define PMC_PWRGATE_TOGGLE     0x30
+#define PWRGATE_TOGGLE_START   (1 << 8)
+#define UN_PWRGATE_CPU         \
+       (PWRGATE_TOGGLE_START | TEGRA_CPU_POWERGATE_ID(TEGRA_POWERGATE_CPU))
+
 #ifdef CONFIG_TEGRA_CLUSTER_CONTROL
 #define PMC_SCRATCH4_WAKE_CLUSTER_MASK (1<<31)
 #endif
@@ -512,6 +517,16 @@ unsigned int tegra_idle_lp2_last(unsigned int sleep_time, unsigned int flags)
                trace_cpu_cluster(POWER_CPU_CLUSTER_START);
                set_power_timers(pdata->cpu_timer, 0,
                        clk_get_rate_all_locked(tegra_pclk));
+               if (flags & TEGRA_POWER_CLUSTER_G) {
+                       /*
+                        * To reduce the vdd_cpu up latency when LP->G
+                        * transition. Before the transition, enable
+                        * the vdd_cpu rail.
+                        */
+                       if (is_lp_cluster())
+                               writel(UN_PWRGATE_CPU,
+                                      pmc + PMC_PWRGATE_TOGGLE);
+               }
                tegra_cluster_switch_prolog(mode);
        } else {
                set_power_timers(pdata->cpu_timer, pdata->cpu_off_timer,