From patchwork Sat Aug 8 20:34:45 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Gamari X-Patchwork-Id: 40198 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n78KZF4M030440 for ; Sat, 8 Aug 2009 20:35:15 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5710D9E942; Sat, 8 Aug 2009 13:35:15 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qy0-f173.google.com (mail-qy0-f173.google.com [209.85.221.173]) by gabe.freedesktop.org (Postfix) with ESMTP id D53169E8FB for ; Sat, 8 Aug 2009 13:35:08 -0700 (PDT) Received: by qyk3 with SMTP id 3so2104513qyk.20 for ; Sat, 08 Aug 2009 13:35:08 -0700 (PDT) Received: by 10.224.89.68 with SMTP id d4mr2105019qam.99.1249763708162; Sat, 08 Aug 2009 13:35:08 -0700 (PDT) Received: from localhost.localdomain ([128.164.237.143]) by mx.google.com with ESMTPS id 6sm7346363qwk.34.2009.08.08.13.35.07 (version=SSLv3 cipher=RC4-MD5); Sat, 08 Aug 2009 13:35:07 -0700 (PDT) From: Ben Gamari To: Owain Ainsworth , Jesse Barnes , Chris Wilson , intel-gfx@lists.freedesktop.org Date: Sat, 8 Aug 2009 16:34:45 -0400 Message-Id: <1249763687-5252-7-git-send-email-bgamari.foss@gmail.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1249763687-5252-6-git-send-email-bgamari.foss@gmail.com> References: <1249763687-5252-1-git-send-email-bgamari.foss@gmail.com> <1249763687-5252-2-git-send-email-bgamari.foss@gmail.com> <1249763687-5252-3-git-send-email-bgamari.foss@gmail.com> <1249763687-5252-4-git-send-email-bgamari.foss@gmail.com> <1249763687-5252-5-git-send-email-bgamari.foss@gmail.com> <1249763687-5252-6-git-send-email-bgamari.foss@gmail.com> Subject: [Intel-gfx] [PATCH 6/8] drm/i915: Rework hardware reset procedure X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Mimick what oga does in the BSD driver --- drivers/gpu/drm/i915/i915_drv.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index a88efb5..576cb7e 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -181,20 +181,28 @@ void i965_reset(struct drm_device *dev, u8 flags) if (IS_I965G(dev) || IS_G4X(dev)) { /* - * Set the domains we want to reset, then the reset bit (bit 0), - * and finally wait for hardware to clear it. + * Set the domains we want to reset, then the reset bit (bit 0). + * Clear the reset bit after a while and wait for hardware status + * bit (bit 1) to be set */ pci_read_config_byte(dev->pdev, GDRST, &gdrst); - pci_write_config_byte(dev->pdev, GDRST, gdrst | flags); + //TODO: Set domains + pci_write_config_byte(dev->pdev, GDRST, gdrst | 1); udelay(50); - pci_write_config_byte(dev->pdev, GDRST, gdrst & 0x1); + pci_write_config_byte(dev->pdev, GDRST, gdrst & 0xfeffffff); /* ...we don't want to loop forever though, 500ms should be plenty */ timeout = jiffies + msecs_to_jiffies(500); do { udelay(100); pci_read_config_byte(dev->pdev, GDRST, &gdrst); - } while ((gdrst & 0x1) && time_after(timeout, jiffies)); + } while ((gdrst & 2) && time_after(timeout, jiffies)); + + if (gdrst & 0x1) { + DRM_ERROR("Failed to reset chip. You're screwed."); + mutex_unlock(&dev->struct_mutex); + return; + } } else { DRM_ERROR("Error occurred. Don't know how to reset this chip.\n"); return;