drm/i915: populate mem_freq/cz_clock for chv
authorDeepak S <deepak.s@linux.intel.com>
Thu, 10 Jul 2014 07:46:24 +0000 (13:16 +0530)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 11 Jul 2014 16:22:00 +0000 (18:22 +0200)
We need mem_freq or cz clock for freq/opcode conversion

Signed-off-by: Deepak S <deepak.s@linux.intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_pm.c

index 7031757628ffa3b14fd6bbe65e489e8e3b409a77..8620ea91e10825299b6ee6ffcd3a5f3aa65c5d56 100644 (file)
@@ -931,6 +931,7 @@ struct intel_gen6_power_mgmt {
        u8 efficient_freq;      /* AKA RPe. Pre-determined balanced frequency */
        u8 rp1_freq;            /* "less than" RP0 power/freqency */
        u8 rp0_freq;            /* Non-overclocked max frequency. */
+       u32 cz_freq;
 
        u32 ei_interrupt_count;
 
index 2d2c4deb3e873ddde7e79e8164540c43c90f3998..0ebe0f49db2837ae0a3433124c16dc8abd13a441 100644 (file)
@@ -5538,6 +5538,12 @@ enum punit_power_well {
                                                 GEN6_PM_RP_DOWN_THRESHOLD | \
                                                 GEN6_PM_RP_DOWN_TIMEOUT)
 
+#define CHV_CZ_CLOCK_FREQ_MODE_200                     200
+#define CHV_CZ_CLOCK_FREQ_MODE_267                     267
+#define CHV_CZ_CLOCK_FREQ_MODE_320                     320
+#define CHV_CZ_CLOCK_FREQ_MODE_333                     333
+#define CHV_CZ_CLOCK_FREQ_MODE_400                     400
+
 #define GEN7_GT_SCRATCH_BASE                   0x4F100
 #define GEN7_GT_SCRATCH_REG_NUM                        8
 
index 8066ca5e2719143f954bb42a8f4f1f3bd39000c1..32ccd7a9378d594db608c7025134b604bf151d55 100644 (file)
@@ -5700,6 +5700,35 @@ static void valleyview_init_clock_gating(struct drm_device *dev)
 static void cherryview_init_clock_gating(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
+       u32 val;
+
+       mutex_lock(&dev_priv->rps.hw_lock);
+       val = vlv_punit_read(dev_priv, CCK_FUSE_REG);
+       mutex_unlock(&dev_priv->rps.hw_lock);
+       switch ((val >> 2) & 0x7) {
+       case 0:
+       case 1:
+                       dev_priv->rps.cz_freq = CHV_CZ_CLOCK_FREQ_MODE_200;
+                       dev_priv->mem_freq = 1600;
+                       break;
+       case 2:
+                       dev_priv->rps.cz_freq = CHV_CZ_CLOCK_FREQ_MODE_267;
+                       dev_priv->mem_freq = 1600;
+                       break;
+       case 3:
+                       dev_priv->rps.cz_freq = CHV_CZ_CLOCK_FREQ_MODE_333;
+                       dev_priv->mem_freq = 2000;
+                       break;
+       case 4:
+                       dev_priv->rps.cz_freq = CHV_CZ_CLOCK_FREQ_MODE_320;
+                       dev_priv->mem_freq = 1600;
+                       break;
+       case 5:
+                       dev_priv->rps.cz_freq = CHV_CZ_CLOCK_FREQ_MODE_400;
+                       dev_priv->mem_freq = 1600;
+                       break;
+       }
+       DRM_DEBUG_DRIVER("DDR speed: %d MHz", dev_priv->mem_freq);
 
        I915_WRITE(DSPCLK_GATE_D, VRHUNIT_CLOCK_GATE_DISABLE);