diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2014-11-21 14:54:25 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-12-03 03:29:36 -0500 |
commit | 73bbf6bd907906dcbdc78f3af38a722c0fe498d8 (patch) | |
tree | e212bcbf12131ac43b021095701135ad0e2320ec | |
parent | aaecdf611a05cac26a94713bad25297e60225c29 (diff) |
drm/i915: Fix gen4 GPU reset
On pre-ctg the reset bit directly controls the reset signal. We must
assert it for >=20usec and then deassert it. Bit 1 is a RO status bit
which should also go down when the reset is no longer asserted.
Tested-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_uncore.c | 41 |
2 files changed, 15 insertions, 27 deletions
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 3102907a96a7..ff1e36f669a2 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -83,6 +83,7 @@ | |||
83 | #define GRDOM_RENDER (1<<2) | 83 | #define GRDOM_RENDER (1<<2) |
84 | #define GRDOM_MEDIA (3<<2) | 84 | #define GRDOM_MEDIA (3<<2) |
85 | #define GRDOM_MASK (3<<2) | 85 | #define GRDOM_MASK (3<<2) |
86 | #define GRDOM_RESET_STATUS (1<<1) | ||
86 | #define GRDOM_RESET_ENABLE (1<<0) | 87 | #define GRDOM_RESET_ENABLE (1<<0) |
87 | 88 | ||
88 | #define ILK_GDSR 0x2ca4 /* MCHBAR offset */ | 89 | #define ILK_GDSR 0x2ca4 /* MCHBAR offset */ |
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index f0230b0e8e11..c333d9c37f11 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c | |||
@@ -1349,37 +1349,24 @@ static int i965_reset_complete(struct drm_device *dev) | |||
1349 | { | 1349 | { |
1350 | u8 gdrst; | 1350 | u8 gdrst; |
1351 | pci_read_config_byte(dev->pdev, I965_GDRST, &gdrst); | 1351 | pci_read_config_byte(dev->pdev, I965_GDRST, &gdrst); |
1352 | return (gdrst & GRDOM_RESET_ENABLE) == 0; | 1352 | return (gdrst & GRDOM_RESET_STATUS) == 0; |
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | static int i965_do_reset(struct drm_device *dev) | 1355 | static int i965_do_reset(struct drm_device *dev) |
1356 | { | 1356 | { |
1357 | int ret; | 1357 | /* assert reset for at least 20 usec */ |
1358 | 1358 | pci_write_config_byte(dev->pdev, I965_GDRST, GRDOM_RESET_ENABLE); | |
1359 | /* FIXME: i965g/gm need a display save/restore for gpu reset. */ | 1359 | udelay(20); |
1360 | return -ENODEV; | ||
1361 | |||
1362 | /* | ||
1363 | * Set the domains we want to reset (GRDOM/bits 2 and 3) as | ||
1364 | * well as the reset bit (GR/bit 0). Setting the GR bit | ||
1365 | * triggers the reset; when done, the hardware will clear it. | ||
1366 | */ | ||
1367 | pci_write_config_byte(dev->pdev, I965_GDRST, | ||
1368 | GRDOM_RENDER | GRDOM_RESET_ENABLE); | ||
1369 | ret = wait_for(i965_reset_complete(dev), 500); | ||
1370 | if (ret) | ||
1371 | return ret; | ||
1372 | |||
1373 | pci_write_config_byte(dev->pdev, I965_GDRST, | ||
1374 | GRDOM_MEDIA | GRDOM_RESET_ENABLE); | ||
1375 | |||
1376 | ret = wait_for(i965_reset_complete(dev), 500); | ||
1377 | if (ret) | ||
1378 | return ret; | ||
1379 | |||
1380 | pci_write_config_byte(dev->pdev, I965_GDRST, 0); | 1360 | pci_write_config_byte(dev->pdev, I965_GDRST, 0); |
1381 | 1361 | ||
1382 | return 0; | 1362 | return wait_for(i965_reset_complete(dev), 500); |
1363 | } | ||
1364 | |||
1365 | static int g4x_reset_complete(struct drm_device *dev) | ||
1366 | { | ||
1367 | u8 gdrst; | ||
1368 | pci_read_config_byte(dev->pdev, I965_GDRST, &gdrst); | ||
1369 | return (gdrst & GRDOM_RESET_ENABLE) == 0; | ||
1383 | } | 1370 | } |
1384 | 1371 | ||
1385 | static int g4x_do_reset(struct drm_device *dev) | 1372 | static int g4x_do_reset(struct drm_device *dev) |
@@ -1389,7 +1376,7 @@ static int g4x_do_reset(struct drm_device *dev) | |||
1389 | 1376 | ||
1390 | pci_write_config_byte(dev->pdev, I965_GDRST, | 1377 | pci_write_config_byte(dev->pdev, I965_GDRST, |
1391 | GRDOM_RENDER | GRDOM_RESET_ENABLE); | 1378 | GRDOM_RENDER | GRDOM_RESET_ENABLE); |
1392 | ret = wait_for(i965_reset_complete(dev), 500); | 1379 | ret = wait_for(g4x_reset_complete(dev), 500); |
1393 | if (ret) | 1380 | if (ret) |
1394 | return ret; | 1381 | return ret; |
1395 | 1382 | ||
@@ -1399,7 +1386,7 @@ static int g4x_do_reset(struct drm_device *dev) | |||
1399 | 1386 | ||
1400 | pci_write_config_byte(dev->pdev, I965_GDRST, | 1387 | pci_write_config_byte(dev->pdev, I965_GDRST, |
1401 | GRDOM_MEDIA | GRDOM_RESET_ENABLE); | 1388 | GRDOM_MEDIA | GRDOM_RESET_ENABLE); |
1402 | ret = wait_for(i965_reset_complete(dev), 500); | 1389 | ret = wait_for(g4x_reset_complete(dev), 500); |
1403 | if (ret) | 1390 | if (ret) |
1404 | return ret; | 1391 | return ret; |
1405 | 1392 | ||