drm/i915/pch: Cosmetic fix to FDI link training
authorAdam Jackson <ajax@redhat.com>
Fri, 25 Jun 2010 19:32:14 +0000 (15:32 -0400)
committerEric Anholt <eric@anholt.net>
Mon, 2 Aug 2010 02:03:47 +0000 (19:03 -0700)
Unmask the bits for link training reporting before starting link
training.  If stage 1 training finished before we unmask them, then we'd
spin around in a loop a few times until smashing on through.  Which is
harmless, since training _did_ succeed, it just looks ugly in dmesg.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/intel_display.c

index 7e57eaba5e256941db72276af9c529a6ff0968cd..f67c74a25264a7c31568c9ace2450f6cc16d8aa6 100644 (file)
@@ -1604,6 +1604,15 @@ static void ironlake_fdi_link_train(struct drm_crtc *crtc)
        int fdi_rx_imr_reg = (pipe == 0) ? FDI_RXA_IMR : FDI_RXB_IMR;
        u32 temp, tries = 0;
 
+       /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
+          for train result */
+       temp = I915_READ(fdi_rx_imr_reg);
+       temp &= ~FDI_RX_SYMBOL_LOCK;
+       temp &= ~FDI_RX_BIT_LOCK;
+       I915_WRITE(fdi_rx_imr_reg, temp);
+       I915_READ(fdi_rx_imr_reg);
+       udelay(150);
+
        /* enable CPU FDI TX and PCH FDI RX */
        temp = I915_READ(fdi_tx_reg);
        temp |= FDI_TX_ENABLE;
@@ -1621,16 +1630,7 @@ static void ironlake_fdi_link_train(struct drm_crtc *crtc)
        I915_READ(fdi_rx_reg);
        udelay(150);
 
-       /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
-          for train result */
-       temp = I915_READ(fdi_rx_imr_reg);
-       temp &= ~FDI_RX_SYMBOL_LOCK;
-       temp &= ~FDI_RX_BIT_LOCK;
-       I915_WRITE(fdi_rx_imr_reg, temp);
-       I915_READ(fdi_rx_imr_reg);
-       udelay(150);
-
-       for (;;) {
+       for (tries = 0; tries < 5; tries++) {
                temp = I915_READ(fdi_rx_iir_reg);
                DRM_DEBUG_KMS("FDI_RX_IIR 0x%x\n", temp);
 
@@ -1640,14 +1640,9 @@ static void ironlake_fdi_link_train(struct drm_crtc *crtc)
                                   temp | FDI_RX_BIT_LOCK);
                        break;
                }
-
-               tries++;
-
-               if (tries > 5) {
-                       DRM_DEBUG_KMS("FDI train 1 fail!\n");
-                       break;
-               }
        }
+       if (tries == 5)
+               DRM_DEBUG_KMS("FDI train 1 fail!\n");
 
        /* Train 2 */
        temp = I915_READ(fdi_tx_reg);
@@ -1663,7 +1658,7 @@ static void ironlake_fdi_link_train(struct drm_crtc *crtc)
 
        tries = 0;
 
-       for (;;) {
+       for (tries = 0; tries < 5; tries++) {
                temp = I915_READ(fdi_rx_iir_reg);
                DRM_DEBUG_KMS("FDI_RX_IIR 0x%x\n", temp);
 
@@ -1673,14 +1668,9 @@ static void ironlake_fdi_link_train(struct drm_crtc *crtc)
                        DRM_DEBUG_KMS("FDI train 2 done.\n");
                        break;
                }
-
-               tries++;
-
-               if (tries > 5) {
-                       DRM_DEBUG_KMS("FDI train 2 fail!\n");
-                       break;
-               }
        }
+       if (tries == 5)
+               DRM_DEBUG_KMS("FDI train 2 fail!\n");
 
        DRM_DEBUG_KMS("FDI train done\n");
 }
@@ -1705,6 +1695,15 @@ static void gen6_fdi_link_train(struct drm_crtc *crtc)
        int fdi_rx_imr_reg = (pipe == 0) ? FDI_RXA_IMR : FDI_RXB_IMR;
        u32 temp, i;
 
+       /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
+          for train result */
+       temp = I915_READ(fdi_rx_imr_reg);
+       temp &= ~FDI_RX_SYMBOL_LOCK;
+       temp &= ~FDI_RX_BIT_LOCK;
+       I915_WRITE(fdi_rx_imr_reg, temp);
+       I915_READ(fdi_rx_imr_reg);
+       udelay(150);
+
        /* enable CPU FDI TX and PCH FDI RX */
        temp = I915_READ(fdi_tx_reg);
        temp |= FDI_TX_ENABLE;
@@ -1730,15 +1729,6 @@ static void gen6_fdi_link_train(struct drm_crtc *crtc)
        I915_READ(fdi_rx_reg);
        udelay(150);
 
-       /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
-          for train result */
-       temp = I915_READ(fdi_rx_imr_reg);
-       temp &= ~FDI_RX_SYMBOL_LOCK;
-       temp &= ~FDI_RX_BIT_LOCK;
-       I915_WRITE(fdi_rx_imr_reg, temp);
-       I915_READ(fdi_rx_imr_reg);
-       udelay(150);
-
        for (i = 0; i < 4; i++ ) {
                temp = I915_READ(fdi_tx_reg);
                temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK;