ARM: tegra14: clock: Update EMC suspend configuration
Alex Frid [Sat, 15 Jun 2013 03:41:53 +0000 (20:41 -0700)]
- Set EMC suspend rate to minimum requested by base-band controller
- Specify LP1BB voltage level based on EMC suspend rate (will actually
be set by LP1BB entry code)

Bug 1300939

Change-Id: Ida480539b5a71e13bfd8d00bb19724f4f85927e6
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/240305
(cherry picked from commit 4777a040200d582b318ccb247299ddcd4675ac5d)
Reviewed-on: http://git-master/r/262031
GVS: Gerrit_Virtual_Submit
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>

arch/arm/mach-tegra/pm.c
arch/arm/mach-tegra/pm.h
arch/arm/mach-tegra/tegra14_clocks.c

index 6af2e54..352ff07 100644 (file)
@@ -1723,6 +1723,22 @@ void tegra_lp1bb_suspend_emc_rate(unsigned long emc_min, unsigned long emc_max)
        pdata->lp1bb_emc_rate_max = emc_max;
 }
 
+void tegra_lp1bb_suspend_mv_set(int mv)
+{
+       if (WARN_ON_ONCE(!pdata))
+               return;
+
+       pdata->lp1bb_core_volt_min = mv;
+}
+
+unsigned long tegra_lp1bb_emc_min_rate_get(void)
+{
+       if (WARN_ON_ONCE(!pdata) || !pdata->lp1bb_emc_rate_min)
+               return 204000000;
+
+       return pdata->lp1bb_emc_rate_min;
+}
+
 unsigned long debug_uart_port_base = 0;
 EXPORT_SYMBOL(debug_uart_port_base);
 
index bccbde1..8197f18 100644 (file)
@@ -117,6 +117,8 @@ int tegra_suspend_dram(enum tegra_suspend_mode mode, unsigned int flags);
 int tegra_is_lp1_suspend_mode(void);
 #endif
 void tegra_lp1bb_suspend_emc_rate(unsigned long emc_min, unsigned long emc_max);
+void tegra_lp1bb_suspend_mv_set(int mv);
+unsigned long tegra_lp1bb_emc_min_rate_get(void);
 
 #ifdef CONFIG_ARCH_TEGRA_14x_SOC
 #define FLOW_CTRL_CLUSTER_CONTROL \
index 3f0a220..9f26d0a 100644 (file)
@@ -4290,11 +4290,16 @@ static int emc_bus_set_rate(struct clk *bus, unsigned long rate)
 
 static int tegra14_clk_emc_suspend(struct clk *c, u32 *ctx)
 {
-       unsigned long rate;
+       int mv;
+       unsigned long rate = tegra_lp1bb_emc_min_rate_get();
        unsigned long old_rate = clk_get_rate_all_locked(c);
        *ctx = old_rate;
 
-       rate = 204000000; /* FIXME: rate from suspend structure */
+       rate = tegra14_emc_clk_round_rate(c, rate);
+
+       mv = tegra_dvfs_predict_millivolts(c, rate);
+       tegra_lp1bb_suspend_mv_set(mv);
+       pr_debug("EMC voltage requested before suspend: %d\n", mv);
 
        if (rate == old_rate)
                return 0;