summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2016-11-08 11:54:24 +1000
committerBen Skeggs <bskeggs@redhat.com>2016-11-09 11:24:24 +1000
commit6f62a29b11a6bab63dcb7f33e18525c13ab55b1c (patch)
treed95594dc39882f851b917ed80c43809e477f6661
parent5bffceba6bd2e3dafae0b5ace4af6e8d8dda2a6b (diff)
downloadnouveau-6f62a29b11a6bab63dcb7f33e18525c13ab55b1c.tar.gz
devinit/gm200: replace while loops with PTIMER-based timeout loops
It appears to be safe to access PTIMER on an unposted board with newer chipsets. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drm/nouveau/nvkm/subdev/devinit/gm200.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drm/nouveau/nvkm/subdev/devinit/gm200.c b/drm/nouveau/nvkm/subdev/devinit/gm200.c
index a410c0db8..d749278b4 100644
--- a/drm/nouveau/nvkm/subdev/devinit/gm200.c
+++ b/drm/nouveau/nvkm/subdev/devinit/gm200.c
@@ -26,6 +26,7 @@
#include <subdev/bios.h>
#include <subdev/bios/bit.h>
#include <subdev/bios/pmu.h>
+#include <subdev/timer.h>
static void
pmu_code(struct nv50_devinit *init, u32 pmu, u32 img, u32 len, bool sec)
@@ -128,8 +129,11 @@ gm200_devinit_post(struct nvkm_devinit *base, bool post)
nvkm_mask(device, 0x000200, 0x00002000, 0x00000000);
nvkm_mask(device, 0x000200, 0x00002000, 0x00002000);
nvkm_rd32(device, 0x000200);
- while (nvkm_rd32(device, 0x10a10c) & 0x00000006) {
- }
+ if (nvkm_msec(device, 2000,
+ if (!(nvkm_rd32(device, 0x10a10c) & 0x00000006))
+ break;
+ ) < 0)
+ return -ETIMEDOUT;
}
ret = pmu_load(init, 0x04, post, &exec, &args);
@@ -156,8 +160,11 @@ gm200_devinit_post(struct nvkm_devinit *base, bool post)
if (post) {
nvkm_wr32(device, 0x10a040, 0x00005000);
pmu_exec(init, exec);
- while (!(nvkm_rd32(device, 0x10a040) & 0x00002000)) {
- }
+ if (nvkm_msec(device, 2000,
+ if (nvkm_rd32(device, 0x10a040) & 0x00002000)
+ break;
+ ) < 0)
+ return -ETIMEDOUT;
}
/* load and execute some other ucode image (bios therm?) */