Skip to contentSkip to conversation

drm/i915: add stepping macro

PATCH In review Jesse Barnes 2 participants 4 messages May 21, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/i915: add stepping macro

In some cases to enable or disable features & workarounds, we may need to check the GPU stepping. Add a macro to do that based on caching the PCI revision ID reg.

---
 drivers/gpu/drm/i915/i915_dma.c | 2 ++
 drivers/gpu/drm/i915/i915_drv.h | 2 ++
 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/i915_dma.c +2 -0
index dea455b..9bcbbf2 100644
@@ -1565,6 +1565,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	device_info = (struct intel_device_info *)&dev_priv->info;
 	*device_info = *info;
 
+	pci_read_config_byte(dev->pdev, PCI_REVISION_ID, &dev_priv->stepping);
+
 	spin_lock_init(&dev_priv->irq_lock);
 	spin_lock_init(&dev_priv->gpu_error.lock);
 	spin_lock_init(&dev_priv->backlight_lock);
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 5d5e57d..22d57b8 100644
@@ -1341,6 +1341,7 @@ struct drm_i915_private {
 	struct kmem_cache *slab;
 
 	const struct intel_device_info info;
+	u8 stepping;
 
 	int relative_constants_mode;
 
@@ -1867,6 +1868,7 @@ struct drm_i915_cmd_table {
 };
 
 #define INTEL_INFO(dev)	(&to_i915(dev)->info)
+#define INTEL_STEPPING(dev) (&to_i915(dev)->stepping)
 
 #define IS_I830(dev)		((dev)->pdev->device == 0x3577)
 #define IS_845G(dev)		((dev)->pdev->device == 0x2562)
Signature · 1 line
1.8.4.2
#1 lore raw

PATCH 2/2 drm/i915: use SNB A step FDI values on A step CPUs

More of an example of where to use the stepping macro than anything else. I think these early steppings never went outside of Intel.

---
 drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +15 -2
index bdb4624..828bac5 100644
@@ -2883,6 +2883,13 @@ static void ironlake_fdi_link_train(struct drm_crtc *crtc)
 
 }
 
+static const int snb_a_fdi_train_param[] = {
+	FDI_LINK_TRAIN_400MV_0DB_SNB_A,
+	FDI_LINK_TRAIN_400MV_6DB_SNB_A,
+	FDI_LINK_TRAIN_600MV_3_5DB_SNB_A,
+	FDI_LINK_TRAIN_800MV_0DB_SNB_A,
+};
+
 static const int snb_b_fdi_train_param[] = {
 	FDI_LINK_TRAIN_400MV_0DB_SNB_B,
 	FDI_LINK_TRAIN_400MV_6DB_SNB_B,
@@ -2898,6 +2905,12 @@ static void gen6_fdi_link_train(struct drm_crtc *crtc)
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
 	u32 reg, temp, i, retry;
+	const int *train_param;
+
+	if (INTEL_STEPPING(dev) == 0)
+		train_param = snb_a_fdi_train_param;
+	else
+		train_param = snb_b_fdi_train_param;
 
 	/* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
 	   for train result */
@@ -2943,7 +2956,7 @@ static void gen6_fdi_link_train(struct drm_crtc *crtc)
 		reg = FDI_TX_CTL(pipe);
 		temp = I915_READ(reg);
 		temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK;
-		temp |= snb_b_fdi_train_param[i];
+		temp |= train_param[i];
 		I915_WRITE(reg, temp);
 
 		POSTING_READ(reg);
@@ -2996,7 +3009,7 @@ static void gen6_fdi_link_train(struct drm_crtc *crtc)
 		reg = FDI_TX_CTL(pipe);
 		temp = I915_READ(reg);
 		temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK;
-		temp |= snb_b_fdi_train_param[i];
+		temp |= train_param[i];
 		I915_WRITE(reg, temp);
 
 		POSTING_READ(reg);
Signature · 1 line
1.8.4.2
#2 lore raw
In reply to Jesse Barnes
Quoted 3 lines · Jesse Barnes

In some cases to enable or disable features & workarounds, we may need to check the GPU stepping. Add a macro to do that based on caching the PCI revision ID reg.

What about just using dev->pdev->revision like we already do? -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#3 lore raw
Quoted 6 lines · On Wed, 21 May 2014 19:50:53 +0100 Chris Wilson <[email protected]>…
Quoted 3 lines · Jesse Barnes

In some cases to enable or disable features & workarounds, we may need to check the GPU stepping. Add a macro to do that based on caching the PCI revision ID reg.

What about just using dev->pdev->revision like we already do?

Oh missed that, was looking for stepping comments and didn't see it. Yeah that's fine.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center