[PATCH 4/4] drm/i915: Implement GPU reset for g33

ville.syrjala
2014-05-19T19:25:38Z

g33 seems to sit somewhere between the 915/945/965 style and the
g4x style. The bits look like g4x, but we still need to do a full
reset including display.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/i915_drv.c | 3 +--
drivers/gpu/drm/i915/intel_uncore.c | 10 +++++++++-
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 187f42c..b44cdb3 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -794,8 +794,7 @@ int i915_reset(struct drm_device *dev)
if (INTEL_INFO(dev)->gen > 5)
intel_reset_gt_powersave(dev);

- if ((IS_GEN3(dev) && !IS_G33(dev)) ||
- (IS_GEN4(dev) && !IS_G4X(dev))) {
+ if (IS_GEN3(dev) || (IS_GEN4(dev) && !IS_G4X(dev))) {
intel_init_clock_gating(dev);

drm_modeset_lock_all(dev);
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index a043baf..de2d708 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -980,6 +980,14 @@ static int g4x_reset_complete(struct drm_device *dev)
return (gdrst & GRDOM_RESET_ENABLE) == 0;
}

+static int g33_do_reset(struct drm_device *dev)
+{
+ /* FIXME spec says to turn off all planes and wait 1 usec before reset */
+
+ pci_write_config_byte(dev->pdev, I915_GDRST, GRDOM_RESET_ENABLE);
+ return wait_for(g4x_reset_complete(dev), 500);
+}
+
static int g4x_do_reset(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1067,7 +1075,7 @@ int intel_gpu_reset(struct drm_device *dev)
return g4x_do_reset(dev);
case 3:
if (IS_G33(dev))
- return -ENODEV;
+ return g33_do_reset(dev);
return i915_do_reset(dev);
default: return -ENODEV;
}