ARM: tegra11: clock: Allow EMC backup if scaling disabled
Alex Frid [Fri, 15 Mar 2013 01:47:18 +0000 (18:47 -0700)]
Re-arranged EMC backup procedure so that backup is allowed even if
EMC scaling is disabled. This is necessary to re-lock main EMC pll
at maximum rate. Without backup, EMC may stuck at rates lower than
maximum while scaling is disabled.

Change-Id: Ie7f7b481d077c1f696d3cd42f3786300fd96fc80
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/209824
(cherry picked from commit e3b9703d8491d8ab24af763a5a70d361125eac92)
Reviewed-on: http://git-master/r/212363
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>

arch/arm/mach-tegra/tegra11_clocks.c
arch/arm/mach-tegra/tegra11_emc.c

index c853385..7f271fc 100644 (file)
@@ -4528,15 +4528,24 @@ static int tegra11_clk_emc_bus_update(struct clk *bus)
                                return -EINVAL;
                        }
 
-                       if (backup_rate < old_rate) /* skip lowering voltage */
-                               bus->auto_dvfs = false;
-                       ret = clk_set_rate_locked(bus, backup_rate);
-                       bus->auto_dvfs = true;
+                       /* set volatge for backup rate if going up */
+                       if (backup_rate > old_rate) {
+                               ret = tegra_dvfs_set_rate(bus, backup_rate);
+                               if (ret) {
+                                       pr_err("%s: dvfs failed on %s rate %lu\n",
+                                             __func__, bus->name, backup_rate);
+                                       return -EINVAL;
+                               }
+                       }
+
+                       trace_clock_set_rate(bus->name, backup_rate, 0);
+                       ret = bus->ops->set_rate(bus, backup_rate);
                        if (ret) {
                                pr_err("%s: Failed to backup %s for rate %lu\n",
                                       __func__, bus->name, rate);
                                return -EINVAL;
                        }
+                       clk_rate_change_notify(bus, backup_rate);
                }
                if (p->refcnt) {
                        pr_err("%s: %s has other than emc child\n",
index ca8fe33..3a00e6f 100644 (file)
@@ -824,7 +824,7 @@ bool tegra_emc_is_parent_ready(unsigned long rate, struct clk **parent,
        struct clk *p = NULL;
        unsigned long p_rate = 0;
 
-       if (!tegra_emc_table || !emc_enable)
+       if (!tegra_emc_table)
                return true;
 
        pr_debug("%s: %lu\n", __func__, rate);