drivers:video:tegra: Fix CDMA timeout recovery
Arto Merilainen [Mon, 3 Sep 2012 12:48:49 +0000 (15:48 +0300)]
This patch fixes wait base handling in CDMA timeouts.

Bug 1025617

Change-Id: Ia93e55631c1159da161d5c4f257d3beebf0d3149
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/129278
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
Reviewed-by: Kirill Artamonov <kartamonov@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>

drivers/video/tegra/host/host1x/host1x_cdma.c

index 2e7ff57..5a29ff6 100644 (file)
@@ -233,12 +233,15 @@ static void cdma_timeout_cpu_incr(struct nvhost_cdma *cdma, u32 getptr,
        /* after CPU incr, ensure shadow is up to date */
        nvhost_syncpt_update_min(&dev->syncpt, cdma->timeout.syncpt_id);
 
-       /* update WAITBASE_3D by same number of incrs */
-       if (waitbases) {
+       /* Synchronize wait bases. 2D wait bases are synchronized with
+        * syncpoint 19. Hence wait bases are not updated when syncptid=18. */
+
+       if (cdma->timeout.syncpt_id != NVSYNCPT_2D_0 && waitbases) {
                void __iomem *p;
                p = dev->sync_aperture + host1x_sync_syncpt_base_0_r() +
-                               (ffs(waitbases) * sizeof(u32));
+                               (__ffs(waitbases) * sizeof(u32));
                writel(syncval, p);
+               dev->syncpt.base_val[__ffs(waitbases)] = syncval;
        }
 
        /* NOP all the PB slots */
@@ -486,7 +489,7 @@ static void cdma_timeout_handler(struct work_struct *work)
        /* stop HW, resetting channel/module */
        cdma_op().timeout_teardown_begin(cdma);
 
-       nvhost_cdma_update_sync_queue(cdma, sp, dev->dev);
+       nvhost_cdma_update_sync_queue(cdma, sp, ch->dev);
        mutex_unlock(&cdma->lock);
 }