]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Improve WRPLL reference clock readout on HSW/BDW
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 4 Jun 2019 20:09:33 +0000 (23:09 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 12 Jun 2019 11:49:47 +0000 (14:49 +0300)
On non-ULT HSW the "special" WRPLL reference clock select
actually means non-SSC. Take that into account when reading
out the WRPLL state.

Also the non-SSC reference may be either 24MHz or 135MHz,
which we can read out from FUSE_STRAP3. The BDW docs actually
say: "also indicates whether the CPU and PCH are in a single
package or separate packages", so it may be that this is not
actually required and we could just assume 135 MHz (just like
the code already did). But it doesn't really hurt to read this
out as the HSW docs aren't quite so clear.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190604200933.29417-5-ville.syrjala@linux.intel.com
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_ddi.c

index 665dfc177528657b720d4e564ddbaa6e78a32a02..d0c262367f099824d1f0ca0fdbb065b568192f44 100644 (file)
@@ -7514,6 +7514,9 @@ enum {
 #define  ILK_DESKTOP                   (1 << 23)
 #define  HSW_CPU_SSC_ENABLE            (1 << 21)
 
+#define FUSE_STRAP3                    _MMIO(0x42020)
+#define  HSW_REF_CLK_SELECT            (1 << 1)
+
 #define ILK_DSPCLK_GATE_D                      _MMIO(0x42020)
 #define   ILK_VRHUNIT_CLOCK_GATE_DISABLE       (1 << 28)
 #define   ILK_DPFCUNIT_CLOCK_GATE_DISABLE      (1 << 9)
index aa06f1bcea6120b3ca5bf8563a9400106e0e40d8..2fad62099ca5c2ad9cacc229b6202c357430b7d7 100644 (file)
@@ -1231,6 +1231,19 @@ static int hsw_ddi_calc_wrpll_link(struct drm_i915_private *dev_priv,
        wrpll = I915_READ(reg);
        switch (wrpll & WRPLL_REF_MASK) {
        case WRPLL_REF_SPECIAL_HSW:
+               /*
+                * muxed-SSC for BDW.
+                * non-SSC for non-ULT HSW. Check FUSE_STRAP3
+                * for the non-SSC reference frequency.
+                */
+               if (IS_HASWELL(dev_priv) && !IS_HSW_ULT(dev_priv)) {
+                       if (I915_READ(FUSE_STRAP3) & HSW_REF_CLK_SELECT)
+                               refclk = 24;
+                       else
+                               refclk = 135;
+                       break;
+               }
+               /* fall through */
        case WRPLL_REF_PCH_SSC:
                /*
                 * We could calculate spread here, but our checking
@@ -1243,7 +1256,7 @@ static int hsw_ddi_calc_wrpll_link(struct drm_i915_private *dev_priv,
                refclk = 2700;
                break;
        default:
-               WARN(1, "bad wrpll refclk\n");
+               MISSING_CASE(wrpll);
                return 0;
        }