arm: tegra: la: restore la and ptsa during resume
Krishna Reddy [Fri, 15 Feb 2013 19:50:55 +0000 (11:50 -0800)]
resore la and ptsa to boot values during resume.
remove unnecessary code.

Change-Id: Ib7c3e9b0627572620fa4df08967da18d7473baa8
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/201250
Reviewed-by: Mrutyunjay Sawant <msawant@nvidia.com>
Tested-by: Mrutyunjay Sawant <msawant@nvidia.com>

arch/arm/mach-tegra/latency_allowance.c
arch/arm/mach-tegra/tegra11x_la.c

index 5e54eed..17ee896 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/spinlock.h>
 #include <linux/stringify.h>
 #include <linux/clk.h>
+#include <linux/syscore_ops.h>
 #include <asm/bug.h>
 #include <asm/io.h>
 #include <asm/string.h>
@@ -246,7 +247,40 @@ static int __init tegra_latency_allowance_debugfs_init(void)
        return 0;
 }
 
-late_initcall(tegra_latency_allowance_debugfs_init);
+static int tegra_la_suspend(void)
+{
+       return 0;
+}
+
+static void tegra_la_resume(void)
+{
+       int i;
+
+       for (i = 0; i < cs.la_info_array_size; i++) {
+               if (cs.la_info_array[i].init_la)
+                       set_la(&cs.la_info_array[i],
+                               cs.la_info_array[i].init_la);
+       }
+#if defined(CONFIG_ARCH_TEGRA_3x_SOC)
+       tegra_set_latency_allowance(TEGRA_LA_G2PR, 20);
+       tegra_set_latency_allowance(TEGRA_LA_G2SR, 20);
+       tegra_set_latency_allowance(TEGRA_LA_G2DR, 20);
+       tegra_set_latency_allowance(TEGRA_LA_G2DW, 20);
+#endif
+       if (cs.init_ptsa)
+               cs.init_ptsa();
+}
+
+static struct syscore_ops tegra_la_syscore_ops = {
+       .suspend = tegra_la_suspend,
+       .resume = tegra_la_resume,
+};
+
+static __init int tegra_la_syscore_init(void)
+{
+       register_syscore_ops(&tegra_la_syscore_ops);
+       return 0;
+}
 
 static int __init tegra_latency_allowance_init(void)
 {
@@ -274,6 +308,8 @@ static int __init tegra_latency_allowance_init(void)
        return 0;
 }
 
+late_initcall(tegra_latency_allowance_debugfs_init);
+subsys_initcall(tegra_la_syscore_init);
 core_initcall(tegra_latency_allowance_init);
 
 #if TEST_LA_CODE
index 1c17b91..5a34ece 100644 (file)
@@ -263,14 +263,6 @@ static void t11x_init_ptsa(void)
        writel(0x01, T11X_MC_RA(SMMU_SMMU_PTSA_MIN_0));
        writel(0x01, T11X_MC_RA(SMMU_SMMU_PTSA_MAX_0));
 
-       writel(0x00, T11X_MC_RA(R0_DIS_PTSA_RATE_0));
-       writel(0x3f, T11X_MC_RA(R0_DIS_PTSA_MIN_0));
-       writel(0x3f, T11X_MC_RA(R0_DIS_PTSA_MAX_0));
-
-       writel(0x00, T11X_MC_RA(R0_DISB_PTSA_RATE_0));
-       writel(0x3f, T11X_MC_RA(R0_DISB_PTSA_MIN_0));
-       writel(0x3f, T11X_MC_RA(R0_DISB_PTSA_MAX_0));
-
        ring1_rate = readl(T11X_MC_RA(DIS_PTSA_RATE_0)) +
                     readl(T11X_MC_RA(DISB_PTSA_RATE_0)) +
                     readl(T11X_MC_RA(VE_PTSA_RATE_0)) +