diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2015-09-03 17:48:13 +0900 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-09-11 11:29:41 +1000 |
commit | cd6f6f7255a2a29b20086a9bb66cc8f955cc35ca (patch) | |
tree | 2107ea020d8c6971195670381167d4eaa0a9549f | |
parent | ef7a427609a8c19204d9298d5735a0a3de33bcea (diff) | |
download | nouveau-cd6f6f7255a2a29b20086a9bb66cc8f955cc35ca.tar.gz |
timer: re-introduce nvkm_wait_xsec macros
Reintroduce macros allowing us to test a register against a certain
mask, since this is the most common usage pattern for the more generic
nvkm_xsec macros and makes the code more concise and readable.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drm/nouveau/include/nvkm/subdev/timer.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drm/nouveau/include/nvkm/subdev/timer.h b/drm/nouveau/include/nvkm/subdev/timer.h index 62ed0880b..82d3e2891 100644 --- a/drm/nouveau/include/nvkm/subdev/timer.h +++ b/drm/nouveau/include/nvkm/subdev/timer.h @@ -59,6 +59,16 @@ void nvkm_timer_alarm_cancel(struct nvkm_timer *, struct nvkm_alarm *); #define nvkm_usec(d,u,cond...) nvkm_nsec((d), (u) * 1000, ##cond) #define nvkm_msec(d,m,cond...) nvkm_usec((d), (m) * 1000, ##cond) +#define nvkm_wait_nsec(d,n,addr,mask,data) \ + nvkm_nsec(d, n, \ + if ((nvkm_rd32(d, (addr)) & (mask)) == (data)) \ + break; \ + ) +#define nvkm_wait_usec(d,u,addr,mask,data) \ + nvkm_wait_nsec((d), (u) * 1000, (addr), (mask), (data)) +#define nvkm_wait_msec(d,m,addr,mask,data) \ + nvkm_wait_usec((d), (m) * 1000, (addr), (mask), (data)) + int nv04_timer_new(struct nvkm_device *, int, struct nvkm_timer **); int nv40_timer_new(struct nvkm_device *, int, struct nvkm_timer **); int nv41_timer_new(struct nvkm_device *, int, struct nvkm_timer **); |