aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2013-07-18 17:51:11 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-07-19 02:53:49 -0400
commitf31f2d55eb77190e66cb13e5dd2beca7a91f8dd0 (patch)
treea6a7e0b634bf3868bb2c31171244e5c29488c198 /drivers/gpu/drm/i915/intel_display.c
parent0ff066a9e4a29481226a6d46eab6bd9499aeaddb (diff)
drm/i915: extract FDI mPHY functions from lpt_init_pch_refclk
Because lpt_init_pch_refclk implements the "Sequence to enable CLKOUT_DP for FDI usage and configure PCH FDI I/O", which is very similar to "Sequence to enable CLKOUT_DP" and "Sequence to enable CLKOUT_DP without spread". With the extracted functions we can more easily implement the two missing sequences. v2: Rebase (WaMPhyProgramming:hsw comment). Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c79
1 files changed, 45 insertions, 34 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 46c4dff92900..502610530e35 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5167,41 +5167,9 @@ static void ironlake_init_pch_refclk(struct drm_device *dev)
5167 BUG_ON(val != final); 5167 BUG_ON(val != final);
5168} 5168}
5169 5169
5170/* 5170static void lpt_reset_fdi_mphy(struct drm_i915_private *dev_priv)
5171 * Sequence to enable CLKOUT_DP for FDI usage and configure PCH FDI I/O.
5172 * WaMPhyProgramming:hsw
5173 */
5174static void lpt_init_pch_refclk(struct drm_device *dev)
5175{ 5171{
5176 struct drm_i915_private *dev_priv = dev->dev_private; 5172 uint32_t tmp;
5177 struct drm_mode_config *mode_config = &dev->mode_config;
5178 struct intel_encoder *encoder;
5179 bool has_vga = false;
5180 u32 tmp;
5181
5182 list_for_each_entry(encoder, &mode_config->encoder_list, base.head) {
5183 switch (encoder->type) {
5184 case INTEL_OUTPUT_ANALOG:
5185 has_vga = true;
5186 break;
5187 }
5188 }
5189
5190 if (!has_vga)
5191 return;
5192
5193 mutex_lock(&dev_priv->dpio_lock);
5194
5195 tmp = intel_sbi_read(dev_priv, SBI_SSCCTL, SBI_ICLK);
5196 tmp &= ~SBI_SSCCTL_DISABLE;
5197 tmp |= SBI_SSCCTL_PATHALT;
5198 intel_sbi_write(dev_priv, SBI_SSCCTL, tmp, SBI_ICLK);
5199
5200 udelay(24);
5201
5202 tmp = intel_sbi_read(dev_priv, SBI_SSCCTL, SBI_ICLK);
5203 tmp &= ~SBI_SSCCTL_PATHALT;
5204 intel_sbi_write(dev_priv, SBI_SSCCTL, tmp, SBI_ICLK);
5205 5173
5206 tmp = I915_READ(SOUTH_CHICKEN2); 5174 tmp = I915_READ(SOUTH_CHICKEN2);
5207 tmp |= FDI_MPHY_IOSFSB_RESET_CTL; 5175 tmp |= FDI_MPHY_IOSFSB_RESET_CTL;
@@ -5218,6 +5186,12 @@ static void lpt_init_pch_refclk(struct drm_device *dev)
5218 if (wait_for_atomic_us((I915_READ(SOUTH_CHICKEN2) & 5186 if (wait_for_atomic_us((I915_READ(SOUTH_CHICKEN2) &
5219 FDI_MPHY_IOSFSB_RESET_STATUS) == 0, 100)) 5187 FDI_MPHY_IOSFSB_RESET_STATUS) == 0, 100))
5220 DRM_ERROR("FDI mPHY reset de-assert timeout\n"); 5188 DRM_ERROR("FDI mPHY reset de-assert timeout\n");
5189}
5190
5191/* WaMPhyProgramming:hsw */
5192static void lpt_program_fdi_mphy(struct drm_i915_private *dev_priv)
5193{
5194 uint32_t tmp;
5221 5195
5222 tmp = intel_sbi_read(dev_priv, 0x8008, SBI_MPHY); 5196 tmp = intel_sbi_read(dev_priv, 0x8008, SBI_MPHY);
5223 tmp &= ~(0xFF << 24); 5197 tmp &= ~(0xFF << 24);
@@ -5287,6 +5261,43 @@ static void lpt_init_pch_refclk(struct drm_device *dev)
5287 tmp &= ~(0xF << 28); 5261 tmp &= ~(0xF << 28);
5288 tmp |= (4 << 28); 5262 tmp |= (4 << 28);
5289 intel_sbi_write(dev_priv, 0x21EC, tmp, SBI_MPHY); 5263 intel_sbi_write(dev_priv, 0x21EC, tmp, SBI_MPHY);
5264}
5265
5266/* Sequence to enable CLKOUT_DP for FDI usage and configure PCH FDI I/O. */
5267static void lpt_init_pch_refclk(struct drm_device *dev)
5268{
5269 struct drm_i915_private *dev_priv = dev->dev_private;
5270 struct drm_mode_config *mode_config = &dev->mode_config;
5271 struct intel_encoder *encoder;
5272 bool has_vga = false;
5273 u32 tmp;
5274
5275 list_for_each_entry(encoder, &mode_config->encoder_list, base.head) {
5276 switch (encoder->type) {
5277 case INTEL_OUTPUT_ANALOG:
5278 has_vga = true;
5279 break;
5280 }
5281 }
5282
5283 if (!has_vga)
5284 return;
5285
5286 mutex_lock(&dev_priv->dpio_lock);
5287
5288 tmp = intel_sbi_read(dev_priv, SBI_SSCCTL, SBI_ICLK);
5289 tmp &= ~SBI_SSCCTL_DISABLE;
5290 tmp |= SBI_SSCCTL_PATHALT;
5291 intel_sbi_write(dev_priv, SBI_SSCCTL, tmp, SBI_ICLK);
5292
5293 udelay(24);
5294
5295 tmp = intel_sbi_read(dev_priv, SBI_SSCCTL, SBI_ICLK);
5296 tmp &= ~SBI_SSCCTL_PATHALT;
5297 intel_sbi_write(dev_priv, SBI_SSCCTL, tmp, SBI_ICLK);
5298
5299 lpt_reset_fdi_mphy(dev_priv);
5300 lpt_program_fdi_mphy(dev_priv);
5290 5301
5291 /* ULT uses SBI_GEN0, but ULT doesn't have VGA, so we don't care. */ 5302 /* ULT uses SBI_GEN0, but ULT doesn't have VGA, so we don't care. */
5292 tmp = intel_sbi_read(dev_priv, SBI_DBUFF0, SBI_ICLK); 5303 tmp = intel_sbi_read(dev_priv, SBI_DBUFF0, SBI_ICLK);