ARM: tegra: clock: Update EMC clock change procedure
Alex Frid [Tue, 15 Nov 2011 03:25:18 +0000 (19:25 -0800)]
Set MC arbiter limits before EMC clock change on Tegra3.

Bug 896654

Signed-off-by: Alex Frid <afrid@nvidia.com>
(cherry picked from commit 16f545012457a04ba38f4f8bf80646b18a74cb2f)
(cherry picked from commit bd29cb18f1d26cc3a0fdc8933a08158d623fed58)

Change-Id: I080f21030007909bece5272ccdb93f8a85d4b13b
Reviewed-on: http://git-master/r/66515
Tested-by: Aleksandr Frid <afrid@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>

Rebase-Id: R0561570b37cdff800f0a7f71558eef16eb82cc59

arch/arm/mach-tegra/tegra3_emc.c
arch/arm/mach-tegra/tegra3_emc.h

index 43336f5..81f5ddc 100644 (file)
@@ -279,6 +279,20 @@ static inline void auto_cal_disable(void)
        }
 }
 
+static inline void set_mc_arbiter_limits(void)
+{
+       u32 reg = mc_readl(MC_EMEM_ARB_OUTSTANDING_REQ);
+       u32 max_val = 0x50 << EMC_MRS_WAIT_CNT_SHORT_WAIT_SHIFT;
+
+       if (!(reg & MC_EMEM_ARB_OUTSTANDING_REQ_HOLDOFF_OVERRIDE) ||
+           ((reg & MC_EMEM_ARB_OUTSTANDING_REQ_MAX_MASK) > max_val)) {
+               reg = MC_EMEM_ARB_OUTSTANDING_REQ_LIMIT_ENABLE |
+                       MC_EMEM_ARB_OUTSTANDING_REQ_HOLDOFF_OVERRIDE | max_val;
+               mc_writel(reg, MC_EMEM_ARB_OUTSTANDING_REQ);
+               mc_writel(0x1, MC_TIMING_CONTROL);
+       }
+}
+
 static inline bool dqs_preset(const struct tegra_emc_table *next_timing,
                              const struct tegra_emc_table *last_timing)
 {
@@ -456,6 +470,11 @@ static noinline void emc_set_clock(const struct tegra_emc_table *next_timing,
                emc_writel(emc_cfg_reg, EMC_CFG);
                pre_wait = 5;           /* 5us+ for self-refresh entry/exit */
        }
+
+       /* 2.25 update MC arbiter settings */
+       set_mc_arbiter_limits();
+
+       /* 2.5 check dq/dqs vref delay */
        if (dqs_preset(next_timing, last_timing)) {
                if (pre_wait < 3)
                        pre_wait = 3;   /* 3us+ for dqs vref settled */
index abd4094..056ebc6 100644 (file)
@@ -226,6 +226,11 @@ enum {
 #define MC_EMEM_ADR_CFG                                0x54
 #define MC_EMEM_ARB_CFG                                0x90
 #define MC_EMEM_ARB_OUTSTANDING_REQ            0x94
+#define MC_EMEM_ARB_OUTSTANDING_REQ_MAX_SHIFT  0
+#define MC_EMEM_ARB_OUTSTANDING_REQ_MAX_MASK   \
+       (0x1FF << MC_EMEM_ARB_OUTSTANDING_REQ_MAX_SHIFT)
+#define MC_EMEM_ARB_OUTSTANDING_REQ_HOLDOFF_OVERRIDE   (0x1 << 30)
+#define MC_EMEM_ARB_OUTSTANDING_REQ_LIMIT_ENABLE       (0x1 << 31)
 #define MC_EMEM_ARB_TIMING_RCD                 0x98
 #define MC_EMEM_ARB_TIMING_RP                  0x9c
 #define MC_EMEM_ARB_TIMING_RC                  0xa0