msm: kgsl: Retry hard reset more than once on failure

It has been observed that if hard reset is tried again after failure
then it succeeds, so add a loop to retry hard reset a few times
before considering it a failure.

Change-Id: I46dd8a420d5fd49941d096168aafd2eab693bebb
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
This commit is contained in:
Shubhraprakash Das 2013-08-15 12:30:34 -07:00 committed by Iliyan Malchev
parent 9091e989e2
commit 3e699d1a91

View file

@ -41,6 +41,9 @@
#define DRIVER_VERSION_MAJOR 3
#define DRIVER_VERSION_MINOR 1
/* Number of times to try hard reset */
#define NUM_TIMES_RESET_RETRY 5
/* Adreno MH arbiter config*/
#define ADRENO_CFG_MHARB \
(0x10 \
@ -1727,6 +1730,7 @@ int adreno_reset(struct kgsl_device *device)
{
int ret = -EINVAL;
struct kgsl_mmu *mmu = &device->mmu;
int i = 0;
/* Try soft reset first, for non mmu fault case only */
if (!atomic_read(&mmu->fault)) {
@ -1735,16 +1739,28 @@ int adreno_reset(struct kgsl_device *device)
KGSL_DEV_ERR_ONCE(device, "Device soft reset failed\n");
}
if (ret) {
/* If soft reset failed or skipped, then pull the power */
ret = adreno_stop(device);
if (ret)
return ret;
for (i = 0; i < NUM_TIMES_RESET_RETRY; i++) {
/* If soft reset failed/skipped, then pull the power */
ret = adreno_stop(device);
if (ret) {
msleep(20);
continue;
}
ret = adreno_start(device);
ret = adreno_start(device);
if (ret)
return ret;
if (ret) {
msleep(20);
continue;
}
break;
}
}
if (ret)
return ret;
if (0 != i)
KGSL_DRV_WARN(device, "Device hard reset tried %d tries\n", i);
/*
* If active_cnt is non-zero then the system was active before