drm/i915: Preserve the FDI line reversal override bit on CPT
authorDamien Lespiau <damien.lespiau@intel.com>
Tue, 11 Dec 2012 18:48:29 +0000 (18:48 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 19 Feb 2013 23:21:45 +0000 (00:21 +0100)
The FDI link has supported link reversal to make the PCB layout
engineer's life easier for quite a while and we have always presered
this bit as we programmed FDI_RX_CTL with a read/modify/write sequence.

We're trying to take a bit more control over what the BIOS leaves in
various register and with the introduction of DDI, started to program
FDI_RX_CTL fully.

There's a fused bit to indicate DMI link reversal and FDI defaults to
mirroring that configuration. We have a bit to override that behaviour
that we need to preserve from the BIOS.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Cc: stable@vger.kernel.org
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_crt.c
drivers/gpu/drm/i915/intel_ddi.c

index b1f6a0925b596b47ebde6420f98cde7c26974ab7..e95337c974594d34c936d071975f5040c78754d1 100644 (file)
@@ -1040,7 +1040,7 @@ typedef struct drm_i915_private {
        bool hw_contexts_disabled;
        uint32_t hw_context_size;
 
-       bool fdi_rx_polarity_reversed;
+       u32 fdi_rx_config;
 
        struct i915_suspend_saved_registers regfile;
 
index d7542cd4abfa3fc5e2f3fd47d89bd55823d65cb1..64919eee248b0cd8aa22532d8a3f4ab991fbedcd 100644 (file)
 #define  FDI_10BPC                      (1<<16)
 #define  FDI_6BPC                       (2<<16)
 #define  FDI_12BPC                      (3<<16)
-#define  FDI_LINK_REVERSE_OVERWRITE     (1<<15)
+#define  FDI_RX_LINK_REVERSAL_OVERRIDE  (1<<15)
 #define  FDI_DMI_LINK_REVERSE_MASK      (1<<14)
 #define  FDI_RX_PLL_ENABLE              (1<<13)
 #define  FDI_FS_ERR_CORRECT_ENABLE      (1<<11)
index 68e79f32e10019d994a56932ec80f25a924732ef..cfc96878d74283714255802bcd4f2fe356b55a45 100644 (file)
@@ -801,10 +801,14 @@ void intel_crt_init(struct drm_device *dev)
        dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS;
 
        /*
-        * TODO: find a proper way to discover whether we need to set the
-        * polarity reversal bit or not, instead of relying on the BIOS.
+        * TODO: find a proper way to discover whether we need to set the the
+        * polarity and link reversal bits or not, instead of relying on the
+        * BIOS.
         */
-       if (HAS_PCH_LPT(dev))
-               dev_priv->fdi_rx_polarity_reversed =
-                    !!(I915_READ(_FDI_RXA_CTL) & FDI_RX_POLARITY_REVERSED_LPT);
+       if (HAS_PCH_LPT(dev)) {
+               u32 fdi_config = FDI_RX_POLARITY_REVERSED_LPT |
+                                FDI_RX_LINK_REVERSAL_OVERRIDE;
+
+               dev_priv->fdi_rx_config = I915_READ(_FDI_RXA_CTL) & fdi_config;
+       }
 }
index cedf4ab5ff16228debe97435f86bf694d6af87b2..89bdb1be61e6effcf413887c88c5f4f4bb853edb 100644 (file)
@@ -180,10 +180,8 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)
                                  FDI_RX_TP1_TO_TP2_48 | FDI_RX_FDI_DELAY_90);
 
        /* Enable the PCH Receiver FDI PLL */
-       rx_ctl_val = FDI_RX_PLL_ENABLE | FDI_RX_ENHANCE_FRAME_ENABLE |
-                    ((intel_crtc->fdi_lanes - 1) << 19);
-       if (dev_priv->fdi_rx_polarity_reversed)
-               rx_ctl_val |= FDI_RX_POLARITY_REVERSED_LPT;
+       rx_ctl_val = dev_priv->fdi_rx_config | FDI_RX_ENHANCE_FRAME_ENABLE |
+                    FDI_RX_PLL_ENABLE | ((intel_crtc->fdi_lanes - 1) << 19);
        I915_WRITE(_FDI_RXA_CTL, rx_ctl_val);
        POSTING_READ(_FDI_RXA_CTL);
        udelay(220);